(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{"+s0g":function(e,n,t){!function(e){"use strict";var n="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),t="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),l=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],i=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;e.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,l){return e?/-MMM-/.test(l)?t[e.month()]:n[e.month()]:n},monthsRegex:i,monthsShortRegex:i,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:l,longMonthsParse:l,shortMonthsParse:l,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"\xe9\xe9n minuut",mm:"%d minuten",h:"\xe9\xe9n uur",hh:"%d uur",d:"\xe9\xe9n dag",dd:"%d dagen",w:"\xe9\xe9n week",ww:"%d weken",M:"\xe9\xe9n maand",MM:"%d maanden",y:"\xe9\xe9n jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(t("wd/R"))},"+z1p":function(e,n,t){var l;(l=window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})).en=Object.assign(l.en||{},{a:"Cannot upload file:",b:"Image toolbar",c:"Table toolbar",d:"Bold",e:"Insert image or file",f:"Choose heading",g:"Heading",h:"Full size image",i:"Side image",j:"Left aligned image",k:"Centered image",l:"Right aligned image",m:"image widget",n:"Block quote",o:"Numbered List",p:"Bulleted List",q:"Increase indent",r:"Decrease indent",s:"Insert image",t:"Insert table",u:"Header column",v:"Insert column left",w:"Insert column right",x:"Delete column",y:"Column",z:"Header row",aa:"Insert row below",ab:"Insert row above",ac:"Delete row",ad:"Row",ae:"Merge cell up",af:"Merge cell right",ag:"Merge cell down",ah:"Merge cell left",ai:"Split cell vertically",aj:"Split cell horizontally",ak:"Merge cells",al:"Italic",am:"Insert media",an:"The URL must not be empty.",ao:"This media URL is not supported.",ap:"media widget",aq:"Upload failed",ar:"Enter image caption",as:"Link",at:"Could not obtain resized image URL.",au:"Selecting resized image failed",av:"Could not insert image at the current position.",aw:"Inserting image failed",ax:"Widget toolbar",ay:"Upload in progress",az:"Open in a new tab",ba:"Downloadable",bb:"Unlink",bc:"Edit link",bd:"Open link in new tab",be:"This link has no URL",bf:"Save",bg:"Cancel",bh:"Link URL",bi:"Rich Text Editor",bj:"Undo",bk:"Redo",bl:"%0 of %1",bm:"Previous",bn:"Next",bo:"Editor toolbar",bp:"Show more items",bq:"Dropdown toolbar",br:"Paste the media URL in the input.",bs:"Tip: Paste the URL into the content to embed faster.",bt:"Media URL",bu:"Rich Text Editor, %0",bv:"Change image text alternative",bw:"Paragraph",bx:"Heading 1",by:"Heading 2",bz:"Heading 3",ca:"Heading 4",cb:"Heading 5",cc:"Heading 6",cd:"Text alternative"}),window,e.exports=function(e){var n={};function t(l){if(n[l])return n[l].exports;var i=n[l]={i:l,l:!1,exports:{}};return e[l].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=n,t.d=function(e,n,l){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:l})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var l=Object.create(null);if(t.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var i in e)t.d(l,i,(function(n){return e[n]}).bind(null,i));return l},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=91)}([function(e,n,t){"use strict";t.d(n,"b",(function(){return l})),t.d(n,"a",(function(){return i}));class l extends Error{constructor(e,n,t){e=i(e),t&&(e+=" "+JSON.stringify(t)),super(e),this.name="CKEditorError",this.context=n,this.data=t}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,n){if(e.is&&e.is("CKEditorError"))throw e;throw new l("unexpected-error",n,{originalError:{message:e.message,stack:e.stack,name:e.name}})}}function i(e){const n=e.match(/^([^:]+):/);return n?e+` Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-${n[1]}\n`:e}},function(e,n,t){"use strict";var l={},i=function(){var e;return function(){return void 0===e&&(e=Boolean(window&&document&&document.all&&!window.atob)),e}}(),o=function(){var e={};return function(n){if(void 0===e[n]){var t=document.querySelector(n);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(e){t=null}e[n]=t}return e[n]}}();function r(e,n){for(var t=[],l={},i=0;i:first-child{margin-top:var(--ck-spacing-large)}.ck.ck-editor__editable_inline>:last-child{margin-bottom:var(--ck-spacing-large)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_n]:after{border-bottom-color:var(--ck-color-base-foreground)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_s]:after{border-top-color:var(--ck-color-base-foreground)}"},function(e,n,t){var l=t(21);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck.ck-label{display:block}.ck.ck-voice-label{display:none}.ck.ck-label{font-weight:700}"},function(e,n,t){var l=t(23);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck.ck-sticky-panel .ck-sticky-panel__content_sticky{z-index:var(--ck-z-modal);position:fixed;top:0}.ck.ck-sticky-panel .ck-sticky-panel__content_sticky_bottom-limit{top:auto;position:absolute}.ck.ck-sticky-panel .ck-sticky-panel__content_sticky{box-shadow:var(--ck-drop-shadow),0 0;border-width:0 1px 1px;border-top-left-radius:0;border-top-right-radius:0}"},function(e,n,t){var l=t(25);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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;will-change:transform}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw{bottom:100%}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{transform:translate3d(0,100%,0)}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se{left:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{right:0}:root{--ck-dropdown-arrow-size:calc(0.5*var(--ck-icon-size))}.ck.ck-dropdown{font-size:inherit}.ck.ck-dropdown .ck-dropdown__arrow{width:var(--ck-dropdown-arrow-size)}[dir=ltr] .ck.ck-dropdown .ck-dropdown__arrow{right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-small)}[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-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on{border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label{width:7em;overflow:hidden;text-overflow:ellipsis}.ck.ck-dropdown__panel{box-shadow:var(--ck-drop-shadow),0 0;border-radius:0}.ck-rounded-corners .ck.ck-dropdown__panel,.ck.ck-dropdown__panel.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0}.ck.ck-dropdown__panel{background:var(--ck-color-dropdown-panel-background);border:1px solid var(--ck-color-dropdown-panel-border);bottom:0;min-width:100%}"},function(e,n,t){var l=t(27);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck.ck-icon{vertical-align:middle}:root{--ck-icon-size:calc(var(--ck-line-height-base)*var(--ck-font-size-normal))}.ck.ck-icon{width:var(--ck-icon-size);height:var(--ck-icon-size);font-size:.8333350694em;will-change:transform}.ck.ck-icon,.ck.ck-icon *{color:inherit;cursor:inherit}.ck.ck-icon :not([fill]){fill:currentColor}"},function(e,n,t){var l=t(29);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports='.ck.ck-tooltip,.ck.ck-tooltip .ck-tooltip__text:after{position:absolute;pointer-events:none;-webkit-backface-visibility:hidden}.ck-tooltip{visibility:hidden;opacity:0;display:none;z-index:var(--ck-z-modal)}.ck-tooltip .ck-tooltip__text{display:inline-block}.ck-tooltip .ck-tooltip__text:after{content:"";width:0;height:0}:root{--ck-tooltip-arrow-size:5px}.ck.ck-tooltip{left:50%;top:0}.ck.ck-tooltip.ck-tooltip_s{bottom:calc(-1*var(--ck-tooltip-arrow-size));transform:translateY(100%)}.ck.ck-tooltip.ck-tooltip_s .ck-tooltip__text:after{top:calc(-1*var(--ck-tooltip-arrow-size));transform:translateX(-50%);border-left-color:transparent;border-bottom-color:var(--ck-color-tooltip-background);border-right-color:transparent;border-top-color:transparent;border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:var(--ck-tooltip-arrow-size);border-right-width:var(--ck-tooltip-arrow-size);border-top-width:0}.ck.ck-tooltip.ck-tooltip_n{top:calc(-1*var(--ck-tooltip-arrow-size));transform:translateY(-100%)}.ck.ck-tooltip.ck-tooltip_n .ck-tooltip__text:after{bottom:calc(-1*var(--ck-tooltip-arrow-size));transform:translateX(-50%);border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;border-top-color:var(--ck-color-tooltip-background);border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:0;border-right-width:var(--ck-tooltip-arrow-size);border-top-width:var(--ck-tooltip-arrow-size)}.ck.ck-tooltip .ck-tooltip__text{border-radius:0}.ck-rounded-corners .ck.ck-tooltip .ck-tooltip__text,.ck.ck-tooltip .ck-tooltip__text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-tooltip .ck-tooltip__text{font-size:.9em;line-height:1.5;color:var(--ck-color-tooltip-text);padding:var(--ck-spacing-small) var(--ck-spacing-medium);background:var(--ck-color-tooltip-background);position:relative;left:-50%}.ck.ck-tooltip .ck-tooltip__text:after{border-style:solid;left:50%}.ck.ck-tooltip,.ck.ck-tooltip .ck-tooltip__text:after{transition:opacity .2s ease-in-out .2s}'},function(e,n,t){var l=t(31);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck.ck-button,a.ck.ck-button{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:block}@media (hover:none){.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:none}}.ck.ck-button,a.ck.ck-button{position:relative;display:inline-flex;align-items:center;justify-content:left}.ck.ck-button.ck-button_with-text .ck-button__label,a.ck.ck-button.ck-button_with-text .ck-button__label{display:inline-block}.ck.ck-button:not(.ck-button_with-text),a.ck.ck-button:not(.ck-button_with-text){justify-content:center}.ck.ck-button:hover .ck-tooltip,a.ck.ck-button:hover .ck-tooltip{visibility:visible;opacity:1}.ck.ck-button .ck-button__label,.ck.ck-button:focus:not(:hover) .ck-tooltip,a.ck.ck-button .ck-button__label,a.ck.ck-button:focus:not(:hover) .ck-tooltip{display:none}.ck.ck-button,a.ck.ck-button{background:var(--ck-color-button-default-background)}.ck.ck-button:not(.ck-disabled):hover,a.ck.ck-button:not(.ck-disabled):hover{background:var(--ck-color-button-default-hover-background)}.ck.ck-button:not(.ck-disabled):active,a.ck.ck-button:not(.ck-disabled):active{background:var(--ck-color-button-default-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-default-active-shadow)}.ck.ck-button.ck-disabled,a.ck.ck-button.ck-disabled{background:var(--ck-color-button-default-disabled-background)}.ck.ck-button,a.ck.ck-button{border-radius:0}.ck-rounded-corners .ck.ck-button,.ck-rounded-corners a.ck.ck-button,.ck.ck-button.ck-rounded-corners,a.ck.ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-button,a.ck.ck-button{white-space:nowrap;cursor:default;vertical-align:middle;padding:var(--ck-spacing-tiny);text-align:center;min-width:var(--ck-ui-component-min-height);min-height:var(--ck-ui-component-min-height);line-height:1;font-size:inherit;border:1px solid transparent;transition:box-shadow .2s ease-in-out;-webkit-appearance:none}.ck.ck-button:active,.ck.ck-button:focus,a.ck.ck-button:active,a.ck.ck-button:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0;border-color:transparent}.ck.ck-button.ck-disabled:active,.ck.ck-button.ck-disabled:focus,a.ck.ck-button.ck-disabled:active,a.ck.ck-button.ck-disabled:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),0 0}.ck.ck-button.ck-disabled .ck-button__icon,a.ck.ck-button.ck-disabled .ck-button__icon{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-disabled .ck-button__label,a.ck.ck-button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-button_with-text,a.ck.ck-button.ck-button_with-text{padding:var(--ck-spacing-tiny) var(--ck-spacing-standard)}[dir=ltr] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=ltr] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-left:calc(-1*var(--ck-spacing-small));margin-right:var(--ck-spacing-small)}[dir=rtl] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=rtl] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-right:calc(-1*var(--ck-spacing-small));margin-left:var(--ck-spacing-small)}.ck.ck-button.ck-on,a.ck.ck-button.ck-on{background:var(--ck-color-button-on-background)}.ck.ck-button.ck-on:not(.ck-disabled):hover,a.ck.ck-button.ck-on:not(.ck-disabled):hover{background:var(--ck-color-button-on-hover-background)}.ck.ck-button.ck-on:not(.ck-disabled):active,a.ck.ck-button.ck-on:not(.ck-disabled):active{background:var(--ck-color-button-on-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-on-active-shadow)}.ck.ck-button.ck-on.ck-disabled,a.ck.ck-button.ck-on.ck-disabled{background:var(--ck-color-button-on-disabled-background)}.ck.ck-button.ck-button-save,a.ck.ck-button.ck-button-save{color:var(--ck-color-button-save)}.ck.ck-button.ck-button-cancel,a.ck.ck-button.ck-button-cancel{color:var(--ck-color-button-cancel)}.ck.ck-button .ck-button__icon use,.ck.ck-button .ck-button__icon use *,a.ck.ck-button .ck-button__icon use,a.ck.ck-button .ck-button__icon use *{color:inherit}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{font-size:inherit;font-weight:inherit;color:inherit;cursor:inherit;vertical-align:middle}[dir=ltr] .ck.ck-button .ck-button__label,[dir=ltr] a.ck.ck-button .ck-button__label{text-align:left}[dir=rtl] .ck.ck-button .ck-button__label,[dir=rtl] a.ck.ck-button .ck-button__label{text-align:right}.ck.ck-button-action,a.ck.ck-button-action{background:var(--ck-color-button-action-background)}.ck.ck-button-action:not(.ck-disabled):hover,a.ck.ck-button-action:not(.ck-disabled):hover{background:var(--ck-color-button-action-hover-background)}.ck.ck-button-action:not(.ck-disabled):active,a.ck.ck-button-action:not(.ck-disabled):active{background:var(--ck-color-button-action-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-action-active-shadow)}.ck.ck-button-action.ck-disabled,a.ck.ck-button-action.ck-disabled{background:var(--ck-color-button-action-disabled-background)}.ck.ck-button-action,a.ck.ck-button-action{color:var(--ck-color-button-action-text)}.ck.ck-button-bold,a.ck.ck-button-bold{font-weight:700}"},function(e,n,t){var l=t(33);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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;border:0;padding:calc(0.2*var(--ck-line-height-base)*var(--ck-font-size-base)) calc(0.4*var(--ck-line-height-base)*var(--ck-font-size-base))}.ck.ck-list__item .ck-button .ck-button__label{line-height:calc(1.2*var(--ck-line-height-base)*var(--ck-font-size-base))}.ck.ck-list__item .ck-button:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on{background:var(--ck-color-list-button-on-background);color:var(--ck-color-list-button-on-text)}.ck.ck-list__item .ck-button.ck-on:hover:not(ck-disabled){background:var(--ck-color-list-button-on-background-focus)}.ck.ck-list__item .ck-button.ck-on:active{box-shadow:none}.ck.ck-list__item .ck-button:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background)}.ck.ck-list__item .ck-switchbutton.ck-on{background:var(--ck-color-list-background);color:inherit}.ck.ck-list__item .ck-switchbutton.ck-on:hover:not(ck-disabled){background:var(--ck-color-list-button-hover-background);color:inherit}.ck.ck-list__separator{height:1px;width:100%;background:var(--ck-color-base-border)}"},function(e,n,t){var l=t(35);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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:1.3846153847em}[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-disabled .ck-button__toggle{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-switchbutton .ck-button__toggle{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle.ck-rounded-corners{border-radius:var(--ck-border-radius)}[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: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-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-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,n,t){var l=t(37);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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,n,t){var l=t(39);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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,n,t){var l=t(41);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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-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_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__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.ck-toolbar__grouped-dropdown>.ck.ck-button.ck-dropdown__button{padding-left:var(--ck-spacing-tiny)}.ck.ck-toolbar .ck.ck-toolbar__separator{align-self:stretch;width:1px;min-width:1px;margin-top:0;margin-bottom:0;background:var(--ck-color-toolbar-border)}.ck-toolbar-container .ck.ck-toolbar{border:0}.ck.ck-toolbar[dir=ltr]>.ck.ck-toolbar__grouped-dropdown,[dir=ltr] .ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown{padding-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr]>.ck.ck-toolbar__items>:last-child,[dir=ltr] .ck.ck-toolbar>.ck.ck-toolbar__items>:last-child{margin-right:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_grouping>.ck-toolbar__items,[dir=ltr] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items{margin-right:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl]>.ck.ck-toolbar__grouped-dropdown,[dir=rtl] .ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown{padding-right:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl]>.ck.ck-toolbar__items>*,[dir=rtl] .ck.ck-toolbar>.ck.ck-toolbar__items>*{margin-left:var(--ck-spacing-small);margin-right:0}.ck.ck-toolbar[dir=rtl]>.ck.ck-toolbar__items>:last-child,[dir=rtl] .ck.ck-toolbar>.ck.ck-toolbar__items>:last-child{margin-left:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_grouping>.ck-toolbar__items,[dir=rtl] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items{margin-left:var(--ck-spacing-small)}"},function(e,n,t){var l=t(43);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck.ck-editor{position:relative}.ck.ck-editor .ck-editor__top .ck-sticky-panel .ck-toolbar{z-index:var(--ck-z-modal)}.ck.ck-editor__top .ck-sticky-panel .ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-toolbar,.ck.ck-editor__top .ck-sticky-panel .ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-editor__top .ck-sticky-panel .ck-toolbar{border-bottom-width:0}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar{border-bottom-width:1px;border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar,.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:0}.ck.ck-editor__main>.ck-editor__editable{background:var(--ck-color-base-background);border-radius:0}.ck-rounded-corners .ck.ck-editor__main>.ck-editor__editable,.ck.ck-editor__main>.ck-editor__editable.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck.ck-editor__main>.ck-editor__editable:not(.ck-focused){border-color:var(--ck-color-base-border)}"},function(e,n,t){var l=t(45);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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,n,t){var l=t(47);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}"},function(e,n,t){var l=t(49);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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-widget_with-selection-handle{position:relative}.ck .ck-widget.ck-widget_with-selection-handle:hover .ck-widget__selection-handle{visibility:visible}.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{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-editor__editable>.ck-widget.ck-widget_with-selection-handle:first-child,.ck-editor__editable blockquote>.ck-widget.ck-widget_with-selection-handle:first-child{margin-top:calc(1em + var(--ck-widget-handler-icon-size))}.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:hover .ck-icon .ck-icon__selected-indicator{opacity:1}.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_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 .ck-widget.ck-widget_with-selection-handle:hover .ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-widget-hover-border)}.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-editor__editable.ck-blurred .ck-widget.ck-widget_selected,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover{outline-color:var(--ck-color-widget-blurred-border)}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected .ck-widget__selection-handle,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected .ck-widget__selection-handle:hover,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover .ck-widget__selection-handle,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck-editor__editable.ck-read-only .ck-widget{--ck-widget-outline-thickness:0}"},function(e,n,t){var l=t(51);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck.ck-labeled-input .ck-labeled-input__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-input .ck-labeled-input__status_error{color:var(--ck-color-base-error)}"},function(e,n,t){var l=t(53);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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-property:box-shadow,border;transition:.2s ease-in-out}.ck.ck-input-text:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),var(--ck-inner-shadow)}.ck.ck-input-text[readonly]{border:1px solid var(--ck-color-input-disabled-border);background:var(--ck-color-input-disabled-background);color:var(--ck-color-input-disabled-text)}.ck.ck-input-text[readonly]:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),var(--ck-inner-shadow)}.ck.ck-input-text.ck-error{border-color:var(--ck-color-input-error-border);animation:ck-text-input-shake .3s ease both}.ck.ck-input-text.ck-error:focus{box-shadow:var(--ck-focus-error-outer-shadow),var(--ck-inner-shadow)}@keyframes ck-text-input-shake{20%{transform:translateX(-2px)}40%{transform:translateX(2px)}60%{transform:translateX(-1px)}80%{transform:translateX(1px)}}"},function(e,n,t){var l=t(55);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck.ck-text-alternative-form{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-text-alternative-form .ck-labeled-input{display:inline-block}.ck.ck-text-alternative-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-text-alternative-form{flex-wrap:wrap}.ck.ck-text-alternative-form .ck-labeled-input{flex-basis:100%}.ck.ck-text-alternative-form .ck-button{flex-basis:50%}}.ck.ck-text-alternative-form{padding:var(--ck-spacing-standard)}.ck.ck-text-alternative-form:focus{outline:none}[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-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-text-alternative-form .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-text-alternative-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);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,n,t){var l=t(57);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=':root{--ck-balloon-panel-arrow-z-index:calc(var(--ck-z-default) - 3)}.ck.ck-balloon-panel{display:none;position:absolute;z-index:var(--ck-z-modal)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{content:"";position:absolute}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_n]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_n]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_s]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_s]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel.ck-balloon-panel_visible{display:block}:root{--ck-balloon-arrow-offset:2px;--ck-balloon-arrow-height:10px;--ck-balloon-arrow-half-width:8px}.ck.ck-balloon-panel{border-radius:0}.ck-rounded-corners .ck.ck-balloon-panel,.ck.ck-balloon-panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-balloon-panel{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{width:0;height:0;border-style:solid}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-left-width:var(--ck-balloon-arrow-half-width);border-bottom-width:var(--ck-balloon-arrow-height);border-right-width:var(--ck-balloon-arrow-half-width);border-top-width:0}.ck.ck-balloon-panel[class*=arrow_n]:before{border-bottom-color:var(--ck-color-panel-border)}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-left-color:transparent;border-right-color:transparent;border-top-color:transparent}.ck.ck-balloon-panel[class*=arrow_n]:after{border-bottom-color:var(--ck-color-panel-background);margin-top:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-left-width:var(--ck-balloon-arrow-half-width);border-bottom-width:0;border-right-width:var(--ck-balloon-arrow-half-width);border-top-width:var(--ck-balloon-arrow-height)}.ck.ck-balloon-panel[class*=arrow_s]:before{border-top-color:var(--ck-color-panel-border)}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent}.ck.ck-balloon-panel[class*=arrow_s]:after{border-top-color:var(--ck-color-panel-background);margin-bottom:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:before{left:50%;margin-left:calc(-1*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:before{left:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:before{right:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:before{left:50%;margin-left:calc(-1*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:before{left:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:before{right:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}'},function(e,n,t){var l=t(59);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck .ck-balloon-rotator__navigation{display:flex;align-items:center;justify-content:center}.ck .ck-balloon-rotator__content .ck-toolbar{justify-content:center}.ck .ck-balloon-rotator__navigation{background:var(--ck-color-toolbar-background);border-bottom:1px solid var(--ck-color-toolbar-border);padding:0 var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation>*{margin-right:var(--ck-spacing-small);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation .ck-balloon-rotator__counter{margin-right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-small)}.ck .ck-balloon-rotator__content .ck.ck-annotation-wrapper{box-shadow:none}"},function(e,n,t){var l=t(61);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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,n,t){var l=t(63);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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,n,t){var l=t(65);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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,n,t){var l=t(67);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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,n,t){var l=t(69);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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,n){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,n,t){var l=t(72);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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,n,t){var l=t(74);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=":root{--ck-image-style-spacing:1.5em}.ck-content .image-style-align-center,.ck-content .image-style-align-left,.ck-content .image-style-align-right,.ck-content .image-style-side{max-width:50%}.ck-content .image-style-side{float:right;margin-left:var(--ck-image-style-spacing)}.ck-content .image-style-align-left{float:left;margin-right:var(--ck-image-style-spacing)}.ck-content .image-style-align-center{margin-left:auto;margin-right:auto}.ck-content .image-style-align-right{float:right;margin-left:var(--ck-image-style-spacing)}"},function(e,n,t){var l=t(76);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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-input{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-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-form .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-link-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);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-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) var(--ck-spacing-small)}.ck.ck-link-form_layout-vertical .ck-labeled-input .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,n,t){var l=t(78);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){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.ck-link-actions .ck-button.ck-link-actions__preview:active,.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus,.ck.ck-link-actions .ck-button.ck-link-actions__preview:hover{background:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:active{box-shadow:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus .ck-button__label{text-decoration:underline}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{padding:0 var(--ck-spacing-medium);color:var(--ck-color-link-default);text-overflow:ellipsis;cursor:pointer;max-width:var(--ck-input-text-width);min-width:3em;text-align:center}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label:hover{text-decoration:underline}.ck.ck-link-actions:focus{outline:none}[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,n,t){var l=t(80);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports='.ck-media__wrapper .ck-media__placeholder{display:flex;flex-direction:column;align-items:center}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-tooltip{display:block}@media (hover:none){.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-tooltip{display:none}}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url{max-width:100%;position:relative}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url:hover .ck-tooltip{visibility:visible;opacity:1}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-media__placeholder__url__text{overflow:hidden;display:block}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck-media__placeholder__icon *{display:none}.ck-editor__editable:not(.ck-read-only) .ck-media__wrapper>:not(.ck-media__placeholder),.ck-editor__editable:not(.ck-read-only) .ck-widget:not(.ck-widget_selected) .ck-media__placeholder{pointer-events:none}:root{--ck-media-embed-placeholder-icon-size:3em;--ck-color-media-embed-placeholder-url-text:#757575;--ck-color-media-embed-placeholder-url-text-hover:var(--ck-color-base-text)}.ck-media__wrapper{margin:0 auto}.ck-media__wrapper .ck-media__placeholder{padding:calc(3*var(--ck-spacing-standard));background:var(--ck-color-base-foreground)}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__icon{min-width:var(--ck-media-embed-placeholder-icon-size);height:var(--ck-media-embed-placeholder-icon-size);margin-bottom:var(--ck-spacing-large);background-position:50%;background-size:cover}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__icon .ck-icon{width:100%;height:100%}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-media__placeholder__url__text{color:var(--ck-color-media-embed-placeholder-url-text);white-space:nowrap;text-align:center;font-style:italic;text-overflow:ellipsis}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-media__placeholder__url__text:hover{color:var(--ck-color-media-embed-placeholder-url-text-hover);cursor:pointer;text-decoration:underline}.ck-media__wrapper[data-oembed-url*="open.spotify.com"]{max-width:300px;max-height:380px}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder{background:linear-gradient(90deg,#71c6f4,#0d70a5)}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgNDAwIj48cGF0aCBkPSJNNDAwIDIwMGMwIDExMC41LTg5LjUgMjAwLTIwMCAyMDBTMCAzMTAuNSAwIDIwMCA4OS41IDAgMjAwIDBzMjAwIDg5LjUgMjAwIDIwMHpNMTYzLjQgMzA1LjVjODguNyAwIDEzNy4yLTczLjUgMTM3LjItMTM3LjIgMC0yLjEgMC00LjItLjEtNi4yIDkuNC02LjggMTcuNi0xNS4zIDI0LjEtMjUtOC42IDMuOC0xNy45IDYuNC0yNy43IDcuNiAxMC02IDE3LjYtMTUuNCAyMS4yLTI2LjctOS4zIDUuNS0xOS42IDkuNS0zMC42IDExLjctOC44LTkuNC0yMS4zLTE1LjItMzUuMi0xNS4yLTI2LjYgMC00OC4yIDIxLjYtNDguMiA0OC4yIDAgMy44LjQgNy41IDEuMyAxMS00MC4xLTItNzUuNi0yMS4yLTk5LjQtNTAuNC00LjEgNy4xLTYuNSAxNS40LTYuNSAyNC4yIDAgMTYuNyA4LjUgMzEuNSAyMS41IDQwLjEtNy45LS4yLTE1LjMtMi40LTIxLjgtNnYuNmMwIDIzLjQgMTYuNiA0Mi44IDM4LjcgNDcuMy00IDEuMS04LjMgMS43LTEyLjcgMS43LTMuMSAwLTYuMS0uMy05LjEtLjkgNi4xIDE5LjIgMjMuOSAzMy4xIDQ1IDMzLjUtMTYuNSAxMi45LTM3LjMgMjAuNi01OS45IDIwLjYtMy45IDAtNy43LS4yLTExLjUtLjcgMjEuMSAxMy44IDQ2LjUgMjEuOCA3My43IDIxLjgiIGZpbGw9IiNmZmYiLz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__url__text{color:#b8e6ff}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}.ck-media__wrapper[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTAuMzc4IiBoZWlnaHQ9IjI1NC4xNjciIHZpZXdCb3g9IjAgMCA2Ni4yNDYgNjcuMjQ4Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcyLjUzMSAtMjE4LjQ1NSkgc2NhbGUoLjk4MDEyKSI+PHJlY3Qgcnk9IjUuMjM4IiByeD0iNS4yMzgiIHk9IjIzMS4zOTkiIHg9IjE3Ni4wMzEiIGhlaWdodD0iNjAuMDk5IiB3aWR0aD0iNjAuMDk5IiBmaWxsPSIjMzRhNjY4IiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxwYXRoIGQ9Ik0yMDYuNDc3IDI2MC45bC0yOC45ODcgMjguOTg3YTUuMjE4IDUuMjE4IDAgMDAzLjc4IDEuNjFoNDkuNjIxYzEuNjk0IDAgMy4xOS0uNzk4IDQuMTQ2LTIuMDM3eiIgZmlsbD0iIzVjODhjNSIvPjxwYXRoIGQ9Ik0yMjYuNzQyIDIyMi45ODhjLTkuMjY2IDAtMTYuNzc3IDcuMTctMTYuNzc3IDE2LjAxNC4wMDcgMi43NjIuNjYzIDUuNDc0IDIuMDkzIDcuODc1LjQzLjcwMy44MyAxLjQwOCAxLjE5IDIuMTA3LjMzMy41MDIuNjUgMS4wMDUuOTUgMS41MDguMzQzLjQ3Ny42NzMuOTU3Ljk4OCAxLjQ0IDEuMzEgMS43NjkgMi41IDMuNTAyIDMuNjM3IDUuMTY4Ljc5MyAxLjI3NSAxLjY4MyAyLjY0IDIuNDY2IDMuOTkgMi4zNjMgNC4wOTQgNC4wMDcgOC4wOTIgNC42IDEzLjkxNHYuMDEyYy4xODIuNDEyLjUxNi42NjYuODc5LjY2Ny40MDMtLjAwMS43NjgtLjMxNC45My0uNzk5LjYwMy01Ljc1NiAyLjIzOC05LjcyOSA0LjU4NS0xMy43OTQuNzgyLTEuMzUgMS42NzMtMi43MTUgMi40NjUtMy45OSAxLjEzNy0xLjY2NiAyLjMyOC0zLjQgMy42MzgtNS4xNjkuMzE1LS40ODIuNjQ1LS45NjIuOTg4LTEuNDM5LjMtLjUwMy42MTctMS4wMDYuOTUtMS41MDguMzU5LS43Ljc2LTEuNDA0IDEuMTktMi4xMDcgMS40MjYtMi40MDIgMi01LjExNCAyLjAwNC03Ljg3NSAwLTguODQ0LTcuNTExLTE2LjAxNC0xNi43NzYtMTYuMDE0eiIgZmlsbD0iI2RkNGIzZSIgcGFpbnQtb3JkZXI9Im1hcmtlcnMgc3Ryb2tlIGZpbGwiLz48ZWxsaXBzZSByeT0iNS41NjQiIHJ4PSI1LjgyOCIgY3k9IjIzOS4wMDIiIGN4PSIyMjYuNzQyIiBmaWxsPSIjODAyZDI3IiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxwYXRoIGQ9Ik0xOTAuMzAxIDIzNy4yODNjLTQuNjcgMC04LjQ1NyAzLjg1My04LjQ1NyA4LjYwNnMzLjc4NiA4LjYwNyA4LjQ1NyA4LjYwN2MzLjA0MyAwIDQuODA2LS45NTggNi4zMzctMi41MTYgMS41My0xLjU1NyAyLjA4Ny0zLjkxMyAyLjA4Ny02LjI5IDAtLjM2Mi0uMDIzLS43MjItLjA2NC0xLjA3OWgtOC4yNTd2My4wNDNoNC44NWMtLjE5Ny43NTktLjUzMSAxLjQ1LTEuMDU4IDEuOTg2LS45NDIuOTU4LTIuMDI4IDEuNTQ4LTMuOTAxIDEuNTQ4LTIuODc2IDAtNS4yMDgtMi4zNzItNS4yMDgtNS4yOTkgMC0yLjkyNiAyLjMzMi01LjI5OSA1LjIwOC01LjI5OSAxLjM5OSAwIDIuNjE4LjQwNyAzLjU4NCAxLjI5M2wyLjM4MS0yLjM4YzAtLjAwMi0uMDAzLS4wMDQtLjAwNC0uMDA1LTEuNTg4LTEuNTI0LTMuNjItMi4yMTUtNS45NTUtMi4yMTV6bTQuNDMgNS42NmwuMDAzLjAwNnYtLjAwM3oiIGZpbGw9IiNmZmYiIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PHBhdGggZD0iTTIxNS4xODQgMjUxLjkyOWwtNy45OCA3Ljk3OSAyOC40NzcgMjguNDc1YTUuMjMzIDUuMjMzIDAgMDAuNDQ5LTIuMTIzdi0zMS4xNjVjLS40NjkuNjc1LS45MzQgMS4zNDktMS4zODIgMi4wMDUtLjc5MiAxLjI3NS0xLjY4MiAyLjY0LTIuNDY1IDMuOTktMi4zNDcgNC4wNjUtMy45ODIgOC4wMzgtNC41ODUgMTMuNzk0LS4xNjIuNDg1LS41MjcuNzk4LS45My43OTktLjM2My0uMDAxLS42OTctLjI1NS0uODc5LS42Njd2LS4wMTJjLS41OTMtNS44MjItMi4yMzctOS44Mi00LjYtMTMuOTE0LS43ODMtMS4zNS0xLjY3My0yLjcxNS0yLjQ2Ni0zLjk5LTEuMTM3LTEuNjY2LTIuMzI3LTMuNC0zLjYzNy01LjE2OWwtLjAwMi0uMDAzeiIgZmlsbD0iI2MzYzNjMyIvPjxwYXRoIGQ9Ik0yMTIuOTgzIDI0OC40OTVsLTM2Ljk1MiAzNi45NTN2LjgxMmE1LjIyNyA1LjIyNyAwIDAwNS4yMzggNS4yMzhoMS4wMTVsMzUuNjY2LTM1LjY2NmExMzYuMjc1IDEzNi4yNzUgMCAwMC0yLjc2NC0zLjkgMzcuNTc1IDM3LjU3NSAwIDAwLS45ODktMS40NCAzNS4xMjcgMzUuMTI3IDAgMDAtLjk1LTEuNTA4Yy0uMDgzLS4xNjItLjE3Ni0uMzI2LS4yNjQtLjQ4OXoiIGZpbGw9IiNmZGRjNGYiIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PHBhdGggZD0iTTIxMS45OTggMjYxLjA4M2wtNi4xNTIgNi4xNTEgMjQuMjY0IDI0LjI2NGguNzgxYTUuMjI3IDUuMjI3IDAgMDA1LjIzOS01LjIzOHYtMS4wNDV6IiBmaWxsPSIjZmZmIiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjwvZz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder{background:#4268b3}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik05NjcuNDg0IDBINTYuNTE3QzI1LjMwNCAwIDAgMjUuMzA0IDAgNTYuNTE3djkxMC45NjZDMCA5OTguNjk0IDI1LjI5NyAxMDI0IDU2LjUyMiAxMDI0SDU0N1Y2MjhINDE0VjQ3M2gxMzNWMzU5LjAyOWMwLTEzMi4yNjIgODAuNzczLTIwNC4yODIgMTk4Ljc1Ni0yMDQuMjgyIDU2LjUxMyAwIDEwNS4wODYgNC4yMDggMTE5LjI0NCA2LjA4OVYyOTlsLTgxLjYxNi4wMzdjLTYzLjk5MyAwLTc2LjM4NCAzMC40OTItNzYuMzg0IDc1LjIzNlY0NzNoMTUzLjQ4N2wtMTkuOTg2IDE1NUg3MDd2Mzk2aDI2MC40ODRjMzEuMjEzIDAgNTYuNTE2LTI1LjMwMyA1Ni41MTYtNTYuNTE2VjU2LjUxNUMxMDI0IDI1LjMwMyA5OTguNjk3IDAgOTY3LjQ4NCAwIiBmaWxsPSIjRkZGRkZFIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__url__text{color:#cdf}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder{background:linear-gradient(-135deg,#1400c8,#b900b4,#f50000)}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTA0IiBoZWlnaHQ9IjUwNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PHBhdGggaWQ9ImEiIGQ9Ik0wIC4xNTloNTAzLjg0MVY1MDMuOTRIMHoiLz48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+PHVzZSB4bGluazpocmVmPSIjYSIvPjwvbWFzaz48cGF0aCBkPSJNMjUxLjkyMS4xNTljLTY4LjQxOCAwLTc2Ljk5Ny4yOS0xMDMuODY3IDEuNTE2LTI2LjgxNCAxLjIyMy00NS4xMjcgNS40ODItNjEuMTUxIDExLjcxLTE2LjU2NiA2LjQzNy0zMC42MTUgMTUuMDUxLTQ0LjYyMSAyOS4wNTYtMTQuMDA1IDE0LjAwNi0yMi42MTkgMjguMDU1LTI5LjA1NiA0NC42MjEtNi4yMjggMTYuMDI0LTEwLjQ4NyAzNC4zMzctMTEuNzEgNjEuMTUxQy4yOSAxNzUuMDgzIDAgMTgzLjY2MiAwIDI1Mi4wOGMwIDY4LjQxNy4yOSA3Ni45OTYgMS41MTYgMTAzLjg2NiAxLjIyMyAyNi44MTQgNS40ODIgNDUuMTI3IDExLjcxIDYxLjE1MSA2LjQzNyAxNi41NjYgMTUuMDUxIDMwLjYxNSAyOS4wNTYgNDQuNjIxIDE0LjAwNiAxNC4wMDUgMjguMDU1IDIyLjYxOSA0NC42MjEgMjkuMDU3IDE2LjAyNCA2LjIyNyAzNC4zMzcgMTAuNDg2IDYxLjE1MSAxMS43MDkgMjYuODcgMS4yMjYgMzUuNDQ5IDEuNTE2IDEwMy44NjcgMS41MTYgNjguNDE3IDAgNzYuOTk2LS4yOSAxMDMuODY2LTEuNTE2IDI2LjgxNC0xLjIyMyA0NS4xMjctNS40ODIgNjEuMTUxLTExLjcwOSAxNi41NjYtNi40MzggMzAuNjE1LTE1LjA1MiA0NC42MjEtMjkuMDU3IDE0LjAwNS0xNC4wMDYgMjIuNjE5LTI4LjA1NSAyOS4wNTctNDQuNjIxIDYuMjI3LTE2LjAyNCAxMC40ODYtMzQuMzM3IDExLjcwOS02MS4xNTEgMS4yMjYtMjYuODcgMS41MTYtMzUuNDQ5IDEuNTE2LTEwMy44NjYgMC02OC40MTgtLjI5LTc2Ljk5Ny0xLjUxNi0xMDMuODY3LTEuMjIzLTI2LjgxNC01LjQ4Mi00NS4xMjctMTEuNzA5LTYxLjE1MS02LjQzOC0xNi41NjYtMTUuMDUyLTMwLjYxNS0yOS4wNTctNDQuNjIxLTE0LjAwNi0xNC4wMDUtMjguMDU1LTIyLjYxOS00NC42MjEtMjkuMDU2LTE2LjAyNC02LjIyOC0zNC4zMzctMTAuNDg3LTYxLjE1MS0xMS43MUMzMjguOTE3LjQ0OSAzMjAuMzM4LjE1OSAyNTEuOTIxLjE1OXptMCA0NS4zOTFjNjcuMjY1IDAgNzUuMjMzLjI1NyAxMDEuNzk3IDEuNDY5IDI0LjU2MiAxLjEyIDM3LjkwMSA1LjIyNCA0Ni43NzggOC42NzQgMTEuNzU5IDQuNTcgMjAuMTUxIDEwLjAyOSAyOC45NjYgMTguODQ1IDguODE2IDguODE1IDE0LjI3NSAxNy4yMDcgMTguODQ1IDI4Ljk2NiAzLjQ1IDguODc3IDcuNTU0IDIyLjIxNiA4LjY3NCA0Ni43NzggMS4yMTIgMjYuNTY0IDEuNDY5IDM0LjUzMiAxLjQ2OSAxMDEuNzk4IDAgNjcuMjY1LS4yNTcgNzUuMjMzLTEuNDY5IDEwMS43OTctMS4xMiAyNC41NjItNS4yMjQgMzcuOTAxLTguNjc0IDQ2Ljc3OC00LjU3IDExLjc1OS0xMC4wMjkgMjAuMTUxLTE4Ljg0NSAyOC45NjYtOC44MTUgOC44MTYtMTcuMjA3IDE0LjI3NS0yOC45NjYgMTguODQ1LTguODc3IDMuNDUtMjIuMjE2IDcuNTU0LTQ2Ljc3OCA4LjY3NC0yNi41NiAxLjIxMi0zNC41MjcgMS40NjktMTAxLjc5NyAxLjQ2OS02Ny4yNzEgMC03NS4yMzctLjI1Ny0xMDEuNzk4LTEuNDY5LTI0LjU2Mi0xLjEyLTM3LjkwMS01LjIyNC00Ni43NzgtOC42NzQtMTEuNzU5LTQuNTctMjAuMTUxLTEwLjAyOS0yOC45NjYtMTguODQ1LTguODE1LTguODE1LTE0LjI3NS0xNy4yMDctMTguODQ1LTI4Ljk2Ni0zLjQ1LTguODc3LTcuNTU0LTIyLjIxNi04LjY3NC00Ni43NzgtMS4yMTItMjYuNTY0LTEuNDY5LTM0LjUzMi0xLjQ2OS0xMDEuNzk3IDAtNjcuMjY2LjI1Ny03NS4yMzQgMS40NjktMTAxLjc5OCAxLjEyLTI0LjU2MiA1LjIyNC0zNy45MDEgOC42NzQtNDYuNzc4IDQuNTctMTEuNzU5IDEwLjAyOS0yMC4xNTEgMTguODQ1LTI4Ljk2NiA4LjgxNS04LjgxNiAxNy4yMDctMTQuMjc1IDI4Ljk2Ni0xOC44NDUgOC44NzctMy40NSAyMi4yMTYtNy41NTQgNDYuNzc4LTguNjc0IDI2LjU2NC0xLjIxMiAzNC41MzItMS40NjkgMTAxLjc5OC0xLjQ2OXoiIGZpbGw9IiNGRkYiIG1hc2s9InVybCgjYikiLz48cGF0aCBkPSJNMjUxLjkyMSAzMzYuMDUzYy00Ni4zNzggMC04My45NzQtMzcuNTk2LTgzLjk3NC04My45NzMgMC00Ni4zNzggMzcuNTk2LTgzLjk3NCA4My45NzQtODMuOTc0IDQ2LjM3NyAwIDgzLjk3MyAzNy41OTYgODMuOTczIDgzLjk3NCAwIDQ2LjM3Ny0zNy41OTYgODMuOTczLTgzLjk3MyA4My45NzN6bTAtMjEzLjMzOGMtNzEuNDQ3IDAtMTI5LjM2NSA1Ny45MTgtMTI5LjM2NSAxMjkuMzY1IDAgNzEuNDQ2IDU3LjkxOCAxMjkuMzY0IDEyOS4zNjUgMTI5LjM2NCA3MS40NDYgMCAxMjkuMzY0LTU3LjkxOCAxMjkuMzY0LTEyOS4zNjQgMC03MS40NDctNTcuOTE4LTEyOS4zNjUtMTI5LjM2NC0xMjkuMzY1ek00MTYuNjI3IDExNy42MDRjMCAxNi42OTYtMTMuNTM1IDMwLjIzLTMwLjIzMSAzMC4yMy0xNi42OTUgMC0zMC4yMy0xMy41MzQtMzAuMjMtMzAuMjMgMC0xNi42OTYgMTMuNTM1LTMwLjIzMSAzMC4yMy0zMC4yMzEgMTYuNjk2IDAgMzAuMjMxIDEzLjUzNSAzMC4yMzEgMzAuMjMxIiBmaWxsPSIjRkZGIi8+PC9nPjwvc3ZnPg==)}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__url__text{color:#ffe0fe}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}'},function(e,n,t){var l=t(82);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck.ck-media-form{display:flex;align-items:flex-start;flex-direction:row;flex-wrap:nowrap}.ck.ck-media-form .ck-labeled-input{display:inline-block}.ck.ck-media-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-media-form{flex-wrap:wrap}.ck.ck-media-form .ck-labeled-input{flex-basis:100%}.ck.ck-media-form .ck-button{flex-basis:50%}}.ck.ck-media-form{padding:var(--ck-spacing-standard)}.ck.ck-media-form:focus{outline:none}[dir=ltr] .ck.ck-media-form>:not(:first-child),[dir=rtl] .ck.ck-media-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-media-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-media-form .ck-labeled-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-media-form .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-media-form .ck-labeled-input .ck-labeled-input__error{white-space:normal}.ck.ck-media-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-media-form .ck-button{margin-left:0}[dir=ltr] .ck.ck-media-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-media-form .ck-button{margin-left:0}[dir=rtl] .ck.ck-media-form .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,n,t){var l=t(84);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck-content .media{clear:both;margin:1em 0;display:block;min-width:15em}"},function(e,n,t){var l=t(86);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=":root{--ck-color-table-focused-cell-background:#f5fafe}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused{background:var(--ck-color-table-focused-cell-background);border-style:none;outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}"},function(e,n,t){var l=t(88);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=":root{--ck-insert-table-dropdown-padding:10px;--ck-insert-table-dropdown-box-height:11px;--ck-insert-table-dropdown-box-width:12px;--ck-insert-table-dropdown-box-margin:1px;--ck-insert-table-dropdown-box-border-color:#bfbfbf;--ck-insert-table-dropdown-box-border-active-color:#53a0e4;--ck-insert-table-dropdown-box-active-background:#c7e5ff}.ck .ck-insert-table-dropdown__grid{display:flex;flex-direction:row;flex-wrap:wrap;width:calc(var(--ck-insert-table-dropdown-box-width)*10 + var(--ck-insert-table-dropdown-box-margin)*20 + var(--ck-insert-table-dropdown-padding)*2);padding:var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0}.ck .ck-insert-table-dropdown__label{text-align:center}.ck .ck-insert-table-dropdown-grid-box{width:var(--ck-insert-table-dropdown-box-width);height:var(--ck-insert-table-dropdown-box-height);margin:var(--ck-insert-table-dropdown-box-margin);border:1px solid var(--ck-insert-table-dropdown-box-border-color);border-radius:1px}.ck .ck-insert-table-dropdown-grid-box.ck-on{border-color:var(--ck-insert-table-dropdown-box-border-active-color);background:var(--ck-insert-table-dropdown-box-active-background)}"},function(e,n,t){var l=t(90);"string"==typeof l&&(l=[[e.i,l,""]]),t(1)(l,{injectType:"singletonStyleTag",insert:"head",singleton:!0}),l.locals&&(e.exports=l.locals)},function(e,n){e.exports=".ck-content .table{margin:1em auto;display:table}.ck-content .table table{border-collapse:collapse;border-spacing:0;border:1px double #b3b3b3}.ck-content .table table td,.ck-content .table table th{min-width:2em;padding:.4em;border-color:#d9d9d9}.ck-content .table table th{font-weight:700;background:#fafafa}"},function(e,n,t){"use strict";t.r(n);var l=t(3),i=l.a.Symbol,o=Object.prototype,r=o.hasOwnProperty,s=o.toString,u=i?i.toStringTag:void 0,a=Object.prototype.toString,c=i?i.toStringTag:void 0,d=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":c&&c in Object(e)?function(e){var n=r.call(e,u),t=e[u];try{e[u]=void 0;var l=!0}catch(e){}var i=s.call(e);return l&&(n?e[u]=t:delete e[u]),i}(e):function(e){return a.call(e)}(e)},h=function(e,n){return function(t){return e(n(t))}},p=h(Object.getPrototypeOf,Object),f=function(e){return null!=e&&"object"==typeof e},m=Function.prototype.toString,g=Object.prototype.hasOwnProperty,v=m.call(Object),_=function(e){if(!f(e)||"[object Object]"!=d(e))return!1;var n=p(e);if(null===n)return!0;var t=g.call(n,"constructor")&&n.constructor;return"function"==typeof t&&t instanceof t&&m.call(t)==v},y=function(e,n){return e===n||e!=e&&n!=n},b=function(e,n){for(var t=e.length;t--;)if(y(e[t][0],n))return t;return-1},w=Array.prototype.splice;function k(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n-1},k.prototype.set=function(e,n){var t=this.__data__,l=b(t,e);return l<0?(++this.size,t.push([e,n])):t[l][1]=n,this};var M=k,C=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)},x=function(e){if(!C(e))return!1;var n=d(e);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n},D=l.a["__core-js_shared__"],S=function(){var e=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),T=Function.prototype.toString,L=function(e){if(null!=e){try{return T.call(e)}catch(e){}try{return e+""}catch(e){}}return""},P=/^\[object .+?Constructor\]$/,A=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),I=function(e,n){var t=function(e,n){return null==e?void 0:e[n]}(e,n);return function(e){return!(!C(e)||function(e){return!!S&&S in e}(e))&&(x(e)?A:P).test(L(e))}(t)?t:void 0},E=I(l.a,"Map"),O=I(Object,"create"),j=Object.prototype.hasOwnProperty,Y=Object.prototype.hasOwnProperty;function F(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},oe={};oe["[object Float32Array]"]=oe["[object Float64Array]"]=oe["[object Int8Array]"]=oe["[object Int16Array]"]=oe["[object Int32Array]"]=oe["[object Uint8Array]"]=oe["[object Uint8ClampedArray]"]=oe["[object Uint16Array]"]=oe["[object Uint32Array]"]=!0,oe["[object Arguments]"]=oe["[object Array]"]=oe["[object ArrayBuffer]"]=oe["[object Boolean]"]=oe["[object DataView]"]=oe["[object Date]"]=oe["[object Error]"]=oe["[object Function]"]=oe["[object Map]"]=oe["[object Number]"]=oe["[object Object]"]=oe["[object RegExp]"]=oe["[object Set]"]=oe["[object String]"]=oe["[object WeakMap]"]=!1;var re=function(e){return function(n){return e(n)}},se=t(4),ue=se.a&&se.a.isTypedArray,ae=ue?re(ue):function(e){return f(e)&&ie(e.length)&&!!oe[d(e)]},ce=Object.prototype.hasOwnProperty,de=function(e,n){var t=ee(e),l=!t&&X(e),i=!t&&!l&&Object(ne.a)(e),o=!t&&!l&&!i&&ae(e),r=t||l||i||o,s=r?function(e,n){for(var t=-1,l=Array(e);++t{this._setToTarget(e,l,n[l],t)})}}function un(e){return rn(e)?e:void 0}var an=t(0);class cn{constructor(e,n){this.source=e,this.name=n,this.path=[],this.stop=function e(){e.called=!0},this.off=function e(){e.called=!0}}}function dn(){let e="e";for(let n=0;n<8;n++)e+=Math.floor(65536*(1+Math.random())).toString(16).substring(1);return e}var hn={get(e){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};t(6);const pn=Symbol("listeningTo"),fn=Symbol("emitterId");var mn={on(e,n,t={}){this.listenTo(this,e,n,t)},once(e,n,t){let l=!1;this.listenTo(this,e,(function(e,...t){l||(l=!0,e.off(),n.call(this,e,...t))}),t)},off(e,n){this.stopListening(this,e,n)},listenTo(e,n,t,l={}){let i,o;this[pn]||(this[pn]={});const r=this[pn];vn(e)||gn(e);const s=vn(e);(i=r[s])||(i=r[s]={emitter:e,callbacks:{}}),(o=i.callbacks[n])||(o=i.callbacks[n]=[]),o.push(t),function(e,n){const t=_n(e);if(t[n])return;let l=n,i=null;const o=[];for(;""!==l&&!t[l];)t[l]={callbacks:[],childEvents:[]},o.push(t[l]),i&&t[l].childEvents.push(i),i=l,l=l.substr(0,l.lastIndexOf(":"));if(""!==l){for(const e of o)e.callbacks=t[l].callbacks.slice();t[l].childEvents.push(i)}}(e,n);const u=yn(e,n),a=hn.get(l.priority),c={callback:t,priority:a};for(const d of u){let e=!1;for(let n=0;n-1?e(n,t.substr(0,t.lastIndexOf(":"))):null}(this,l);if(t.path.push(this),i){const e=[t,...n];i=Array.from(i);for(let n=0;n{this._delegations||(this._delegations=new Map),e.forEach(e=>{const l=this._delegations.get(e);l?l.set(n,t):this._delegations.set(e,new Map([[n,t]]))})}}},stopDelegating(e,n){if(this._delegations)if(e)if(n){const t=this._delegations.get(e);t&&t.delete(n)}else this._delegations.delete(e);else this._delegations.clear()}};function gn(e,n){e[fn]||(e[fn]=n||dn())}function vn(e){return e[fn]}function _n(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function yn(e,n){const t=_n(e)[n];if(!t)return[];let l=[t.callbacks];for(let i=0;i{Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n)).forEach(t=>{if(t in e.prototype)return;const l=Object.getOwnPropertyDescriptor(n,t);l.enumerable=!1,Object.defineProperty(e.prototype,t,l)})})}function Mn(e,n){const t=Math.min(e.length,n.length);for(let l=0;le.data.length)throw new an.b("view-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.",this);if(t<0||n+t>e.data.length)throw new an.b("view-textproxy-wrong-length: Given length value is incorrect.",this);this.data=e.data.substring(n,n+t),this.offsetInText=n}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}getAncestors(e={includeSelf:!1,parentFirst:!1}){const n=[];let t=e.includeSelf?this.textNode:this.parent;for(;null!==t;)n[e.parentFirst?"push":"unshift"](t),t=t.parent;return n}}function Tn(e){const n=new Map;for(const t in e)n.set(t,e[t]);return n}function Ln(e){return!(!e||!e[Symbol.iterator])}class Pn{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let n of e)("string"==typeof n||n instanceof RegExp)&&(n={name:n}),n.classes&&("string"==typeof n.classes||n.classes instanceof RegExp)&&(n.classes=[n.classes]),this._patterns.push(n)}match(...e){for(const n of e)for(const e of this._patterns){const t=An(n,e);if(t)return{element:n,pattern:e,match:t}}return null}matchAll(...e){const n=[];for(const t of e)for(const e of this._patterns){const l=An(t,e);l&&n.push({element:t,pattern:e,match:l})}return n.length>0?n:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],n=e.name;return"function"==typeof e||!n||n instanceof RegExp?null:n}}function An(e,n){if("function"==typeof n)return n(e);const t={};return n.name&&(t.name=function(e,n){return e instanceof RegExp?e.test(n):e===n}(n.name,e.name),!t.name)||n.attributes&&(t.attributes=function(e,n){const t=[];for(const l in e){const i=e[l];if(!n.hasAttribute(l))return null;{const e=n.getAttribute(l);if(!0===i)t.push(l);else if(i instanceof RegExp){if(!i.test(e))return null;t.push(l)}else{if(e!==i)return null;t.push(l)}}}return t}(n.attributes,e),!t.attributes)?null:!(n.classes&&(t.classes=function(e,n){const t=[];for(const l of e)if(l instanceof RegExp){const e=n.getClassNames();for(const n of e)l.test(n)&&t.push(n);if(0===t.length)return null}else{if(!n.hasClass(l))return null;t.push(l)}return t}(n.classes,e),!t.classes))&&!(n.styles&&(t.styles=function(e,n){const t=[];for(const l in e){const i=e[l];if(!n.hasStyle(l))return null;{const e=n.getStyle(l);if(i instanceof RegExp){if(!i.test(e))return null;t.push(l)}else{if(e!==i)return null;t.push(l)}}}return t}(n.styles,e),!t.styles))&&t}class In extends xn{constructor(e,n,t){if(super(),this.name=e,this._attrs=function(e){e=_(e)?Tn(e):new Map(e);for(const[n,t]of e)null===t?e.delete(n):"string"!=typeof t&&e.set(n,String(t));return e}(n),this._children=[],t&&this._insertChild(0,t),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");On(this._classes,e),this._attrs.delete("class")}this._styles=new Map,this._attrs.has("style")&&(En(this._styles,this._attrs.get("style")),this._attrs.delete("style")),this._customProperties=new Map}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}is(e,n=null){const t=e.replace(/^view:/,"");return n?"element"==t&&n==this.name:"element"==t||t==this.name||super.is(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.size>0&&(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.size>0&&(yield["style",this.getAttribute("style")])}getAttribute(e){if("class"==e)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"!=e)return this._attrs.get(e);if(this._styles.size>0){let e="";for(const[n,t]of this._styles)e+=`${n}:${t};`;return e}}hasAttribute(e){return"class"==e?this._classes.size>0:"style"==e?this._styles.size>0:this._attrs.has(e)}isSimilar(e){if(!(e instanceof In))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[n,t]of this._attrs)if(!e._attrs.has(n)||e._attrs.get(n)!==t)return!1;for(const n of this._classes)if(!e._classes.has(n))return!1;for(const[n,t]of this._styles)if(!e._styles.has(n)||e._styles.get(n)!==t)return!1;return!0}hasClass(...e){for(const n of e)if(!this._classes.has(n))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.get(e)}getStyleNames(){return this._styles.keys()}hasStyle(...e){for(const n of e)if(!this._styles.has(n))return!1;return!0}findAncestor(...e){const n=new Pn(...e);let t=this.parent;for(;t;){if(n.match(t))return t;t=t.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),n=Array.from(this._styles).map(e=>`${e[0]}:${e[1]}`).sort().join(";"),t=Array.from(this._attrs).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(""==n?"":` style="${n}"`)+(""==t?"":" "+t)}_clone(e=!1){const n=[];if(e)for(const l of this.getChildren())n.push(l._clone(e));const t=new this.constructor(this.name,this._attrs,n);return t._classes=new Set(this._classes),t._styles=new Map(this._styles),t._customProperties=new Map(this._customProperties),t.getFillerOffset=this.getFillerOffset,t}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,n){this._fireChange("children",this);let t=0;const l=function(e){return"string"==typeof e?[new Dn(e)]:(Ln(e)||(e=[e]),Array.from(e).map(e=>"string"==typeof e?new Dn(e):e instanceof Sn?new Dn(e.data):e))}(n);for(const i of l)null!==i.parent&&i._remove(),i.parent=this,this._children.splice(e,0,i),e++,t++;return t}_removeChildren(e,n=1){this._fireChange("children",this);for(let t=e;t0&&(this._classes.clear(),!0):"style"==e?this._styles.size>0&&(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,n){if(this._fireChange("attributes",this),_(e)){const n=Object.keys(e);for(const t of n)this._styles.set(t,e[t])}else this._styles.set(e,n)}_removeStyle(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._styles.delete(e))}_setCustomProperty(e,n){this._customProperties.set(e,n)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function En(e,n){let t=null,l=0,i=0,o=null;if(e.clear(),""!==n){";"!=n.charAt(n.length-1)&&(n+=";");for(let r=0;re.add(n))}class jn extends In{constructor(e,n,t){super(e,n,t),this.getFillerOffset=Yn}is(e,n=null){const t=e&&e.replace(/^view:/,"");return n?"containerElement"==t&&n==this.name||super.is(e,n):"containerElement"==t||super.is(e)}}function Yn(){const e=[...this.getChildren()],n=e[this.childCount-1];if(n&&n.is("element","br"))return this.childCount;for(const t of e)if(!t.is("uiElement"))return null;return this.childCount}var Fn=function(e){return e},Nn=function(e,n,t){switch(t.length){case 0:return e.call(n);case 1:return e.call(n,t[0]);case 2:return e.call(n,t[0],t[1]);case 3:return e.call(n,t[0],t[1],t[2])}return e.apply(n,t)},Rn=Math.max,Vn=function(e){return function(){return e}},Hn=Date.now,zn=function(e){var n=0,t=0;return function(){var l=Hn(),i=16-(l-t);if(t=l,i>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}(U?function(e,n){return U(e,"toString",{configurable:!0,enumerable:!1,value:Vn(n),writable:!0})}:Fn),Bn=function(e){return function(e,n){return zn(function(e,n,t){return n=Rn(void 0===n?e.length-1:n,0),function(){for(var l=arguments,i=-1,o=Rn(l.length-n,0),r=Array(o);++i1?t[i-1]:void 0,r=i>2?t[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,r&&function(e,n,t){if(!C(t))return!1;var l=typeof n;return!!("number"==l?ge(t)&&le(n,t.length):"string"==l&&n in t)&&y(t[n],e)}(t[0],t[1],r)&&(o=i<3?void 0:o,i=1),n=Object(n);++l{this.set(n,e[n])},this);Kn(this);const t=this[Un];if(e in this&&!t.has(e))throw new an.b("observable-set-cannot-override: Cannot override an existing property.",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>t.get(e),set(n){const l=t.get(e);let i=this.fire("set:"+e,e,n,l);void 0===i&&(i=n),l===i&&t.has(e)||(t.set(e,i),this.fire("change:"+e,e,i,l))}}),this[e]=n},bind(...e){if(!e.length||!Zn(e))throw new an.b("observable-bind-wrong-properties: All properties must be strings.",this);if(new Set(e).size!==e.length)throw new an.b("observable-bind-duplicate-properties: Properties must be unique.",this);Kn(this);const n=this[qn];e.forEach(e=>{if(n.has(e))throw new an.b("observable-bind-rebind: Cannot bind the same property more that once.",this)});const t=new Map;return e.forEach(e=>{const l={property:e,to:[]};n.set(e,l),t.set(e,l)}),{to:Jn,toMany:Qn,_observable:this,_bindProperties:e,_to:[],_bindings:t}},unbind(...e){if(!(Un in this))return;const n=this[qn],t=this[Wn];if(e.length){if(!Zn(e))throw new an.b("observable-unbind-wrong-properties: Properties must be strings.",this);e.forEach(e=>{const l=n.get(e);if(!l)return;let i,o,r,s;l.to.forEach(e=>{i=e[0],o=e[1],r=t.get(i),(s=r[o]).delete(l),s.size||delete r[o],Object.keys(r).length||(t.delete(i),this.stopListening(i,"change"))}),n.delete(e)})}else t.forEach((e,n)=>{this.stopListening(n,"change")}),t.clear(),n.clear()},decorate(e){const n=this[e];if(!n)throw new an.b("observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.",this,{object:this,methodName:e});this.on(e,(e,t)=>{e.return=n.apply(this,t)}),this[e]=function(...n){return this.fire(e,n)}}};Bn($n,mn);var Gn=$n;function Kn(e){Un in e||(Object.defineProperty(e,Un,{value:new Map}),Object.defineProperty(e,Wn,{value:new Map}),Object.defineProperty(e,qn,{value:new Map}))}function Jn(...e){const n=function(...e){if(!e.length)throw new an.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.",null);const n={to:[]};let t;return"function"==typeof e[e.length-1]&&(n.callback=e.pop()),e.forEach(e=>{if("string"==typeof e)t.properties.push(e);else{if("object"!=typeof e)throw new an.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.",null);t={observable:e,properties:[]},n.to.push(t)}}),n}(...e),t=Array.from(this._bindings.keys()),l=t.length;if(!n.callback&&n.to.length>1)throw new an.b("observable-bind-to-no-callback: Binding multiple observables only possible with callback.",this);if(l>1&&n.callback)throw new an.b("observable-bind-to-extra-callback: Cannot bind multiple properties and use a callback in one binding.",this);n.to.forEach(e=>{if(e.properties.length&&e.properties.length!==l)throw new an.b("observable-bind-to-properties-length: The number of properties must match.",this);e.properties.length||(e.properties=this._bindProperties)}),this._to=n.to,n.callback&&(this._bindings.get(t[0]).callback=n.callback),function(e,n){n.forEach(n=>{const t=e[Wn];let l;t.get(n.observable)||e.listenTo(n.observable,"change",(i,o)=>{(l=t.get(n.observable)[o])&&l.forEach(n=>{Xn(e,n.property)})})})}(this._observable,this._to),function(e){let n;e._bindings.forEach((t,l)=>{e._to.forEach(i=>{n=i.properties[t.callback?0:e._bindProperties.indexOf(l)],t.to.push([i.observable,n]),function(e,n,t,l){const i=e[Wn],o=i.get(t),r=o||{};r[l]||(r[l]=new Set),r[l].add(n),o||i.set(t,r)}(e._observable,t,i.observable,n)})})}(this),this._bindProperties.forEach(e=>{Xn(this._observable,e)})}function Qn(e,n,t){if(this._bindings.size>1)throw new an.b("observable-bind-to-many-not-one-binding: Cannot bind multiple properties with toMany().",this);this.to(...function(e,n){const t=e.map(e=>[e,n]);return Array.prototype.concat.apply([],t)}(e,n),t)}function Zn(e){return e.every(e=>"string"==typeof e)}function Xn(e,n){const t=e[qn].get(n);let l;l=t.callback?t.callback.apply(e,t.to.map(e=>e[0][e[1]])):(l=t.to[0])[0][l[1]],e.hasOwnProperty(n)?e[n]=l:e.set(n,l)}const et=Symbol("document");class nt extends jn{constructor(e,n,t){super(e,n,t),this.set("isReadOnly",!1),this.set("isFocused",!1)}is(e,n=null){const t=e&&e.replace(/^view:/,"");return n?"editableElement"==t&&n==this.name||super.is(e,n):"editableElement"==t||super.is(e)}destroy(){this.stopListening()}get document(){return this.getCustomProperty(et)}set _document(e){if(this.getCustomProperty(et))throw new an.b("view-editableelement-document-already-set: View document is already set.",this);this._setCustomProperty(et,e),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",n=>n&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}}kn(nt,Gn);const tt=Symbol("rootName");class lt extends nt{constructor(e){super(e),this.rootName="main"}is(e,n=null){const t=e.replace(/^view:/,"");return n?"rootElement"==t&&n==this.name||super.is(e,n):"rootElement"==t||super.is(e)}get rootName(){return this.getCustomProperty(tt)}set rootName(e){this._setCustomProperty(tt,e)}set _name(e){this.name=e}}class it{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new an.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 an.b("view-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,this.position=ot._createAt(e.startPosition?e.startPosition: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 n,t,l;do{l=this.position,({done:n,value:t}=this.next())}while(!n&&e(t));n||(this.position=l)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const n=this.position,t=e.parent;if(null===t.parent&&e.offset===t.childCount)return{done:!0};if(t===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};let l;if(t instanceof Dn){if(e.isAtEnd)return this.position=ot._createAfter(t),this._next();l=t.data[e.offset]}else l=t.getChild(e.offset);if(l instanceof In)return this.shallow?e.offset++:e=new ot(l,0),this.position=e,this._formatReturnValue("elementStart",l,n,e,1);if(l instanceof Dn){if(this.singleCharacters)return e=new ot(l,0),this.position=e,this._next();{let t,i=l.data.length;return l==this._boundaryEndParent?(i=this.boundaries.end.offset,t=new Sn(l,0,i),e=ot._createAfter(t)):(t=new Sn(l,0,l.data.length),e.offset++),this.position=e,this._formatReturnValue("text",t,n,e,i)}}if("string"==typeof l){let l;l=this.singleCharacters?1:(t===this._boundaryEndParent?this.boundaries.end.offset:t.data.length)-e.offset;const i=new Sn(t,e.offset,l);return e.offset+=l,this.position=e,this._formatReturnValue("text",i,n,e,l)}return e=ot._createAfter(t),this.position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",t,n,e)}_previous(){let e=this.position.clone();const n=this.position,t=e.parent;if(null===t.parent&&0===e.offset)return{done:!0};if(t==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0};let l;if(t instanceof Dn){if(e.isAtStart)return this.position=ot._createBefore(t),this._previous();l=t.data[e.offset-1]}else l=t.getChild(e.offset-1);if(l instanceof In)return this.shallow?(e.offset--,this.position=e,this._formatReturnValue("elementStart",l,n,e,1)):(e=new ot(l,l.childCount),this.position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",l,n,e));if(l instanceof Dn){if(this.singleCharacters)return e=new ot(l,l.data.length),this.position=e,this._previous();{let t,i=l.data.length;if(l==this._boundaryStartParent){const n=this.boundaries.start.offset;i=(t=new Sn(l,n,l.data.length-n)).data.length,e=ot._createBefore(t)}else t=new Sn(l,0,l.data.length),e.offset--;return this.position=e,this._formatReturnValue("text",t,n,e,i)}}if("string"==typeof l){let l;l=this.singleCharacters?1:e.offset-(t===this._boundaryStartParent?this.boundaries.start.offset:0),e.offset-=l;const i=new Sn(t,e.offset,l);return this.position=e,this._formatReturnValue("text",i,n,e,l)}return e=ot._createBefore(t),this.position=e,this._formatReturnValue("elementStart",t,n,e,1)}_formatReturnValue(e,n,t,l,i){return n instanceof Sn&&(n.offsetInText+n.data.length==n.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?t=ot._createAfter(n.textNode):(l=ot._createAfter(n.textNode),this.position=l)),0===n.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?t=ot._createBefore(n.textNode):(l=ot._createBefore(n.textNode),this.position=l))),{done:!1,value:{type:e,item:n,previousPosition:t,nextPosition:l,length:i}}}}class ot{constructor(e,n){this.parent=e,this.offset=n}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 nt);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const n=ot._createAt(this),t=n.offset+e;return n.offset=t<0?0:t,n}getLastMatchingPosition(e,n={}){n.startPosition=this;const t=new it(n);return t.skip(e),t.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const n=this.getAncestors(),t=e.getAncestors();let l=0;for(;n[l]==t[l]&&n[l];)l++;return 0===l?null:n[l-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 n=this.parent.is("node")?this.parent.getPath():[],t=e.parent.is("node")?e.parent.getPath():[];n.push(this.offset),t.push(e.offset);const l=Mn(n,t);switch(l){case"prefix":return"before";case"extension":return"after";default:return n[l]0?new this(t,l):new this(l,t)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const n=e.is("textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(ot._createBefore(e),n)}}function st(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}function ut(e){let n=0;for(const t of e)n++;return n}class at{constructor(e=null,n,t){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(e,n,t)}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 n of this._ranges)e&&!n.start.isBefore(e.start)||(e=n);return e?e.clone():null}getLastRange(){let e=null;for(const n of this._ranges)e&&!n.end.isAfter(e.end)||(e=n);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 n of this._ranges){let t=!1;for(const l of e._ranges)if(n.isEqual(l)){t=!0;break}if(!t)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const n=ut(this.getRanges());if(n!=ut(e.getRanges()))return!1;if(0==n)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let n=!1;for(let l of e.getRanges())if(l=l.getTrimmed(),t.start.isEqual(l.start)&&t.end.isEqual(l.end)){n=!0;break}if(!n)return!1}return!0}getSelectedElement(){if(1!==this.rangeCount)return null;const e=this.getFirstRange();let n=e.start.nodeAfter,t=e.end.nodeBefore;return e.start.parent.is("text")&&e.start.isAtEnd&&e.start.parent.nextSibling&&(n=e.start.parent.nextSibling),e.end.parent.is("text")&&e.end.isAtStart&&e.end.parent.previousSibling&&(t=e.end.parent.previousSibling),n instanceof In&&n==t?n:null}setTo(e,n,t){if(null===e)this._setRanges([]),this._setFakeOptions(n);else if(e instanceof at||e instanceof ct)this._setRanges(e.getRanges(),e.isBackward),this._setFakeOptions({fake:e.isFake,label:e.fakeSelectionLabel});else if(e instanceof rt)this._setRanges([e],n&&n.backward),this._setFakeOptions(n);else if(e instanceof ot)this._setRanges([new rt(e)]),this._setFakeOptions(n);else if(e instanceof xn){const l=!!t&&!!t.backward;let i;if(void 0===n)throw new an.b("view-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.",this);i="in"==n?rt._createIn(e):"on"==n?rt._createOn(e):new rt(ot._createAt(e,n)),this._setRanges([i],l),this._setFakeOptions(t)}else{if(!Ln(e))throw new an.b("view-selection-setTo-not-selectable: Cannot set selection to given place.",this);this._setRanges(e,n&&n.backward),this._setFakeOptions(n)}this.fire("change")}setFocus(e,n){if(null===this.anchor)throw new an.b("view-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.",this);const t=ot._createAt(e,n);if("same"==t.compareWith(this.focus))return;const l=this.anchor;this._ranges.pop(),"before"==t.compareWith(l)?this._addRange(new rt(t,l),!0):this._addRange(new rt(l,t)),this.fire("change")}is(e){return"selection"==e||"view:selection"==e}_setRanges(e,n=!1){e=Array.from(e),this._ranges=[];for(const t of e)this._addRange(t);this._lastRangeBackward=!!n}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,n=!1){if(!(e instanceof rt))throw new an.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=!!n}_pushRange(e){for(const n of this._ranges)if(e.isIntersecting(n))throw new an.b("view-selection-range-intersects: Trying to add a range that intersects with another range from selection.",this,{addedRange:e,intersectingRange:n});this._ranges.push(new rt(e.start,e.end))}}kn(at,mn);class ct{constructor(e=null,n,t){this._selection=new at,this._selection.delegate("change").to(this),this._selection.setTo(e,n,t)}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,n,t){this._selection.setTo(e,n,t)}_setFocus(e,n){this._selection.setFocus(e,n)}}kn(ct,mn);class dt{constructor(e={}){this._items=[],this._itemMap=new Map,this._idProperty=e.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[]}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,n){let t;const l=this._idProperty;if(l in e){if("string"!=typeof(t=e[l]))throw new an.b("collection-add-invalid-id",this);if(this.get(t))throw new an.b("collection-add-item-already-exists",this)}else e[l]=t=dn();if(void 0===n)n=this._items.length;else if(n>this._items.length||n<0)throw new an.b("collection-add-item-invalid-index",this);return this._items.splice(n,0,e),this._itemMap.set(t,e),this.fire("add",e,n),this}get(e){let n;if("string"==typeof e)n=this._itemMap.get(e);else{if("number"!=typeof e)throw new an.b("collection-get-invalid-arg: Index or id must be given.",this);n=this._items[e]}return n||null}has(e){return this._itemMap.has("string"==typeof e?e:e[this._idProperty])}getIndex(e){let n;return n="string"==typeof e?this._itemMap.get(e):e,this._items.indexOf(n)}remove(e){let n,t,l,i=!1;const o=this._idProperty;if("string"==typeof e?(t=e,i=!(l=this._itemMap.get(t)),l&&(n=this._items.indexOf(l))):"number"==typeof e?(n=e,i=!(l=this._items[n]),l&&(t=l[o])):(t=(l=e)[o],i=-1==(n=this._items.indexOf(l))||!this._itemMap.get(t)),i)throw new an.b("collection-remove-404: Item not found.",this);this._items.splice(n,1),this._itemMap.delete(t);const r=this._bindToInternalToExternalMap.get(l);return this._bindToInternalToExternalMap.delete(l),this._bindToExternalToInternalMap.delete(r),this.fire("remove",l,n),l}map(e,n){return this._items.map(e,n)}find(e,n){return this._items.find(e,n)}filter(e,n){return this._items.filter(e,n)}clear(){for(this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);this.length;)this.remove(0)}bindTo(e){if(this._bindToCollection)throw new an.b("collection-bind-to-rebind: The collection cannot be bound more than once.",this);return this._bindToCollection=e,{as:e=>{this._setUpBindToBinding(n=>new e(n))},using:e=>{this._setUpBindToBinding("function"==typeof e?n=>e(n):n=>n[e])}}}_setUpBindToBinding(e){const n=this._bindToCollection,t=(t,l,i)=>{const o=n._bindToCollection==this,r=n._bindToInternalToExternalMap.get(l);if(o&&r)this._bindToExternalToInternalMap.set(l,r),this._bindToInternalToExternalMap.set(r,l);else{const t=e(l);if(!t)return void this._skippedIndexesFromExternal.push(i);let o=i;for(const e of this._skippedIndexesFromExternal)i>e&&o--;for(const e of n._skippedIndexesFromExternal)o>=e&&o++;this._bindToExternalToInternalMap.set(l,t),this._bindToInternalToExternalMap.set(t,l),this.add(t,o);for(let e=0;e{const l=this._bindToExternalToInternalMap.get(n);l&&this.remove(l),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,n)=>(tn&&e.push(n),e),[])})}[Symbol.iterator](){return this._items[Symbol.iterator]()}}kn(dt,mn);class ht{constructor(){this.selection=new ct,this.roots=new dt({idProperty:"rootName"}),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 n=!1;do{for(const t of this._postFixers)if(n=t(e))break}while(n)}}kn(ht,Gn);class pt extends In{constructor(e,n,t){super(e,n,t),this.getFillerOffset=ft,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 an.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,n=null){const t=e&&e.replace(/^view:/,"");return n?"attributeElement"==t&&n==this.name||super.is(e,n):"attributeElement"==t||super.is(e)}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e){const n=super._clone(e);return n._priority=this._priority,n._id=this._id,n}}function ft(){if(mt(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(mt(e)>1)return null;e=e.parent}return!e||mt(e)>1?null:this.childCount}function mt(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}pt.DEFAULT_PRIORITY=10;class gt extends In{constructor(e,n,t){super(e,n,t),this.getFillerOffset=vt}is(e,n=null){const t=e.replace(/^view:/,"");return n?"emptyElement"==t&&n==this.name||super.is(e,n):"emptyElement"==t||super.is(e)}_insertChild(e,n){if(n&&(n instanceof xn||Array.from(n).length>0))throw new an.b("view-emptyelement-cannot-add: Cannot add child nodes to EmptyElement instance.",[this,n])}}function vt(){return null}const _t=navigator.userAgent.toLowerCase();var yt=function(e){return e.indexOf("macintosh")>-1}(_t),bt=function(e){return!!e.match(/edge\/(\d+.?\d*)/)}(_t),wt=function(e){return!!e.match(/gecko\/\d+/)}(_t),kt=function(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}(_t),Mt=function(e){return e.indexOf("android")>-1}(_t);!function(){let e=!1;try{e=0==="\u0107".search(new RegExp("[\\p{L}]","u"))}catch(e){}}();const Ct={"\u2318":"ctrl","\u21e7":"shift","\u2325":"alt"},xt={ctrl:"\u2318",shift:"\u21e7",alt:"\u2325"},Dt=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 n=65;n<=90;n++)e[String.fromCharCode(n).toLowerCase()]=n;for(let n=48;n<=57;n++)e[n-48]=n;for(let n=112;n<=123;n++)e["f"+(n-111)]=n;return e}();function St(e){let n;if("string"==typeof e){if(!(n=Dt[e.toLowerCase()]))throw new an.b("keyboard-unknown-key: Unknown key name.",null,{key:e})}else n=e.keyCode+(e.altKey?Dt.alt:0)+(e.ctrlKey?Dt.ctrl:0)+(e.shiftKey?Dt.shift:0);return n}function Tt(e){return"string"==typeof e&&(e=Lt(e)),e.map(e=>"string"==typeof e?St(e):e).reduce((e,n)=>n+e,0)}function Lt(e){return e.split(/\s*\+\s*/)}class Pt extends In{constructor(e,n,t){super(e,n,t),this.getFillerOffset=At}is(e,n=null){const t=e.replace(/^view:/,"");return n?"uiElement"==t&&n==this.name||super.is(e,n):"uiElement"==t||super.is(e)}_insertChild(e,n){if(n&&(n instanceof xn||Array.from(n).length>0))throw new an.b("view-uielement-cannot-add: Cannot add child nodes to UIElement instance.",this)}render(e){return this.toDomElement(e)}toDomElement(e){const n=e.createElement(this.name);for(const t of this.getAttributeKeys())n.setAttribute(t,this.getAttribute(t));return n}}function At(){return null}class It{constructor(e){this._children=[],e&&this._insertChild(0,e)}[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,n){this._fireChange("children",this);let t=0;const l=function(e){return"string"==typeof e?[new Dn(e)]:(Ln(e)||(e=[e]),Array.from(e).map(e=>"string"==typeof e?new Dn(e):e instanceof Sn?new Dn(e.data):e))}(n);for(const i of l)null!==i.parent&&i._remove(),i.parent=this,this._children.splice(e,0,i),e++,t++;return t}_removeChildren(e,n=1){this._fireChange("children",this);for(let t=e;tl instanceof e))throw new an.b("view-writer-insert-invalid-node",t);l.is("text")||e(l.getChildren(),t)}}(n=Ln(n)?[...n]:[n],this.document);const t=Ot(e);if(!t)throw new an.b("view-writer-invalid-position-container",this.document);const l=this._breakAttributes(e,!0),i=t._insertChild(l.offset,n);for(const s of n)this._addToClonedElementsGroup(s);const o=l.getShiftedBy(i),r=this.mergeAttributes(l);if(0===i)return new rt(r,r);{r.isEqual(l)||o.offset--;const e=this.mergeAttributes(o);return new rt(r,e)}}remove(e){const n=e instanceof rt?e:rt._createOn(e);if(Ht(n,this.document),n.isCollapsed)return new It;const{start:t,end:l}=this._breakAttributesRange(n,!0),i=t.parent._removeChildren(t.offset,l.offset-t.offset);for(const r of i)this._removeFromClonedElementsGroup(r);const o=this.mergeAttributes(t);return n.start=o,n.end=o.clone(),new It(i)}clear(e,n){Ht(e,this.document);const t=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const l of t){const t=l.item;let i;if(t.is("element")&&n.isSimilar(t))i=rt._createOn(t);else if(!l.nextPosition.isAfter(e.start)&&t.is("textProxy")){const e=t.getAncestors().find(e=>e.is("element")&&n.isSimilar(e));e&&(i=rt._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,n){let t;if(n.isAfter(e.end)){const l=(n=this._breakAttributes(n,!0)).parent,i=l.childCount;e=this._breakAttributesRange(e,!0),t=this.remove(e),n.offset+=l.childCount-i}else t=this.remove(e);return this.insert(n,t)}wrap(e,n){if(!(n instanceof pt))throw new an.b("view-writer-wrap-invalid-attribute",this.document);if(Ht(e,this.document),e.isCollapsed){let t=e.start;t.parent.is("element")&&!function(e){return Array.from(e.getChildren()).some(e=>!e.is("uiElement"))}(t.parent)&&(t=t.getLastMatchingPosition(e=>e.item.is("uiElement"))),t=this._wrapPosition(t,n);const l=this.document.selection;return l.isCollapsed&&l.getFirstPosition().isEqual(e.start)&&this.setSelection(t),new rt(t)}return this._wrapRange(e,n)}unwrap(e,n){if(!(n instanceof pt))throw new an.b("view-writer-unwrap-invalid-attribute",this.document);if(Ht(e,this.document),e.isCollapsed)return e;const{start:t,end:l}=this._breakAttributesRange(e,!0),i=this._unwrapChildren(t.parent,t.offset,l.offset,n),o=this.mergeAttributes(i.start);o.isEqual(i.start)||i.end.offset--;const r=this.mergeAttributes(i.end);return new rt(o,r)}rename(e,n){const t=new jn(e,n.getAttributes());return this.insert(ot._createAfter(n),t),this.move(rt._createIn(n),ot._createAt(t,0)),this.remove(rt._createOn(n)),t}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,n){return ot._createAt(e,n)}createPositionAfter(e){return ot._createAfter(e)}createPositionBefore(e){return ot._createBefore(e)}createRange(e,n){return new rt(e,n)}createRangeOn(e){return rt._createOn(e)}createRangeIn(e){return rt._createIn(e)}createSelection(e,n,t){return new at(e,n,t)}_wrapChildren(e,n,t,l){let i=n;const o=[];for(;i!1,e.parent._insertChild(e.offset,t);const l=new rt(e,e.getShiftedBy(1));this.wrap(l,n);const i=new ot(t.parent,t.index);t._remove();const o=i.nodeBefore,r=i.nodeAfter;return o instanceof Dn&&r instanceof Dn?Nt(o,r):Yt(i)}_wrapAttributeElement(e,n){if(!zt(e,n))return!1;if(e.name!==n.name||e.priority!==n.priority)return!1;for(const t of e.getAttributeKeys())if("class"!==t&&"style"!==t&&n.hasAttribute(t)&&n.getAttribute(t)!==e.getAttribute(t))return!1;for(const t of e.getStyleNames())if(n.hasStyle(t)&&n.getStyle(t)!==e.getStyle(t))return!1;for(const t of e.getAttributeKeys())"class"!==t&&"style"!==t&&(n.hasAttribute(t)||this.setAttribute(t,e.getAttribute(t),n));for(const t of e.getStyleNames())n.hasStyle(t)||this.setStyle(t,e.getStyle(t),n);for(const t of e.getClassNames())n.hasClass(t)||this.addClass(t,n);return!0}_unwrapAttributeElement(e,n){if(!zt(e,n))return!1;if(e.name!==n.name||e.priority!==n.priority)return!1;for(const t of e.getAttributeKeys())if("class"!==t&&"style"!==t&&(!n.hasAttribute(t)||n.getAttribute(t)!==e.getAttribute(t)))return!1;if(!n.hasClass(...e.getClassNames()))return!1;for(const t of e.getStyleNames())if(!n.hasStyle(t)||n.getStyle(t)!==e.getStyle(t))return!1;for(const t of e.getAttributeKeys())"class"!==t&&"style"!==t&&this.removeAttribute(t,n);return this.removeClass(Array.from(e.getClassNames()),n),this.removeStyle(Array.from(e.getStyleNames()),n),!0}_breakAttributesRange(e,n=!1){const t=e.start,l=e.end;if(Ht(e,this.document),e.isCollapsed){const t=this._breakAttributes(e.start,n);return new rt(t,t)}const i=this._breakAttributes(l,n),o=i.parent.childCount,r=this._breakAttributes(t,n);return i.offset+=i.parent.childCount-o,new rt(r,i)}_breakAttributes(e,n=!1){const t=e.offset,l=e.parent;if(e.parent.is("emptyElement"))throw new an.b("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new an.b("view-writer-cannot-break-ui-element",this.document);if(!n&&l.is("text")&&Vt(l.parent))return e.clone();if(Vt(l))return e.clone();if(l.is("text"))return this._breakAttributes(Ft(e),n);if(t==l.childCount){const e=new ot(l.parent,l.index+1);return this._breakAttributes(e,n)}if(0===t){const e=new ot(l.parent,l.index);return this._breakAttributes(e,n)}{const e=l.index+1,i=l._clone();l.parent._insertChild(e,i),this._addToClonedElementsGroup(i);const o=l._removeChildren(t,l.childCount-t);i._appendChild(o);const r=new ot(l.parent,e);return this._breakAttributes(r,n)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const l of e.getChildren())this._addToClonedElementsGroup(l);const n=e.id;if(!n)return;let t=this._cloneGroups.get(n);t||(t=new Set,this._cloneGroups.set(n,t)),t.add(e),e._clonesGroup=t}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const l of e.getChildren())this._removeFromClonedElementsGroup(l);const n=e.id;if(!n)return;const t=this._cloneGroups.get(n);t&&t.delete(e)}}function Ot(e){let n=e.parent;for(;!Vt(n);){if(!n)return;n=n.parent}return n}function jt(e,n){return e.priorityn.priority)&&e.getIdentity()e.createTextNode("\xa0"),Wt=e=>{const n=e.createElement("br");return n.dataset.ckeFiller=!0,n},qt=(()=>{let e="";for(let n=0;n<7;n++)e+="\u200b";return e})();function $t(e){return Bt(e)&&e.data.substr(0,7)===qt}function Gt(e){return 7==e.data.length&&$t(e)}function Kt(e){return $t(e)?e.data.slice(7):e.data}function Jt(e,n){if(n.keyCode==Dt.arrowleft){const e=n.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const n=e.getRangeAt(0).startContainer,t=e.getRangeAt(0).startOffset;$t(n)&&t<=7&&e.collapse(n,0)}}}function Qt(e,n,t,l=!1){t=t||function(e,n){return e===n},Array.isArray(e)||(e=Array.from(e)),Array.isArray(n)||(n=Array.from(n));const i=function(e,n,t){const l=Zt(e,n,t);if(-1===l)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const i=Zt(Xt(e,l),Xt(n,l),t);return{firstIndex:l,lastIndexOld:e.length-i,lastIndexNew:n.length-i}}(e,n,t);return l?function(e,n){const{firstIndex:t,lastIndexOld:l,lastIndexNew:i}=e;if(-1===t)return Array(n).fill("equal");let o=[];return t>0&&(o=o.concat(Array(t).fill("equal"))),i-t>0&&(o=o.concat(Array(i-t).fill("insert"))),l-t>0&&(o=o.concat(Array(l-t).fill("delete"))),i0&&t.push({index:l,type:"insert",values:e.slice(l,o)}),i-l>0&&t.push({index:l+(o-l),type:"delete",howMany:i-l}),t}(n,i)}function Zt(e,n,t){for(let l=0;l200||i>200||l+i>300)return el.fastDiff(e,n,t,!0);let o,r;if(ia?-1:1;c[l+h]&&(c[l]=c[l+h].slice(0)),c[l]||(c[l]=[]),c[l].push(i>a?o:r);let p=Math.max(i,a),f=p-l;for(;fa;p--)d[p]=h(p);d[a]=h(a),f++}while(d[a]!==u);return c[a].slice(1)}function nl(e,n,t){e.insertBefore(t,e.childNodes[n]||null)}function tl(e){const n=e.parentNode;n&&n.removeChild(e)}function ll(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}el.fastDiff=Qt;class il{constructor(e,n){this.domDocuments=new Set,this.domConverter=e,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this.selection=n,this.isFocused=!1,this._inlineFiller=null,this._fakeSelectionContainer=null}markToSync(e,n){if("text"===e)this.domConverter.mapViewToDom(n.parent)&&this.markedTexts.add(n);else{if(!this.domConverter.mapViewToDom(n))return;if("attributes"===e)this.markedAttributes.add(n);else{if("children"!==e)throw new an.b("view-renderer-unknown-type: Unknown type passed to Renderer.markToSync.",this);this.markedChildren.add(n)}}}render(){let e;for(const n of this.markedChildren)this._updateChildrenMappings(n);this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent));for(const n of this.markedAttributes)this._updateAttrs(n);for(const n of this.markedChildren)this._updateChildren(n,{inlineFillerPosition:e});for(const n of this.markedTexts)!this.markedChildren.has(n.parent)&&this.domConverter.mapViewToDom(n.parent)&&this._updateText(n,{inlineFillerPosition:e});if(e){const n=this.domConverter.viewPositionToDom(e),t=n.parent.ownerDocument;this._inlineFiller=$t(n.parent)?n.parent:ol(t,n.parent,n.offset)}else this._inlineFiller=null;this._updateSelection(),this._updateFocus(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const n=this.domConverter.mapViewToDom(e);if(!n)return;const t=this.domConverter.mapViewToDom(e).childNodes,l=Array.from(this.domConverter.viewChildrenToDom(e,n.ownerDocument,{withChildren:!1})),i=this._diffNodeLists(t,l),o=this._findReplaceActions(i,t,l);if(-1!==o.indexOf("replace")){const n={equal:0,insert:0,delete:0};for(const i of o)if("replace"===i){const i=n.equal+n.insert,o=n.equal+n.delete,r=e.getChild(i);r&&!r.is("uiElement")&&this._updateElementMappings(r,t[o]),tl(l[i]),n.equal++}else n[i]++}}_updateElementMappings(e,n){this.domConverter.unbindDomElement(n),this.domConverter.bindElements(n,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("text")?ot._createBefore(this.selection.getFirstPosition().parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),n=this.domConverter.viewPositionToDom(e);return!!(n&&Bt(n.parent)&&$t(n.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!$t(e))throw new an.b("view-renderer-filler-was-lost: The inline filler node was lost.",this);Gt(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(),n=e.parent,t=e.offset;return!(!this.domConverter.mapViewToDom(n.root)||!n.is("element")||!function(e){if("false"==e.getAttribute("contenteditable"))return!1;const n=e.findAncestor(e=>e.hasAttribute("contenteditable"));return!n||"true"==n.getAttribute("contenteditable")}(n)||t===n.getFillerOffset()||e.nodeBefore instanceof Dn||e.nodeAfter instanceof Dn)}_updateText(e,n){const t=this.domConverter.findCorrespondingDomText(e),l=this.domConverter.viewToDom(e,t.ownerDocument),i=t.data;let o=l.data;const r=n.inlineFillerPosition;if(r&&r.parent==e.parent&&r.offset==e.index&&(o=qt+o),i!=o){const e=Qt(i,o);for(const n of e)"insert"===n.type?t.insertData(n.index,n.values.join("")):t.deleteData(n.index,n.howMany)}}_updateAttrs(e){const n=this.domConverter.mapViewToDom(e);if(!n)return;const t=Array.from(n.attributes).map(e=>e.name),l=e.getAttributeKeys();for(const i of l)n.setAttribute(i,e.getAttribute(i));for(const i of t)e.hasAttribute(i)||n.removeAttribute(i)}_updateChildren(e,n){const t=this.domConverter.mapViewToDom(e);if(!t)return;const l=n.inlineFillerPosition,i=this.domConverter.mapViewToDom(e).childNodes,o=Array.from(this.domConverter.viewChildrenToDom(e,t.ownerDocument,{bind:!0,inlineFillerPosition:l}));l&&l.parent===e&&ol(t.ownerDocument,o,l.offset);const r=this._diffNodeLists(i,o);let s=0;const u=new Set;for(const a of r)"insert"===a?(nl(t,s,o[s]),s++):"delete"===a?(u.add(i[s]),tl(i[s])):(this._markDescendantTextToSync(this.domConverter.domToView(o[s])),s++);for(const a of u)a.parentNode||this.domConverter.unbindDomElement(a)}_diffNodeLists(e,n){return el(e=function(e,n){const t=Array.from(e);return 0!=t.length&&n?(t[t.length-1]==n&&t.pop(),t):t}(e,this._fakeSelectionContainer),n,(function(e,n,t){return n===t||(Bt(n)&&Bt(t)?n.data===t.data:!(!e.isBlockFiller(n)||!e.isBlockFiller(t)))}).bind(null,this.domConverter))}_findReplaceActions(e,n,t){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let l=[],i=[],o=[];const r={equal:0,insert:0,delete:0};for(const s of e)"insert"===s?o.push(t[r.equal+r.insert]):"delete"===s?i.push(n[r.equal+r.delete]):((l=l.concat(el(i,o,rl).map(e=>"equal"===e?"replace":e))).push("equal"),i=[],o=[]),r[s]++;return l.concat(el(i,o,rl).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 n of e.getChildren())this._markDescendantTextToSync(n)}_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 n=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const n=e.createElement("div");return Object.assign(n.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),n.textContent="\xa0",n}(n));const t=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(t,this.selection),!this._fakeSelectionNeedsUpdate(e))return;t.parentElement&&t.parentElement==e||e.appendChild(t),t.textContent=this.selection.fakeSelectionLabel||"\xa0";const l=n.getSelection(),i=n.createRange();l.removeAllRanges(),i.selectNodeContents(t),l.addRange(i)}_updateDomSelection(e){const n=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(n))return;const t=this.domConverter.viewPositionToDom(this.selection.anchor),l=this.domConverter.viewPositionToDom(this.selection.focus);e.focus(),n.collapse(t.parent,t.offset),n.extend(l.parent,l.offset),wt&&function(e,n){const t=e.parent;if(t.nodeType!=Node.ELEMENT_NODE||e.offset!=t.childNodes.length-1)return;const l=t.childNodes[e.offset];l&&"BR"==l.tagName&&n.addRange(n.getRangeAt(0))}(l,n)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const n=e&&this.domConverter.domSelectionToView(e);return!(n&&this.selection.isEqual(n)||!this.selection.isCollapsed&&this.selection.isSimilar(n))}_fakeSelectionNeedsUpdate(e){const n=this._fakeSelectionContainer,t=e.ownerDocument.getSelection();return!n||n.parentElement!==e||t.anchorNode!==n&&!n.contains(t.anchorNode)||n.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments)if(e.getSelection().rangeCount){const n=e.activeElement,t=this.domConverter.mapDomToView(n);n&&t&&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 ol(e,n,t){const l=n instanceof Array?n:n.childNodes,i=l[t];if(Bt(i))return i.data=qt+i.data,i;{const i=e.createTextNode(qt);return Array.isArray(n)?l.splice(t,0,i):nl(n,t,i),i}}function rl(e,n){return ll(e)&&ll(n)&&!Bt(e)&&!Bt(n)&&e.tagName.toLowerCase()===n.tagName.toLowerCase()}kn(il,Gn);var sl={window:window,document:document};function ul(e){let n=0;for(;e.previousSibling;)e=e.previousSibling,n++;return n}function al(e){const n=[];for(;e&&e.nodeType!=Node.DOCUMENT_NODE;)n.unshift(e),e=e.parentNode;return n}const cl=Wt(document);class dl{constructor(e={}){this.blockFillerMode=e.blockFillerMode||"br",this.preElements=["pre"],this.blockElements=["p","div","h1","h2","h3","h4","h5","h6","li","dd","dt","figcaption"],this._blockFiller="br"==this.blockFillerMode?Wt:Ut,this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap}bindFakeSelection(e,n){this._fakeSelectionMapping.set(e,new at(n))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,n){this._domToViewMapping.set(e,n),this._viewToDomMapping.set(n,e)}unbindDomElement(e){const n=this._domToViewMapping.get(e);if(n){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(n);for(const n of Array.from(e.childNodes))this.unbindDomElement(n)}}bindDocumentFragments(e,n){this._domToViewMapping.set(e,n),this._viewToDomMapping.set(n,e)}viewToDom(e,n,t={}){if(e.is("text")){const t=this._processDataFromViewText(e);return n.createTextNode(t)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let l;if(e.is("documentFragment"))l=n.createDocumentFragment(),t.bind&&this.bindDocumentFragments(l,e);else{if(e.is("uiElement"))return l=e.render(n),t.bind&&this.bindElements(l,e),l;l=e.hasAttribute("xmlns")?n.createElementNS(e.getAttribute("xmlns"),e.name):n.createElement(e.name),t.bind&&this.bindElements(l,e);for(const n of e.getAttributeKeys())l.setAttribute(n,e.getAttribute(n))}if(t.withChildren||void 0===t.withChildren)for(const i of this.viewChildrenToDom(e,n,t))l.appendChild(i);return l}}*viewChildrenToDom(e,n,t={}){const l=e.getFillerOffset&&e.getFillerOffset();let i=0;for(const o of e.getChildren())l===i&&(yield this._blockFiller(n)),yield this.viewToDom(o,n,t),i++;l===i&&(yield this._blockFiller(n))}viewRangeToDom(e){const n=this.viewPositionToDom(e.start),t=this.viewPositionToDom(e.end),l=document.createRange();return l.setStart(n.parent,n.offset),l.setEnd(t.parent,t.offset),l}viewPositionToDom(e){const n=e.parent;if(n.is("text")){const t=this.findCorrespondingDomText(n);if(!t)return null;let l=e.offset;return $t(t)&&(l+=7),{parent:t,offset:l}}{let t,l,i;if(0===e.offset){if(!(t=this.mapViewToDom(n)))return null;i=t.childNodes[0]}else{const n=e.nodeBefore;if(!(l=n.is("text")?this.findCorrespondingDomText(n):this.mapViewToDom(e.nodeBefore)))return null;t=l.parentNode,i=l.nextSibling}return Bt(i)&&$t(i)?{parent:i,offset:7}:{parent:t,offset:l?ul(l)+1:0}}}domToView(e,n={}){if(this.isBlockFiller(e,this.blockFillerMode))return null;const t=this.getParentUIElement(e,this._domToViewMapping);if(t)return t;if(Bt(e)){if(Gt(e))return null;{const n=this._processDataFromDomText(e);return""===n?null:new Dn(n)}}if(this.isComment(e))return null;{if(this.mapDomToView(e))return this.mapDomToView(e);let t;if(this.isDocumentFragment(e))t=new It,n.bind&&this.bindDocumentFragments(e,t);else{const l=n.keepOriginalCase?e.tagName:e.tagName.toLowerCase();t=new In(l),n.bind&&this.bindElements(e,t);const i=e.attributes;for(let e=i.length-1;e>=0;e--)t._setAttribute(i[e].name,i[e].value)}if(n.withChildren||void 0===n.withChildren)for(const l of this.domChildrenToView(e,n))t._appendChild(l);return t}}*domChildrenToView(e,n={}){for(let t=0;t{const{scrollLeft:n,scrollTop:t}=e;l.push([n,t])}),n.focus(),pl(n,e=>{const[n,t]=l.shift();e.scrollLeft=n,e.scrollTop=t}),sl.window.scrollTo(e,t)}}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(cl):function(e,n){return Bt(e)&&"\xa0"==e.data&&function(e,n){const t=e.parentNode;return t&&t.tagName&&n.includes(t.tagName.toLowerCase())}(e,n)&&1===e.parentNode.childNodes.length}(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const n=document.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset);const t=n.collapsed;return n.detach(),t}getParentUIElement(e){const n=al(e);for(n.pop();n.length;){const e=n.pop(),t=this._domToViewMapping.get(e);if(t&&t.is("uiElement"))return t}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}_isDomSelectionPositionCorrect(e,n){if(Bt(e)&&$t(e)&&n<7)return!1;if(this.isElement(e)&&$t(e.childNodes[n]))return!1;const t=this.mapDomToView(e);return!t||!t.is("uiElement")}_processDataFromViewText(e){let n=e.data;if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return n;if(" "==n.charAt(0)){const t=this._getTouchingViewTextNode(e,!1);(!t||!this._nodeEndsWithSpace(t))&&t||(n="\xa0"+n.substr(1))}if(" "==n.charAt(n.length-1)){const t=this._getTouchingViewTextNode(e,!0);" "!=n.charAt(n.length-2)&&t&&" "!=t.data.charAt(0)||(n=n.substr(0,n.length-1)+"\xa0")}return n.replace(/ {2}/g," \xa0")}_nodeEndsWithSpace(e){if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return!1;const n=this._processDataFromViewText(e);return" "==n.charAt(n.length-1)}_processDataFromDomText(e){let n=e.data;if(hl(e,this.preElements))return Kt(e);n=n.replace(/[ \n\t\r]{1,}/g," ");const t=this._getTouchingInlineDomNode(e,!1),l=this._getTouchingInlineDomNode(e,!0),i=this._checkShouldLeftTrimDomText(t),o=this._checkShouldRightTrimDomText(e,l);return i&&(n=n.replace(/^ /,"")),o&&(n=n.replace(/ $/,"")),n=(n=Kt(new Text(n))).replace(/ \u00A0/g," "),(/( |\u00A0)\u00A0$/.test(n)||!l||l.data&&" "==l.data.charAt(0))&&(n=n.replace(/\u00A0$/," ")),i&&(n=n.replace(/^\u00A0/," ")),n}_checkShouldLeftTrimDomText(e){return!e||!!rn(e)||/[^\S\u00A0]/.test(e.data.charAt(e.data.length-1))}_checkShouldRightTrimDomText(e,n){return!n&&!$t(e)}_getTouchingViewTextNode(e,n){const t=new it({startPosition:n?ot._createAfter(e):ot._createBefore(e),direction:n?"forward":"backward"});for(const l of t){if(l.item.is("containerElement"))return null;if(l.item.is("br"))return null;if(l.item.is("textProxy"))return l.item}return null}_getTouchingInlineDomNode(e,n){if(!e.parentNode)return null;const t=n?"nextNode":"previousNode",l=e.ownerDocument,i=al(e)[0],o=l.createTreeWalker(i,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:e=>Bt(e)||"BR"==e.tagName?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});o.currentNode=e;const r=o[t]();if(null!==r){const n=function(e,n){const t=al(e),l=al(n);let i=0;for(;t[i]==l[i]&&t[i];)i++;return 0===i?null:t[i-1]}(e,r);if(n&&!hl(e,this.blockElements,n)&&!hl(r,this.blockElements,n))return r}return null}}function hl(e,n,t){let l=al(e);return t&&(l=l.slice(l.indexOf(t)+1)),l.some(e=>e.tagName&&n.includes(e.tagName.toLowerCase()))}function pl(e,n){for(;e&&e!=sl.document;)n(e),e=e.parentNode}function fl(e){const n=Object.prototype.toString.apply(e);return"[object Window]"==n||"[object global]"==n}var ml=Bn({},mn,{listenTo(e,...n){if(ll(e)||fl(e)){const t=this._getProxyEmitter(e)||new gl(e);t.attach(...n),e=t}mn.listenTo.call(this,e,...n)},stopListening(e,n,t){if(ll(e)||fl(e)){const n=this._getProxyEmitter(e);if(!n)return;e=n}mn.stopListening.call(this,e,n,t),e instanceof gl&&e.detach(n)},_getProxyEmitter(e){return function(e,n){return e[pn]&&e[pn][n]?e[pn][n].emitter:null}(this,vl(e))}});class gl{constructor(e){gn(this,vl(e)),this._domNode=e}}function vl(e){return e["data-ck-expando"]||(e["data-ck-expando"]=dn())}Bn(gl.prototype,mn,{attach(e,n,t={}){if(this._domListeners&&this._domListeners[e])return;const l=this._createDomListener(e,!!t.useCapture);this._domNode.addEventListener(e,l,!!t.useCapture),this._domListeners||(this._domListeners={}),this._domListeners[e]=l},detach(e){let n;!this._domListeners[e]||(n=this._events[e])&&n.callbacks.length||this._domListeners[e].removeListener()},_createDomListener(e,n){const t=n=>{this.fire(e,n)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,n),delete this._domListeners[e]},t}});class _l{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()}}function yl(e){var n=-1,t=null==e?0:e.length;for(this.__data__=new H;++ns))return!1;var a=o.get(e);if(a&&o.get(n))return a==n;var c=-1,d=!0,h=2&t?new bl:void 0;for(o.set(e,n),o.set(n,e);++c{this.listenTo(e,n,(e,n)=>{this.isEnabled&&this.onDomEvent(n)},{useCapture:this.useCapture})})}fire(e,n,t){this.isEnabled&&this.document.fire(e,new Yl(this.view,n,t))}}class Nl extends Fl{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 St(this)}})}}var Rl=function(){return l.a.Date.now()},Vl=function(e){return"symbol"==typeof e||f(e)&&"[object Symbol]"==d(e)},Hl=/^\s+|\s+$/g,zl=/^[-+]0x[0-9a-f]+$/i,Bl=/^0b[01]+$/i,Ul=/^0o[0-7]+$/i,Wl=parseInt,ql=function(e){if("number"==typeof e)return e;if(Vl(e))return NaN;if(C(e)){var n="function"==typeof e.valueOf?e.valueOf():e;e=C(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Hl,"");var t=Bl.test(e);return t||Ul.test(e)?Wl(e.slice(2),t?2:8):zl.test(e)?NaN:+e},$l=Math.max,Gl=Math.min,Kl=function(e,n,t){var l,i,o,r,s,u,a=0,c=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(n){var t=l,o=i;return l=i=void 0,a=n,r=e.apply(o,t)}function f(e){var t=e-u;return void 0===u||t>=n||t<0||d&&e-a>=o}function m(){var e=Rl();if(f(e))return g(e);s=setTimeout(m,function(e){var t=n-(e-u);return d?Gl(t,o-(e-a)):t}(e))}function g(e){return s=void 0,h&&l?p(e):(l=i=void 0,r)}function v(){var e=Rl(),t=f(e);if(l=arguments,i=this,u=e,t){if(void 0===s)return function(e){return a=e,s=setTimeout(m,n),c?p(e):r}(u);if(d)return clearTimeout(s),s=setTimeout(m,n),p(u)}return void 0===s&&(s=setTimeout(m,n)),r}return n=ql(n)||0,C(t)&&(c=!!t.leading,o=(d="maxWait"in t)?$l(ql(t.maxWait)||0,n):o,h="trailing"in t?!!t.trailing:h),v.cancel=function(){void 0!==s&&clearTimeout(s),a=0,l=u=i=s=void 0},v.flush=function(){return void 0===s?r:g(Rl())},v};class Jl extends _l{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Kl(e=>this.document.fire("selectionChangeDone",e),200)}observe(){const e=this.document;e.on("keydown",(n,t)=>{e.selection.isFake&&function(e){return e==Dt.arrowright||e==Dt.arrowleft||e==Dt.arrowup||e==Dt.arrowdown}(t.keyCode)&&this.isEnabled&&(t.preventDefault(),this._handleSelectionMove(t.keyCode))},{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const n=this.document.selection,t=new at(n.getRanges(),{backward:n.isBackward,fake:!1});e!=Dt.arrowleft&&e!=Dt.arrowup||t.setTo(t.getFirstPosition()),e!=Dt.arrowright&&e!=Dt.arrowdown||t.setTo(t.getLastPosition());const l={oldSelection:n,newSelection:t,domSelection:null};this.document.fire("selectionChange",l),this._fireSelectionChangeDoneDebounced(l)}}class Ql extends _l{constructor(e){super(e),this.mutationObserver=e.getObserver(jl),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=Kl(e=>this.document.fire("selectionChangeDone",e),200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._loopbackCounter=0}observe(e){const n=e.ownerDocument;this._documents.has(n)||(this.listenTo(n,"selectionchange",()=>{this._handleSelectionChange(n)}),this._documents.add(n))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionChange(e){if(!this.isEnabled||!this.document.isFocused&&!this.document.isReadOnly)return;this.mutationObserver.flush();const n=e.defaultView.getSelection(),t=this.domConverter.domSelectionToView(n);if(!(this.selection.isEqual(t)&&this.domConverter.isDomSelectionCorrect(n)||++this._loopbackCounter>60))if(this.selection.isSimilar(t))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:t,domSelection:n};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}_clearInfiniteLoop(){this._loopbackCounter=0}}class Zl extends Fl{constructor(e){super(e),this.domEventType=["focus","blur"],this.useCapture=!0;const n=this.document;n.on("focus",()=>{n.isFocused=!0,this._renderTimeoutId=setTimeout(()=>e.forceRender(),50)}),n.on("blur",(t,l)=>{const i=n.selection.editableElement;null!==i&&i!==l.target||(n.isFocused=!1,e.forceRender())})}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class Xl extends Fl{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const n=this.document;n.on("compositionstart",()=>{n.isComposing=!0}),n.on("compositionend",()=>{n.isComposing=!1})}onDomEvent(e){this.fire(e.type,e)}}class ei extends Fl{constructor(e){super(e),this.domEventType=["beforeinput"]}onDomEvent(e){this.fire(e.type,e)}}function ni(e){return"[object Range]"==Object.prototype.toString.apply(e)}function ti(e){const n=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(n.borderTopWidth,10),right:parseInt(n.borderRightWidth,10),bottom:parseInt(n.borderBottomWidth,10),left:parseInt(n.borderLeftWidth,10)}}const li=["top","right","bottom","left","width","height"];class ii{constructor(e){const n=ni(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),rn(e)||n)oi(this,n?ii.getDomRangeRects(e)[0]:e.getBoundingClientRect());else if(fl(e)){const{innerWidth:n,innerHeight:t}=e;oi(this,{top:0,right:n,bottom:t,left:0,width:n,height:t})}else oi(this,e)}clone(){return new ii(this)}moveTo(e,n){return this.top=n,this.right=e+this.width,this.bottom=n+this.height,this.left=e,this}moveBy(e,n){return this.top+=n,this.right+=e,this.left+=e,this.bottom+=n,this}getIntersection(e){const n={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 n.width=n.right-n.left,n.height=n.bottom-n.top,n.width<0||n.height<0?null:new ii(n)}getIntersectionArea(e){const n=this.getIntersection(e);return n?n.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let n=this.clone();if(!ri(e)){let t=e.parentNode||e.commonAncestorContainer;for(;t&&!ri(t);){const e=new ii(t),l=n.getIntersection(e);if(!l)return null;l.getArea()gi(e,l));const r=gi(e,l);if(ui(l,r,n),l.parent!=l){if(i=l.frameElement,l=l.parent,!i)return}else l=null}}function ui(e,n,t){const l=n.clone().moveBy(0,t),i=n.clone().moveBy(0,-t),o=new ii(e).excludeScrollbarsAndBorders();if(![i,l].every(e=>o.contains(e))){let{scrollX:r,scrollY:s}=e;di(i,o)?s-=o.top-n.top+t:ci(l,o)&&(s+=n.bottom-o.bottom+t),hi(n,o)?r-=o.left-n.left+t:pi(n,o)&&(r+=n.right-o.right+t),e.scrollTo(r,s)}}function ai(e,n){const t=fi(e);let l,i;for(;e!=t.document.body;)i=n(),(l=new ii(e).excludeScrollbarsAndBorders()).contains(i)||(di(i,l)?e.scrollTop-=l.top-i.top:ci(i,l)&&(e.scrollTop+=i.bottom-l.bottom),hi(i,l)?e.scrollLeft-=l.left-i.left:pi(i,l)&&(e.scrollLeft+=i.right-l.right)),e=e.parentNode}function ci(e,n){return e.bottom>n.bottom}function di(e,n){return e.topn.right}function fi(e){return ni(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function mi(e){if(ni(e)){let n=e.commonAncestorContainer;return Bt(n)&&(n=n.parentNode),n}return e.parentNode}function gi(e,n){const t=fi(e),l=new ii(e);if(t===n)return l;{let e=t;for(;e!=n;){const n=new ii(e.frameElement).excludeScrollbarsAndBorders();l.moveBy(n.left,n.top),e=e.parent}}return l}Object.assign({},{scrollViewportToShowTarget:si,scrollAncestorsToShowTarget:function(e){ai(mi(e),()=>new ii(e))}});class vi{constructor(){this.document=new ht,this.domConverter=new dl,this.domRoots=new Map,this.set("isRenderingInProgress",!1),this._renderer=new il(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 Et(this.document),this.addObserver(jl),this.addObserver(Ql),this.addObserver(Zl),this.addObserver(Nl),this.addObserver(Jl),this.addObserver(Xl),Mt&&this.addObserver(ei),function(e){e.document.on("keydown",Jt)}(this),function(e){e.document.on("keydown",(n,t)=>function(e,n,t){if(n.keyCode==Dt.arrowright){const e=n.domTarget.ownerDocument.defaultView.getSelection(),l=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(l||n.shiftKey){const n=t.domPositionToView(e.focusNode,e.focusOffset);if(null===n)return;let i=!1;const o=n.getLastMatchingPosition(e=>(e.item.is("uiElement")&&(i=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement"))));if(i){const n=t.viewPositionToDom(o);l?e.collapse(n.parent,n.offset):e.extend(n.parent,n.offset)}}}}(0,t,e.domConverter))}(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0})}attachDomRoot(e,n="main"){const t=this.document.getRoot(n);t._name=e.tagName.toLowerCase();const l={};for(const{name:o,value:r}of Array.from(e.attributes))l[o]=r,"class"===o?this._writer.addClass(r.split(" "),t):this._writer.setAttribute(o,r,t);this._initialDomRootAttributes.set(e,l);const i=()=>{this._writer.setAttribute("contenteditable",!t.isReadOnly,t),t.isReadOnly?this._writer.addClass("ck-read-only",t):this._writer.removeClass("ck-read-only",t)};i(),this.domRoots.set(n,e),this.domConverter.bindElements(e,t),this._renderer.markToSync("children",t),this._renderer.markToSync("attributes",t),this._renderer.domDocuments.add(e.ownerDocument),t.on("change:children",(e,n)=>this._renderer.markToSync("children",n)),t.on("change:attributes",(e,n)=>this._renderer.markToSync("attributes",n)),t.on("change:text",(e,n)=>this._renderer.markToSync("text",n)),t.on("change:isReadOnly",()=>this.change(i)),t.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const o of this._observers.values())o.observe(e,n)}detachDomRoot(e){const n=this.domRoots.get(e);Array.from(n.attributes).forEach(({name:e})=>n.removeAttribute(e));const t=this._initialDomRootAttributes.get(n);for(const l in t)n.setAttribute(l,t[l]);this.domRoots.delete(e),this.domConverter.unbindDomElement(n)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let n=this._observers.get(e);if(n)return n;n=new e(this),this._observers.set(e,n);for(const[t,l]of this.domRoots)n.observe(l,t);return n.enable(),n}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&&si({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 an.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 n=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")),n}catch(e){an.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,n){return ot._createAt(e,n)}createPositionAfter(e){return ot._createAfter(e)}createPositionBefore(e){return ot._createBefore(e)}createRange(e,n){return new rt(e,n)}createRangeOn(e){return rt._createOn(e)}createRangeIn(e){return rt._createIn(e)}createSelection(e,n,t){return new at(e,n,t)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}function _i(e){return _(e)?Tn(e):new Map(e)}kn(vi,Gn);class yi{constructor(e){this.parent=null,this._attrs=_i(e)}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new an.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 an.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}get document(){return this.root==this?null:this.root.document||null}getPath(){const e=[];let n=this;for(;n.parent;)e.unshift(n.startOffset),n=n.parent;return e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const n=[];let t=e.includeSelf?this:this.parent;for(;t;)n[e.parentFirst?"push":"unshift"](t),t=t.parent;return n}getCommonAncestor(e,n={}){const t=this.getAncestors(n),l=e.getAncestors(n);let i=0;for(;t[i]==l[i]&&t[i];)i++;return 0===i?null:t[i-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const n=this.getPath(),t=e.getPath(),l=Mn(n,t);switch(l){case"prefix":return!0;case"extension":return!1;default:return n[l](e[n[0]]=n[1],e),{})),e}is(e){return"node"==e||"model:node"==e}_clone(){return new yi(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,n){this._attrs.set(e,n)}_setAttributesTo(e){this._attrs=_i(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}class bi extends yi{constructor(e,n){super(n),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}is(e){return"text"==e||"model:text"==e||super.is(e)}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new bi(this.data,this.getAttributes())}static fromJSON(e){return new bi(e.data,e.attributes)}}class wi{constructor(e,n,t){if(this.textNode=e,n<0||n>e.offsetSize)throw new an.b("model-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.",this);if(t<0||n+t>e.offsetSize)throw new an.b("model-textproxy-wrong-length: Given length value is incorrect.",this);this.data=e.data.substring(n,n+t),this.offsetInText=n}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}is(e){return"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 n=[];let t=e.includeSelf?this:this.parent;for(;t;)n[e.parentFirst?"push":"unshift"](t),t=t.parent;return n}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 ki{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,n)=>e+n.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const n=this._nodes.indexOf(e);return-1==n?null:n}getNodeStartOffset(e){const n=this.getNodeIndex(e);return null===n?null:this._nodes.slice(0,n).reduce((e,n)=>e+n.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const n=this._nodes[e];if(!n)throw new an.b("model-nodelist-index-out-of-bounds: Given index cannot be found in the node list.",this);return this.getNodeStartOffset(n)}offsetToIndex(e){let n=0;for(const t of this._nodes){if(e>=n&&ee.toJSON())}}class Mi extends yi{constructor(e,n,t){super(n),this.name=e,this._children=new ki,t&&this._insertChild(0,t)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}is(e,n=null){const t=e.replace(/^model:/,"");return n?"element"==t&&n==this.name:"element"==t||t==this.name||super.is(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 n=this;for(const t of e)n=n.getChild(n.offsetToIndex(t));return n}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const n of this._children)e.children.push(n.toJSON())}return e}_clone(e=!1){const n=e?Array.from(this._children).map(e=>e._clone(!0)):null;return new Mi(this.name,this.getAttributes(),n)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,n){const t=function(e){return"string"==typeof e?[new bi(e)]:(Ln(e)||(e=[e]),Array.from(e).map(e=>"string"==typeof e?new bi(e):e instanceof wi?new bi(e.data,e.getAttributes()):e))}(n);for(const l of t)null!==l.parent&&l._remove(),l.parent=this;this._children._insertNodes(e,t)}_removeChildren(e,n=1){const t=this._children._removeNodes(e,n);for(const l of t)l.parent=null;return t}static fromJSON(e){let n=null;if(e.children){n=[];for(const t of e.children)n.push(t.name?Mi.fromJSON(t):bi.fromJSON(t))}return new Mi(e.name,e.attributes,n)}}class Ci{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new an.b("model-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.",null);const n=e.direction||"forward";if("forward"!=n&&"backward"!=n)throw new an.b("model-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",e,{direction:n});this.direction=n,this.boundaries=e.boundaries||null,this.position=e.startPosition?e.startPosition.clone():Di._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 n,t,l,i;do{l=this.position,i=this._visitedParent,({done:n,value:t}=this.next())}while(!n&&e(t));n||(this.position=l,this._visitedParent=i)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,n=this.position.clone(),t=this._visitedParent;if(null===t.parent&&n.offset===t.maxOffset)return{done:!0};if(t===this._boundaryEndParent&&n.offset==this.boundaries.end.offset)return{done:!0};const l=n.textNode?n.textNode:n.nodeAfter;if(l instanceof Mi)return this.shallow?n.offset++:(n.path.push(0),this._visitedParent=l),this.position=n,xi("elementStart",l,e,n,1);if(l instanceof bi){let i;if(this.singleCharacters)i=1;else{let e=l.endOffset;this._boundaryEndParent==t&&this.boundaries.end.offsete&&(e=this.boundaries.start.offset),i=n.offset-e}const o=new wi(l,n.offset-l.startOffset-i,i);return n.offset-=i,this.position=n,xi("text",o,e,n,i)}return n.path.pop(),this.position=n,this._visitedParent=t.parent,xi("elementStart",t,e,n,1)}}function xi(e,n,t,l,i){return{done:!1,value:{type:e,item:n,previousPosition:t,nextPosition:l,length:i}}}class Di{constructor(e,n,t="toNone"){if(!e.is("element")&&!e.is("documentFragment"))throw new an.b("model-position-root-invalid: Position root invalid.",e);if(!(n instanceof Array)||0===n.length)throw new an.b("model-position-path-incorrect-format: Position path must be an array with at least one item.",e,{path:n});n=e.getPath().concat(n),this.root=e=e.root,this.path=n,this.stickiness=t}get offset(){return function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}(this.path)}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let n=0;nt.path.length){if(n.offset!==l.maxOffset)return!1;n.path=n.path.slice(0,-1),l=l.parent,n.offset++}else{if(0!==t.offset)return!1;t.path=t.path.slice(0,-1)}}}is(e){return"position"==e||"model:position"==e}hasSameParentAs(e){return this.root===e.root&&"same"==Mn(this.getParentPath(),e.getParentPath())}getTransformedByOperation(e){let n;switch(e.type){case"insert":n=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":n=this._getTransformedByMoveOperation(e);break;case"split":n=this._getTransformedBySplitOperation(e);break;case"merge":n=this._getTransformedByMergeOperation(e);break;default:n=Di._createAt(this)}return n}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const n=e.movedRange;return n.containsPosition(this)||n.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 n=e.movedRange;let t;return n.containsPosition(this)||n.start.isEqual(this)?(t=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(t=t._getTransformedByDeletion(e.deletionPosition,1))):t=this.isEqual(e.deletionPosition)?Di._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),t}_getTransformedByDeletion(e,n){const t=Di._createAt(this);if(this.root!=e.root)return t;if("same"==Mn(e.getParentPath(),this.getParentPath())){if(e.offsetthis.offset)return null;t.offset-=n}}else if("prefix"==Mn(e.getParentPath(),this.getParentPath())){const l=e.path.length-1;if(e.offset<=this.path[l]){if(e.offset+n>this.path[l])return null;t.path[l]-=n}}return t}_getTransformedByInsertion(e,n){const t=Di._createAt(this);if(this.root!=e.root)return t;if("same"==Mn(e.getParentPath(),this.getParentPath()))(e.offsetn+1;){const n=l.maxOffset-t.offset;0!==n&&e.push(new Si(t,t.getShiftedBy(n))),t.path=t.path.slice(0,-1),t.offset++,l=l.parent}for(;t.path.length<=this.end.path.length;){const n=this.end.path[t.path.length-1],l=n-t.offset;0!==l&&e.push(new Si(t,t.getShiftedBy(l))),t.offset=n,t.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new Ci(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const n=new Ci(e);for(const t of n)yield t.item}*getPositions(e={}){e.boundaries=this;const n=new Ci(e);yield n.position;for(const t of n)yield t.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 Si(this.start,this.end)]}getTransformedByOperations(e){const n=[new Si(this.start,this.end)];for(const t of e)for(let e=0;e0?new this(t,l):new this(l,t)}static _createIn(e){return new this(Di._createAt(e,0),Di._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(Di._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new an.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 n=e[0];e.sort((e,n)=>e.start.isAfter(n.start)?1:-1);const t=e.indexOf(n),l=new this(n.start,n.end);if(t>0)for(let i=t-1;e[i].end.isEqual(l.start);i++)l.start=Di._createAt(e[i].start);for(let i=t+1;i{if(n.viewPosition)return;const t=this._modelToViewMapping.get(n.modelPosition.parent);n.viewPosition=this._findPositionIn(t,n.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,n)=>{if(n.modelPosition)return;const t=this.findMappedViewAncestor(n.viewPosition),l=this._viewToModelMapping.get(t),i=this._toModelOffset(n.viewPosition.parent,n.viewPosition.offset,t);n.modelPosition=Di._createAt(l,i)},{priority:"low"})}bindElements(e,n){this._modelToViewMapping.set(e,n),this._viewToModelMapping.set(n,e)}unbindViewElement(e){const n=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(n)==e&&this._modelToViewMapping.delete(n)}unbindModelElement(e){const n=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(n)==e&&this._viewToModelMapping.delete(n)}bindElementToMarker(e,n){const t=this._markerNameToElements.get(n)||new Set;t.add(e);const l=this._elementToMarkerNames.get(e)||new Set;l.add(n),this._markerNameToElements.set(n,t),this._elementToMarkerNames.set(e,l)}unbindElementFromMarkerName(e,n){const t=this._markerNameToElements.get(n);t&&(t.delete(e),0==t.size&&this._markerNameToElements.delete(n));const l=this._elementToMarkerNames.get(e);l&&(l.delete(n),0==l.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 Si(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new rt(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const n={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",n),n.modelPosition}toViewPosition(e,n={isPhantom:!1}){const t={modelPosition:e,mapper:this,isPhantom:n.isPhantom};return this.fire("modelToViewPosition",t),t.viewPosition}markerNameToElements(e){const n=this._markerNameToElements.get(e);if(!n)return null;const t=new Set;for(const l of n)if(l.is("attributeElement"))for(const e of l.getElementsWithSameId())t.add(e);else t.add(l);return t}registerViewToModelLength(e,n){this._viewToModelLengthCallbacks.set(e,n)}findMappedViewAncestor(e){let n=e.parent;for(;!this._viewToModelMapping.has(n);)n=n.parent;return n}_toModelOffset(e,n,t){if(t!=e)return this._toModelOffset(e.parent,e.index,t)+this._toModelOffset(e,n,e);if(e.is("text"))return n;let l=0;for(let i=0;i1?n[0]+":"+n[1]:n[0]}class Ai{constructor(e){this.conversionApi=Bn({dispatcher:this},e)}convertChanges(e,n,t){for(const l of e.getMarkersToRemove())this.convertMarkerRemove(l.name,l.range,t);for(const l of e.getChanges())"insert"==l.type?this.convertInsert(Si._createFromPositionAndShift(l.position,l.length),t):"remove"==l.type?this.convertRemove(l.position,l.length,l.name,t):this.convertAttribute(l.range,l.attributeKey,l.attributeOldValue,l.attributeNewValue,t);for(const l of this.conversionApi.mapper.flushUnboundMarkerNames()){const e=n.get(l).getRange();this.convertMarkerRemove(l,e,t),this.convertMarkerAdd(l,e,t)}for(const l of e.getMarkersToAdd())this.convertMarkerAdd(l.name,l.range,t)}convertInsert(e,n){this.conversionApi.writer=n,this.conversionApi.consumable=this._createInsertConsumable(e);for(const t of e){const e=t.item,n={item:e,range:Si._createFromPositionAndShift(t.previousPosition,t.length)};this._testAndFire("insert",n);for(const t of e.getAttributeKeys())n.attributeKey=t,n.attributeOldValue=null,n.attributeNewValue=e.getAttribute(t),this._testAndFire("attribute:"+t,n)}this._clearConversionApi()}convertRemove(e,n,t,l){this.conversionApi.writer=l,this.fire("remove:"+t,{position:e,length:n},this.conversionApi),this._clearConversionApi()}convertAttribute(e,n,t,l,i){this.conversionApi.writer=i,this.conversionApi.consumable=this._createConsumableForRange(e,"attribute:"+n);for(const o of e){const e={item:o.item,range:Si._createFromPositionAndShift(o.previousPosition,o.length),attributeKey:n,attributeOldValue:t,attributeNewValue:l};this._testAndFire("attribute:"+n,e)}this._clearConversionApi()}convertSelection(e,n,t){const l=Array.from(n.getMarkersAtPosition(e.getFirstPosition()));if(this.conversionApi.writer=t,this.conversionApi.consumable=this._createSelectionConsumable(e,l),this.fire("selection",{selection:e},this.conversionApi),e.isCollapsed){for(const n of l){const t=n.getRange();if(!Ii(e.getFirstPosition(),n,this.conversionApi.mapper))continue;const l={item:e,markerName:n.name,markerRange:t};this.conversionApi.consumable.test(e,"addMarker:"+n.name)&&this.fire("addMarker:"+n.name,l,this.conversionApi)}for(const n of e.getAttributeKeys()){const t={item:e,range:e.getFirstRange(),attributeKey:n,attributeOldValue:null,attributeNewValue:e.getAttribute(n)};this.conversionApi.consumable.test(e,"attribute:"+t.attributeKey)&&this.fire("attribute:"+t.attributeKey+":$text",t,this.conversionApi)}this._clearConversionApi()}}convertMarkerAdd(e,n,t){if(!n.root.document||"$graveyard"==n.root.rootName)return;this.conversionApi.writer=t;const l="addMarker:"+e,i=new Li;if(i.add(n,l),this.conversionApi.consumable=i,this.fire(l,{markerName:e,markerRange:n},this.conversionApi),i.test(n,l)){this.conversionApi.consumable=this._createConsumableForRange(n,l);for(const t of n.getItems()){if(!this.conversionApi.consumable.test(t,l))continue;const i={item:t,range:Si._createOn(t),markerName:e,markerRange:n};this.fire(l,i,this.conversionApi)}this._clearConversionApi()}}convertMarkerRemove(e,n,t){n.root.document&&"$graveyard"!=n.root.rootName&&(this.conversionApi.writer=t,this.fire("removeMarker:"+e,{markerName:e,markerRange:n},this.conversionApi),this._clearConversionApi())}_createInsertConsumable(e){const n=new Li;for(const t of e){const e=t.item;n.add(e,"insert");for(const t of e.getAttributeKeys())n.add(e,"attribute:"+t)}return n}_createConsumableForRange(e,n){const t=new Li;for(const l of e.getItems())t.add(l,n);return t}_createSelectionConsumable(e,n){const t=new Li;t.add(e,"selection");for(const l of n)t.add(e,"addMarker:"+l.name);for(const l of e.getAttributeKeys())t.add(e,"attribute:"+l);return t}_testAndFire(e,n){this.conversionApi.consumable.test(n.item,e)&&this.fire(e+":"+(n.item.name||"$text"),n,this.conversionApi)}_clearConversionApi(){delete this.conversionApi.writer,delete this.conversionApi.consumable}}function Ii(e,n,t){const l=n.getRange(),i=Array.from(e.getAncestors());return i.shift(),i.reverse(),!i.some(e=>{if(l.containsItem(e))return!!t.toViewElement(e).getCustomProperty("addHighlight")})}kn(Ai,mn);class Ei{constructor(e,n,t){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,e&&this.setTo(e,n,t)}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 n of this._ranges){let t=!1;for(const l of e._ranges)if(n.isEqual(l)){t=!0;break}if(!t)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new Si(e.start,e.end)}getFirstRange(){let e=null;for(const n of this._ranges)e&&!n.start.isBefore(e.start)||(e=n);return e?new Si(e.start,e.end):null}getLastRange(){let e=null;for(const n of this._ranges)e&&!n.end.isAfter(e.end)||(e=n);return e?new Si(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,n,t){if(null===e)this._setRanges([]);else if(e instanceof Ei)this._setRanges(e.getRanges(),e.isBackward);else if(e&&"function"==typeof e.getRanges)this._setRanges(e.getRanges(),e.isBackward);else if(e instanceof Si)this._setRanges([e],!!n&&!!n.backward);else if(e instanceof Di)this._setRanges([new Si(e)]);else if(e instanceof yi){const l=!!t&&!!t.backward;let i;if("in"==n)i=Si._createIn(e);else if("on"==n)i=Si._createOn(e);else{if(void 0===n)throw new an.b("model-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.",[this,e]);i=new Si(Di._createAt(e,n))}this._setRanges([i],l)}else{if(!Ln(e))throw new an.b("model-selection-setTo-not-selectable: Cannot set the selection to the given place.",[this,e]);this._setRanges(e,n&&!!n.backward)}}_setRanges(e,n=!1){const t=(e=Array.from(e)).some(n=>{if(!(n instanceof Si))throw new an.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(n))});if(e.length!==this._ranges.length||t){this._removeAllRanges();for(const n of e)this._pushRange(n);this._lastRangeBackward=!!n,this.fire("change:range",{directChange:!0})}}setFocus(e,n){if(null===this.anchor)throw new an.b("model-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.",[this,e]);const t=Di._createAt(e,n);if("same"==t.compareWith(this.focus))return;const l=this.anchor;this._ranges.length&&this._popRange(),"before"==t.compareWith(l)?(this._pushRange(new Si(t,l)),this._lastRangeBackward=!0):(this._pushRange(new Si(l,t)),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,n){this.getAttribute(e)!==n&&(this._attrs.set(e,n),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){if(1!==this.rangeCount)return null;const e=this.getFirstRange(),n=e.start.nodeAfter;return n instanceof Mi&&n==e.end.nodeBefore?n:null}is(e){return"selection"==e||"model:selection"==e}*getSelectedBlocks(){const e=new WeakSet;for(const n of this.getRanges()){const t=Yi(n.start,e);t&&Fi(t,n)&&(yield t);for(const i of n.getWalker()){const t=i.item;"elementEnd"==i.type&&ji(t,e,n)&&(yield t)}const l=Yi(n.end,e);l&&!n.end.isTouching(Di._createAt(l,0))&&Fi(l,n)&&(yield l)}}containsEntireContent(e=this.anchor.root){const n=Di._createAt(e,0),t=Di._createAt(e,"end");return n.isTouching(this.getFirstPosition())&&t.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new Si(e.start,e.end))}_checkRange(e){for(let n=0;n0;)this._popRange()}_popRange(){this._ranges.pop()}}function Oi(e,n){return!n.has(e)&&(n.add(e),e.document.model.schema.isBlock(e)&&e.parent)}function ji(e,n,t){return Oi(e,n)&&Fi(e,t)}function Yi(e,n){const t=e.parent.document.model.schema,l=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let i=!1;const o=l.find(e=>!i&&!(i=t.isLimit(e))&&Oi(e,n));return l.forEach(e=>n.add(e)),o}function Fi(e,n){const t=function(e){const n=e.document.model.schema;let t=e.parent;for(;t;){if(n.isBlock(t))return t;t=t.parent}}(e);return!t||!n.containsRange(Si._createOn(t),!0)}kn(Ei,mn);class Ni extends Si{constructor(e,n){super(e,n),(function(){this.listenTo(this.root.document.model,"applyOperation",(e,n)=>{const t=n[0];t.isDocumentOperation&&(function(e){const n=this.getTransformedByOperation(e),t=Si._createFromRanges(n),l=!t.isEqual(this),i=function(e,n){switch(n.type){case"insert":return e.containsPosition(n.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(n.sourcePosition)||e.start.isEqual(n.sourcePosition)||e.containsPosition(n.targetPosition);case"split":return e.containsPosition(n.splitPosition)||e.containsPosition(n.insertionPosition)}return!1}(this,e);let o=null;if(l){"$graveyard"==t.root.rootName&&(o="remove"==e.type?e.sourcePosition:e.deletionPosition);const n=this.toRange();this.start=t.start,this.end=t.end,this.fire("change:range",n,{deletionPosition:o})}else i&&this.fire("change:content",this.toRange(),{deletionPosition:o})}).call(this,t)},{priority:"low"})}).call(this)}detach(){this.stopListening()}is(e){return"liveRange"==e||"model:liveRange"==e||super.is(e)}toRange(){return new Si(this.start,this.end)}static fromRange(e){return new Ni(e.start,e.end)}}kn(Ni,mn);const Ri="selection:";class Vi{constructor(e){this._selection=new Hi(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}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,n){this._selection.setFocus(e,n)}_setTo(e,n,t){this._selection.setTo(e,n,t)}_setAttribute(e,n){this._selection.setAttribute(e,n)}_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 Ri+e}static _isStoreAttributeKey(e){return e.startsWith(Ri)}}kn(Vi,mn);class Hi extends Ei{constructor(e){super(),this.markers=new dt({idProperty:"name"}),this._model=e.model,this._document=e,this._attributePriority=new Map,this._fixGraveyardRangesData=[],this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this.listenTo(this._model,"applyOperation",(e,n)=>{const t=n[0];if(t.isDocumentOperation&&"marker"!=t.type&&"rename"!=t.type&&"noop"!=t.type){for(;this._fixGraveyardRangesData.length;){const{liveRange:e,sourcePosition:n}=this._fixGraveyardRangesData.shift();this._fixGraveyardSelection(e,n)}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 an.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,n)=>{!function(e,n){const t=e.document.differ;for(const l of t.getChanges()){if("insert"!=l.type)continue;const t=l.position.parent;l.length===t.maxOffset&&e.enqueueChange(n,e=>{const n=Array.from(t.getAttributeKeys()).filter(e=>e.startsWith(Ri));for(const l of n)e.removeAttribute(l,t)})}}(this._model,n)})}get isCollapsed(){return 0===this._ranges.length?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e{this._hasChangedRange=!0,n.root==this._document.graveyard&&this._fixGraveyardRangesData.push({liveRange:n,sourcePosition:l.deletionPosition})}),n}_updateMarkers(){const e=[];for(const n of this._model.markers){const t=n.getRange();for(const l of this.getRanges())t.containsRange(l,!l.isCollapsed)&&e.push(n)}for(const n of e)this.markers.has(n)||this.markers.add(n);for(const n of Array.from(this.markers))e.includes(n)||this.markers.remove(n)}_updateAttributes(e){const n=_i(this._getSurroundingAttributes()),t=_i(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[i,o]of this._attributePriority)"low"==o&&(this._attrs.delete(i),this._attributePriority.delete(i));this._setAttributesTo(n);const l=[];for(const[i,o]of this.getAttributes())t.has(i)&&t.get(i)===o||l.push(i);for(const[i]of t)this.hasAttribute(i)||l.push(i);l.length>0&&this.fire("change:attribute",{attributeKeys:l,directChange:!1})}_setAttribute(e,n,t=!0){const l=t?"normal":"low";return("low"!=l||"normal"!=this._attributePriority.get(e))&&super.getAttribute(e)!==n&&(this._attrs.set(e,n),this._attributePriority.set(e,l),!0)}_removeAttribute(e,n=!0){const t=n?"normal":"low";return!("low"==t&&"normal"==this._attributePriority.get(e)||(this._attributePriority.set(e,t),!super.hasAttribute(e)||(this._attrs.delete(e),0)))}_setAttributesTo(e){const n=new Set;for(const[t,l]of this.getAttributes())e.get(t)!==l&&this._removeAttribute(t,!1);for(const[t,l]of e)this._setAttribute(t,l,!1)&&n.add(t);return n}*_getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const n of e.getAttributeKeys())n.startsWith(Ri)&&(yield[n.substr(Ri.length),e.getAttribute(n)])}_getSurroundingAttributes(){const e=this.getFirstPosition(),n=this._model.schema;let t=null;if(this.isCollapsed){const n=e.textNode?e.textNode:e.nodeBefore,l=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(t=zi(n)),t||(t=zi(l)),!this.isGravityOverridden&&!t){let e=n;for(;e&&!t;)t=zi(e=e.previousSibling)}if(!t){let e=l;for(;e&&!t;)t=zi(e=e.nextSibling)}t||(t=this._getStoredAttributes())}else{const e=this.getFirstRange();for(const l of e){if(l.item.is("element")&&n.isObject(l.item))break;if("text"==l.type){t=l.item.getAttributes();break}}}return t}_fixGraveyardSelection(e,n){const t=n.clone(),l=this._model.schema.getNearestSelectionRange(t),i=this._ranges.indexOf(e);if(this._ranges.splice(i,1),e.detach(),l){const e=this._prepareRange(l);this._ranges.splice(i,0,e)}}}function zi(e){return e instanceof wi||e instanceof bi?e.getAttributes():null}class Bi{constructor(e){this._dispatchers=e}add(e){for(const n of this._dispatchers)e(n);return this}}var Ui=function(e){return ln(e,5)};class Wi extends Bi{elementToElement(e){return this.add(function(e){return(e=Ui(e)).view=$i(e.view,"container"),n=>{n.on("insert:"+e.model,function(e){return(n,t,l)=>{const i=e(t.item,l.writer);if(!i)return;if(!l.consumable.consume(t.item,"insert"))return;const o=l.mapper.toViewPosition(t.range.start);l.mapper.bindElements(t.item,i),l.writer.insert(o,i)}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}attributeToElement(e){return this.add(function(e){let n="attribute:"+((e=Ui(e)).model.key?e.model.key:e.model);if(e.model.name&&(n+=":"+e.model.name),e.model.values)for(const l of e.model.values)e.view[l]=$i(e.view[l],"attribute");else e.view=$i(e.view,"attribute");const t=Gi(e);return l=>{l.on(n,function(e){return(n,t,l)=>{const i=e(t.attributeOldValue,l.writer),o=e(t.attributeNewValue,l.writer);if(!i&&!o)return;if(!l.consumable.consume(t.item,n.name))return;const r=l.writer;if(t.item instanceof Ei||t.item instanceof Vi)r.wrap(r.document.selection.getFirstRange(),o);else{let e=l.mapper.toViewRange(t.range);null!==t.attributeOldValue&&i&&(e=r.unwrap(e,i)),null!==t.attributeNewValue&&o&&r.wrap(e,o)}}}(t),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){let n="attribute:"+((e=Ui(e)).model.key?e.model.key:e.model);if(e.model.name&&(n+=":"+e.model.name),e.model.values)for(const l of e.model.values)e.view[l]=Ki(e.view[l]);else e.view=Ki(e.view);const t=Gi(e);return l=>{l.on(n,function(e){return(n,t,l)=>{const i=e(t.attributeOldValue,t),o=e(t.attributeNewValue,t);if(!i&&!o)return;if(!l.consumable.consume(t.item,n.name))return;const r=l.mapper.toViewElement(t.item),s=l.writer;if(!r)throw new an.b("conversion-attribute-to-attribute-on-text: Trying to convert text node's attribute with attribute-to-attribute converter.",[t,l]);if(null!==t.attributeOldValue&&i)if("class"==i.key){const e=Array.isArray(i.value)?i.value:[i.value];for(const n of e)s.removeClass(n,r)}else if("style"==i.key){const e=Object.keys(i.value);for(const n of e)s.removeStyle(n,r)}else s.removeAttribute(i.key,r);if(null!==t.attributeNewValue&&o)if("class"==o.key){const e=Array.isArray(o.value)?o.value:[o.value];for(const n of e)s.addClass(n,r)}else if("style"==o.key){const e=Object.keys(o.value);for(const n of e)s.setStyle(n,o.value[n],r)}else s.setAttribute(o.key,o.value,r)}}(t),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){return(e=Ui(e)).view=$i(e.view,"ui"),n=>{n.on("addMarker:"+e.model,function(e){return(n,t,l)=>{t.isOpening=!0;const i=e(t,l.writer);t.isOpening=!1;const o=e(t,l.writer);if(!i||!o)return;const r=t.markerRange;if(r.isCollapsed&&!l.consumable.consume(r,n.name))return;for(const e of r)if(!l.consumable.consume(e.item,n.name))return;const s=l.mapper,u=l.writer;u.insert(s.toViewPosition(r.start),i),l.mapper.bindElementToMarker(i,t.markerName),r.isCollapsed||(u.insert(s.toViewPosition(r.end),o),l.mapper.bindElementToMarker(o,t.markerName)),n.stop()}}(e.view),{priority:e.converterPriority||"normal"}),n.on("removeMarker:"+e.model,(e,n,t)=>{const l=t.mapper.markerNameToElements(n.markerName);if(l){for(const e of l)t.mapper.unbindElementFromMarkerName(e,n.markerName),t.writer.clear(t.writer.createRangeOn(e),e);t.writer.clearClonedElementsGroup(n.markerName),e.stop()}},{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return n=>{n.on("addMarker:"+e.model,function(e){return(n,t,l)=>{if(!t.item)return;if(!(t.item instanceof Ei||t.item instanceof Vi||t.item.is("textProxy")))return;const i=Ji(e,t,l);if(!i)return;if(!l.consumable.consume(t.item,n.name))return;const o=qi(i),r=l.writer,s=r.document.selection;if(t.item instanceof Ei||t.item instanceof Vi)r.wrap(s.getFirstRange(),o,s);else{const e=l.mapper.toViewRange(t.range),n=r.wrap(e,o);for(const i of n.getItems())if(i.is("attributeElement")&&i.isSimilar(o)){l.mapper.bindElementToMarker(i,t.markerName);break}}}}(e.view),{priority:e.converterPriority||"normal"}),n.on("addMarker:"+e.model,function(e){return(n,t,l)=>{if(!t.item)return;if(!(t.item instanceof Mi))return;const i=Ji(e,t,l);if(!i)return;if(!l.consumable.test(t.item,n.name))return;const o=l.mapper.toViewElement(t.item);if(o&&o.getCustomProperty("addHighlight")){l.consumable.consume(t.item,n.name);for(const e of Si._createIn(t.item))l.consumable.consume(e.item,n.name);o.getCustomProperty("addHighlight")(o,i,l.writer),l.mapper.bindElementToMarker(o,t.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),n.on("removeMarker:"+e.model,function(e){return(n,t,l)=>{if(t.markerRange.isCollapsed)return;const i=Ji(e,t,l);if(!i)return;const o=qi(i),r=l.mapper.markerNameToElements(t.markerName);if(r){for(const e of r)l.mapper.unbindElementFromMarkerName(e,t.markerName),e.is("attributeElement")?l.writer.unwrap(l.writer.createRangeOn(e),o):e.getCustomProperty("removeHighlight")(e,i.id,l.writer);l.writer.clearClonedElementsGroup(t.markerName),n.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}}function qi(e){const n=new pt("span",e.attributes);return e.classes&&n._addClass(e.classes),e.priority&&(n._priority=e.priority),n._id=e.id,n}function $i(e,n){return"function"==typeof e?e:(t,l)=>function(e,n,t){let l;"string"==typeof e&&(e={name:e});const i=Object.assign({},e.attributes);if(l="container"==t?n.createContainerElement(e.name,i):"attribute"==t?n.createAttributeElement(e.name,i,{priority:e.priority||pt.DEFAULT_PRIORITY}):n.createUIElement(e.name,i),e.styles){const t=Object.keys(e.styles);for(const i of t)n.setStyle(i,e.styles[i],l)}if(e.classes){const t=e.classes;if("string"==typeof t)n.addClass(t,l);else for(const e of t)n.addClass(e,l)}return l}(e,l,n)}function Gi(e){return e.model.values?(n,t)=>{const l=e.view[n];return l?l(n,t):null}:e.view}function Ki(e){return"string"==typeof e?n=>({key:e,value:n}):"object"==typeof e?e.value?()=>e:n=>({key:e.key,value:n}):e}function Ji(e,n,t){const l="function"==typeof e?e(n,t):e;return l?(l.priority||(l.priority=10),l.id||(l.id=n.markerName),l):null}class Qi extends Bi{elementToElement(e){return this.add(Zi(e))}elementToAttribute(e){return this.add(function(e){eo(e=Ui(e));const n=no(e,!1),t=Xi(e.view),l=t?"element:"+t:"element";return t=>{t.on(l,n,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){let n=null;("string"==typeof(e=Ui(e)).view||e.view.key)&&(n=function(e){"string"==typeof e.view&&(e.view={key:e.view});const n=e.view.key;let t;return t="class"==n||"style"==n?{["class"==n?"classes":"styles"]:e.view.value}:{attributes:{[n]:void 0===e.view.value?/[\s\S]*/:e.view.value}},e.view.name&&(t.name=e.view.name),e.view=t,n}(e)),eo(e,n);const t=no(e,!0);return n=>{n.on("element",t,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(e){return function(e){const n=e.model;e.model=(e,t)=>{const l="string"==typeof n?n:n(e);return t.createElement("$marker",{"data-name":l})}}(e=Ui(e)),Zi(e)}(e))}}function Zi(e){const n=function(e){const n=e.view?new Pn(e.view):null;return(t,l,i)=>{let o={};if(n){const e=n.match(l.viewItem);if(!e)return;o=e.match}o.name=!0;const r=function(e,n,t){return e instanceof Function?e(n,t):t.createElement(e)}(e.model,l.viewItem,i.writer);if(!r)return;if(!i.consumable.test(l.viewItem,o))return;const s=i.splitToAllowedParent(r,l.modelCursor);if(!s)return;i.writer.insert(r,s.position),i.convertChildren(l.viewItem,i.writer.createPositionAt(r,0)),i.consumable.consume(l.viewItem,o);const u=i.getSplitParts(r);l.modelRange=new Si(i.writer.createPositionBefore(r),i.writer.createPositionAfter(u[u.length-1])),l.modelCursor=s.cursorParent?i.writer.createPositionAt(s.cursorParent,0):l.modelRange.end}}(e=Ui(e)),t=Xi(e.view),l=t?"element:"+t:"element";return t=>{t.on(l,n,{priority:e.converterPriority||"normal"})}}function Xi(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function eo(e,n=null){const t=null===n||(e=>e.getAttribute(n));e.model={key:"object"!=typeof e.model?e.model:e.model.key,value:"object"!=typeof e.model||void 0===e.model.value?t:e.model.value}}function no(e,n){const t=new Pn(e.view);return(l,i,o)=>{const r=t.match(i.viewItem);if(!r)return;const s=e.model.key,u="function"==typeof e.model.value?e.model.value(i.viewItem):e.model.value;null!==u&&(function(e,n){const t="function"==typeof e?e(n):e;return!("object"==typeof t&&!Xi(t)||t.classes||t.attributes||t.styles)}(e.view,i.viewItem)?r.match.name=!0:delete r.match.name,o.consumable.test(i.viewItem,r.match)&&(i.modelRange||(i=Object.assign(i,o.convertChildren(i.viewItem,i.modelCursor))),function(e,n,t,l){let i=!1;for(const o of Array.from(e.getItems({shallow:t})))l.schema.checkAttribute(o,n.key)&&(l.writer.setAttribute(n.key,n.value,o),i=!0);return i}(i.modelRange,{key:s,value:u},n,o)&&o.consumable.consume(i.viewItem,r.match)))}}class to{constructor(e){this.model=e,this.view=new vi,this.mapper=new Ti,this.downcastDispatcher=new Ai({mapper:this.mapper});const n=this.model.document,t=n.selection,l=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(n,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(n.differ,l,e),this.downcastDispatcher.convertSelection(t,l,e)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,n){return(t,l)=>{const i=l.newSelection,o=new Ei,r=[];for(const e of i.getRanges())r.push(n.toModelRange(e));o.setTo(r,{backward:i.isBackward}),o.isEqual(e.document.selection)||e.change(e=>{e.setSelection(o)})}}(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",(e,n,t)=>{if(!t.consumable.consume(n.item,"insert"))return;const l=t.writer,i=t.mapper.toViewPosition(n.range.start),o=l.createText(n.item.data);l.insert(i,o)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(e,n,t)=>{const l=t.mapper.toViewPosition(n.position),i=n.position.getShiftedBy(n.length),o=t.mapper.toViewPosition(i,{isPhantom:!0}),r=t.writer.createRange(l,o),s=t.writer.remove(r.getTrimmed());for(const u of t.writer.createRangeIn(s).getItems())t.mapper.unbindViewElement(u)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,n,t)=>{const l=t.writer,i=l.document.selection;for(const o of i.getRanges())o.isCollapsed&&o.end.parent.document&&t.writer.mergeAttributes(o.start);l.setSelection(null)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,n,t)=>{const l=n.selection;if(l.isCollapsed)return;if(!t.consumable.consume(l,"selection"))return;const i=[];for(const o of l.getRanges()){const e=t.mapper.toViewRange(o);i.push(e)}t.writer.setSelection(i,{backward:l.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(e,n,t)=>{const l=n.selection;if(!l.isCollapsed)return;if(!t.consumable.consume(l,"selection"))return;const i=t.writer,o=l.getFirstPosition(),r=t.mapper.toViewPosition(o),s=i.breakAttributes(r);i.setSelection(s)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(e=>{if("$graveyard"==e.rootName)return null;const n=new lt(e.name);return n.rootName=e.rootName,n._document=this.view.document,this.mapper.bindElements(e,n),n})}destroy(){this.view.destroy(),this.stopListening()}}kn(to,Gn);class lo{constructor(e,n=[]){this._editor=e,this._availablePlugins=new Map,this._plugins=new Map;for(const t of n)this._availablePlugins.set(t,t),t.pluginName&&this._availablePlugins.set(t.pluginName,t)}*[Symbol.iterator](){for(const e of this._plugins)"function"==typeof e[0]&&(yield e)}get(e){const n=this._plugins.get(e);if(!n){let n=e;throw"function"==typeof e&&(n=e.pluginName||e.name),new an.b("plugincollection-plugin-not-loaded: The requested plugin is not loaded.",this._editor,{plugin:n})}return n}has(e){return this._plugins.has(e)}init(e,n=[]){const t=this,l=this._editor,i=new Set,o=[],r=d(e),s=d(n),u=function(e){const n=[];for(const t of e)c(t)||n.push(t);return n.length?n:null}(e);if(u){const e="plugincollection-plugin-not-found: Some plugins are not available and could not be loaded.";return console.error(Object(an.a)(e),{plugins:u}),Promise.reject(new an.b(e,this._editor,{plugins:u}))}return Promise.all(r.map((function e(r){if(!s.includes(r)&&!t._plugins.has(r)&&!i.has(r))return function(r){return new Promise(s=>{i.add(r),r.requires&&r.requires.forEach(t=>{const i=c(t);if(n.includes(i))throw new an.b("plugincollection-required: Cannot load a plugin because one of its dependencies is listed inthe `removePlugins` option.",l,{plugin:i,requiredBy:r});e(i)});const u=new r(l);t._add(r,u),o.push(u),s()})}(r).catch(e=>{throw console.error(Object(an.a)("plugincollection-load: It was not possible to load the plugin."),{plugin:r}),e})}))).then(()=>a(o,"init")).then(()=>a(o,"afterInit")).then(()=>o);function a(e,n){return e.reduce((e,t)=>t[n]?e.then(t[n].bind(t)):e,Promise.resolve())}function c(e){return"function"==typeof e?e:t._availablePlugins.get(e)}function d(e){return e.map(e=>c(e)).filter(e=>!!e)}}destroy(){const e=Array.from(this).map(([,e])=>e).filter(e=>"function"==typeof e.destroy).map(e=>e.destroy());return Promise.all(e)}_add(e,n){this._plugins.set(e,n);const t=e.pluginName;if(t){if(this._plugins.has(t))throw new an.b("plugincollection-plugin-name-conflict: Two plugins with the same name were loaded.",null,{pluginName:t,plugin1:this._plugins.get(t).constructor,plugin2:e});this._plugins.set(t,n)}}}kn(lo,mn);class io{constructor(){this._commands=new Map}add(e,n){this._commands.set(e,n)}get(e){return this._commands.get(e)}execute(e,...n){const t=this.get(e);if(!t)throw new an.b("commandcollection-command-not-found: Command does not exist.",this,{commandName:e});t.execute(...n)}*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()}}window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});const oo=["ar","fa","he","ku","ug"];class ro{constructor(e={}){this.uiLanguage=e.uiLanguage||"en",this.contentLanguage=e.contentLanguage||this.uiLanguage,this.uiLanguageDirection=so(this.uiLanguage),this.contentLanguageDirection=so(this.contentLanguage),this.t=(...e)=>this._t(...e)}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,n){let t=function(e,n){const t=Object.keys(window.CKEDITOR_TRANSLATIONS).length;return 1===t&&(e=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]),0!==t&&function(e,n){return e in window.CKEDITOR_TRANSLATIONS&&n in window.CKEDITOR_TRANSLATIONS[e]}(e,n)?window.CKEDITOR_TRANSLATIONS[e][n].replace(/ \[context: [^\]]+\]$/,""):n.replace(/ \[context: [^\]]+\]$/,"")}(this.uiLanguage,e);return n&&(t=t.replace(/%(\d+)/g,(e,t)=>t{n[0]=new ho(n[0])},{priority:"highest"}),this.on("checkChild",(e,n)=>{n[0]=new ho(n[0]),n[1]=this.getDefinition(n[1])},{priority:"highest"})}register(e,n){if(this._sourceDefinitions[e])throw new an.b("schema-cannot-register-item-twice: A single item cannot be registered twice in the schema.",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},n)],this._clearCache()}extend(e,n){if(!this._sourceDefinitions[e])throw new an.b("schema-cannot-extend-missing-item: Cannot extend an item which was not registered yet.",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},n)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let n;return n="string"==typeof e?e:e.is&&(e.is("text")||e.is("textProxy"))?"$text":e.name,this.getDefinitions()[n]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const n=this.getDefinition(e);return!(!n||!n.isBlock)}isLimit(e){const n=this.getDefinition(e);return!(!n||!n.isLimit&&!n.isObject)}isObject(e){const n=this.getDefinition(e);return!(!n||!n.isObject)}isInline(e){const n=this.getDefinition(e);return!(!n||!n.isInline)}checkChild(e,n){return!!n&&this._checkContextMatch(n,e)}checkAttribute(e,n){const t=this.getDefinition(e.last);return!!t&&t.allowAttributes.includes(n)}checkMerge(e,n=null){if(e instanceof Di){const n=e.nodeBefore,t=e.nodeAfter;if(!(n instanceof Mi))throw new an.b("schema-check-merge-no-element-before: The node before the merge position must be an element.",this);if(!(t instanceof Mi))throw new an.b("schema-check-merge-no-element-after: The node after the merge position must be an element.",this);return this.checkMerge(n,t)}for(const t of n.getChildren())if(!this.checkChild(e,t))return!1;return!0}addChildCheck(e){this.on("checkChild",(n,[t,l])=>{if(!l)return;const i=e(t,l);"boolean"==typeof i&&(n.stop(),n.return=i)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(n,[t,l])=>{const i=e(t,l);"boolean"==typeof i&&(n.stop(),n.return=i)},{priority:"high"})}setAttributeProperties(e,n){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),n)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let n;for(n=e instanceof Di?e.parent:(e instanceof Si?[e]:Array.from(e.getRanges())).reduce((e,n)=>{const t=n.getCommonAncestor();return e?e.getCommonAncestor(t,{includeSelf:!0}):t},null);!this.isLimit(n)&&n.parent;)n=n.parent;return n}checkAttributeInSelection(e,n){if(e.isCollapsed){const t=[...e.getFirstPosition().getAncestors(),new bi("",e.getAttributes())];return this.checkAttribute(t,n)}{const t=e.getRanges();for(const e of t)for(const t of e)if(this.checkAttribute(t.item,n))return!0}return!1}*getValidRanges(e,n){e=function*(e){for(const n of e)yield*n.getMinimalFlatRanges()}(e);for(const t of e)yield*this._getValidRangesForRange(t,n)}getNearestSelectionRange(e,n="both"){if(this.checkChild(e,"$text"))return new Si(e);let t,l;"both"!=n&&"backward"!=n||(t=new Ci({startPosition:e,direction:"backward"})),"both"!=n&&"forward"!=n||(l=new Ci({startPosition:e}));for(const i of function*(e,n){let t=!1;for(;!t;){if(t=!0,e){const n=e.next();n.done||(t=!1,yield{walker:e,value:n.value})}if(n){const e=n.next();e.done||(t=!1,yield{walker:n,value:e.value})}}}(t,l)){const e=i.value;if(e.type==(i.walker==t?"elementEnd":"elementStart")&&this.isObject(e.item))return Si._createOn(e.item);if(this.checkChild(e.nextPosition,"$text"))return new Si(e.nextPosition)}return null}findAllowedParent(e,n){let t=e.parent;for(;t;){if(this.checkChild(t,n))return t;if(this.isLimit(t))return null;t=t.parent}return null}removeDisallowedAttributes(e,n){for(const t of e)if(t.is("text"))Mo(this,t,n);else{const e=Si._createIn(t).getPositions();for(const t of e)Mo(this,t.nodeBefore||t.parent,n)}}createContext(e){return new ho(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},n=this._sourceDefinitions,t=Object.keys(n);for(const l of t)e[l]=po(n[l],l);for(const l of t)fo(e,l);for(const l of t)mo(e,l);for(const l of t)go(e,l),vo(e,l);for(const l of t)_o(e,l),yo(e,l);this._compiledDefinitions=e}_checkContextMatch(e,n,t=n.length-1){const l=n.getItem(t);if(e.allowIn.includes(l.name)){if(0==t)return!0;{const e=this.getDefinition(l);return this._checkContextMatch(e,n,t-1)}}return!1}*_getValidRangesForRange(e,n){let t=e.start,l=e.start;for(const i of e.getItems({shallow:!0}))i.is("element")&&(yield*this._getValidRangesForRange(Si._createIn(i),n)),this.checkAttribute(i,n)||(t.isEqual(l)||(yield new Si(t,l)),t=Di._createAfter(i)),l=Di._createAfter(i);t.isEqual(l)||(yield new Si(t,l))}}kn(co,Gn);class ho{constructor(e){if(e instanceof ho)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(ko)}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 n=new ho([e]);return n._items=[...this._items,...n._items],n}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}}function po(e,n){const t={name:n,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],inheritTypesFrom:[]};return function(e,n){for(const t of e){const e=Object.keys(t).filter(e=>e.startsWith("is"));for(const l of e)n[l]=t[l]}}(e,t),bo(e,t,"allowIn"),bo(e,t,"allowContentOf"),bo(e,t,"allowWhere"),bo(e,t,"allowAttributes"),bo(e,t,"allowAttributesOf"),bo(e,t,"inheritTypesFrom"),function(e,n){for(const t of e){const e=t.inheritAllFrom;e&&(n.allowContentOf.push(e),n.allowWhere.push(e),n.allowAttributesOf.push(e),n.inheritTypesFrom.push(e))}}(e,t),t}function fo(e,n){for(const t of e[n].allowContentOf)e[t]&&wo(e,t).forEach(e=>{e.allowIn.push(n)});delete e[n].allowContentOf}function mo(e,n){for(const t of e[n].allowWhere){const l=e[t];l&&e[n].allowIn.push(...l.allowIn)}delete e[n].allowWhere}function go(e,n){for(const t of e[n].allowAttributesOf){const l=e[t];l&&e[n].allowAttributes.push(...l.allowAttributes)}delete e[n].allowAttributesOf}function vo(e,n){const t=e[n];for(const l of t.inheritTypesFrom){const n=e[l];if(n){const e=Object.keys(n).filter(e=>e.startsWith("is"));for(const l of e)l in t||(t[l]=n[l])}}delete t.inheritTypesFrom}function _o(e,n){const t=e[n],l=t.allowIn.filter(n=>e[n]);t.allowIn=Array.from(new Set(l))}function yo(e,n){const t=e[n];t.allowAttributes=Array.from(new Set(t.allowAttributes))}function bo(e,n,t){for(const l of e)"string"==typeof l[t]?n[t].push(l[t]):Array.isArray(l[t])&&n[t].push(...l[t])}function wo(e,n){const t=e[n];return function(e){return Object.keys(e).map(n=>e[n])}(e).filter(e=>e.allowIn.includes(t.name))}function ko(e){return"string"==typeof e?{name:e,*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:n=>e.getAttribute(n)}}function Mo(e,n,t){for(const l of n.getAttributeKeys())e.checkAttribute(n,l)||t.removeAttribute(l,n)}class Co{constructor(e={}){this._splitParts=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.splitToAllowedParent=this._splitToAllowedParent.bind(this),this.conversionApi.getSplitParts=this._getSplitParts.bind(this)}convert(e,n,t=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,n){let t;for(const l of new ho(e)){const e={};for(const n of l.getAttributeKeys())e[n]=l.getAttribute(n);const i=n.createElement(l.name,e);t&&n.append(i,t),t=Di._createAt(i,0)}return t}(t,n),this.conversionApi.writer=n,this.conversionApi.consumable=uo.createFrom(e),this.conversionApi.store={};const{modelRange:l}=this._convertItem(e,this._modelCursor),i=n.createDocumentFragment();if(l){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))n.append(e,i);i.markers=function(e,n){const t=new Set,l=new Map,i=Si._createIn(e).getItems();for(const o of i)"$marker"==o.name&&t.add(o);for(const o of t){const e=o.getAttribute("data-name"),t=n.createPositionBefore(o);l.has(e)?l.get(e).end=t.clone():l.set(e,new Si(t.clone())),n.remove(o)}return l}(i,n)}return this._modelCursor=null,this._splitParts.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,i}_convertItem(e,n){const t=Object.assign({viewItem:e,modelCursor:n,modelRange:null});if(e.is("element")?this.fire("element:"+e.name,t,this.conversionApi):e.is("text")?this.fire("text",t,this.conversionApi):this.fire("documentFragment",t,this.conversionApi),t.modelRange&&!(t.modelRange instanceof Si))throw new an.b("view-conversion-dispatcher-incorrect-result: Incorrect conversion result was dropped.",this);return{modelRange:t.modelRange,modelCursor:t.modelCursor}}_convertChildren(e,n){const t=new Si(n);let l=n;for(const i of Array.from(e.getChildren())){const e=this._convertItem(i,l);e.modelRange instanceof Si&&(t.end=e.modelRange.end,l=e.modelCursor)}return{modelRange:t,modelCursor:l}}_splitToAllowedParent(e,n){const t=this.conversionApi.schema.findAllowedParent(n,e);if(!t)return null;if(t===n.parent)return{position:n};if(this._modelCursor.parent.getAncestors().includes(t))return null;const l=this.conversionApi.writer.split(n,t),i=[];for(const o of l.range.getWalker())if("elementEnd"==o.type)i.push(o.item);else{const e=i.pop();this._registerSplitPair(e,o.item)}return{position:l.position,cursorParent:l.range.end.parent}}_registerSplitPair(e,n){this._splitParts.has(e)||this._splitParts.set(e,[e]);const t=this._splitParts.get(e);this._splitParts.set(n,t),t.push(n)}_getSplitParts(e){return this._splitParts.has(e)?this._splitParts.get(e):[e]}_removeEmptyElements(){let e=!1;for(const n of this._splitParts.keys())n.isEmpty&&(this.conversionApi.writer.remove(n),this._splitParts.delete(n),e=!0);e&&this._removeEmptyElements()}}kn(Co,mn);class xo{constructor(e,n){this.model=e,this.processor=n,this.mapper=new Ti,this.downcastDispatcher=new Ai({mapper:this.mapper}),this.downcastDispatcher.on("insert:$text",(e,n,t)=>{if(!t.consumable.consume(n.item,"insert"))return;const l=t.writer,i=t.mapper.toViewPosition(n.range.start),o=l.createText(n.item.data);l.insert(i,o)},{priority:"lowest"}),this.upcastDispatcher=new Co({schema:e.schema}),this.upcastDispatcher.on("text",(e,n,t)=>{if(t.schema.checkChild(n.modelCursor,"$text")&&t.consumable.consume(n.viewItem)){const e=t.writer.createText(n.viewItem.data);t.writer.insert(e,n.modelCursor),n.modelRange=Si._createFromPositionAndShift(n.modelCursor,e.offsetSize),n.modelCursor=n.modelRange.end}},{priority:"lowest"}),this.upcastDispatcher.on("element",(e,n,t)=>{if(!n.modelRange&&t.consumable.consume(n.viewItem,{name:!0})){const{modelRange:e,modelCursor:l}=t.convertChildren(n.viewItem,n.modelCursor);n.modelRange=e,n.modelCursor=l}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,n,t)=>{if(!n.modelRange&&t.consumable.consume(n.viewItem,{name:!0})){const{modelRange:e,modelCursor:l}=t.convertChildren(n.viewItem,n.modelCursor);n.modelRange=e,n.modelCursor=l}},{priority:"lowest"}),this.decorate("init"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"})}get(e){const{rootName:n="main",trim:t="empty"}=e||{};if(!this._checkIfRootsExists([n]))throw new an.b("datacontroller-get-non-existent-root: Attempting to get data from a non-existing root.",this);const l=this.model.document.getRoot(n);return"empty"!==t||this.model.hasContent(l,{ignoreWhitespaces:!0})?this.stringify(l):""}stringify(e){const n=this.toView(e);return this.processor.toData(n)}toView(e){this.mapper.clearBindings();const n=Si._createIn(e),t=new It,l=new Et(new ht);if(this.mapper.bindElements(e,t),this.downcastDispatcher.convertInsert(n,l),!e.is("documentFragment")){const n=function(e){const n=[],t=e.root.document;if(!t)return[];const l=Si._createIn(e);for(const i of t.model.markers){const e=l.getIntersection(i.getRange());e&&n.push([i.name,e])}return n}(e);for(const[e,t]of n)this.downcastDispatcher.convertMarkerAdd(e,t,l)}return t}init(e){if(this.model.document.version)throw new an.b("datacontroller-init-document-not-empty: Trying to set initial data to not empty document.",this);let n={};if("string"==typeof e?n.main=e:n=e,!this._checkIfRootsExists(Object.keys(n)))throw new an.b("datacontroller-init-non-existent-root: Attempting to init data on a non-existing root.",this);return this.model.enqueueChange("transparent",e=>{for(const t of Object.keys(n)){const l=this.model.document.getRoot(t);e.insert(this.parse(n[t],l),l,0)}}),Promise.resolve()}set(e){let n={};if("string"==typeof e?n.main=e:n=e,!this._checkIfRootsExists(Object.keys(n)))throw new an.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 t of Object.keys(n)){const l=this.model.document.getRoot(t);e.remove(e.createRangeIn(l)),e.insert(this.parse(n[t],l),l,0)}})}parse(e,n="$root"){const t=this.processor.toView(e);return this.toModel(t,n)}toModel(e,n="$root"){return this.model.change(t=>this.upcastDispatcher.convert(e,t,n))}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const n of e)if(!this.model.document.getRootNames().includes(n))return!1;return!0}}kn(xo,Gn);class Do{constructor(e,n){this._helpers=new Map,this._downcast=Array.isArray(e)?e:[e],this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Array.isArray(n)?n:[n],this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,n){const t=this._downcast.includes(n);if(!this._upcast.includes(n)&&!t)throw new an.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:[n],isDowncast:t})}for(e){if(!this._helpers.has(e))throw new an.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:n,view:t}of So(e))this.for("upcast").elementToElement({model:n,view:t,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:n,view:t}of So(e))this.for("upcast").elementToAttribute({view:t,model:n,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:n,view:t}of So(e))this.for("upcast").attributeToAttribute({view:t,model:n})}_createConversionHelpers({name:e,dispatchers:n,isDowncast:t}){if(this._helpers.has(e))throw new an.b("conversion-group-exists: Trying to register a group name that has already been registered.",this);const l=t?new Wi(n):new Qi(n);this._helpers.set(e,l)}}function*So(e){if(e.model.values)for(const n of e.model.values)yield*To({key:e.model.key,value:n},e.view[n],e.upcastAlso?e.upcastAlso[n]:void 0);else yield*To(e.model,e.view,e.upcastAlso)}function*To(e,n,t){if(yield{model:e,view:n},t){t=Array.isArray(t)?t:[t];for(const n of t)yield{model:e,view:n}}}class Lo{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 Po{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 Ao{constructor(e){this.markers=new Map,this._children=new ki,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 n=this;for(const t of e)n=n.getChild(n.offsetToIndex(t));return n}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const n of this._children)e.push(n.toJSON());return e}static fromJSON(e){const n=[];for(const t of e)n.push(t.name?Mi.fromJSON(t):bi.fromJSON(t));return new Ao(n)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,n){const t=function(e){return"string"==typeof e?[new bi(e)]:(Ln(e)||(e=[e]),Array.from(e).map(e=>"string"==typeof e?new bi(e):e instanceof wi?new bi(e.data,e.getAttributes()):e))}(n);for(const l of t)null!==l.parent&&l._remove(),l.parent=this;this._children._insertNodes(e,t)}_removeChildren(e,n=1){const t=this._children._removeNodes(e,n);for(const l of t)l.parent=null;return t}}function Io(e,n){const t=(n=jo(n)).reduce((e,n)=>e+n.offsetSize,0),l=e.parent;Fo(e);const i=e.index;return l._insertChild(i,n),Yo(l,i+n.length),Yo(l,i),new Si(e,e.getShiftedBy(t))}function Eo(e){if(!e.isFlat)throw new an.b("operation-utils-remove-range-not-flat: Trying to remove a range which starts and ends in different element.",this);const n=e.start.parent;Fo(e.start),Fo(e.end);const t=n._removeChildren(e.start.index,e.end.index-e.start.index);return Yo(n,e.start.index),t}function Oo(e,n){if(!e.isFlat)throw new an.b("operation-utils-move-range-not-flat: Trying to move a range which starts and ends in different element.",this);const t=Eo(e);return Io(n=n._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),t)}function jo(e){const n=[];e instanceof Array||(e=[e]);for(let t=0;te.maxOffset)throw new an.b("move-operation-nodes-do-not-exist: The nodes which should be moved do not exist.",this);if(e===n&&t=t&&this.targetPosition.path[e]e._clone(!0))),n=new Bo(this.position,e,this.baseVersion);return n.shouldReceiveAttributes=this.shouldReceiveAttributes,n}getReversed(){const e=new Di(this.position.root.document.graveyard,[0]);return new zo(this.position,this.nodes.maxOffset,e,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffsete._clone(!0))),Io(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,n){const t=[];for(const i of e.nodes)t.push(i.name?Mi.fromJSON(i):bi.fromJSON(i));const l=new Bo(Di.fromJSON(e.position,n),t,e.baseVersion);return l.shouldReceiveAttributes=e.shouldReceiveAttributes,l}}class Uo extends Po{constructor(e,n,t,l,i,o){super(o),this.name=e,this.oldRange=n?n.clone():null,this.newRange=t?t.clone():null,this.affectsData=i,this._markers=l}get type(){return"marker"}clone(){return new Uo(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Uo(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this._markers[this.newRange?"_set":"_remove"](this.name,this.newRange,!0,this.affectsData)}toJSON(){const 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,n){return new Uo(e.name,e.oldRange?Si.fromJSON(e.oldRange,n):null,e.newRange?Si.fromJSON(e.newRange,n):null,n.model.markers,e.affectsData,e.baseVersion)}}class Wo extends Po{constructor(e,n,t,l){super(l),this.position=e,this.position.stickiness="toNext",this.oldName=n,this.newName=t}get type(){return"rename"}clone(){return new Wo(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Wo(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof Mi))throw new an.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 an.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,n){return new Wo(Di.fromJSON(e.position,n),e.oldName,e.newName,e.baseVersion)}}class qo extends Po{constructor(e,n,t,l,i){super(i),this.root=e,this.key=n,this.oldValue=t,this.newValue=l}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new qo(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new qo(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new an.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 an.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 an.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,n){if(!n.getRoot(e.root))throw new an.b("rootattribute-operation-fromjson-no-root: Cannot create RootAttributeOperation. Root with specified name does not exist.",this,{rootName:e.root});return new qo(n.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class $o extends Po{constructor(e,n,t,l,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=n,this.targetPosition=t.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=l.clone()}get type(){return"merge"}get deletionPosition(){return new Di(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Si(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),n=this.sourcePosition.path.slice(0,-1),t=new Di(this.sourcePosition.root,n)._getTransformedByMergeOperation(this),l=new Go(e,this.howMany,this.graveyardPosition,this.baseVersion+1);return l.insertionPosition=t,l}_validate(){const e=this.sourcePosition.parent,n=this.targetPosition.parent;if(!e.parent)throw new an.b("merge-operation-source-position-invalid: Merge source position is invalid.",this);if(!n.parent)throw new an.b("merge-operation-target-position-invalid: Merge target position is invalid.",this);if(this.howMany!=e.maxOffset)throw new an.b("merge-operation-how-many-invalid: Merge operation specifies wrong number of nodes to move.",this)}_execute(){const e=this.sourcePosition.parent;Oo(Si._createIn(e),this.targetPosition),Oo(Si._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,n){const t=Di.fromJSON(e.sourcePosition,n),l=Di.fromJSON(e.targetPosition,n),i=Di.fromJSON(e.graveyardPosition,n);return new this(t,e.howMany,l,i,e.baseVersion)}}class Go extends Po{constructor(e,n,t,l){super(l),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=n,this.insertionPosition=Go.getInsertionPosition(e),this.insertionPosition.stickiness="toNone",this.graveyardPosition=t?t.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 Di(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Si(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=new Di(this.splitPosition.root.document.graveyard,[0]);return new $o(this.moveTargetPosition,this.howMany,this.splitPosition,e,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent;if(!e||e.maxOffset{for(const n of e.getAttributeKeys())this.removeAttribute(n,e)};if(e instanceof Si)for(const t of e.getItems())n(t);else n(e)}move(e,n,t){if(this._assertWriterUsedCorrectly(),!(e instanceof Si))throw new an.b("writer-move-invalid-range: Invalid range to move.",this);if(!e.isFlat)throw new an.b("writer-move-range-not-flat: Range to move is not flat.",this);const l=Di._createAt(n,t);if(l.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!nr(e.root,l.root))throw new an.b("writer-move-different-document: Range is going to be moved between different documents.",this);const i=new zo(e.start,e.end.offset-e.start.offset,l,e.root.document?e.root.document.version:null);this.batch.addOperation(i),this.model.applyOperation(i)}remove(e){this._assertWriterUsedCorrectly();const n=(e instanceof Si?e:Si._createOn(e)).getMinimalFlatRanges().reverse();for(const t of n)this._addOperationForAffectedMarkers("move",t),er(t.start,t.end.offset-t.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const n=e.nodeBefore,t=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(n instanceof Mi))throw new an.b("writer-merge-no-element-before: Node before merge position must be an element.",this);if(!(t instanceof Mi))throw new an.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,n,t){return this.model.createPositionFromPath(e,n,t)}createPositionAt(e,n){return this.model.createPositionAt(e,n)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,n){return this.model.createRange(e,n)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(e,n,t){return this.model.createSelection(e,n,t)}_mergeDetached(e){const n=e.nodeBefore,t=e.nodeAfter;this.move(Si._createIn(t),Di._createAt(n,"end")),this.remove(t)}_merge(e){const n=Di._createAt(e.nodeBefore,"end"),t=Di._createAt(e.nodeAfter,0),l=new Di(e.root.document.graveyard,[0]),i=new $o(t,e.nodeAfter.maxOffset,n,l,e.root.document.version);this.batch.addOperation(i),this.model.applyOperation(i)}rename(e,n){if(this._assertWriterUsedCorrectly(),!(e instanceof Mi))throw new an.b("writer-rename-not-element-instance: Trying to rename an object which is not an instance of Element.",this);const t=e.root.document?e.root.document.version:null,l=new Wo(Di._createBefore(e),e.name,n,t);this.batch.addOperation(l),this.model.applyOperation(l)}split(e,n){this._assertWriterUsedCorrectly();let t,l,i=e.parent;if(!i.parent)throw new an.b("writer-split-element-no-parent: Element with no parent can not be split.",this);if(n||(n=i.parent),!e.parent.getAncestors({includeSelf:!0}).includes(n))throw new an.b("writer-split-invalid-limit-element: Limit element is not a position ancestor.",this);do{const n=new Go(e,i.maxOffset-e.offset,null,i.root.document?i.root.document.version:null);this.batch.addOperation(n),this.model.applyOperation(n),t||l||(t=i,l=e.parent.nextSibling),i=(e=this.createPositionAfter(e.parent)).parent}while(i!==n);return{position:e,range:new Si(Di._createAt(t,"end"),Di._createAt(l,0))}}wrap(e,n){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new an.b("writer-wrap-range-not-flat: Range to wrap is not flat.",this);const t=n instanceof Mi?n:new Mi(n);if(t.childCount>0)throw new an.b("writer-wrap-element-not-empty: Element to wrap with is not empty.",this);if(null!==t.parent)throw new an.b("writer-wrap-element-attached: Element to wrap with is already attached to tree model.",this);this.insert(t,e.start);const l=new Si(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(l,Di._createAt(t,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new an.b("writer-unwrap-element-no-parent: Trying to unwrap an element which has no parent.",this);this.move(Si._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,n){if(this._assertWriterUsedCorrectly(),!n||"boolean"!=typeof n.usingOperation)throw new an.b("writer-addMarker-no-usingOperation: The options.usingOperation parameter is required when adding a new marker.",this);const t=n.usingOperation,l=n.range,i=void 0!==n.affectsData&&n.affectsData;if(this.model.markers.has(e))throw new an.b("writer-addMarker-marker-exists: Marker with provided name already exists.",this);if(!l)throw new an.b("writer-addMarker-no-range: Range parameter is required when adding a new marker.",this);return t?(Xo(this,e,null,l,i),this.model.markers.get(e)):this.model.markers._set(e,l,t,i)}updateMarker(e,n){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name,l=this.model.markers.get(t);if(!l)throw new an.b("writer-updateMarker-marker-not-exists: Marker with provided name does not exists.",this);if(!n)return void this.model.markers._refresh(l);const i="boolean"==typeof n.usingOperation,o="boolean"==typeof n.affectsData,r=o?n.affectsData:l.affectsData;if(!i&&!n.range&&!o)throw new an.b("writer-updateMarker-wrong-options: One of the options is required - provide range, usingOperations or affectsData.",this);const s=l.getRange(),u=n.range?n.range:s;i&&n.usingOperation!==l.managedUsingOperations?n.usingOperation?Xo(this,t,null,u,r):(Xo(this,t,s,null,r),this.model.markers._set(t,u,void 0,r)):l.managedUsingOperations?Xo(this,t,s,u,r):this.model.markers._set(t,u,void 0,r)}removeMarker(e){this._assertWriterUsedCorrectly();const n="string"==typeof e?e:e.name;if(!this.model.markers.has(n))throw new an.b("writer-removeMarker-no-marker: Trying to remove marker which does not exist.",this);const t=this.model.markers.get(n);t.managedUsingOperations?Xo(this,n,t.getRange(),null,t.affectsData):this.model.markers._remove(n)}setSelection(e,n,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(e,n,t)}setSelectionFocus(e,n){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,n)}setSelectionAttribute(e,n){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._setSelectionAttribute(e,n);else for(const[t,l]of _i(e))this._setSelectionAttribute(t,l)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._removeSelectionAttribute(e);else for(const n of e)this._removeSelectionAttribute(n)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,n){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const l=Vi._getStoreAttributeKey(e);this.setAttribute(l,n,t.anchor.parent)}t._setAttribute(e,n)}_removeSelectionAttribute(e){const n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const t=Vi._getStoreAttributeKey(e);this.removeAttribute(t,n.anchor.parent)}n._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new an.b("writer-incorrect-use: Trying to use a writer outside the change() block.",this)}_addOperationForAffectedMarkers(e,n){for(const t of this.model.markers){if(!t.managedUsingOperations)continue;const l=t.getRange();let i=!1;if("move"==e)i=n.containsPosition(l.start)||n.start.isEqual(l.start)||n.containsPosition(l.end)||n.end.isEqual(l.end);else{const e=n.nodeAfter,t=l.end.parent==e&&0==l.end.offset,o=l.end.nodeAfter==e,r=l.start.nodeAfter==e;i=l.start.parent==n.nodeBefore&&l.start.isAtEnd||t||o||r}i&&this.updateMarker(t.name,{range:l})}}}function Qo(e,n,t,l){const i=e.model,o=i.document;let r,s,u,a=l.start;for(const d of l.getWalker({shallow:!0}))u=d.item.getAttribute(n),r&&s!=u&&(s!=t&&c(),a=r),r=d.nextPosition,s=u;function c(){const l=new Si(a,r),u=new Vo(l,n,s,t,l.root.document?o.version:null);e.batch.addOperation(u),i.applyOperation(u)}r instanceof Di&&r!=a&&s!=t&&c()}function Zo(e,n,t,l){const i=e.model,o=i.document,r=l.getAttribute(n);let s,u;if(r!=t){if(l.root===l)u=new qo(l,n,r,t,l.document?o.version:null);else{const i=(s=new Si(Di._createBefore(l),e.createPositionAfter(l))).root.document?o.version:null;u=new Vo(s,n,r,t,i)}e.batch.addOperation(u),i.applyOperation(u)}}function Xo(e,n,t,l,i){const o=e.model,r=new Uo(n,t,l,o.markers,i,o.document.version);e.batch.addOperation(r),o.applyOperation(r)}function er(e,n,t,l){let i;if(e.root.document){const t=l.document,o=new Di(t.graveyard,[0]);i=new zo(e,n,o,t.version)}else i=new Ho(e,n);t.addOperation(i),l.applyOperation(i)}function nr(e,n){return e===n||e instanceof Ko&&n instanceof Ko}class tr{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 n=Si._createOn(e);for(const t of this._markerCollection.getMarkersIntersectingRange(n)){const e=t.getRange();this.bufferMarkerChange(t.name,e,e,t.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 n of e.range.getItems({shallow:!0}))this._isInInsertedElement(n.parent)||this._markAttribute(n);break;case"remove":case"move":case"reinsert":{if(e.sourcePosition.isEqual(e.targetPosition)||e.sourcePosition.getShiftedBy(e.howMany).isEqual(e.targetPosition))return;const n=this._isInInsertedElement(e.sourcePosition.parent),t=this._isInInsertedElement(e.targetPosition.parent);n||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),t||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 n=Si._createFromPositionAndShift(e.position,1);for(const e of this._markerCollection.getMarkersIntersectingRange(n)){const n=e.getRange();this.bufferMarkerChange(e.name,n,n,e.affectsData)}break}case"split":{const n=e.splitPosition.parent;this._isInInsertedElement(n)||this._markRemove(n,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 n=e.sourcePosition.parent;this._isInInsertedElement(n.parent)||this._markRemove(n.parent,n.startOffset,1),this._markInsert(e.graveyardPosition.parent,e.graveyardPosition.offset,1);const t=e.targetPosition.parent;this._isInInsertedElement(t)||this._markInsert(t,e.targetPosition.offset,n.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(e,n,t,l){const i=this._changedMarkers.get(e);i?(i.newRange=t,i.affectsData=l,null==i.oldRange&&null==i.newRange&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{oldRange:n,newRange:t,affectsData:l})}getMarkersToRemove(){const e=[];for(const[n,t]of this._changedMarkers)null!=t.oldRange&&e.push({name:n,range:t.oldRange});return e}getMarkersToAdd(){const e=[];for(const[n,t]of this._changedMarkers)null!=t.newRange&&e.push({name:n,range:t.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 n=[];for(const t of this._changesInElement.keys()){const e=this._changesInElement.get(t).sort((e,n)=>e.offset===n.offset?e.type!=n.type?"remove"==e.type?-1:1:0:e.offsete.position.root!=n.position.root?e.position.root.rootNamet.offset){if(l>i){const e={type:"attribute",offset:i,howMany:l-i,count:this._changeCount++};this._handleChange(e,n),n.push(e)}e.nodesToHandle=t.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=t.offset&&e.offseti?(e.nodesToHandle=l-i,e.offset=i):e.nodesToHandle=0);if("remove"==t.type&&e.offsett.offset){const i={type:"attribute",offset:t.offset,howMany:l-t.offset,count:this._changeCount++};this._handleChange(i,n),n.push(i),e.nodesToHandle=t.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==t.type&&(e.offset>=t.offset&&l<=i?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=t.offset&&l>=i&&(t.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,n,t){return{type:"insert",position:Di._createAt(e,n),name:t,length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,n,t){return{type:"remove",position:Di._createAt(e,n),name:t,length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,n,t){const l=[];t=new Map(t);for(const[i,o]of n){const n=t.has(i)?t.get(i):null;n!==o&&l.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:i,attributeOldValue:o,attributeNewValue:n,changeCount:this._changeCount++}),t.delete(i)}for(const[i,o]of t)l.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:i,attributeOldValue:null,attributeNewValue:o,changeCount:this._changeCount++});return l}_isInInsertedElement(e){const n=e.parent;if(!n)return!1;const t=this._changesInElement.get(n),l=e.startOffset;if(t)for(const i of t)if("insert"==i.type&&l>=i.offset&&ll){for(let e=0;e{const t=n[0];if(t.isDocumentOperation&&t.baseVersion!==this.version)throw new an.b("model-document-applyOperation-wrong-version: Only operations with matching versions can be applied.",this,{operation:t})},{priority:"highest"}),this.listenTo(e,"applyOperation",(e,n)=>{const t=n[0];t.isDocumentOperation&&this.differ.bufferOperation(t)},{priority:"high"}),this.listenTo(e,"applyOperation",(e,n)=>{const t=n[0];t.isDocumentOperation&&(this.version++,this.history.addOperation(t))},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(e,n,t,l)=>{this.differ.bufferMarkerChange(n.name,t,l,n.affectsData),null===t&&n.on("change",(e,t)=>{this.differ.bufferMarkerChange(n.name,t,n.getRange(),n.affectsData)})})}get graveyard(){return this.getRoot(ar)}createRoot(e="$root",n="main"){if(this.roots.get(n))throw new an.b("model-document-createRoot-name-exists: Root with specified name already exists.",this,{name:n});const t=new Ko(this,e,n);return this.roots.add(t),t}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=>e!=ar)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=Cn(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(),n=this.model,t=n.schema,l=n.createPositionFromPath(e,[0]);return t.getNearestSelectionRange(l)||n.createRange(l)}_validateSelectionRange(e){return dr(e.start)&&dr(e.end)}_callPostFixers(e){let n=!1;do{for(const t of this._postFixers)if(this.selection.refresh(),n=t(e))break}while(n)}}function dr(e){const n=e.textNode;if(n){const t=n.data,l=e.offset-n.startOffset;return!sr(t,l)&&!ur(t,l)}return!0}kn(cr,mn);class hr{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,n,t=!1,l=!1){const i=e instanceof pr?e.name:e,o=this._markers.get(i);if(o){const e=o.getRange();let r=!1;return e.isEqual(n)||(o._attachLiveRange(Ni.fromRange(n)),r=!0),t!=o.managedUsingOperations&&(o._managedUsingOperations=t,r=!0),"boolean"==typeof l&&l!=o.affectsData&&(o._affectsData=l,r=!0),r&&this.fire("update:"+i,o,e,n),o}const r=Ni.fromRange(n),s=new pr(i,r,t,l);return this._markers.set(i,s),this.fire("update:"+i,s,null,n),s}_remove(e){const n=e instanceof pr?e.name:e,t=this._markers.get(n);return!!t&&(this._markers.delete(n),this.fire("update:"+n,t,t.getRange(),null),this._destroyMarker(t),!0)}_refresh(e){const n=e instanceof pr?e.name:e,t=this._markers.get(n);if(!t)throw new an.b("markercollection-refresh-marker-not-exists: Marker with provided name does not exists.",this);const l=t.getRange();this.fire("update:"+n,t,l,l,t.managedUsingOperations,t.affectsData)}*getMarkersAtPosition(e){for(const n of this)n.getRange().containsPosition(e)&&(yield n)}*getMarkersIntersectingRange(e){for(const n of this)null!==n.getRange().getIntersection(e)&&(yield n)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const n of this._markers.values())n.name.startsWith(e+":")&&(yield n)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}kn(hr,mn);class pr{constructor(e,n,t,l){this.name=e,this._liveRange=this._attachLiveRange(n),this._managedUsingOperations=t,this._affectsData=l}get managedUsingOperations(){if(!this._liveRange)throw new an.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new an.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._affectsData}getStart(){if(!this._liveRange)throw new an.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new an.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new an.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}}kn(pr,mn);class fr extends Di{constructor(e,n,t="toNone"){if(super(e,n,t),!this.root.is("rootElement"))throw new an.b("model-liveposition-root-not-rootelement: LivePosition's root has to be an instance of RootElement.",e);(function(){this.listenTo(this.root.document.model,"applyOperation",(e,n)=>{const t=n[0];t.isDocumentOperation&&(function(e){const n=this.getTransformedByOperation(e);if(!this.isEqual(n)){const e=this.toPosition();this.path=n.path,this.root=n.root,this.fire("change",e)}}).call(this,t)},{priority:"low"})}).call(this)}detach(){this.stopListening()}is(e){return"livePosition"==e||"model:livePosition"==e||super.is(e)}toPosition(){return new Di(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,n){return new this(e.root,e.path.slice(),n||e.stickiness)}}kn(fr,mn);class mr{constructor(e,n,t){this.model=e,this.writer=n,this.position=t,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null}handleNodes(e,n){e=Array.from(e);for(let t=0;t!0);if(e.schema.checkChild(n.nextPosition,"$text"))return n.nextPosition}}function br(e,n,t){return _r.includes(e.charAt(n+(t?0:-1)))}function wr(e,n,t){return n===(t?e.endOffset:0)}function kr(e,n){const t=[];Array.from(e.getItems({direction:"backward"})).map(e=>n.createRangeOn(e)).filter(n=>(n.start.isAfter(e.start)||n.start.isEqual(e.start))&&(n.end.isBefore(e.end)||n.end.isEqual(e.end))).forEach(e=>{t.push(e.start.parent),n.remove(e)}),t.forEach(e=>{let t=e;for(;t.parent&&t.isEmpty;){const e=n.createRangeOn(t);t=t.parent,n.remove(e)}})}function Mr(e,n){return e.isCollapsed?function(e,n){const t=e.start,l=n.getNearestSelectionRange(t);if(!l)return null;const i=l.start;return t.isEqual(i)?null:i.nodeAfter&&n.isLimit(i.nodeAfter)?new Si(i,Di._createAfter(i.nodeAfter)):new Si(i)}(e,n):function(e,n){const t=e.start,l=e.end,i=n.checkChild(t,"$text"),o=n.checkChild(l,"$text"),r=n.getLimitElement(t),s=n.getLimitElement(l);if(r===s){if(i&&o)return null;if(function(e,n,t){const l=e.nodeAfter&&!t.isLimit(e.nodeAfter)||t.checkChild(e,"$text"),i=n.nodeBefore&&!t.isLimit(n.nodeBefore)||t.checkChild(n,"$text");return l||i}(t,l,n)){const e=t.nodeAfter&&n.isObject(t.nodeAfter)?null:n.getNearestSelectionRange(t,"forward"),i=l.nodeBefore&&n.isObject(l.nodeBefore)?null:n.getNearestSelectionRange(l,"backward");return new Si(e?e.start:t,i?i.start:l)}}const u=r&&!r.is("rootElement"),a=s&&!s.is("rootElement");if(u||a){const e=t.nodeAfter&&l.nodeBefore&&t.nodeAfter.parent===l.nodeBefore.parent,i=u&&(!e||!xr(t.nodeAfter,n)),o=a&&(!e||!xr(l.nodeBefore,n));let c=t,d=l;return i&&(c=Di._createBefore(Cr(r,n))),o&&(d=Di._createAfter(Cr(s,n))),new Si(c,d)}return null}(e,n)}function Cr(e,n){let t=e,l=t;for(;n.isLimit(l)&&l.parent;)t=l,l=l.parent;return t}function xr(e,n){return e&&n.isObject(e)}class Dr{constructor(){this.markers=new hr,this.document=new cr(this),this.schema=new co,this._pendingChanges=[],this._currentWriter=null,["insertContent","deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>this.decorate(e)),this.on("applyOperation",(e,n)=>{n[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$block",{allowIn:"$root",isBlock:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",isLimit:!0}),this.schema.extend("$text",{allowIn:"$clipboardHolder"}),this.schema.register("$marker"),this.schema.addChildCheck((e,n)=>{if("$marker"===n.name)return!0}),function(e){e.document.registerPostFixer(n=>function(e,n){const t=n.document.selection,l=n.schema,i=[];let o=!1;for(const r of t.getRanges()){const e=Mr(r,l);e?(i.push(e),o=!0):i.push(r)}if(o){let n=i;i.length>1&&(n=[new Si(i[0].start,i[i.length-1].end)]),e.setSelection(n,{backward:t.isBackward})}}(n,e))}(this)}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new Lo,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){an.b.rethrowUnexpectedError(e,this)}}enqueueChange(e,n){try{"string"==typeof e?e=new Lo(e):"function"==typeof e&&(n=e,e=new Lo),this._pendingChanges.push({batch:e,callback:n}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){an.b.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,n,t){return function(e,n,t,l){return e.change(i=>{let o;const r=(o=t?t instanceof Ei||t instanceof Vi?t:i.createSelection(t,l):e.document.selection).getFirstPosition();o.isCollapsed||e.deleteContent(o,{doNotAutoparagraph:!0});const s=new mr(e,i,r);let u;u=n.is("documentFragment")?n.getChildren():[n],s.handleNodes(u,{isFirst:!0,isLast:!0});const a=s.getSelectionRange();a&&(o instanceof Vi?i.setSelection(a):o.setTo(a));const c=s.getAffectedRange()||e.createRange(r);return s.destroy(),c})}(this,e,n,t)}deleteContent(e,n){!function(e,n,t={}){if(n.isCollapsed)return;const l=n.getFirstRange();if("$graveyard"==l.root.rootName)return;const i=e.schema;e.change(e=>{if(!t.doNotResetEntireContent&&function(e,n){const t=e.getLimitElement(n);if(!n.containsEntireContent(t))return!1;const l=n.getFirstRange();return l.start.parent!=l.end.parent&&e.checkChild(t,"paragraph")}(i,n))return void function(e,n){const t=e.model.schema.getLimitElement(n);e.remove(e.createRangeIn(t)),gr(e,e.createPositionAt(t,0),n)}(e,n);const o=l.start,r=fr.fromPosition(l.end,"toNext");if(l.start.isTouching(l.end)||e.remove(l),t.leaveUnmerged||(function e(n,t,l){const i=t.parent,o=l.parent;if(i!=o&&!n.model.schema.isLimit(i)&&!n.model.schema.isLimit(o)&&function(e,n,t){const l=new Si(e,n);for(const i of l.getWalker())if(t.isLimit(i.item))return!1;return!0}(t,l,n.model.schema)){for(t=n.createPositionAfter(i),(l=n.createPositionBefore(o)).isEqual(t)||n.insert(o,t),n.merge(t);l.parent.isEmpty;){const e=l.parent;l=n.createPositionBefore(e),n.remove(e)}e(n,t,l)}}(e,o,r),i.removeDisallowedAttributes(o.parent.getChildren(),e)),vr(e,n,o),function(e,n){const t=e.checkChild(n,"$text"),l=e.checkChild(n,"paragraph");return!t&&l}(i,o)){const l=i.getNearestSelectionRange(o);t.doNotAutoparagraph&&l?vr(e,n,l):gr(e,o,n)}r.detach()})}(this,e,n)}modifySelection(e,n){!function(e,n,t={}){const l=e.schema,i="backward"!=t.direction,o=t.unit?t.unit:"character",r=new Ci({boundaries:function(e,n){const t=Di._createAt(e.root,n?"end":0);return n?new Si(e,t):new Si(t,e)}(n.focus,i),singleCharacters:!0,direction:i?"forward":"backward"}),s={walker:r,schema:l,isForward:i,unit:o};let u;for(;u=r.next();){if(u.done)return;const t=yr(s,u.value);if(t)return void(n instanceof Vi?e.change(e=>{e.setSelectionFocus(t)}):n.setFocus(t))}}(this,e,n)}getSelectedContent(e){return function(e,n){return e.change(e=>{const t=e.createDocumentFragment(),l=n.getFirstRange();if(!l||l.isCollapsed)return t;const i=l.start.root,o=l.start.getCommonPath(l.end),r=i.getNodeByPath(o);let s;const u=(s=l.start.parent==l.end.parent?l:e.createRange(e.createPositionAt(r,l.start.path[o.length]),e.createPositionAt(r,l.end.path[o.length]+1))).end.offset-s.start.offset;for(const n of s.getItems({shallow:!0}))n.is("textProxy")?e.appendText(n.data,n.getAttributes(),t):e.append(n._clone(!0),t);if(s!=l){const n=l._getTransformedByMove(s.start,e.createPositionAt(t,0),u)[0],i=e.createRange(e.createPositionAt(t,0),n.start);kr(e.createRange(n.end,e.createPositionAt(t,"end")),e),kr(i,e)}return t})}(this,e)}hasContent(e,n){const t=e instanceof Mi?Si._createIn(e):e;if(t.isCollapsed)return!1;for(const i of this.markers.getMarkersIntersectingRange(t))if(i.affectsData)return!0;const{ignoreWhitespaces:l=!1}=n||{};for(const i of t.getItems())if(i.is("textProxy")){if(!l)return!0;if(-1!==i.data.search(/\S/))return!0}else if(this.schema.isObject(i))return!0;return!1}createPositionFromPath(e,n,t){return new Di(e,n,t)}createPositionAt(e,n){return Di._createAt(e,n)}createPositionAfter(e){return Di._createAfter(e)}createPositionBefore(e){return Di._createBefore(e)}createRange(e,n){return new Si(e,n)}createRangeIn(e){return Si._createIn(e)}createRangeOn(e){return Si._createOn(e)}createSelection(e,n,t){return new Ei(e,n,t)}createBatch(e){return new Lo(e)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];for(this.fire("_beforeChanges");this._pendingChanges.length;){this._currentWriter=new Jo(this,this._pendingChanges[0].batch);const n=this._pendingChanges[0].callback(this._currentWriter);e.push(n),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),e}}kn(Dr,Gn);class Sr{constructor(){this._listener=Object.create(ml)}listenTo(e){this._listener.listenTo(e,"keydown",(e,n)=>{this._listener.fire("_keydown:"+St(n),n)})}set(e,n,t={}){const l=Tt(e);this._listener.listenTo(this._listener,"_keydown:"+l,(e,t)=>{n(t,()=>{t.preventDefault(),t.stopPropagation(),e.stop()}),e.return=!0},{priority:t.priority})}press(e){return!!this._listener.fire("_keydown:"+St(e),e)}destroy(){this._listener.stopListening()}}class Tr extends Sr{constructor(e){super(),this.editor=e}set(e,n,t={}){if("string"==typeof n){const e=n;n=(n,t)=>{this.editor.execute(e),t()}}super.set(e,n,t)}}class Lr{constructor(e){const n=this.constructor.builtinPlugins;this.config=new sn(e,this.constructor.defaultConfig),this.config.define("plugins",n),this.plugins=new lo(this,n),this.commands=new io;const t=this.config.get("language")||{};this.locale=new ro({uiLanguage:"string"==typeof t?t:t.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.set("isReadOnly",!1),this.model=new Dr,this.data=new xo(this.model),this.editing=new to(this.model),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Do([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 Tr(this),this.keystrokes.listenTo(this.editing.view.document)}initPlugins(){const e=this.config,n=e.get("plugins")||[],t=e.get("removePlugins")||[],l=e.get("extraPlugins")||[];return this.plugins.init(n.concat(l),t)}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()})}execute(...e){try{this.commands.execute(...e)}catch(e){an.b.rethrowUnexpectedError(e,this)}}}kn(Lr,Gn);var Pr={setData(e){this.data.set(e)},getData(e){return this.data.get(e)}},Ar={updateSourceElement(){if(!this.sourceElement)throw new an.b("editor-missing-sourceelement: Cannot update the source element of a detached editor.",this);!function(e,n){e instanceof HTMLTextAreaElement&&(e.value=n),e.innerHTML=n}(this.sourceElement,this.data.get())}};class Ir{getHtml(e){const n=document.implementation.createHTMLDocument("").createElement("div");return n.appendChild(e),n.innerHTML}}class Er{constructor(){this._domParser=new DOMParser,this._domConverter=new dl({blockFillerMode:"nbsp"}),this._htmlWriter=new Ir}toData(e){const n=this._domConverter.viewToDom(e,document);return this._htmlWriter.getHtml(n)}toView(e){const n=this._toDom(e);return this._domConverter.domToView(n)}_toDom(e){const n=this._domParser.parseFromString(e,"text/html"),t=n.createDocumentFragment(),l=n.body.childNodes;for(;l.length>0;)t.appendChild(l[0]);return t}}class Or{constructor(e){this.editor=e,this._components=new Map}*names(){for(const e of this._components.values())yield e.originalName}add(e,n){if(this.has(e))throw new an.b("componentfactory-item-exists: The item already exists in the component factory.",this,{name:e});this._components.set(jr(e),{callback:n,originalName:e})}create(e){if(!this.has(e))throw new an.b("componentfactory-item-missing: The required component is not registered in the factory.",this,{name:e});return this._components.get(jr(e)).callback(this.editor.locale)}has(e){return this._components.has(jr(e))}}function jr(e){return String(e).toLowerCase()}class Yr{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 an.b("focusTracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(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)}}kn(Yr,ml),kn(Yr,Gn);class Fr{constructor(e){this.editor=e,this.componentFactory=new Or(e),this.focusTracker=new Yr,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,n){this._editableElementsMap.set(e,n),n.ckeditorInstance||(n.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}}kn(Fr,mn),t(14);const Nr=new WeakMap;function Rr(e){const{view:n,element:t,text:l,isDirectHost:i=!0}=e,o=n.document;Nr.has(o)||(Nr.set(o,new Map),o.registerPostFixer(e=>Vr(o,e))),Nr.get(o).set(t,{text:l,isDirectHost:i}),n.change(e=>Vr(o,e))}function Vr(e,n){const t=Nr.get(e);let l=!1;for(const[i,o]of t)Hr(n,i,o)&&(l=!0);return l}function Hr(e,n,t){const{text:l,isDirectHost:i}=t,o=i?n:function(e){if(1===e.childCount){const n=e.getChild(0);if(n.is("element")&&!n.is("uiElement"))return n}return null}(n);let r=!1;return!!o&&(t.hostElement=o,o.getAttribute("data-placeholder")!==l&&(e.setAttribute("data-placeholder",l,o),r=!0),function(e){const n=e.document;if(!n)return!1;const t=!Array.from(e.getChildren()).some(e=>!e.is("uiElement"));if(!n.isFocused&&t)return!0;const l=n.selection.anchor;return!(!t||!l||l.parent===e)}(o)?function(e,n){return!n.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",n),!0)}(e,o)&&(r=!0):function(e,n){return!!n.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",n),!0)}(e,o)&&(r=!0),r)}class zr{constructor(){this._replacedElements=[]}replace(e,n){this._replacedElements.push({element:e,newElement:n}),e.style.display="none",n&&e.parentNode.insertBefore(n,e.nextSibling)}restore(){this._replacedElements.forEach(({element:e,newElement:n})=>{e.style.display="",n&&n.remove()}),this._replacedElements=[]}}class Br extends Fr{constructor(e,n){super(e),this.view=n,this._toolbarConfig=function(e){return Array.isArray(e)?{items:e}:e?Object.assign({items:[]},e):{items:[]}}(e.config.get("toolbar")),this._elementReplacer=new zr}get element(){return this.view.element}init(e){const n=this.view,t=this.editor.editing.view,l=n.editable,i=t.document.getRoot();l.name=i.rootName,n.render();const o=l.element;this.setEditableElement(l.name,o),this.focusTracker.add(o),n.editable.bind("isFocused").to(this.focusTracker),t.attachDomRoot(o),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){const e=this.view,n=this.editor.editing.view;this._elementReplacer.restore(),n.detachDomRoot(e.editable.name),e.destroy(),super.destroy()}_initToolbar(){const e=this.editor,n=this.view,t=e.editing.view;n.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),n.stickyPanel.limiterElement=n.element,this._toolbarConfig.viewportTopOffset&&(n.stickyPanel.viewportTopOffset=this._toolbarConfig.viewportTopOffset),n.toolbar.fillFromConfig(this._toolbarConfig.items,this.componentFactory),function({origin:e,originKeystrokeHandler:n,originFocusTracker:t,toolbar:l,beforeFocus:i,afterBlur:o}){t.add(l.element),n.set("Alt+F10",(e,n)=>{t.isFocused&&!l.focusTracker.isFocused&&(i&&i(),l.focus(),n())}),l.keystrokes.set("Esc",(n,t)=>{l.focusTracker.isFocused&&(e.focus(),o&&o(),t())})}({origin:t,originFocusTracker:this.focusTracker,originKeystrokeHandler:e.keystrokes,toolbar:n.toolbar})}_initPlaceholder(){const e=this.editor,n=e.editing.view,t=n.document.getRoot(),l=e.sourceElement,i=e.config.get("placeholder")||l&&"textarea"===l.tagName.toLowerCase()&&l.getAttribute("placeholder");i&&Rr({view:n,element:t,text:i,isDirectHost:!1})}}class Ur extends dt{constructor(e){super({idProperty:"viewUid"}),this.on("add",(e,n,t)=>{n.isRendered||n.render(),n.element&&this._parentElement&&this._parentElement.insertBefore(n.element,this._parentElement.children[t])}),this.on("remove",(e,n)=>{n.element&&this._parentElement&&n.element.remove()}),this.locale=e,this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e}delegate(...e){if(!e.length||!function(e){return e.every(e=>"string"==typeof e)}(e))throw new an.b("ui-viewcollection-delegate-wrong-events: All event names must be strings.",this);return{to:n=>{for(const t of this)for(const l of e)t.delegate(l).to(n);this.on("add",(t,l)=>{for(const i of e)l.delegate(i).to(n)}),this.on("remove",(t,l)=>{for(const i of e)l.stopDelegating(i,n)})}}}}class Wr{constructor(e){Object.assign(this,es(Xr(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 an.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(n){if(n.children)for(const t of n.children)os(t)?yield t:rs(t)&&(yield*e(t))}(this)}static bind(e,n){return{to:(t,l)=>new $r({eventNameOrFunction:t,attribute:t,observable:e,emitter:n,callback:l}),if:(t,l,i)=>new Gr({observable:e,emitter:n,attribute:t,valueIfTrue:l,callback:i})}}static extend(e,n){if(e._isRendered)throw new an.b("template-extend-render: Attempting to extend a template which has already been rendered.",[this,e]);!function e(n,t){if(t.attributes&&(n.attributes||(n.attributes={}),ls(n.attributes,t.attributes)),t.eventListeners&&(n.eventListeners||(n.eventListeners={}),ls(n.eventListeners,t.eventListeners)),t.text&&n.text.push(...t.text),t.children&&t.children.length){if(n.children.length!=t.children.length)throw new an.b("ui-template-extend-children-mismatch: The number of children in extended definition does not match.",n);let l=0;for(const i of t.children)e(n.children[l++],i)}}(e,es(Xr(n)))}_renderNode(e){let n;if(n=e.node?this.tag&&this.text:this.tag?this.text:!this.text)throw new an.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 n=e.node;return n||(n=e.node=document.createElementNS(this.ns||"http://www.w3.org/1999/xhtml",this.tag)),this._renderAttributes(e),this._renderElementChildren(e),this._setUpListeners(e),n}_renderText(e){let n=e.node;return n?e.revertData.text=n.textContent:n=e.node=document.createTextNode(""),Kr(this.text)?this._bindToObservable({schema:this.text,updater:function(e){return{set(n){e.textContent=n},remove(){e.textContent=""}}}(n),data:e}):n.textContent=this.text.join(""),n}_renderAttributes(e){let n,t,l,i;if(!this.attributes)return;const o=e.node,r=e.revertData;for(n in this.attributes)if(l=o.getAttribute(n),t=this.attributes[n],r&&(r.attributes[n]=l),i=C(t[0])&&t[0].ns?t[0].ns:null,Kr(t)){const s=i?t[0].value:t;r&&us(n)&&s.unshift(l),this._bindToObservable({schema:s,updater:Qr(o,n,i),data:e})}else"style"==n&&"string"!=typeof t[0]?this._renderStyleAttribute(t[0],e):(r&&l&&us(n)&&t.unshift(l),is(t=t.map(e=>e&&e.value||e).reduce((e,n)=>e.concat(n),[]).reduce(ts,""))||o.setAttributeNS(i,n,t))}_renderStyleAttribute(e,n){const t=n.node;for(const l in e){const i=e[l];Kr(i)?this._bindToObservable({schema:[i],updater:Zr(t,l),data:n}):t.style[l]=i}}_renderElementChildren(e){const n=e.node,t=e.intoFragment?document.createDocumentFragment():n,l=e.isApplying;let i=0;for(const o of this.children)if(ss(o)){if(!l){o.setParent(n);for(const e of o)t.appendChild(e.element)}}else if(os(o))l||(o.isRendered||o.render(),t.appendChild(o.element));else if(ll(o))t.appendChild(o);else if(l){const n={children:[],bindings:[],attributes:{}};e.revertData.children.push(n),o._renderNode({node:t.childNodes[i++],isApplying:!0,revertData:n})}else t.appendChild(o.render());e.intoFragment&&n.appendChild(t)}_setUpListeners(e){if(this.eventListeners)for(const n in this.eventListeners){const t=this.eventListeners[n].map(t=>{const[l,i]=n.split("@");return t.activateDomEventListener(l,i,e)});e.revertData&&e.revertData.bindings.push(t)}}_bindToObservable({schema:e,updater:n,data:t}){const l=t.revertData;Jr(e,n,t);const i=e.filter(e=>!is(e)).filter(e=>e.observable).map(l=>l.activateAttributeListener(e,n,t));l&&l.bindings.push(i)}_revertTemplateFromNode(e,n){for(const t of n.bindings)for(const e of t)e();if(n.text)e.textContent=n.text;else{for(const t in n.attributes){const l=n.attributes[t];null===l?e.removeAttribute(t):e.setAttribute(t,l)}for(let t=0;tJr(e,n,t);return this.emitter.listenTo(this.observable,"change:"+this.attribute,l),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,l)}}}class $r extends qr{activateDomEventListener(e,n,t){const l=(e,t)=>{n&&!t.target.matches(n)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(t):this.observable.fire(this.eventNameOrFunction,t))};return this.emitter.listenTo(t.node,e,l),()=>{this.emitter.stopListening(t.node,e,l)}}}class Gr extends qr{getValue(e){return!is(super.getValue(e))&&(this.valueIfTrue||!0)}}function Kr(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(Kr):e instanceof qr)}function Jr(e,n,{node:t}){let l=function(e,n){return e.map(e=>e instanceof qr?e.getValue(n):e)}(e,t);is(l=1==e.length&&e[0]instanceof Gr?l[0]:l.reduce(ts,""))?n.remove():n.set(l)}function Qr(e,n,t){return{set(l){e.setAttributeNS(t,n,l)},remove(){e.removeAttributeNS(t,n)}}}function Zr(e,n){return{set(t){e.style[n]=t},remove(){e.style[n]=null}}}function Xr(e){return on(e,e=>{if(e&&(e instanceof qr||rs(e)||os(e)||ss(e)))return e})}function es(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 n in e)ns(e,n);return e}(e.on),delete e.on),!e.text){e.attributes&&function(e){for(const n in e)e[n].value&&(e[n].value=[].concat(e[n].value)),ns(e,n)}(e.attributes);const n=[];if(e.children)if(ss(e.children))n.push(e.children);else for(const t of e.children)rs(t)||os(t)||ll(t)?n.push(t):n.push(new Wr(t));e.children=n}return e}function ns(e,n){Array.isArray(e[n])||(e[n]=[e[n]])}function ts(e,n){return is(n)?e:is(e)?n:`${e} ${n}`}function ls(e,n){for(const t in n)e[t]?e[t].push(...n[t]):e[t]=n[t]}function is(e){return!e&&0!==e}function os(e){return e instanceof as}function rs(e){return e instanceof Wr}function ss(e){return e instanceof Ur}function us(e){return"class"==e||"style"==e}t(16);class as{constructor(e){this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new dt,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(n,t)=>{t.locale=e}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Wr.bind(this,this)}createCollection(){const e=new Ur;return this._viewCollections.add(e),e}registerChild(e){Ln(e)||(e=[e]);for(const n of e)this._unboundChildren.add(n)}deregisterChild(e){Ln(e)||(e=[e]);for(const n of e)this._unboundChildren.remove(n)}setTemplate(e){this.template=new Wr(e)}extendTemplate(e){Wr.extend(this.template,e)}render(){if(this.isRendered)throw new an.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)}}kn(as,ml),kn(as,Gn),t(18);class cs extends as{constructor(e){super(e),this.body=this.createCollection()}render(){super.render(),this._renderBodyCollection()}destroy(){return this._bodyCollectionContainer.remove(),super.destroy()}_renderBodyCollection(){const e=this._bodyCollectionContainer=new Wr({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this.body}).render();document.body.appendChild(e)}}t(20);class ds extends as{constructor(e){super(e),this.set("text"),this.set("for");const n=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],for:n.to("for")},children:[{text:n.to("text")}]})}}class hs extends cs{constructor(e){super(e);const n=dn();this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(n),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:e.uiLanguageDirection,lang:e.uiLanguage,"aria-labelledby":"ck-editor__aria-label_"+n},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(e){const n=this.t,t=new ds;return t.text=n("bi"),t.extendTemplate({attributes:{id:"ck-editor__aria-label_"+e,class:"ck-voice-label"}}),t}}class ps extends as{constructor(e,n,t){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=t,this._hasExternalElement=!!this._editableElement,this._editingView=n}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 n(n){e.change(t=>{const l=e.document.getRoot(n.name);t.addClass(n.isFocused?"ck-focused":"ck-blurred",l),t.removeClass(n.isFocused?"ck-blurred":"ck-focused",l)})}e.isRenderingInProgress?function t(l){e.once("change:isRenderingInProgress",(e,i,o)=>{o?t(l):n(l)})}(this):n(this)}}class fs extends ps{constructor(e,n,t){super(e,n,t),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView,n=this.t;e.change(t=>{const l=e.document.getRoot(this.name);t.setAttribute("aria-label",n("bu",[this.name]),l)})}}function ms(e){return n=>n+e}t(22);const gs=ms("px");class vs extends as{constructor(e){super(e);const n=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheLimiter",!1),this.set("_hasViewportTopOffset",!1),this.content=this.createCollection(),this._contentPanelPlaceholder=new Wr({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:n.to("isSticky",e=>e?"block":"none"),height:n.to("isSticky",e=>e?gs(this._panelRect.height):null)}}}).render(),this._contentPanel=new Wr({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",n.if("isSticky","ck-sticky-panel__content_sticky"),n.if("_isStickyToTheLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:n.to("isSticky",e=>e?gs(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:n.to("_hasViewportTopOffset",e=>e?gs(this.viewportTopOffset):null),bottom:n.to("_isStickyToTheLimiter",e=>e?gs(this.limiterBottomOffset):null),marginLeft:n.to("_marginLeft")}},children:this.content}).render(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-sticky-panel"]},children:[this._contentPanelPlaceholder,this._contentPanel]})}render(){super.render(),this._checkIfShouldBeSticky(),this.listenTo(sl.window,"scroll",()=>{this._checkIfShouldBeSticky()}),this.listenTo(this,"change:isActive",()=>{this._checkIfShouldBeSticky()})}_checkIfShouldBeSticky(){const e=this._panelRect=this._contentPanel.getBoundingClientRect();let n;this.limiterElement?(n=this._limiterRect=this.limiterElement.getBoundingClientRect(),this.isSticky=this.isActive&&n.top{this[n](),t()})}}get first(){return this.focusables.find(ys)||null}get last(){return this.focusables.filter(ys).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((n,t)=>{const l=n.element===this.focusTracker.focusedElement;return l&&(e=t),l}),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 n=this.current,t=this.focusables.length;if(!t)return null;if(null===n)return this[1===e?"first":"last"];let l=(n+t+e)%t;do{const n=this.focusables.get(l);if(ys(n))return n;l=(l+t+e)%t}while(l!==n);return null}}function ys(e){return!(!e.focus||"none"==sl.window.getComputedStyle(e.element).display)}class bs extends as{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class ws{constructor(e){this._callback=e,this._elements=new Set,this._previousRects=new Map,this._periodicCheckTimeout=null}observe(e){this._elements.add(e),1===this._elements.size&&this._startPeriodicCheck()}unobserve(e){this._elements.delete(e),this._previousRects.delete(e),this._elements.size||this._stopPeriodicCheck()}disconnect(){this._elements.forEach(e=>this.unobserve(e))}_startPeriodicCheck(){const e=()=>{this._checkElementRectsAndExecuteCallback(),this._periodicCheckTimeout=setTimeout(e,100)};this.listenTo(sl.window,"resize",()=>{this._checkElementRectsAndExecuteCallback()}),e()}_stopPeriodicCheck(){clearTimeout(this._periodicCheckTimeout),this.stopListening(),this._previousRects.clear()}_checkElementRectsAndExecuteCallback(){const e=[];for(const n of this._elements)this._hasRectChanged(n)&&e.push({target:n,contentRect:this._previousRects.get(n)});e.length&&this._callback(e)}_hasRectChanged(e){if(!e.ownerDocument.body.contains(e))return!1;const n=new ii(e),t=this._previousRects.get(e),l=!t||!t.isEqual(n);return this._previousRects.set(e,n),l}}kn(ws,ml);class ks extends as{constructor(e){super(e);const n=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",n.to("position",e=>"ck-dropdown__panel_"+e),n.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:n.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()}}}function Ms({element:e,target:n,positions:t,limiter:l,fitInViewport:i}){x(n)&&(n=n()),x(l)&&(l=l());const o=function(e){for(;e&&"html"!=e.tagName.toLowerCase();){if("static"!=sl.window.getComputedStyle(e).position)return e;e=e.parentElement}return null}(e.parentElement),r=new ii(e),s=new ii(n);let u,a;if(l||i){const e=l&&new ii(l).getVisible(),n=i&&new ii(sl.window);[a,u]=function(e,n,t,l,i){let o,r,s=0,u=0;const a=t.getArea();return e.some(e=>{const[c,d]=Cs(e,n,t);let h,p;if(l)if(i){const e=l.getIntersection(i);h=e?e.getIntersectionArea(d):0}else h=l.getIntersectionArea(d);function f(){u=p,s=h,o=d,r=c}return i&&(p=i.getIntersectionArea(d)),i&&!l?p>u&&f():!i&&l?h>s&&f():(p>u&&h>=s||p>=u&&h>s)&&f(),h===a}),o?[r,o]:null}(t,s,r,e,n)||Cs(t[0],s,r)}else[a,u]=Cs(t[0],s,r);let{left:c,top:d}=xs(u);if(o){const e=xs(new ii(o)),n=ti(o);c-=e.left,d-=e.top,c+=o.scrollLeft,d+=o.scrollTop,c-=n.left,d-=n.top}return{left:c,top:d,name:a}}function Cs(e,n,t){const{left:l,top:i,name:o}=e(n,t);return[o,t.clone().moveTo(l,i)]}function xs({left:e,top:n}){const{scrollX:t,scrollY:l}=sl.window;return{left:e+t,top:n+l}}t(24);class Ds extends as{constructor(e,n,t){super(e);const l=this.bindTemplate;this.buttonView=n,this.panelView=t,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("panelPosition","auto"),this.focusTracker=new Yr,this.keystrokes=new Sr,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",l.to("class"),l.if("isEnabled","ck-disabled",e=>!e)]},children:[n,t]}),n.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&&(this.panelView.position="auto"===this.panelPosition?Ds._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions}).name:this.panelPosition)}),this.keystrokes.listenTo(this.element),this.focusTracker.add(this.element);const e=(e,n)=>{this.isOpen&&(this.buttonView.focus(),this.isOpen=!1,n())};this.keystrokes.set("arrowdown",(e,n)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,n())}),this.keystrokes.set("arrowright",(e,n)=>{this.isOpen&&n()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:n,northEast:t,northWest:l}=Ds.defaultPanelPositions;return"ltr"===this.locale.uiLanguageDirection?[e,n,t,l]:[n,e,l,t]}}Ds.defaultPanelPositions={southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,n)=>({top:e.bottom,left:e.left-n.width+e.width,name:"sw"}),northEast:(e,n)=>({top:e.top-n.height,left:e.left,name:"ne"}),northWest:(e,n)=>({top:e.bottom-n.height,left:e.left-n.width+e.width,name:"nw"})},Ds._getOptimalPosition=Ms,t(26);class Ss extends as{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"),n=e.getAttribute("viewBox");for(n&&(this.viewBox=n),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})}}t(28);class Ts extends as{constructor(e){super(e),this.set("text",""),this.set("position","s");const n=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip",n.to("position",e=>"ck-tooltip_"+e),n.if("text","ck-hidden",e=>!e.trim())]},children:[{tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:n.to("text")}]}]})}}t(30);class Ls extends as{constructor(e){super(e);const n=this.bindTemplate,t=dn();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.children=this.createCollection(),this.tooltipView=this._createTooltipView(),this.labelView=this._createLabelView(t),this.iconView=new Ss,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this)),this.setTemplate({tag:"button",attributes:{class:["ck","ck-button",n.to("class"),n.if("isEnabled","ck-disabled",e=>!e),n.if("isVisible","ck-hidden",e=>!e),n.to("isOn",e=>e?"ck-on":"ck-off"),n.if("withText","ck-button_with-text")],type:n.to("type",e=>e||"button"),tabindex:n.to("tabindex"),"aria-labelledby":"ck-editor__aria-label_"+t,"aria-disabled":n.if("isEnabled",!0,e=>!e),"aria-pressed":n.to("isOn",e=>!!this.isToggleable&&String(e))},children:this.children,on:{mousedown:n.to(e=>{e.preventDefault()}),click:n.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)}focus(){this.element.focus()}_createTooltipView(){const e=new Ts;return e.bind("text").to(this,"_tooltipString"),e.bind("position").to(this,"tooltipPosition"),e}_createLabelView(e){const n=new as;return n.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:this.bindTemplate.to("labelStyle"),id:"ck-editor__aria-label_"+e},children:[{text:this.bindTemplate.to("label")}]}),n}_getTooltipString(e,n,t){return e?"string"==typeof e?e:(t&&(t=function(e){return yt?Lt(e).map(e=>xt[e.toLowerCase()]||e).reduce((e,n)=>e.slice(-1)in Ct?e+n:e+"+"+n):e}(t)),e instanceof Function?e(n,t):`${n}${t?` (${t})`:""}`):""}}class Ps extends Ls{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 Ss;return e.content='',e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}t(32);class As extends as{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new Yr,this.keystrokes=new Sr,this._focusCycler=new _s({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,n)=>{this.focusTracker.add(n.element)}),this.items.on("remove",(e,n)=>{this.focusTracker.remove(n.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class Is extends as{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 Es extends as{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}t(34);class Os extends Ls{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 as;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}function js({emitter:e,activator:n,callback:t,contextElements:l}){e.listenTo(document,"mousedown",(e,{target:i})=>{if(n()){for(const e of l)if(e.contains(i))return;t()}})}function Ys(e,n=Ps){const t=new n(e),l=new ks(e),i=new Ds(e,t,l);return t.bind("isEnabled").to(i),t instanceof Ps?t.bind("isOn").to(i,"isOpen"):t.arrowView.bind("isOn").to(i,"isOpen"),function(e){(function(e){e.on("render",()=>{js({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:[e.element]})})})(e),function(e){e.on("execute",n=>{n.source instanceof Os||(e.isOpen=!1)})}(e),function(e){e.keystrokes.set("arrowdown",(n,t)=>{e.isOpen&&(e.panelView.focus(),t())}),e.keystrokes.set("arrowup",(n,t)=>{e.isOpen&&(e.panelView.focusLast(),t())})}(e)}(i),i}function Fs(e,n){const t=e.locale,l=e.listView=new As(t);l.items.bindTo(n).using(({type:e,model:n})=>{if("separator"===e)return new Es(t);if("button"===e||"switchbutton"===e){const l=new Is(t);let i;return(i="button"===e?new Ls(t):new Os(t)).bind(...Object.keys(n)).to(n),i.delegate("execute").to(l),l.children.add(i),l}}),e.panelView.children.add(l),l.items.delegate("execute").to(e)}t(36),t(38),t(40);class Ns extends as{constructor(e,n){super(e);const t=this.bindTemplate,l=this.t;this.options=n||{},this.set("ariaLabel",l("bo")),this.items=this.createCollection(),this.focusTracker=new Yr,this.keystrokes=new Sr,this.set("class"),this.itemsView=new Rs(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection(),this._focusCycler=new _s({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",t.to("class")],role:"toolbar","aria-label":t.to("ariaLabel")},children:this.children,on:{mousedown:function(e){return e.bindTemplate.to(n=>{n.target===e.element&&n.preventDefault()})}(this)}}),this._behavior=this.options.shouldGroupWhenFull?new Hs(this):new Vs(this)}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,n)=>{this.focusTracker.add(n.element)}),this.items.on("remove",(e,n)=>{this.focusTracker.remove(n.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,n){e.map(e=>{"|"==e?this.items.add(new bs):n.has(e)?this.items.add(n.create(e)):console.warn(Object(an.a)("toolbarview-item-unavailable: The requested toolbar item is unavailable."),{name:e})})}}class Rs extends as{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Vs{constructor(e){const n=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:[n.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Hs{constructor(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,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("add",(e,n,t)=>{t>this.ungroupedItems.length?this.groupedItems.add(n,t-this.ungroupedItems.length):this.ungroupedItems.add(n,t),this._updateGrouping()}),e.items.on("remove",(e,n,t)=>{t>this.ungroupedItems.length?this.groupedItems.remove(n):this.ungroupedItems.remove(n),this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize()}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.disconnect()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;let e;for(;this._areItemsOverflowing;)this._groupLastItem(),e=!0;if(!e&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,n=this.viewLocale.uiLanguageDirection,t=new ii(e.lastChild),l=new ii(e);if(!this.cachedPadding){const t=sl.window.getComputedStyle(e);this.cachedPadding=Number.parseInt(t["ltr"===n?"paddingRight":"paddingLeft"])}return"ltr"===n?t.right>l.right-this.cachedPadding:t.left{e&&e===n.contentRect.width||(this._updateGrouping(),e=n.contentRect.width)}),this.resizeObserver.observe(this.viewElement),this._updateGrouping()}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new bs),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,n=e.t,t=Ys(e);return t.class="ck-toolbar__grouped-dropdown",t.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",function(e,n){const t=e.locale,l=t.t,i=e.toolbarView=new Ns(t);i.set("ariaLabel",l("bq")),e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),[].map(e=>i.items.add(e)),e.panelView.children.add(i),i.items.delegate("execute").to(e)}(t),t.buttonView.set({label:n("bp"),tooltip:!0,icon:'\n'}),t.toolbarView.items.bindTo(this.groupedItems).using(e=>e),t}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}t(42);class zs extends hs{constructor(e,n){super(e),this.stickyPanel=new vs(e),this.toolbar=new Ns(e,{shouldGroupWhenFull:!0}),this.editable=new fs(e,n)}render(){super.render(),this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class Bs extends Lr{constructor(e,n){super(n),rn(e)&&(this.sourceElement=e),this.data.processor=new Er,this.model.document.createRoot(),this.ui=new Br(this,new zs(this.locale,this.editing.view)),function(e){if(!x(e.updateSourceElement))throw new an.b("attachtoform-missing-elementapi-interface: Editor passed to attachToForm() must implement ElementApi.",e);const n=e.sourceElement;if(n&&"textarea"===n.tagName.toLowerCase()&&n.form){let t;const l=n.form,i=()=>e.updateSourceElement();x(l.submit)&&(t=l.submit,l.submit=()=>{i(),t.apply(l)}),l.addEventListener("submit",i),e.on("destroy",()=>{l.removeEventListener("submit",i),t&&(l.submit=t)})}}(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,n={}){return new Promise(t=>{const l=new this(e,n);t(l.initPlugins().then(()=>l.ui.init(rn(e)?e:null)).then(()=>{if(!rn(e)&&n.initialData)throw new an.b("editor-create-initial-data: The config.initialData option cannot be used together with initial data passed in Editor.create().",null);const t=n.initialData||function(e){return rn(e)?function(e){return e instanceof HTMLTextAreaElement?e.value:e.innerHTML}(e):e}(e);return l.data.init(t)}).then(()=>l.fire("ready")).then(()=>l))})}}kn(Bs,Pr),kn(Bs,Ar);class Us{constructor(e){this.editor=e}destroy(){this.stopListening()}}kn(Us,Gn);class Ws{constructor(e){this.files=function(e){const n=e.files?Array.from(e.files):[],t=e.items?Array.from(e.items):[];return n.length?n:t.filter(e=>"file"===e.kind).map(e=>e.getAsFile())}(e),this._native=e}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,n){this._native.setData(e,n)}}class qs extends Fl{constructor(e){super(e);const n=this.document;function t(e,t){t.preventDefault();const l=t.dropRange?[t.dropRange]:Array.from(n.selection.getRanges()),i=new cn(n,"clipboardInput");n.fire(i,{dataTransfer:t.dataTransfer,targetRanges:l}),i.stop.called&&t.stopPropagation()}this.domEventType=["paste","copy","cut","drop","dragover"],this.listenTo(n,"paste",t,{priority:"low"}),this.listenTo(n,"drop",t,{priority:"low"})}onDomEvent(e){const n={dataTransfer:new Ws(e.clipboardData?e.clipboardData:e.dataTransfer)};"drop"==e.type&&(n.dropRange=function(e,n){const t=n.target.ownerDocument,l=n.clientX,i=n.clientY;let o;return t.caretRangeFromPoint&&t.caretRangeFromPoint(l,i)?o=t.caretRangeFromPoint(l,i):n.rangeParent&&((o=t.createRange()).setStart(n.rangeParent,n.rangeOffset),o.collapse(!0)),o?e.domConverter.domRangeToView(o):e.document.selection.getFirstRange()}(this.view,e)),this.fire(e.type,e,n)}}const $s=["figcaption","li"];class Gs extends Us{static get pluginName(){return"Clipboard"}init(){const e=this.editor,n=e.model.document,t=e.editing.view,l=t.document;function i(t,i){const o=i.dataTransfer;i.preventDefault();const r=e.data.toView(e.model.getSelectedContent(n.selection));l.fire("clipboardOutput",{dataTransfer:o,content:r,method:t.name})}this._htmlDataProcessor=new Er,t.addObserver(qs),this.listenTo(l,"clipboardInput",n=>{e.isReadOnly&&n.stop()},{priority:"highest"}),this.listenTo(l,"clipboardInput",(e,n)=>{const l=n.dataTransfer;let i="";l.getData("text/html")?i=function(e){return e.replace(/(\s+)<\/span>/g,(e,n)=>1==n.length?" ":n)}(l.getData("text/html")):l.getData("text/plain")&&(i=function(e){return(e=e.replace(//g,">").replace(/\n/g,"

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

")>-1&&(e=`

${e}

`),e}(l.getData("text/plain"))),i=this._htmlDataProcessor.toView(i),this.fire("inputTransformation",{content:i,dataTransfer:l}),t.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(e,n)=>{if(!n.content.isEmpty){const e=this.editor.model,t=this.editor.data.toModel(n.content,"$clipboardHolder");if(0==t.childCount)return;e.insertContent(t)}},{priority:"low"}),this.listenTo(l,"copy",i,{priority:"low"}),this.listenTo(l,"cut",(n,t)=>{e.isReadOnly?t.preventDefault():i(n,t)},{priority:"low"}),this.listenTo(l,"clipboardOutput",(t,l)=>{l.content.isEmpty||(l.dataTransfer.setData("text/html",this._htmlDataProcessor.toData(l.content)),l.dataTransfer.setData("text/plain",function e(n){let t="";if(n.is("text")||n.is("textProxy"))t=n.data;else if(n.is("img")&&n.hasAttribute("alt"))t=n.getAttribute("alt");else{let l=null;for(const i of n.getChildren()){const n=e(i);l&&(l.is("containerElement")||i.is("containerElement"))&&($s.includes(l.name)||$s.includes(i.name)?t+="\n":t+="\n\n"),t+=n,l=i}}return t}(l.content))),"cut"==l.method&&e.model.deleteContent(n.selection)},{priority:"low"})}}class Ks{constructor(e){this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.on("execute",e=>{this.isEnabled||e.stop()},{priority:"high"}),this.listenTo(e,"change:isReadOnly",(e,n,t)=>{t?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Js,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Js),this.refresh())}execute(){}destroy(){this.stopListening()}}function Js(e){e.return=!1,e.stop()}function*Qs(e,n){for(const t of n)t&&e.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}kn(Ks,Gn);class Zs extends Ks{execute(){const e=this.editor.model,n=e.document;e.change(t=>{!function(e,n,t,l){const i=t.isCollapsed,o=t.getFirstRange(),r=o.start.parent,s=o.end.parent;if(l.isLimit(r)||l.isLimit(s))i||r!=s||e.deleteContent(t);else if(i){const e=Qs(n.model.schema,t.getAttributes());Xs(n,o.start),n.setSelectionAttribute(e)}else{const l=!(o.start.isAtStart&&o.end.isAtEnd),i=r==s;e.deleteContent(t,{leaveUnmerged:l}),l&&(i?Xs(n,t.focus):n.setSelection(s,0))}}(this.editor.model,t,n.selection,e.schema),this.fire("afterExecute",{writer:t})})}}function Xs(e,n){e.split(n),e.setSelection(n.parent.nextSibling,0)}class eu extends _l{constructor(e){super(e);const n=this.document;n.on("keydown",(e,t)=>{if(this.isEnabled&&t.keyCode==Dt.enter){let l;n.once("enter",e=>l=e,{priority:"highest"}),n.fire("enter",new Yl(n,t.domEvent,{isSoft:t.shiftKey})),l&&l.stop.called&&e.stop()}})}observe(){}}class nu extends Us{static get pluginName(){return"Enter"}init(){const e=this.editor,n=e.editing.view,t=n.document;n.addObserver(eu),e.commands.add("enter",new Zs(e)),this.listenTo(t,"enter",(t,l)=>{l.preventDefault(),l.isSoft||(e.execute("enter"),n.scrollToTheSelection())},{priority:"low"})}}class tu extends Ks{execute(){const e=this.editor.model,n=e.document;e.change(t=>{!function(e,n,t){const l=t.isCollapsed,i=t.getFirstRange(),o=i.end.parent,r=i.start.parent==o;if(l){const l=Qs(e.schema,t.getAttributes());lu(n,i.end),n.removeSelectionAttribute(t.getAttributeKeys()),n.setSelectionAttribute(l)}else{const l=!(i.start.isAtStart&&i.end.isAtEnd);e.deleteContent(t,{leaveUnmerged:l}),r?lu(n,t.focus):l&&n.setSelection(o,0)}}(e,t,n.selection),this.fire("afterExecute",{writer:t})})}refresh(){const e=this.editor.model;this.isEnabled=function(e,n){if(n.rangeCount>1)return!1;const t=n.anchor;if(!t||!e.checkChild(t,"softBreak"))return!1;const l=n.getFirstRange(),i=l.start.parent,o=l.end.parent;return!iu(i,e)&&!iu(o,e)||i===o}(e.schema,e.document.selection)}}function lu(e,n){const t=e.createElement("softBreak");e.insert(t,n),e.setSelection(t,"after")}function iu(e,n){return!e.is("rootElement")&&(n.isLimit(e)||iu(e.parent,n))}class ou extends Us{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,n=e.conversion,t=e.editing.view,l=t.document;e.model.schema.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(e,n)=>n.createEmptyElement("br")}),t.addObserver(eu),e.commands.add("shiftEnter",new tu(e)),this.listenTo(l,"enter",(n,l)=>{l.preventDefault(),l.isSoft&&(e.execute("shiftEnter"),t.scrollToTheSelection())},{priority:"low"})}}class ru{constructor(e,n=20){this.model=e,this.size=0,this.limit=n,this.isLocked=!1,this._changeCallback=(e,n)=>{"transparent"!=n.type&&n!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch()),this._batch}input(e){this.size+=e,this.size>=this.limit&&this._reset(!0)}lock(){this.isLocked=!0}unlock(){this.isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e){this.isLocked&&!e||(this._batch=null,this.size=0)}}class su extends Ks{constructor(e,n){super(e),this._buffer=new ru(e.model,n),this._batches=new WeakSet}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const n=this.editor.model,t=n.document,l=e.text||"",i=l.length,o=e.range||t.selection.getFirstRange(),r=e.resultRange;n.enqueueChange(this._buffer.batch,e=>{const s=o.isCollapsed;this._buffer.lock(),n.deleteContent(n.createSelection(o)),l&&n.insertContent(e.createText(l,t.selection.getAttributes()),o.start),r?e.setSelection(r):s&&e.setSelection(o.start.getShiftedBy(i)),this._buffer.unlock(),this._buffer.input(i),this._batches.add(this._buffer.batch)})}}const uu=[St("arrowUp"),St("arrowRight"),St("arrowDown"),St("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let Zp=112;Zp<=135;Zp++)uu.push(Zp);function au(e){if(e.newChildren.length-e.oldChildren.length!=1)return;const n=function(e,n){const t=[];let l,i=0;return e.forEach(e=>{"equal"==e?(o(),i++):"insert"==e?(r("insert")?l.values.push(n[i]):(o(),l={type:"insert",index:i,values:[n[i]]}),i++):r("delete")?l.howMany++:(o(),l={type:"delete",index:i,howMany:1})}),o(),t;function o(){l&&(t.push(l),l=null)}function r(e){return l&&l.type==e}}(el(e.oldChildren,e.newChildren,cu),e.newChildren);if(n.length>1)return;const t=n[0];return t.values[0]&&t.values[0].is("text")?t:void 0}function cu(e,n){return e&&e.is("text")&&n&&n.is("text")?e.data===n.data:e===n}class du{constructor(e){this.editor=e,this.editing=this.editor.editing}handle(e,n){if(function(e){if(0==e.length)return!1;for(const n of e)if("children"===n.type&&!au(n))return!0;return!1}(e))this._handleContainerChildrenMutations(e,n);else for(const t of e)this._handleTextMutation(t,n),this._handleTextNodeInsertion(t)}_handleContainerChildrenMutations(e,n){const t=function(e){const n=e.map(e=>e.node).reduce((e,n)=>e.getCommonAncestor(n,{includeSelf:!0}));if(n)return n.getAncestors({includeSelf:!0,parentFirst:!0}).find(e=>e.is("containerElement")||e.is("rootElement"))}(e);if(!t)return;const l=this.editor.editing.view.domConverter.mapViewToDom(t),i=new dl,o=this.editor.data.toModel(i.domToView(l)).getChild(0),r=this.editor.editing.mapper.toModelElement(t);if(!r)return;const s=Array.from(o.getChildren()),u=Array.from(r.getChildren()),a=s[s.length-1],c=u[u.length-1];a&&a.is("softBreak")&&c&&!c.is("softBreak")&&s.pop();const d=this.editor.model.schema;if(!hu(s,d)||!hu(u,d))return;const h=s.map(e=>e.is("text")?e.data:"@").join("").replace(/\u00A0/g," "),p=u.map(e=>e.is("text")?e.data:"@").join("").replace(/\u00A0/g," ");if(p===h)return;const f=el(p,h),{firstChangeAt:m,insertions:g,deletions:v}=pu(f);let _=null;n&&(_=this.editing.mapper.toModelRange(n.getFirstRange()));const y=h.substr(m,g),b=this.editor.model.createRange(this.editor.model.createPositionAt(r,m),this.editor.model.createPositionAt(r,m+v));this.editor.execute("input",{text:y,range:b,resultRange:_})}_handleTextMutation(e,n){if("text"!=e.type)return;const t=e.newText.replace(/\u00A0/g," "),l=e.oldText.replace(/\u00A0/g," ");if(l===t)return;const i=el(l,t),{firstChangeAt:o,insertions:r,deletions:s}=pu(i);let u=null;n&&(u=this.editing.mapper.toModelRange(n.getFirstRange()));const a=this.editing.view.createPositionAt(e.node,o),c=this.editing.mapper.toModelPosition(a),d=this.editor.model.createRange(c,c.getShiftedBy(s)),h=t.substr(o,r);this.editor.execute("input",{text:h,range:d,resultRange:u})}_handleTextNodeInsertion(e){if("children"!=e.type)return;const n=au(e),t=this.editing.view.createPositionAt(e.node,n.index),l=this.editing.mapper.toModelPosition(t);this.editor.execute("input",{text:n.values[0].data.replace(/\u00A0/g," "),range:this.editor.model.createRange(l)})}}function hu(e,n){return e.every(e=>n.isInline(e))}function pu(e){let n=null,t=null;for(let o=0;o{t.deleteContent(t.document.selection)}),e.unlock()}l.document.on(Mt?"beforeinput":"keydown",(e,n)=>o(n),{priority:"lowest"}),l.document.on("compositionstart",(function(){const e=t.document,n=1!==e.selection.rangeCount||e.selection.getFirstRange().isFlat;e.selection.isCollapsed||n||r()}),{priority:"lowest"}),l.document.on("compositionend",()=>{n=t.createSelection(t.document.selection)},{priority:"lowest"})}(e),function(e){e.editing.view.document.on("mutations",(n,t,l)=>{new du(e).handle(t,l)})}(e)}isInput(e){return this.editor.commands.get("input")._batches.has(e)}}class mu extends Ks{constructor(e,n){super(e),this.direction=n,this._buffer=new ru(e.model,e.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(e={}){const n=this.editor.model,t=n.document;n.enqueueChange(this._buffer.batch,l=>{this._buffer.lock();const i=l.createSelection(e.selection||t.selection),o=i.isCollapsed;if(i.isCollapsed&&n.modifySelection(i,{direction:this.direction,unit:e.unit}),this._shouldEntireContentBeReplacedWithParagraph(e.sequence||1))return void this._replaceEntireContentWithParagraph(l);if(i.isCollapsed)return;let r=0;i.getFirstRange().getMinimalFlatRanges().forEach(e=>{r+=ut(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),n.deleteContent(i,{doNotResetEntireContent:o}),this._buffer.input(r),l.setSelection(i),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const n=this.editor.model,t=n.document.selection,l=n.schema.getLimitElement(t);if(!t.isCollapsed||!t.containsEntireContent(l))return!1;if(!n.schema.checkChild(l,"paragraph"))return!1;const i=l.getChild(0);return!i||"paragraph"!==i.name}_replaceEntireContentWithParagraph(e){const n=this.editor.model,t=n.schema.getLimitElement(n.document.selection),l=e.createElement("paragraph");e.remove(e.createRangeIn(t)),e.insert(l,t),e.setSelection(l,0)}}class gu extends _l{constructor(e){super(e);const n=e.document;let t=0;function l(e,t,l){let i;n.once("delete",e=>i=e,{priority:Number.POSITIVE_INFINITY}),n.fire("delete",new Yl(n,t,l)),i&&i.stop.called&&e.stop()}n.on("keyup",(e,n)=>{n.keyCode!=Dt.delete&&n.keyCode!=Dt.backspace||(t=0)}),n.on("keydown",(e,n)=>{const i={};if(n.keyCode==Dt.delete)i.direction="forward",i.unit="character";else{if(n.keyCode!=Dt.backspace)return;i.direction="backward",i.unit="codePoint"}i.unit=(yt?n.altKey:n.ctrlKey)?"word":i.unit,i.sequence=++t,l(e,n.domEvent,i)}),Mt&&n.on("beforeinput",(n,t)=>{if("deleteContentBackward"!=t.domEvent.inputType)return;const i={unit:"codepoint",direction:"backward",sequence:1},o=t.domTarget.ownerDocument.defaultView.getSelection();o.anchorNode==o.focusNode&&o.anchorOffset+1!=o.focusOffset&&(i.selectionToRemove=e.domConverter.domSelectionToView(o)),l(n,t.domEvent,i)})}observe(){}}class vu extends Us{static get pluginName(){return"Delete"}init(){const e=this.editor,n=e.editing.view,t=n.document;if(n.addObserver(gu),e.commands.add("forwardDelete",new mu(e,"forward")),e.commands.add("delete",new mu(e,"backward")),this.listenTo(t,"delete",(t,l)=>{const i={unit:l.unit,sequence:l.sequence};if(l.selectionToRemove){const n=e.model.createSelection(),t=[];for(const i of l.selectionToRemove.getRanges())t.push(e.editing.mapper.toModelRange(i));n.setTo(t),i.selection=n}e.execute("forward"==l.direction?"forwardDelete":"delete",i),l.preventDefault(),n.scrollToTheSelection()}),Mt){let e=null;this.listenTo(t,"delete",(n,t)=>{const l=t.domTarget.ownerDocument.defaultView.getSelection();e={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}},{priority:"lowest"}),this.listenTo(t,"keyup",(n,t)=>{if(e){const n=t.domTarget.ownerDocument.defaultView.getSelection();n.collapse(e.anchorNode,e.anchorOffset),n.extend(e.focusNode,e.focusOffset),e=null}})}}}class _u extends Us{static get requires(){return[fu,vu]}static get pluginName(){return"Typing"}}class yu extends Po{get type(){return"noop"}clone(){return new yu(this.baseVersion)}getReversed(){return new yu(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}const bu=new Map;function wu(e,n,t){let l=bu.get(e);l||(l=new Map,bu.set(e,l)),l.set(n,t)}function ku(e){return[e]}function Mu(e,n,t={}){const l=function(e,n){const t=bu.get(e);return t&&t.has(n)?t.get(n):ku}(e.constructor,n.constructor);try{return l(e=e.clone(),n,t)}catch(e){throw e}}function Cu(e,n,t){e=e.slice(),n=n.slice();const l=new xu(t.document,t.useRelations,t.forceWeakRemove);l.setOriginalOperations(e),l.setOriginalOperations(n);const i=l.originalOperations;if(0==e.length||0==n.length)return{operationsA:e,operationsB:n,originalOperations:i};const o=new WeakMap;for(const u of e)o.set(u,0);const r={nextBaseVersionA:e[e.length-1].baseVersion+1,nextBaseVersionB:n[n.length-1].baseVersion+1,originalOperationsACount:e.length,originalOperationsBCount:n.length};let s=0;for(;s{if(e.key===n.key){const l=e.range.getDifference(n.range).map(n=>new Vo(n,e.key,e.oldValue,e.newValue,0)),i=e.range.getIntersection(n.range);return i&&t.aIsStrong&&l.push(new Vo(i,n.key,n.newValue,e.newValue,0)),0==l.length?[new yu(0)]:l}return[e]}),wu(Vo,Bo,(e,n)=>{if(e.range.start.hasSameParentAs(n.position)&&e.range.containsPosition(n.position)){const t=e.range._getTransformedByInsertion(n.position,n.howMany,!n.shouldReceiveAttributes).map(n=>new Vo(n,e.key,e.oldValue,e.newValue,e.baseVersion));if(n.shouldReceiveAttributes){const l=Tu(n,e.key,e.oldValue);l&&t.unshift(l)}return t}return e.range=e.range._getTransformedByInsertion(n.position,n.howMany,!1)[0],[e]}),wu(Vo,$o,(e,n)=>{const t=[];e.range.start.hasSameParentAs(n.deletionPosition)&&(e.range.containsPosition(n.deletionPosition)||e.range.start.isEqual(n.deletionPosition))&&t.push(Si._createFromPositionAndShift(n.graveyardPosition,1));const l=e.range._getTransformedByMergeOperation(n);return l.isCollapsed||t.push(l),t.map(n=>new Vo(n,e.key,e.oldValue,e.newValue,e.baseVersion))}),wu(Vo,zo,(e,n)=>function(e,n){const t=Si._createFromPositionAndShift(n.sourcePosition,n.howMany);let l=null,i=[];t.containsRange(e,!0)?l=e:e.start.hasSameParentAs(t.start)?(i=e.getDifference(t),l=e.getIntersection(t)):i=[e];const o=[];for(let r of i){r=r._getTransformedByDeletion(n.sourcePosition,n.howMany);const e=n.getMovedRangeStart(),t=r.start.hasSameParentAs(e);r=r._getTransformedByInsertion(e,n.howMany,t),o.push(...r)}return l&&o.push(l._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany,!1)[0]),o}(e.range,n).map(n=>new Vo(n,e.key,e.oldValue,e.newValue,e.baseVersion))),wu(Vo,Go,(e,n)=>{if(e.range.end.isEqual(n.insertionPosition))return n.graveyardPosition||e.range.end.offset++,[e];if(e.range.start.hasSameParentAs(n.splitPosition)&&e.range.containsPosition(n.splitPosition)){const t=e.clone();return t.range=new Si(n.moveTargetPosition.clone(),e.range.end._getCombined(n.splitPosition,n.moveTargetPosition)),e.range.end=n.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,t]}return e.range=e.range._getTransformedBySplitOperation(n),[e]}),wu(Bo,Vo,(e,n)=>{const t=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(n.range.start)&&n.range.containsPosition(e.position)){const l=Tu(e,n.key,n.newValue);l&&t.push(l)}return t}),wu(Bo,Bo,(e,n,t)=>(e.position.isEqual(n.position)&&t.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(n)),[e])),wu(Bo,zo,(e,n)=>(e.position=e.position._getTransformedByMoveOperation(n),[e])),wu(Bo,Go,(e,n)=>(e.position=e.position._getTransformedBySplitOperation(n),[e])),wu(Bo,$o,(e,n)=>(e.position=e.position._getTransformedByMergeOperation(n),[e])),wu(Uo,Bo,(e,n)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(n)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(n)[0]),[e])),wu(Uo,Uo,(e,n,t)=>{if(e.name==n.name){if(!t.aIsStrong)return[new yu(0)];e.oldRange=n.newRange?n.newRange.clone():null}return[e]}),wu(Uo,$o,(e,n)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(n)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(n)),[e])),wu(Uo,zo,(e,n,t)=>{if(e.oldRange&&(e.oldRange=Si._createFromRanges(e.oldRange._getTransformedByMoveOperation(n))),e.newRange){if(t.abRelation){const l=Si._createFromRanges(e.newRange._getTransformedByMoveOperation(n));if("left"==t.abRelation.side&&n.targetPosition.isEqual(e.newRange.start))return e.newRange.start.path=t.abRelation.path,e.newRange.end=l.end,[e];if("right"==t.abRelation.side&&n.targetPosition.isEqual(e.newRange.end))return e.newRange.start=l.start,e.newRange.end.path=t.abRelation.path,[e]}e.newRange=Si._createFromRanges(e.newRange._getTransformedByMoveOperation(n))}return[e]}),wu(Uo,Go,(e,n,t)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(n)),e.newRange){if(t.abRelation){const l=e.newRange._getTransformedBySplitOperation(n);return e.newRange.start.isEqual(n.splitPosition)&&t.abRelation.wasStartBeforeMergedElement?e.newRange.start=Di._createAt(n.insertionPosition):e.newRange.start.isEqual(n.splitPosition)&&!t.abRelation.wasInLeftElement&&(e.newRange.start=Di._createAt(n.moveTargetPosition)),e.newRange.end=e.newRange.end.isEqual(n.splitPosition)&&t.abRelation.wasInRightElement?Di._createAt(n.moveTargetPosition):e.newRange.end.isEqual(n.splitPosition)&&t.abRelation.wasEndBeforeMergedElement?Di._createAt(n.insertionPosition):l.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(n)}return[e]}),wu($o,Bo,(e,n)=>(e.sourcePosition.hasSameParentAs(n.position)&&(e.howMany+=n.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(n),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(n),[e])),wu($o,$o,(e,n,t)=>{if(e.sourcePosition.isEqual(n.sourcePosition)&&e.targetPosition.isEqual(n.targetPosition)){if(t.bWasUndone){const t=n.graveyardPosition.path.slice();return t.push(0),e.sourcePosition=new Di(n.graveyardPosition.root,t),e.howMany=0,[e]}return[new yu(0)]}if(e.sourcePosition.isEqual(n.sourcePosition)&&!e.targetPosition.isEqual(n.targetPosition)&&!t.bWasUndone&&"splitAtSource"!=t.abRelation){const l="$graveyard"==e.targetPosition.root.rootName,i="$graveyard"==n.targetPosition.root.rootName;if(i&&!l||(!l||i)&&t.aIsStrong){const t=n.targetPosition._getTransformedByMergeOperation(n),l=e.targetPosition._getTransformedByMergeOperation(n);return[new zo(t,e.howMany,l,0)]}return[new yu(0)]}return e.sourcePosition.hasSameParentAs(n.targetPosition)&&(e.howMany+=n.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMergeOperation(n),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(n),e.graveyardPosition.isEqual(n.graveyardPosition)&&t.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(n)),[e]}),wu($o,zo,(e,n,t)=>{const l=Si._createFromPositionAndShift(n.sourcePosition,n.howMany);return"remove"==n.type&&!t.bWasUndone&&!t.forceWeakRemove&&e.deletionPosition.hasSameParentAs(n.sourcePosition)&&l.containsPosition(e.sourcePosition)?[new yu(0)]:(e.sourcePosition.hasSameParentAs(n.targetPosition)&&(e.howMany+=n.howMany),e.sourcePosition.hasSameParentAs(n.sourcePosition)&&(e.howMany-=n.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMoveOperation(n),e.targetPosition=e.targetPosition._getTransformedByMoveOperation(n),e.graveyardPosition.isEqual(n.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(n)),[e])}),wu($o,Go,(e,n,t)=>{if(n.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(n.graveyardPosition,1),e.deletionPosition.isEqual(n.graveyardPosition)&&(e.howMany=n.howMany)),e.targetPosition.isEqual(n.splitPosition)){const l=0!=n.howMany,i=n.graveyardPosition&&e.deletionPosition.isEqual(n.graveyardPosition);if(l||i||"mergeTargetNotMoved"==t.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(n),[e]}if(e.sourcePosition.isEqual(n.splitPosition)){if("mergeSourceNotMoved"==t.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(n),[e];if("mergeSameElement"==t.abRelation||e.sourcePosition.offset>0)return e.sourcePosition=n.moveTargetPosition.clone(),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(n),[e]}return e.sourcePosition.hasSameParentAs(n.splitPosition)&&(e.howMany=n.splitPosition.offset),e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(n),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(n),[e]}),wu(zo,Bo,(e,n)=>{const t=Si._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(n,!1)[0];return e.sourcePosition=t.start,e.howMany=t.end.offset-t.start.offset,e.targetPosition.isEqual(n.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(n)),[e]}),wu(zo,zo,(e,n,t)=>{const l=Si._createFromPositionAndShift(e.sourcePosition,e.howMany),i=Si._createFromPositionAndShift(n.sourcePosition,n.howMany);let o,r=t.aIsStrong,s=!t.aIsStrong;if("insertBefore"==t.abRelation||"insertAfter"==t.baRelation?s=!0:"insertAfter"!=t.abRelation&&"insertBefore"!=t.baRelation||(s=!1),o=e.targetPosition.isEqual(n.targetPosition)&&s?e.targetPosition._getTransformedByDeletion(n.sourcePosition,n.howMany):e.targetPosition._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany),Lu(e,n)&&Lu(n,e))return[n.getReversed()];if(l.containsPosition(n.targetPosition)&&l.containsRange(i,!0))return l.start=l.start._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany),l.end=l.end._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany),Pu([l],o);if(i.containsPosition(e.targetPosition)&&i.containsRange(l,!0))return l.start=l.start._getCombined(n.sourcePosition,n.getMovedRangeStart()),l.end=l.end._getCombined(n.sourcePosition,n.getMovedRangeStart()),Pu([l],o);const u=Mn(e.sourcePosition.getParentPath(),n.sourcePosition.getParentPath());if("prefix"==u||"extension"==u)return l.start=l.start._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany),l.end=l.end._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany),Pu([l],o);"remove"!=e.type||"remove"==n.type||t.aWasUndone||t.forceWeakRemove?"remove"==e.type||"remove"!=n.type||t.bWasUndone||t.forceWeakRemove||(r=!1):r=!0;const a=[],c=l.getDifference(i);for(const h of c){h.start=h.start._getTransformedByDeletion(n.sourcePosition,n.howMany),h.end=h.end._getTransformedByDeletion(n.sourcePosition,n.howMany);const e="same"==Mn(h.start.getParentPath(),n.getMovedRangeStart().getParentPath()),t=h._getTransformedByInsertion(n.getMovedRangeStart(),n.howMany,e);a.push(...t)}const d=l.getIntersection(i);return null!==d&&r&&(d.start=d.start._getCombined(n.sourcePosition,n.getMovedRangeStart()),d.end=d.end._getCombined(n.sourcePosition,n.getMovedRangeStart()),0===a.length?a.push(d):1==a.length?i.start.isBefore(l.start)||i.start.isEqual(l.start)?a.unshift(d):a.push(d):a.splice(1,0,d)),0===a.length?[new yu(e.baseVersion)]:Pu(a,o)}),wu(zo,Go,(e,n,t)=>{let l=e.targetPosition.clone();e.targetPosition.isEqual(n.insertionPosition)&&n.graveyardPosition&&"moveTargetAfter"!=t.abRelation||(l=e.targetPosition._getTransformedBySplitOperation(n));const i=Si._createFromPositionAndShift(e.sourcePosition,e.howMany);if(i.end.isEqual(n.insertionPosition))return n.graveyardPosition||e.howMany++,e.targetPosition=l,[e];if(i.start.hasSameParentAs(n.splitPosition)&&i.containsPosition(n.splitPosition)){let e=new Si(n.splitPosition,i.end);return e=e._getTransformedBySplitOperation(n),Pu([new Si(i.start,n.splitPosition),e],l)}e.targetPosition.isEqual(n.splitPosition)&&"insertAtSource"==t.abRelation&&(l=n.moveTargetPosition),e.targetPosition.isEqual(n.insertionPosition)&&"insertBetween"==t.abRelation&&(l=e.targetPosition);const o=[i._getTransformedBySplitOperation(n)];if(n.graveyardPosition){const l=i.start.isEqual(n.graveyardPosition)||i.containsPosition(n.graveyardPosition);e.howMany>1&&l&&!t.aWasUndone&&o.push(Si._createFromPositionAndShift(n.insertionPosition,1))}return Pu(o,l)}),wu(zo,$o,(e,n,t)=>{const l=Si._createFromPositionAndShift(e.sourcePosition,e.howMany);if(n.deletionPosition.hasSameParentAs(e.sourcePosition)&&l.containsPosition(n.sourcePosition))if("remove"!=e.type||t.forceWeakRemove){if(1==e.howMany)return t.bWasUndone?(e.sourcePosition=n.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(n),[e]):[new yu(0)]}else if(!t.aWasUndone){const t=[];let l=n.graveyardPosition.clone(),i=n.targetPosition._getTransformedByMergeOperation(n);e.howMany>1&&(t.push(new zo(e.sourcePosition,e.howMany-1,e.targetPosition,0)),l=l._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1),i=i._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1));const o=n.deletionPosition._getCombined(e.sourcePosition,e.targetPosition),r=new zo(l,1,o,0),s=r.getMovedRangeStart().path.slice();s.push(0);const u=new Di(r.targetPosition.root,s);i=i._getTransformedByMove(l,o,1);const a=new zo(i,n.howMany,u,0);return t.push(r),t.push(a),t}const i=Si._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(n);return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(n),[e]}),wu(Wo,Bo,(e,n)=>(e.position=e.position._getTransformedByInsertOperation(n),[e])),wu(Wo,$o,(e,n)=>e.position.isEqual(n.deletionPosition)?(e.position=n.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(n),[e])),wu(Wo,zo,(e,n)=>(e.position=e.position._getTransformedByMoveOperation(n),[e])),wu(Wo,Wo,(e,n,t)=>{if(e.position.isEqual(n.position)){if(!t.aIsStrong)return[new yu(0)];e.oldName=n.newName}return[e]}),wu(Wo,Go,(e,n)=>"same"!=Mn(e.position.path,n.splitPosition.getParentPath())||n.graveyardPosition?(e.position=e.position._getTransformedBySplitOperation(n),[e]):[e,new Wo(e.position.getShiftedBy(1),e.oldName,e.newName,0)]),wu(qo,qo,(e,n,t)=>{if(e.root===n.root&&e.key===n.key){if(!t.aIsStrong||e.newValue===n.newValue)return[new yu(0)];e.oldValue=n.newValue}return[e]}),wu(Go,Bo,(e,n)=>(e.splitPosition.hasSameParentAs(n.position)&&e.splitPosition.offset{if(!e.graveyardPosition&&!t.bWasUndone&&e.splitPosition.hasSameParentAs(n.sourcePosition)){const t=n.graveyardPosition.path.slice();t.push(0);const l=new Di(n.graveyardPosition.root,t),i=Go.getInsertionPosition(new Di(n.graveyardPosition.root,t)),o=new Go(l,0,null,0);return o.insertionPosition=i,e.splitPosition=e.splitPosition._getTransformedByMergeOperation(n),e.insertionPosition=Go.getInsertionPosition(e.splitPosition),e.graveyardPosition=o.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[o,e]}return e.splitPosition.hasSameParentAs(n.deletionPosition)&&!e.splitPosition.isAfter(n.deletionPosition)&&e.howMany--,e.splitPosition.hasSameParentAs(n.targetPosition)&&(e.howMany+=n.howMany),e.splitPosition=e.splitPosition._getTransformedByMergeOperation(n),e.insertionPosition=Go.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(n)),[e]}),wu(Go,zo,(e,n,t)=>{const l=Si._createFromPositionAndShift(n.sourcePosition,n.howMany);if(e.graveyardPosition){const i=l.start.isEqual(e.graveyardPosition)||l.containsPosition(e.graveyardPosition);if(!t.bWasUndone&&i){const t=e.splitPosition._getTransformedByMoveOperation(n),l=e.graveyardPosition._getTransformedByMoveOperation(n),i=l.path.slice();i.push(0);const o=new Di(l.root,i);return[new zo(t,e.howMany,o,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(n)}return e.splitPosition.hasSameParentAs(n.sourcePosition)&&l.containsPosition(e.splitPosition)?(e.howMany-=n.howMany-(e.splitPosition.offset-n.sourcePosition.offset),e.splitPosition.hasSameParentAs(n.targetPosition)&&e.splitPosition.offset{if(e.splitPosition.isEqual(n.splitPosition)){if(!e.graveyardPosition&&!n.graveyardPosition)return[new yu(0)];if(e.graveyardPosition&&n.graveyardPosition&&e.graveyardPosition.isEqual(n.graveyardPosition))return[new yu(0)];if("splitBefore"==t.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(n),[e]}if(e.graveyardPosition&&n.graveyardPosition&&e.graveyardPosition.isEqual(n.graveyardPosition)){const l="$graveyard"==e.splitPosition.root.rootName,i="$graveyard"==n.splitPosition.root.rootName;if(i&&!l||(!l||i)&&t.aIsStrong){const t=[];return n.howMany&&t.push(new zo(n.moveTargetPosition,n.howMany,n.splitPosition,0)),e.howMany&&t.push(new zo(e.splitPosition,e.howMany,e.moveTargetPosition,0)),t}return[new yu(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(n)),e.splitPosition.isEqual(n.insertionPosition)&&"splitBefore"==t.abRelation)return e.howMany++,[e];if(n.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==t.baRelation){const t=n.insertionPosition.path.slice();t.push(0);const l=new Di(n.insertionPosition.root,t);return[e,new zo(e.insertionPosition,1,l,0)]}return e.splitPosition.hasSameParentAs(n.splitPosition)&&e.splitPosition.offset0}addBatch(e){const n=this.editor.model.document.selection,t={ranges:n.hasOwnRange?Array.from(n.getRanges()):[],isBackward:n.isBackward};this._stack.push({batch:e,selection:t}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,n,t){const l=this.editor.model,i=l.document,o=[];for(const r of e){const e=Iu(r,t).find(e=>e.start.root!=i.graveyard);e&&o.push(e)}o.length&&l.change(e=>{e.setSelection(o,{backward:n})})}_undo(e,n){const t=this.editor.model,l=t.document;this._createdBatches.add(n);const i=e.operations.slice().filter(e=>e.isDocumentOperation);i.reverse();for(const o of i){const e=Array.from(l.history.getOperations(o.baseVersion+1)),i=Cu([o.getReversed()],e,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const r of i)n.addOperation(r),t.applyOperation(r),l.history.setOperationAsUndone(o,r)}}}function Iu(e,n){const t=e.getTransformedByOperations(n);t.sort((e,n)=>e.start.isBefore(n.start)?-1:1);for(let l=1;ln.batch==e):this._stack.length-1,t=this._stack.splice(n,1)[0],l=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(l,()=>{this._undo(t.batch,l);const e=this.editor.model.document.history.getOperations(t.batch.baseVersion);this._restoreSelection(t.selection.ranges,t.selection.isBackward,e),this.fire("revert",t.batch,l)}),this.refresh()}}class Ou extends Au{execute(){const e=this._stack.pop(),n=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(n,()=>{const t=this.editor.model.document.history.getOperations(e.batch.operations[e.batch.operations.length-1].baseVersion+1);this._restoreSelection(e.selection.ranges,e.selection.isBackward,t),this._undo(e.batch,n)}),this.refresh()}}class ju extends Us{static get pluginName(){return"UndoEditing"}constructor(e){super(e),this._batchRegistry=new WeakSet}init(){const e=this.editor;this._undoCommand=new Eu(e),this._redoCommand=new Ou(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(e,n)=>{const t=n[0];if(!t.isDocumentOperation)return;const l=t.batch,i=this._redoCommand._createdBatches.has(l),o=this._undoCommand._createdBatches.has(l);this._batchRegistry.has(l)||"transparent"==l.type&&!i&&!o||(i?this._undoCommand.addBatch(l):o||(this._undoCommand.addBatch(l),this._redoCommand.clearStack()),this._batchRegistry.add(l))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(e,n,t)=>{this._redoCommand.addBatch(t)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}var Yu='',Fu='';class Nu extends Us{init(){const e=this.editor,n=e.locale,t=e.t,l="ltr"==n.uiLanguageDirection?Yu:Fu,i="ltr"==n.uiLanguageDirection?Fu:Yu;this._addButton("undo",t("bj"),"CTRL+Z",l),this._addButton("redo",t("bk"),"CTRL+Y",i)}_addButton(e,n,t,l){const i=this.editor;i.ui.componentFactory.add(e,o=>{const r=i.commands.get(e),s=new Ls(o);return s.set({label:n,icon:l,keystroke:t,tooltip:!0}),s.bind("isEnabled").to(r,"isEnabled"),this.listenTo(s,"execute",()=>i.execute(e)),s})}}class Ru extends Us{static get requires(){return[ju,Nu]}static get pluginName(){return"Undo"}}class Vu extends Us{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new dt({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new an.b("pendingactions-add-invalid-message: The message must be a string.",this);const n=Object.create(Gn);return n.set("message",e),this._actions.add(n),this.hasAny=!0,n}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}class Hu{constructor(){const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=e=>{this.loaded=e.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const n=this._reader;return this.total=e.size,new Promise((t,l)=>{n.onload=()=>{const e=n.result;this._data=e,t(e)},n.onerror=()=>{l("error")},n.onabort=()=>{l("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}kn(Hu,Gn);class zu extends Us{static get pluginName(){return"FileRepository"}static get requires(){return[Vu]}init(){this.loaders=new dt,this.loaders.on("add",()=>this._updatePendingAction()),this.loaders.on("remove",()=>this._updatePendingAction()),this._loadersMap=new Map,this._pendingAction=null,this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,n)=>n?e/n*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return console.warn(Object(an.a)("filerepository-no-upload-adapter: Upload adapter is not defined.")),null;const n=new Bu(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(n),this._loadersMap.set(e,n),e instanceof Promise&&n.file.then(e=>{this._loadersMap.set(e,n)}).catch(()=>{}),n.on("change:uploaded",()=>{let e=0;for(const n of this.loaders)e+=n.uploaded;this.uploaded=e}),n.on("change:uploadTotal",()=>{let e=0;for(const n of this.loaders)n.uploadTotal&&(e+=n.uploadTotal);this.uploadTotal=e}),n}destroyLoader(e){const n=e instanceof Bu?e:this.getLoader(e);n._destroy(),this.loaders.remove(n),this._loadersMap.forEach((e,t)=>{e===n&&this._loadersMap.delete(t)})}_updatePendingAction(){const e=this.editor.plugins.get(Vu);if(this.loaders.length){if(!this._pendingAction){const n=this.editor.t,t=e=>`${n("ay")} ${parseInt(e)}%.`;this._pendingAction=e.add(t(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",t)}}else e.remove(this._pendingAction),this._pendingAction=null}}kn(zu,Gn);class Bu{constructor(e,n){this.id=dn(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=n(this),this._reader=new Hu,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,n)=>n?e/n*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new an.b("filerepository-read-wrong-status: You cannot call read if the status is different than idle.",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if("reading"!==this.status)throw this.status;return this.status="idle",e}).catch(e=>{if("aborted"===e)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:e})}upload(){if("idle"!=this.status)throw new an.b("filerepository-upload-wrong-status: You cannot call upload if the status is different than idle.",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{if("aborted"===this.status)throw"aborted";throw this.status="error",e})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==e?this._reader.abort():"uploading"==e&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const n={};return n.promise=new Promise((t,l)=>{n.rejecter=l,n.isFulfilled=!1,e.then(e=>{n.isFulfilled=!0,t(e)}).catch(e=>{n.isFulfilled=!0,l(e)})}),n}}kn(Bu,Gn);const Uu="abcdefghijklmnopqrstuvwxyz0123456789";class Wu extends Us{static get requires(){return[zu]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(zu).createUploadAdapter=n=>new qu(n,e,this.editor.t))}}class qu{constructor(e,n,t){this.loader=e,this.url=n,this.t=t}upload(){return this.loader.file.then(e=>new Promise((n,t)=>{this._initRequest(),this._initListeners(n,t,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,n,t){const l=this.xhr,i=this.loader,o=(0,this.t)("a")+` ${t.name}.`;l.addEventListener("error",()=>n(o)),l.addEventListener("abort",()=>n()),l.addEventListener("load",()=>{const t=l.response;if(!t||!t.uploaded)return n(t&&t.error&&t.error.message?t.error.message:o);e({default:t.url})}),l.upload&&l.upload.addEventListener("progress",e=>{e.lengthComputable&&(i.uploadTotal=e.total,i.uploaded=e.loaded)})}_sendRequest(e){const n=new FormData;n.append("upload",e),n.append("ckCsrfToken",function(){let e=function(e){e=e.toLowerCase();const n=document.cookie.split(";");for(const t of n){const n=t.split("=");if(decodeURIComponent(n[0].trim().toLowerCase())===e)return decodeURIComponent(n[1])}return null}("ckCsrfToken");return e&&40==e.length||(e=function(e){let n="";const t=new Uint8Array(40);window.crypto.getRandomValues(t);for(let l=0;l.5?e.toUpperCase():e}return n}(),function(e,n){document.cookie=encodeURIComponent("ckCsrfToken")+"="+encodeURIComponent(n)+";path=/"}(0,e)),e}()),this.xhr.send(n)}}class $u{static get pluginName(){return"BlockAutoformatEditing"}constructor(e,n,t){let l,i=null;"function"==typeof t?l=t:(i=e.commands.get(t),l=()=>{e.execute(t)}),e.model.document.on("change",(t,o)=>{if(i&&!i.isEnabled)return;if("transparent"==o.type)return;const r=Array.from(e.model.document.differ.getChanges()),s=r[0];if(1!=r.length||"insert"!==s.type||"$text"!=s.name||1!=s.length)return;const u=s.position.textNode||s.position.nodeAfter;if(!u.parent.is("paragraph"))return;const a=n.exec(u.data);a&&e.model.enqueueChange(e=>{const n=e.createPositionAt(u.parent,0),t=e.createPositionAt(u.parent,a[0].length),i=new Ni(n,t);!1!==l({match:a})&&e.remove(i),i.detach()})})}}class Gu{static get pluginName(){return"InlineAutoformatEditing"}constructor(e,n,t){let l,i,o,r;n instanceof RegExp?l=n:o=n,"string"==typeof t?i=t:r=t,o=o||(e=>{let n;const t=[],i=[];for(;null!==(n=l.exec(e))&&!(n&&n.length<4);){let{index:e,1:l,2:o,3:r}=n;const s=[e+=n[0].length-(l+o+r).length,e+l.length],u=[e+l.length+o.length,e+l.length+o.length+r.length];t.push(s),t.push(u),i.push([e+l.length,e+l.length+o.length])}return{remove:t,format:i}}),r=r||((n,t)=>{const l=e.model.schema.getValidRanges(t,i);for(const e of l)n.setAttribute(i,!0,e);n.removeSelectionAttribute(i)}),e.model.document.on("change",(n,t)=>{if("transparent"==t.type)return;const l=e.model,i=l.document.selection;if(!i.isCollapsed)return;const s=Array.from(l.document.differ.getChanges()),u=s[0];if(1!=s.length||"insert"!==u.type||"$text"!=u.name||1!=u.length)return;const a=i.focus,c=a.parent,{text:d,range:h}=function(e,n){let t=e.start;return{text:Array.from(e.getItems()).reduce((e,l)=>l.is("text")||l.is("textProxy")?e+l.data:(t=n.createPositionAfter(l),""),""),range:n.createRange(t,e.end)}}(l.createRange(l.createPositionAt(c,0),a),l),p=o(d),f=Ku(h.start,p.format,l),m=Ku(h.start,p.remove,l);f.length&&m.length&&l.enqueueChange(e=>{if(!1!==r(e,f))for(const n of m.reverse())e.remove(n)})})}}function Ku(e,n,t){return n.filter(e=>void 0!==e[0]&&void 0!==e[1]).map(n=>t.createRange(e.getShiftedBy(n[0]),e.getShiftedBy(n[1])))}function Ju(e,n){return(t,l)=>{if(!e.commands.get(n).isEnabled)return!1;const i=e.model.schema.getValidRanges(l,n);for(const e of i)t.setAttribute(n,!0,e);t.removeSelectionAttribute(n)}}class Qu extends Ks{constructor(e,n){super(e),this.attributeKey=n}refresh(){const e=this.editor.model,n=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(n.selection,this.attributeKey)}execute(e={}){const n=this.editor.model,t=n.document.selection,l=void 0===e.forceValue?!this.value:e.forceValue;n.change(e=>{if(t.isCollapsed)l?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const i=n.schema.getValidRanges(t.getRanges(),this.attributeKey);for(const n of i)l?e.setAttribute(this.attributeKey,l,n):e.removeAttribute(this.attributeKey,n)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,n=e.schema,t=e.document.selection;if(t.isCollapsed)return t.hasAttribute(this.attributeKey);for(const l of t.getRanges())for(const e of l.getItems())if(n.checkAttribute(e,this.attributeKey))return e.hasAttribute(this.attributeKey);return!1}}const Zu="bold";class Xu extends Us{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Zu}),e.model.schema.setAttributeProperties(Zu,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Zu,view:"strong",upcastAlso:["b",e=>{const n=e.getStyle("font-weight");return n?"bold"==n||Number(n)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),e.commands.add(Zu,new Qu(e,Zu)),e.keystrokes.set("CTRL+B",Zu)}}const ea="bold";class na extends Us{init(){const e=this.editor,n=e.t;e.ui.componentFactory.add(ea,t=>{const l=e.commands.get(ea),i=new Ls(t);return i.set({label:n("d"),icon:'',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(l,"value","isEnabled"),this.listenTo(i,"execute",()=>e.execute(ea)),i})}}const ta="italic";class la extends Us{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:ta}),e.model.schema.setAttributeProperties(ta,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:ta,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(ta,new Qu(e,ta)),e.keystrokes.set("CTRL+I",ta)}}const ia="italic";class oa extends Us{init(){const e=this.editor,n=e.t;e.ui.componentFactory.add(ia,t=>{const l=e.commands.get(ia),i=new Ls(t);return i.set({label:n("al"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(l,"value","isEnabled"),this.listenTo(i,"execute",()=>e.execute(ia)),i})}}function ra(e){const n=e.next();return n.done?null:n.value}class sa extends Ks{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const n=this.editor.model,t=n.schema,l=Array.from(n.document.selection.getSelectedBlocks()),i=void 0===e.forceValue?!this.value:e.forceValue;n.change(e=>{if(i){const n=l.filter(e=>ua(e)||ca(t,e));this._applyQuote(e,n)}else this._removeQuote(e,l.filter(ua))})}_getValue(){const e=ra(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!ua(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.schema,n=ra(this.editor.model.document.selection.getSelectedBlocks());return!!n&&ca(e,n)}_removeQuote(e,n){aa(e,n).reverse().forEach(n=>{if(n.start.isAtStart&&n.end.isAtEnd)return void e.unwrap(n.start.parent);if(n.start.isAtStart){const t=e.createPositionBefore(n.start.parent);return void e.move(n,t)}n.end.isAtEnd||e.split(n.end);const t=e.createPositionAfter(n.end.parent);e.move(n,t)})}_applyQuote(e,n){const t=[];aa(e,n).reverse().forEach(n=>{let l=ua(n.start);l||(l=e.createElement("blockQuote"),e.wrap(n,l)),t.push(l)}),t.reverse().reduce((n,t)=>n.nextSibling==t?(e.merge(e.createPositionAfter(n)),n):t)}}function ua(e){return"blockQuote"==e.parent.name?e.parent:null}function aa(e,n){let t,l=0;const i=[];for(;l{if(e.endsWith("blockQuote")&&"blockQuote"==n.name)return!1}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(t=>{const l=e.model.document.differ.getChanges();for(const e of l)if("insert"==e.type){const l=e.position.nodeAfter;if(!l)continue;if(l.is("blockQuote")&&l.isEmpty)return t.remove(l),!0;if(l.is("blockQuote")&&!n.checkChild(e.position,l))return t.unwrap(l),!0;if(l.is("element")){const e=t.createRangeIn(l);for(const l of e.getItems())if(l.is("blockQuote")&&!n.checkChild(t.createPositionBefore(l),l))return t.unwrap(l),!0}}else if("remove"==e.type){const n=e.position.parent;if(n.is("blockQuote")&&n.isEmpty)return t.remove(n),!0}return!1})}afterInit(){const e=this.editor.commands.get("blockQuote");this.listenTo(this.editor.editing.view.document,"enter",(n,t)=>{const l=this.editor.model.document,i=l.selection.getLastPosition().parent;l.selection.isCollapsed&&i.isEmpty&&e.value&&(this.editor.execute("blockQuote"),this.editor.editing.view.scrollToTheSelection(),t.preventDefault(),n.stop())})}}t(44);class ha extends Us{init(){const e=this.editor,n=e.t;e.ui.componentFactory.add("blockQuote",t=>{const l=e.commands.get("blockQuote"),i=new Ls(t);return i.set({label:n("n"),icon:'',tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(l,"value","isEnabled"),this.listenTo(i,"execute",()=>e.execute("blockQuote")),i})}}class pa extends Us{static get pluginName(){return"CKFinderUI"}init(){const e=this.editor,n=e.t;e.ui.componentFactory.add("ckfinder",t=>{const l=e.commands.get("ckfinder"),i=new Ls(t);return i.set({label:n("e"),icon:'',tooltip:!0}),i.bind("isEnabled").to(l),i.on("execute",()=>{e.execute("ckfinder"),e.editing.view.focus()}),i})}}class fa extends _l{constructor(e){super(e),this._observedElements=new Set}observe(e,n){this.document.getRoot(n).on("change:children",(n,t)=>{this.view.once("render",()=>this._updateObservedElements(e,t))})}_updateObservedElements(e,n){if(!n.is("element")||n.is("attributeElement"))return;const t=this.view.domConverter.mapViewToDom(n);if(t){for(const e of t.querySelectorAll("img"))this._observedElements.has(e)||(this.listenTo(e,"load",(e,n)=>this._fireEvents(n)),this._observedElements.add(e));for(const n of this._observedElements)e.contains(n)||(this.stopListening(n),this._observedElements.delete(n))}}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}destroy(){this._observedElements.clear(),super.destroy()}}function ma(e){return t=>{t.on(`attribute:${e}:image`,n)};function n(e,n,t){if(!t.consumable.consume(n.item,e.name))return;const l=t.writer,i=t.mapper.toViewElement(n.item).getChild(0);null!==n.attributeNewValue?l.setAttribute(n.attributeKey,n.attributeNewValue,i):l.removeAttribute(n.attributeKey,i)}}class ga{constructor(){this._stack=[]}add(e,n){const t=this._stack,l=t[0];this._insertDescriptor(e);const i=t[0];l===i||va(l,i)||this.fire("change:top",{oldDescriptor:l,newDescriptor:i,writer:n})}remove(e,n){const t=this._stack,l=t[0];this._removeDescriptor(e);const i=t[0];l===i||va(l,i)||this.fire("change:top",{oldDescriptor:l,newDescriptor:i,writer:n})}_insertDescriptor(e){const n=this._stack,t=n.findIndex(n=>n.id===e.id);if(va(e,n[t]))return;t>-1&&n.splice(t,1);let l=0;for(;n[l]&&_a(n[l],e);)l++;n.splice(l,0,e)}_removeDescriptor(e){const n=this._stack,t=n.findIndex(n=>n.id===e);t>-1&&n.splice(t,1)}}function va(e,n){return e&&n&&e.priority==n.priority&&ya(e.classes)==ya(n.classes)}function _a(e,n){return e.priority>n.priority||!(e.priorityya(n.classes)}function ya(e){return Array.isArray(e)?e.sort().join(","):e}kn(ga,mn);const ba="ck-widget_selected";function wa(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function ka(e,n,t={}){return bt||n.setAttribute("contenteditable","false",e),n.addClass("ck-widget",e),n.setCustomProperty("widget",!0,e),e.getFillerOffset=Da,t.label&&function(e,n,t){t.setCustomProperty("widgetLabel",n,e)}(e,t.label,n),t.hasSelectionHandle&&function(e,n){const t=n.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const n=this.toDomElement(e),t=new Ss;return t.set("content",''),t.render(),n.appendChild(t.element),n}));n.insert(n.createPositionAt(e,0),t),n.addClass(["ck-widget_with-selection-handle"],e)}(e,n),function(e,n,t,l){const i=new ga;i.on("change:top",(n,i)=>{i.oldDescriptor&&l(e,i.oldDescriptor,i.writer),i.newDescriptor&&t(e,i.newDescriptor,i.writer)}),n.setCustomProperty("addHighlight",(e,n,t)=>i.add(n,t),e),n.setCustomProperty("removeHighlight",(e,n,t)=>i.remove(n,t),e)}(e,n,(e,n,t)=>t.addClass(l(n.classes),e),(e,n,t)=>t.removeClass(l(n.classes),e)),e;function l(e){return Array.isArray(e)?e:[e]}}function Ma(e){const n=e.getCustomProperty("widgetLabel");return n?"function"==typeof n?n():n:""}function Ca(e,n){return n.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),bt||(n.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",(t,l,i)=>{n.setAttribute("contenteditable",i?"false":"true",e)})),e.on("change:isFocused",(t,l,i)=>{i?n.addClass("ck-editor__nested-editable_focused",e):n.removeClass("ck-editor__nested-editable_focused",e)}),e}function xa(e,n){const t=e.getSelectedElement();if(t&&n.schema.isBlock(t))return n.createPositionAfter(t);const l=e.getSelectedBlocks().next().value;if(l){if(l.isEmpty)return n.createPositionAt(l,0);const t=n.createPositionAfter(l);return e.focus.isTouching(t)?t:n.createPositionBefore(l)}return e.focus}function Da(){return null}function Sa(e){const n=e.getSelectedElement();return n&&function(e){return!!e.getCustomProperty("image")&&wa(e)}(n)?n:null}function Ta(e){return!!e&&e.is("image")}function La(e,n,t={}){const l=e.createElement("image",t),i=xa(n.document.selection,n);n.insertContent(l,i),l.parent&&e.setSelection(l,"on")}function Pa(e){const n=e.schema,t=e.document.selection;return function(e,n,t){const l=function(e,n){const t=xa(e,n).parent;return t.isEmpty&&!t.is("$root")?t.parent:t}(e,t);return n.checkChild(l,"image")}(t,n,e)&&!function(e,n){const t=e.getSelectedElement();return t&&n.isObject(t)}(t,n)&&function(e){return[...e.focus.getAncestors()].every(e=>!e.is("image"))}(t)}class Aa extends Ks{refresh(){this.isEnabled=Pa(this.editor.model)}execute(e){const n=this.editor.model;n.change(t=>{const l=Array.isArray(e.source)?e.source:[e.source];for(const e of l)La(t,n,{src:e})})}}class Ia extends Us{static get pluginName(){return"ImageEditing"}init(){const e=this.editor,n=e.model.schema,t=e.t,l=e.conversion;e.editing.view.addObserver(fa),n.register("image",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["alt","src","srcset"]}),l.for("dataDowncast").elementToElement({model:"image",view:(e,n)=>Ea(n)}),l.for("editingDowncast").elementToElement({model:"image",view:(e,n)=>function(e,n,t){return n.setCustomProperty("image",!0,e),ka(e,n,{label:function(){const n=e.getChild(0).getAttribute("alt");return n?`${n} ${t}`:t}})}(Ea(n),n,t("m"))}),l.for("downcast").add(ma("src")).add(ma("alt")).add(function(){return n=>{n.on("attribute:srcset:image",e)};function e(e,n,t){if(!t.consumable.consume(n.item,e.name))return;const l=t.writer,i=t.mapper.toViewElement(n.item).getChild(0);if(null===n.attributeNewValue){const e=n.attributeOldValue;e.data&&(l.removeAttribute("srcset",i),l.removeAttribute("sizes",i),e.width&&l.removeAttribute("width",i))}else{const e=n.attributeNewValue;e.data&&(l.setAttribute("srcset",e.data,i),l.setAttribute("sizes","100vw",i),e.width&&l.setAttribute("width",e.width,i))}}}()),l.for("upcast").elementToElement({view:{name:"img",attributes:{src:!0}},model:(e,n)=>n.createElement("image",{src:e.getAttribute("src")})}).attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:e=>{const n={data:e.getAttribute("srcset")};return e.hasAttribute("width")&&(n.width=e.getAttribute("width")),n}}}).add(function(){return n=>{n.on("element:figure",e)};function e(e,n,t){if(!t.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const l=Array.from(n.viewItem.getChildren()).find(e=>e.is("img"));if(!l||!l.hasAttribute("src")||!t.consumable.test(l,{name:!0}))return;const i=t.convertItem(l,n.modelCursor),o=ra(i.modelRange.getItems());o&&(t.convertChildren(n.viewItem,t.writer.createPositionAt(o,0)),n.modelRange=i.modelRange,n.modelCursor=i.modelCursor)}}()),e.commands.add("imageInsert",new Aa(e))}}function Ea(e){const n=e.createEmptyElement("img"),t=e.createContainerElement("figure",{class:"image"});return e.insert(e.createPositionAt(t,0),n),t}function Oa(e,n,t){return t.createRange(ja(e,n,!0,t),ja(e,n,!1,t))}function ja(e,n,t,l){let i=e.textNode||(t?e.nodeBefore:e.nodeAfter),o=null;for(;i&&i.getAttribute("linkHref")==n;)o=i,i=t?i.previousSibling:i.nextSibling;return o?l.createPositionAt(o,t?"before":"after"):e}class Ya extends Ks{constructor(e){super(e),this.manualDecorators=new dt}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,n=e.document;this.value=n.selection.getAttribute("linkHref");for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id);this.isEnabled=e.schema.checkAttributeInSelection(n.selection,"linkHref")}execute(e,n={}){const t=this.editor.model,l=t.document.selection,i=[],o=[];for(const r in n)n[r]?i.push(r):o.push(r);t.change(n=>{if(l.isCollapsed){const r=l.getFirstPosition();if(l.hasAttribute("linkHref")){const s=Oa(r,l.getAttribute("linkHref"),t);n.setAttribute("linkHref",e,s),i.forEach(e=>{n.setAttribute(e,!0,s)}),o.forEach(e=>{n.removeAttribute(e,s)}),n.setSelection(s)}else if(""!==e){const o=_i(l.getAttributes());o.set("linkHref",e),i.forEach(e=>{o.set(e,!0)});const s=n.createText(e,o);t.insertContent(s,r),n.setSelection(n.createRangeOn(s))}}else{const r=t.schema.getValidRanges(l.getRanges(),"linkHref");for(const t of r)n.setAttribute("linkHref",e,t),i.forEach(e=>{n.setAttribute(e,!0,t)}),o.forEach(e=>{n.removeAttribute(e,t)})}})}_getDecoratorStateFromModel(e){return this.editor.model.document.selection.getAttribute(e)||!1}}class Fa extends Ks{refresh(){this.isEnabled=this.editor.model.document.selection.hasAttribute("linkHref")}execute(){const e=this.editor.model,n=e.document.selection,t=this.editor.commands.get("link");e.change(l=>{const i=n.isCollapsed?[Oa(n.getFirstPosition(),n.getAttribute("linkHref"),e)]:n.getRanges();for(const e of i)if(l.removeAttribute("linkHref",e),t)for(const n of t.manualDecorators)l.removeAttribute(n.id,e)})}}var Na=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),Ra=function(e){return Na.test(e)},Va="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Ha="\\ud83c[\\udffb-\\udfff]",za="[^\\ud800-\\udfff]",Ba="(?:\\ud83c[\\udde6-\\uddff]){2}",Ua="[\\ud800-\\udbff][\\udc00-\\udfff]",Wa="(?:"+Va+"|"+Ha+")?",qa="[\\ufe0e\\ufe0f]?"+Wa+"(?:\\u200d(?:"+[za,Ba,Ua].join("|")+")[\\ufe0e\\ufe0f]?"+Wa+")*",$a="(?:"+[za+Va+"?",Va,Ba,Ua,"[\\ud800-\\udfff]"].join("|")+")",Ga=RegExp(Ha+"(?="+Ha+")|"+$a+qa,"g"),Ka=i?i.prototype:void 0,Ja=Ka?Ka.toString:void 0,Qa=function(e){e=function(e){return null==e?"":function e(n){if("string"==typeof n)return n;if(ee(n))return function(e,n){for(var t=-1,l=null==e?0:e.length,i=Array(l);++ti?0:i+n),(t=t>i?i:t)<0&&(t+=i),i=n>t?0:t-n>>>0,n>>>=0;for(var o=Array(i);++lthis._definitions.add(e)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(e,n,t)=>{if(!t.consumable.test(n.item,"attribute:linkHref"))return;const l=t.writer,i=l.document.selection;for(const o of this._definitions){const e=l.createAttributeElement("a",o.attributes,{priority:5});l.setCustomProperty("link",!0,e),o.callback(n.attributeNewValue)?n.item.is("selection")?l.wrap(i.getFirstRange(),e):l.wrap(t.mapper.toViewRange(n.range),e):l.unwrap(t.mapper.toViewRange(n.range),e)}},{priority:"high"})}}}class lc{constructor({id:e,label:n,attributes:t}){this.id=e,this.set("value"),this.label=n,this.attributes=t}}kn(lc,Gn);class ic{constructor(e,n,t){this.model=e,this.attribute=t,this._modelSelection=e.document.selection,this._overrideUid=null,this._isNextGravityRestorationSkipped=!1,n.listenTo(this._modelSelection,"change:range",(e,n)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!n.directChange&&oc(this._modelSelection.getFirstPosition(),t)||this._restoreGravity())})}handleForwardMovement(e,n){const t=this.attribute;if(!(this._isGravityOverridden||e.isAtStart&&this._hasSelectionAttribute))return uc(e,t)&&this._hasSelectionAttribute?(this._preventCaretMovement(n),this._removeSelectionAttribute(),!0):rc(e,t)||sc(e,t)&&this._hasSelectionAttribute?(this._preventCaretMovement(n),this._overrideGravity(),!0):void 0}handleBackwardMovement(e,n){const t=this.attribute;return this._isGravityOverridden?uc(e,t)&&this._hasSelectionAttribute?(this._preventCaretMovement(n),this._restoreGravity(),this._removeSelectionAttribute(),!0):(this._preventCaretMovement(n),this._restoreGravity(),e.isAtStart&&this._removeSelectionAttribute(),!0):uc(e,t)&&!this._hasSelectionAttribute?(this._preventCaretMovement(n),this._setSelectionAttributeFromTheNodeBefore(e),!0):e.isAtEnd&&sc(e,t)?this._hasSelectionAttribute?void(ac(e,t)&&(this._skipNextAutomaticGravityRestoration(),this._overrideGravity())):(this._preventCaretMovement(n),this._setSelectionAttributeFromTheNodeBefore(e),!0):e.isAtStart?this._hasSelectionAttribute?(this._removeSelectionAttribute(),this._preventCaretMovement(n),!0):void 0:void(ac(e,t)&&(this._skipNextAutomaticGravityRestoration(),this._overrideGravity()))}get _isGravityOverridden(){return!!this._overrideUid}get _hasSelectionAttribute(){return this._modelSelection.hasAttribute(this.attribute)}_overrideGravity(){this._overrideUid=this.model.change(e=>e.overrideSelectionGravity())}_restoreGravity(){this.model.change(e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}_preventCaretMovement(e){e.preventDefault()}_removeSelectionAttribute(){this.model.change(e=>{e.removeSelectionAttribute(this.attribute)})}_setSelectionAttributeFromTheNodeBefore(e){const n=this.attribute;this.model.change(t=>{t.setSelectionAttribute(this.attribute,e.nodeBefore.getAttribute(n))})}_skipNextAutomaticGravityRestoration(){this._isNextGravityRestorationSkipped=!0}}function oc(e,n){return rc(e,n)||sc(e,n)}function rc(e,n){const{nodeBefore:t,nodeAfter:l}=e,i=!!t&&t.hasAttribute(n);return!!l&&l.hasAttribute(n)&&(!i||t.getAttribute(n)!==l.getAttribute(n))}function sc(e,n){const{nodeBefore:t,nodeAfter:l}=e,i=!!t&&t.hasAttribute(n),o=!!l&&l.hasAttribute(n);return i&&(!o||t.getAttribute(n)!==l.getAttribute(n))}function uc(e,n){const{nodeBefore:t,nodeAfter:l}=e,i=!!t&&t.hasAttribute(n);if(l&&l.hasAttribute(n)&&i)return l.getAttribute(n)!==t.getAttribute(n)}function ac(e,n){return oc(e.getShiftedBy(-1),n)}t(46);const cc="ck-link_selected",dc="automatic",hc=/^(https?:)?\/\//;class pc extends Us{static get pluginName(){return"LinkEditing"}constructor(e){super(e),e.config.define("link",{addTargetToExternalLinks:!1})}init(){const e=this.editor,n=e.locale;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:ec}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,n)=>ec(nc(e),n)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new Ya(e)),e.commands.add("unlink",new Fa(e));const t=function(e,n){const t={"Open in a new tab":e("az"),Downloadable:e("ba")};return n.forEach(e=>(e.label&&t[e.label]&&(e.label=t[e.label]),e)),n}(e.t,function(e){const n=[];if(e)for(const[t,l]of Object.entries(e)){const e=Object.assign({},l,{id:"link"+Qa(t)});n.push(e)}return n}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(e=>e.mode===dc)),this._enableManualDecorators(t.filter(e=>"manual"===e.mode)),function({view:e,model:n,emitter:t,attribute:l,locale:i}){const o=new ic(n,t,l),r=n.document.selection;t.listenTo(e.document,"keydown",(e,n)=>{if(!r.isCollapsed)return;if(n.shiftKey||n.altKey||n.ctrlKey)return;const t=n.keyCode==Dt.arrowright,l=n.keyCode==Dt.arrowleft;if(!t&&!l)return;const s=r.getFirstPosition(),u=i.contentLanguageDirection;let a;(a="ltr"===u&&t||"rtl"===u&&l?o.handleForwardMovement(s,n):o.handleBackwardMovement(s,n))&&e.stop()},{priority:hn.get("high")+1})}({view:e.editing.view,model:e.model,emitter:this,attribute:"linkHref",locale:n}),this._setupLinkHighlight()}_enableAutomaticDecorators(e){const n=this.editor,t=new tc;n.config.get("link.addTargetToExternalLinks")&&t.add({id:"linkIsExternal",mode:dc,callback:e=>hc.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),t.add(e),t.length&&n.conversion.for("downcast").add(t.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const n=this.editor,t=n.commands.get("link").manualDecorators;e.forEach(e=>{n.model.schema.extend("$text",{allowAttributes:e.id}),t.add(new lc(e)),n.conversion.for("downcast").attributeToElement({model:e.id,view:(n,l)=>{if(n){const n=t.get(e.id).attributes,i=l.createAttributeElement("a",n,{priority:5});return l.setCustomProperty("link",!0,i),i}}}),n.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:t.get(e.id).attributes},model:{key:e.id}})})}_setupLinkHighlight(){const e=this.editor,n=e.editing.view,t=new Set;n.document.registerPostFixer(n=>{const l=e.model.document.selection;let i=!1;if(l.hasAttribute("linkHref")){const o=Oa(l.getFirstPosition(),l.getAttribute("linkHref"),e.model),r=e.editing.mapper.toViewRange(o);for(const e of r.getItems())e.is("a")&&!e.hasClass(cc)&&(n.addClass(cc,e),t.add(e),i=!0)}return i}),e.conversion.for("editingDowncast").add(e=>{function l(){n.change(e=>{for(const n of t.values())e.removeClass(cc,n),t.delete(n)})}e.on("insert",l,{priority:"highest"}),e.on("remove",l,{priority:"highest"}),e.on("attribute",l,{priority:"highest"}),e.on("selection",l,{priority:"highest"})})}}class fc extends Us{static get pluginName(){return"Notification"}init(){this.on("show:warning",(e,n)=>{window.alert(n.message)},{priority:"lowest"})}showSuccess(e,n={}){this._showNotification({message:e,type:"success",namespace:n.namespace,title:n.title})}showInfo(e,n={}){this._showNotification({message:e,type:"info",namespace:n.namespace,title:n.title})}showWarning(e,n={}){this._showNotification({message:e,type:"warning",namespace:n.namespace,title:n.title})}_showNotification(e){this.fire("show:"+e.type+(e.namespace?":"+e.namespace:""),{message:e.message,type:e.type,title:e.title||""})}}class mc extends Ks{constructor(e){super(e),this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",()=>this.refresh(),{priority:"low"})}refresh(){const e=this.editor.commands.get("imageInsert"),n=this.editor.commands.get("link");this.isEnabled=e.isEnabled||n.isEnabled}execute(){const e=this.editor,n=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=n&&"modal"!=n)throw new an.b('ckfinder-unknown-openerMethod: The openerMethod config option must by "popup" or "modal".',e);const t=this.editor.config.get("ckfinder.options")||{};t.chooseFiles=!0;const l=t.onInit;t.language||(t.language=e.locale.uiLanguage),t.onInit=n=>{l&&l(n),n.on("files:choose",t=>{const l=t.data.files.toArray(),i=l.filter(e=>!e.isImage()),o=l.filter(e=>e.isImage());for(const n of i)e.execute("link",n.getUrl());const r=[];for(const e of o){const t=e.getUrl();r.push(t||n.request("file:getProxyUrl",{file:e}))}r.length&&gc(e,r)}),n.on("file:choose:resizedImage",n=>{const t=n.data.resizedUrl;if(t)gc(e,[t]);else{const n=e.plugins.get("Notification"),t=e.locale.t;n.showWarning(t("at"),{title:t("au"),namespace:"ckfinder"})}})},window.CKFinder[n](t)}}function gc(e,n){if(e.commands.get("imageInsert").isEnabled)e.execute("imageInsert",{source:n});else{const n=e.plugins.get("Notification"),t=e.locale.t;n.showWarning(t("av"),{title:t("aw"),namespace:"ckfinder"})}}class vc extends Us{static get pluginName(){return"CKFinderEditing"}static get requires(){return[fc,Ia,pc]}init(){const e=this.editor;e.commands.add("ckfinder",new mc(e))}}const _c=/^data:(\S*?);base64,/;class yc{constructor(e,n,t){if(!e)throw new an.b("fileuploader-missing-file: File must be provided as the first argument",null);if(!n)throw new an.b("fileuploader-missing-token: Token must be provided as the second argument.",null);if(!t)throw new an.b("fileuploader-missing-api-address: Api address must be provided as the third argument.",null);this.file=function(e){if("string"!=typeof e)return!1;const n=e.match(_c);return!(!n||!n.length)}(e)?function(e,n=512){try{const t=e.match(_c)[1],l=atob(e.replace(_c,"")),i=[];for(let e=0;ee(t)),this}onError(e){return this.once("error",(n,t)=>e(t)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){const e=new XMLHttpRequest;e.open("POST",this._apiAddress),e.setRequestHeader("Authorization",this._token.value),e.responseType="json",this.xhr=e}_attachXHRListeners(){const e=this,n=this.xhr;function t(n){return()=>e.fire("error",n)}n.addEventListener("error",t("Network Error")),n.addEventListener("abort",t("Abort")),n.upload&&n.upload.addEventListener("progress",e=>{e.lengthComputable&&this.fire("progress",{total:e.total,uploaded:e.loaded})}),n.addEventListener("load",()=>{const e=n.status,t=n.response;if(e<200||e>299)return this.fire("error",t.message||t.error)})}_sendRequest(){const e=new FormData,n=this.xhr;return e.append("file",this.file),new Promise((t,l)=>{n.addEventListener("load",()=>{const e=n.status,i=n.response;return e<200||e>299?l(i.message?new an.b("fileuploader-uploading-data-failed: Uploading file failed.",this,{message:i.message}):i.error):t(i)}),n.addEventListener("error",()=>l(new Error("Network Error"))),n.addEventListener("abort",()=>l(new Error("Abort"))),n.send(e)})}}kn(yc,mn);const bc={refreshInterval:36e5,autoRefresh:!0};class wc{constructor(e,n=bc){if(!e)throw new an.b("token-missing-token-url: A `tokenUrl` must be provided as the first constructor argument.",this);this.set("value",n.initValue),this._refresh="function"==typeof e?e:()=>function(e){return new Promise((n,t)=>{const l=new XMLHttpRequest;l.open("GET",e),l.addEventListener("load",()=>{const e=l.status,i=l.response;return e<200||e>299?t(new an.b("token-cannot-download-new-token: Cannot download new token from the provided url.",null)):n(i)}),l.addEventListener("error",()=>t(new Error("Network Error"))),l.addEventListener("abort",()=>t(new Error("Abort"))),l.send()})}(e),this._options=Object.assign({},bc,n)}init(){return new Promise((e,n)=>{this._options.autoRefresh&&this._startRefreshing(),this.value?e(this):this._refreshToken().then(e).catch(n)})}_refreshToken(){return this._refresh().then(e=>this.set("value",e)).then(()=>this)}destroy(){this._stopRefreshing()}_startRefreshing(){this._refreshInterval=setInterval(()=>this._refreshToken(),this._options.refreshInterval)}_stopRefreshing(){clearInterval(this._refreshInterval)}static create(e,n=bc){return new wc(e,n).init()}}kn(wc,Gn);var kc=wc;class Mc extends Us{static get pluginName(){return"CloudServices"}init(){const e=this.editor.config.get("cloudServices")||{};for(const n in e)this[n]=e[n];if(this.tokenUrl)return this.token=new Mc.Token(this.tokenUrl),this.token.init();this.token=null}}Mc.Token=kc;class Cc extends Us{static get requires(){return[zu,Mc]}init(){const e=this.editor,n=e.plugins.get(Mc),t=n.token;t&&(this._uploadGateway=new Cc._UploadGateway(t,n.uploadUrl),e.plugins.get(zu).createUploadAdapter=e=>new xc(this._uploadGateway,e))}}class xc{constructor(e,n){this.uploadGateway=e,this.loader=n}upload(){return this.loader.file.then(e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",(e,n)=>{this.loader.uploadTotal=n.total,this.loader.uploaded=n.uploaded}),this.fileUploader.send()))}abort(){this.fileUploader.abort()}}Cc._UploadGateway=class{constructor(e,n){if(!e)throw new an.b("uploadgateway-missing-token: Token must be provided.",null);if(!n)throw new an.b("uploadgateway-missing-api-address: Api address must be provided.",null);this._token=e,this._apiAddress=n}upload(e){return new yc(e,this._token,this._apiAddress)}};class Dc extends Fl{constructor(e){super(e),this.domEventType="mousedown"}onDomEvent(e){this.fire(e.type,e)}}t(48);const Sc=Tt("Ctrl+A");class Tc extends Us{static get pluginName(){return"Widget"}init(){const e=this.editor.editing.view,n=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",(e,n,t)=>{this._clearPreviouslySelectedWidgets(t.writer);const l=t.writer,i=l.document.selection,o=i.getSelectedElement();let r=null;for(const s of i.getRanges())for(const e of s){const n=e.item;wa(n)&&!Lc(n,r)&&(l.addClass(ba,n),this._previouslySelected.add(n),r=n,n==o&&l.setSelection(i.getRanges(),{fake:!0,label:Ma(o)}))}},{priority:"low"}),e.addObserver(Dc),this.listenTo(n,"mousedown",(...e)=>this._onMousedown(...e)),this.listenTo(n,"keydown",(...e)=>this._onKeydown(...e),{priority:"high"}),this.listenTo(n,"delete",(e,n)=>{this._handleDelete("forward"==n.direction)&&(n.preventDefault(),e.stop())},{priority:"high"})}_onMousedown(e,n){const t=this.editor,l=t.editing.view,i=l.document;let o=n.target;if(function(e){for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(wa(e))return!1;e=e.parent}return!1}(o)){if(kt&&n.domEvent.detail>=3){const e=t.editing.mapper.toModelElement(o);this.editor.model.change(t=>{n.preventDefault(),t.setSelection(e,"in")})}return}if(!wa(o)&&!(o=o.findAncestor(wa)))return;n.preventDefault(),i.isFocused||l.focus();const r=t.editing.mapper.toModelElement(o);this._setSelectionOverElement(r)}_onKeydown(e,n){const t=n.keyCode,l=t==Dt.arrowdown||t==Dt["ltr"===this.editor.locale.contentLanguageDirection?"arrowright":"arrowleft"];let i=!1;!function(e){return e==Dt.arrowright||e==Dt.arrowleft||e==Dt.arrowup||e==Dt.arrowdown}(t)?function(e){return St(e)==Sc}(n)?i=this._selectAllNestedEditableContent()||this._selectAllContent():t===Dt.enter&&(i=this._handleEnterKey(n.shiftKey)):i=this._handleArrowKeys(l),i&&(n.preventDefault(),e.stop())}_handleDelete(e){if(this.editor.isReadOnly)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const t=this._getObjectElementNextToSelection(e);return t?(this.editor.model.change(e=>{let l=n.anchor.parent;for(;l.isEmpty;){const n=l;l=n.parent,e.remove(n)}this._setSelectionOverElement(t)}),!0):void 0}_handleArrowKeys(e){const n=this.editor.model,t=n.schema,l=n.document.selection,i=l.getSelectedElement();if(i&&t.isObject(i)){const i=e?l.getLastPosition():l.getFirstPosition(),o=t.getNearestSelectionRange(i,e?"forward":"backward");return o&&n.change(e=>{e.setSelection(o)}),!0}if(!l.isCollapsed)return;const o=this._getObjectElementNextToSelection(e);return o&&t.isObject(o)?(this._setSelectionOverElement(o),!0):void 0}_handleEnterKey(e){const n=this.editor.model,t=n.document.selection.getSelectedElement();if(function(e,n){return e&&n.isObject(e)&&!n.isInline(e)}(t,n.schema))return n.change(l=>{let i=l.createPositionAt(t,e?"before":"after");const o=l.createElement("paragraph");if(n.schema.isBlock(t.parent)){const e=n.schema.findAllowedParent(i,o);i=l.split(i,e).position}l.insert(o,i),l.setSelection(o,"in")}),!0}_selectAllNestedEditableContent(){const e=this.editor.model,n=e.document.selection,t=e.schema.getLimitElement(n);return n.getFirstRange().root!=t&&(e.change(e=>{e.setSelection(e.createRangeIn(t))}),!0)}_selectAllContent(){const e=this.editor.model,n=this.editor.editing,t=n.view.document.selection.getSelectedElement();if(t&&wa(t)){const l=n.mapper.toModelElement(t.parent);return e.change(e=>{e.setSelection(e.createRangeIn(l))}),!0}return!1}_setSelectionOverElement(e){this.editor.model.change(n=>{n.setSelection(n.createRangeOn(e))})}_getObjectElementNextToSelection(e){const n=this.editor.model,t=n.schema,l=n.createSelection(n.document.selection);n.modifySelection(l,{direction:e?"forward":"backward"});const i=e?l.focus.nodeBefore:l.focus.nodeAfter;return i&&t.isObject(i)?i:null}_clearPreviouslySelectedWidgets(e){for(const n of this._previouslySelected)e.removeClass(ba,n);this._previouslySelected.clear()}}function Lc(e,n){return!!n&&Array.from(e.getAncestors()).includes(n)}class Pc extends Ks{refresh(){const e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=Ta(e),this.value=!(!Ta(e)||!e.hasAttribute("alt"))&&e.getAttribute("alt")}execute(e){const n=this.editor.model,t=n.document.selection.getSelectedElement();n.change(n=>{n.setAttribute("alt",e.newValue,t)})}}class Ac extends Us{static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new Pc(this.editor))}}t(50);class Ic extends as{constructor(e,n){super(e);const t="ck-input-"+dn(),l="ck-status-"+dn();this.set("label"),this.set("value"),this.set("isReadOnly",!1),this.set("errorText",null),this.set("infoText",null),this.labelView=this._createLabelView(t),this.inputView=this._createInputView(n,t,l),this.statusView=this._createStatusView(l),this.bind("_statusText").to(this,"errorText",this,"infoText",(e,n)=>e||n),this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-input",this.bindTemplate.if("isReadOnly","ck-disabled")]},children:[this.labelView,this.inputView,this.statusView]})}_createLabelView(e){const n=new ds(this.locale);return n.for=e,n.bind("text").to(this,"label"),n}_createInputView(e,n,t){const l=new e(this.locale,t);return l.id=n,l.ariaDescribedById=t,l.bind("value").to(this),l.bind("isReadOnly").to(this),l.bind("hasError").to(this,"errorText",e=>!!e),l.on("input",()=>{this.errorText=null}),l}_createStatusView(e){const n=new as(this.locale),t=this.bindTemplate;return n.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-input__status",t.if("errorText","ck-labeled-input__status_error"),t.if("_statusText","ck-hidden",e=>!e)],id:e,role:t.if("errorText","alert")},children:[{text:t.to("_statusText")}]}),n}select(){this.inputView.select()}focus(){this.inputView.focus()}}t(52);class Ec extends as{constructor(e){super(e),this.set("value"),this.set("id"),this.set("placeholder"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById");const n=this.bindTemplate;this.setTemplate({tag:"input",attributes:{type:"text",class:["ck","ck-input","ck-input-text",n.if("hasError","ck-error")],id:n.to("id"),placeholder:n.to("placeholder"),readonly:n.to("isReadOnly"),"aria-invalid":n.if("hasError",!0),"aria-describedby":n.to("ariaDescribedById")},on:{input:n.to("input")}})}render(){super.render();const e=e=>{this.element.value=e||0===e?e:""};e(this.value),this.on("change:value",(n,t,l)=>{e(l)})}select(){this.element.select()}focus(){this.element.focus()}}function Oc({view:e}){e.listenTo(e.element,"submit",(n,t)=>{t.preventDefault(),e.fire("submit")},{useCapture:!0})}var jc='',Yc='';t(54);class Fc extends as{constructor(e){super(e);const n=this.locale.t;this.focusTracker=new Yr,this.keystrokes=new Sr,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(n("bf"),jc,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("bg"),Yc,"ck-button-cancel","cancel"),this._focusables=new Ur,this._focusCycler=new _s({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),Oc({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}_createButton(e,n,t,l){const i=new Ls(this.locale);return i.set({label:e,icon:n,tooltip:!0}),i.extendTemplate({attributes:{class:t}}),l&&i.delegate("execute").to(this,l),i}_createLabeledInputView(){const e=this.locale.t,n=new Ic(this.locale,Ec);return n.label=e("cd"),n.inputView.placeholder=e("cd"),n}}t(56);const Nc=ms("px"),Rc=sl.document.body;class Vc extends as{constructor(e){super(e);const n=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",n.to("position",e=>"ck-balloon-panel_"+e),n.if("isVisible","ck-balloon-panel_visible"),n.if("withArrow","ck-balloon-panel_with-arrow"),n.to("class")],style:{top:n.to("top",Nc),left:n.to("left",Nc)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const n=Vc.defaultPositions,t=Object.assign({},{element:this.element,positions:[n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast],limiter:Rc,fitInViewport:!0},e),l=Vc._getOptimalPosition(t),i=parseInt(l.left),o=parseInt(l.top);Object.assign(this,{top:o,left:i,position:l.name})}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 n=Hc(e.target),t=e.limiter?Hc(e.limiter):Rc;this.listenTo(sl.document,"scroll",(l,i)=>{const o=i.target,r=n&&o.contains(n),s=t&&o.contains(t);!r&&!s&&n&&t||this.attachTo(e)},{useCapture:!0}),this.listenTo(sl.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(sl.document,"scroll"),this.stopListening(sl.window,"resize")}}function Hc(e){return rn(e)?e:ni(e)?e.commonAncestorContainer:"function"==typeof e?Hc(e()):null}function zc(e,n){return e.top-n.height-Vc.arrowVerticalOffset}function Bc(e){return e.bottom+Vc.arrowVerticalOffset}Vc.arrowHorizontalOffset=25,Vc.arrowVerticalOffset=10,Vc._getOptimalPosition=Ms,Vc.defaultPositions={northArrowSouth:(e,n)=>({top:zc(e,n),left:e.left+e.width/2-n.width/2,name:"arrow_s"}),northArrowSouthEast:(e,n)=>({top:zc(e,n),left:e.left+e.width/2-n.width+Vc.arrowHorizontalOffset,name:"arrow_se"}),northArrowSouthWest:(e,n)=>({top:zc(e,n),left:e.left+e.width/2-Vc.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouth:(e,n)=>({top:zc(e,n),left:e.left-n.width/2,name:"arrow_s"}),northWestArrowSouthWest:(e,n)=>({top:zc(e,n),left:e.left-Vc.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouthEast:(e,n)=>({top:zc(e,n),left:e.left-n.width+Vc.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouth:(e,n)=>({top:zc(e,n),left:e.right-n.width/2,name:"arrow_s"}),northEastArrowSouthEast:(e,n)=>({top:zc(e,n),left:e.right-n.width+Vc.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouthWest:(e,n)=>({top:zc(e,n),left:e.right-Vc.arrowHorizontalOffset,name:"arrow_sw"}),southArrowNorth:(e,n)=>({top:Bc(e),left:e.left+e.width/2-n.width/2,name:"arrow_n"}),southArrowNorthEast:(e,n)=>({top:Bc(e),left:e.left+e.width/2-n.width+Vc.arrowHorizontalOffset,name:"arrow_ne"}),southArrowNorthWest:(e,n)=>({top:Bc(e),left:e.left+e.width/2-Vc.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorth:(e,n)=>({top:Bc(e),left:e.left-n.width/2,name:"arrow_n"}),southWestArrowNorthWest:(e,n)=>({top:Bc(e),left:e.left-Vc.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorthEast:(e,n)=>({top:Bc(e),left:e.left-n.width+Vc.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorth:(e,n)=>({top:Bc(e),left:e.right-n.width/2,name:"arrow_n"}),southEastArrowNorthEast:(e,n)=>({top:Bc(e),left:e.right-n.width+Vc.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorthWest:(e,n)=>({top:Bc(e),left:e.right-Vc.arrowHorizontalOffset,name:"arrow_nw"})},t(58),t(60);const Uc=ms("px");class Wc extends Us{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this.positionLimiter=()=>{const e=this.editor.editing.view,n=e.document.selection.editableElement;return n?e.domConverter.mapViewToDom(n.root):null},this.set("visibleView",null),this.view=new Vc(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 an.b("contextualballoon-add-view-exist: Cannot add configuration of the same view twice.",[this,e]);const n=e.stackId||"main";if(!this._idToStack.has(n))return this._idToStack.set(n,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(n)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!e.singleViewMode||this.showStack(n));const t=this._idToStack.get(n);e.singleViewMode&&this.showStack(n),t.set(e.view,e),this._viewToStack.set(e.view,t),t===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new an.b("contextualballoon-remove-view-not-exist: Cannot remove the configuration of a non-existent view.",[this,e]);const n=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(1===n.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(n.values())[n.size-2])),1===n.size?(this._idToStack.delete(this._getStackId(n)),this._numberOfStacks=this._idToStack.size):n.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 n=this._idToStack.get(e);if(!n)throw new an.b("contextualballoon-showstack-stack-not-exist: Cannot show a stack that does not exist.",this);this._visibleStack!==n&&this._showView(Array.from(n.values()).pop())}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(n=>n[1]===e)[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let n=e.indexOf(this._visibleStack)+1;e[n]||(n=0),this.showStack(this._getStackId(e[n]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let n=e.indexOf(this._visibleStack)-1;e[n]||(n=e.length-1),this.showStack(this._getStackId(e[n]))}_createRotatorView(){const e=new qc(this.editor.locale),n=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(e,n)=>!n&&e>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(e,t)=>{if(t<2)return"";const l=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return n("bl",[l,t])}),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 $c(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(e,n)=>!n&&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:n="",withArrow:t=!0,singleViewMode:l=!1}){this.view.class=n,this.view.withArrow=t,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),l&&(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 qc extends as{constructor(e){super(e);const n=e.t,t=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new Yr,this.buttonPrevView=this._createButtonView(n("bm"),'\n'),this.buttonNextView=this._createButtonView(n("bn"),'\n'),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",t.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:t.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,n){const t=new Ls(this.locale);return t.set({label:e,icon:n,tooltip:!0}),t}}class $c extends as{constructor(e,n){super(e);const t=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=n,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",t.to("numberOfPanels",e=>e?"":"ck-hidden")],style:{top:t.to("top",Uc),left:t.to("left",Uc),width:t.to("width",Uc),height:t.to("height",Uc)}},children:this.content}),this.on("change:numberOfPanels",(e,n,t,l)=>{t>l?this._addPanels(t-l):this._removePanels(l-t),this.updatePosition()})}_addPanels(e){for(;e--;){const e=new as;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:n}=this._balloonPanelView,{width:t,height:l}=new ii(this._balloonPanelView.element);Object.assign(this,{top:e,left:n,width:t,height:l})}}}function Gc(e){const n=e.editing.view,t=Vc.defaultPositions;return{target:n.domConverter.viewToDom(n.document.selection.getSelectedElement()),positions:[t.northArrowSouth,t.northArrowSouthWest,t.northArrowSouthEast,t.southArrowNorth,t.southArrowNorthWest,t.southArrowNorthEast]}}class Kc extends Us{static get requires(){return[Wc]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const e=this.editor,n=e.t;e.ui.componentFactory.add("imageTextAlternative",t=>{const l=e.commands.get("imageTextAlternative"),i=new Ls(t);return i.set({label:n("bv"),icon:'',tooltip:!0}),i.bind("isEnabled").to(l,"isEnabled"),this.listenTo(i,"execute",()=>this._showForm()),i})}_createForm(){const e=this.editor,n=e.editing.view.document;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new Fc(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.inputView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this._form.keystrokes.set("Esc",(e,n)=>{this._hideForm(!0),n()}),this.listenTo(e.ui,"update",()=>{Sa(n.selection)?this._isVisible&&function(e){const n=e.plugins.get("ContextualBalloon");if(Sa(e.editing.view.document.selection)){const t=Gc(e);n.updatePosition(t)}}(e):this._hideForm(!0)}),js({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const e=this.editor,n=e.commands.get("imageTextAlternative"),t=this._form.labeledInput;this._isInBalloon||this._balloon.add({view:this._form,position:Gc(e)}),t.value=t.inputView.element.value=n.value||"",this._form.labeledInput.select()}_hideForm(e){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}class Jc extends Us{static get requires(){return[Ac,Kc]}static get pluginName(){return"ImageTextAlternative"}}t(62);class Qc extends Us{static get requires(){return[Ia,Tc,Jc]}static get pluginName(){return"Image"}}class Zc extends as{constructor(e){super(e),this.buttonView=new Ls(e),this._fileInputView=new Xc(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",()=>{this._fileInputView.open()})}focus(){this.buttonView.focus()}}class Xc extends as{constructor(e){super(e),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const n=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:n.to("acceptedType"),multiple:n.to("allowMultipleFiles")},on:{change:n.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}function ed(e){const n=e.map(e=>e.replace("+","\\+"));return new RegExp(`^image\\/(${n.join("|")})$`)}function nd(e){return new Promise((n,t)=>{const l=e.getAttribute("src");fetch(l).then(e=>e.blob()).then(e=>{const i=function(e,n){return e.type?e.type:n.match(/data:(image\/\w+);base64/)?n.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}(e,l),o=function(e,n,t){try{return new File([e],n,{type:t})}catch(e){return null}}(e,"image."+i.replace("image/",""),i);o?n(o):t()}).catch(t)})}class td extends Us{init(){const e=this.editor,n=e.t;e.ui.componentFactory.add("imageUpload",t=>{const l=new Zc(t),i=e.commands.get("imageUpload"),o=e.config.get("image.upload.types"),r=ed(o);return l.set({acceptedType:o.map(e=>"image/"+e).join(","),allowMultipleFiles:!0}),l.buttonView.set({label:n("s"),icon:'',tooltip:!0}),l.buttonView.bind("isEnabled").to(i),l.on("done",(n,t)=>{const l=Array.from(t).filter(e=>r.test(e.type));l.length&&e.execute("imageUpload",{file:l})}),l})}}t(64),t(66),t(68);class ld extends Us{constructor(e){super(e),this.placeholder="data:image/svg+xml;utf8,"+encodeURIComponent('')}init(){this.editor.editing.downcastDispatcher.on("attribute:uploadStatus:image",(...e)=>this.uploadStatusChange(...e))}uploadStatusChange(e,n,t){const l=this.editor,i=n.item,o=i.getAttribute("uploadId");if(!t.consumable.consume(n.item,e.name))return;const r=l.plugins.get(zu),s=o?n.attributeNewValue:null,u=this.placeholder,a=l.editing.mapper.toViewElement(i),c=t.writer;if("reading"==s)return id(a,c),void od(u,a,c);if("uploading"==s){const e=r.loaders.get(o);return id(a,c),void(e?(rd(a,c),function(e,n,t,l){const i=function(e){const n=e.createUIElement("div",{class:"ck-progress-bar"});return e.setCustomProperty("progressBar",!0,n),n}(n);n.insert(n.createPositionAt(e,"end"),i),t.on("change:uploadedPercent",(e,n,t)=>{l.change(e=>{e.setStyle("width",t+"%",i)})})}(a,c,e,l.editing.view),function(e,n,t){if(t.data){const l=e.getChild(0);n.setAttribute("src",t.data,l)}}(a,c,e)):od(u,a,c))}"complete"==s&&r.loaders.get(o)&&!bt&&function(e,n,t){const l=n.createUIElement("div",{class:"ck-image-upload-complete-icon"});n.insert(n.createPositionAt(e,"end"),l),setTimeout(()=>{t.change(e=>e.remove(e.createRangeOn(l)))},3e3)}(a,c,l.editing.view),function(e,n){ud(e,n,"progressBar")}(a,c),rd(a,c),function(e,n){n.removeClass("ck-appear",e)}(a,c)}}function id(e,n){e.hasClass("ck-appear")||n.addClass("ck-appear",e)}function od(e,n,t){n.hasClass("ck-image-upload-placeholder")||t.addClass("ck-image-upload-placeholder",n);const l=n.getChild(0);l.getAttribute("src")!==e&&t.setAttribute("src",e,l),sd(n,"placeholder")||t.insert(t.createPositionAfter(l),function(e){const n=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,n),n}(t))}function rd(e,n){e.hasClass("ck-image-upload-placeholder")&&n.removeClass("ck-image-upload-placeholder",e),ud(e,n,"placeholder")}function sd(e,n){for(const t of e.getChildren())if(t.getCustomProperty(n))return t}function ud(e,n,t){const l=sd(e,t);l&&n.remove(n.createRangeOn(l))}class ad{createDocumentFragment(e){return new It(e)}createElement(e,n,t){return new In(e,n,t)}createText(e){return new Dn(e)}clone(e,n=!1){return e._clone(n)}appendChild(e,n){return n._appendChild(e)}insertChild(e,n,t){return t._insertChild(e,n)}removeChildren(e,n,t){return t._removeChildren(e,n)}remove(e){const n=e.parent;return n?this.removeChildren(n.getChildIndex(e),1,n):[]}replace(e,n){const t=e.parent;if(t){const l=t.getChildIndex(e);return this.removeChildren(l,1,t),this.insertChild(l,n,t),!0}return!1}unwrapElement(e){const n=e.parent;if(n){const t=n.getChildIndex(e);this.remove(e),this.insertChild(t,e.getChildren(),n)}}rename(e,n){const t=new In(e,n.getAttributes(),n.getChildren());return this.replace(n,t)?t:null}setAttribute(e,n,t){t._setAttribute(e,n)}removeAttribute(e,n){n._removeAttribute(e)}addClass(e,n){n._addClass(e)}removeClass(e,n){n._removeClass(e)}setStyle(e,n,t){_(e)&&void 0===t&&(t=n),t._setStyle(e,n)}removeStyle(e,n){n._removeStyle(e)}setCustomProperty(e,n,t){t._setCustomProperty(e,n)}removeCustomProperty(e,n){return n._removeCustomProperty(e)}createPositionAt(e,n){return ot._createAt(e,n)}createPositionAfter(e){return ot._createAfter(e)}createPositionBefore(e){return ot._createBefore(e)}createRange(e,n){return new rt(e,n)}createRangeOn(e){return rt._createOn(e)}createRangeIn(e){return rt._createIn(e)}createSelection(e,n,t){return new at(e,n,t)}}class cd extends Ks{refresh(){this.isEnabled=Pa(this.editor.model)}execute(e){const n=this.editor,t=n.model,l=n.plugins.get(zu);t.change(n=>{const i=Array.isArray(e.file)?e.file:[e.file];for(const e of i)dd(n,t,l,e)})}}function dd(e,n,t,l){const i=t.createLoader(l);i&&La(e,n,{uploadId:i.id})}class hd extends Us{static get requires(){return[zu,fc,Gs]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}})}init(){const e=this.editor,n=e.model.document,t=e.model.schema,l=e.conversion,i=e.plugins.get(zu),o=ed(e.config.get("image.upload.types"));t.extend("image",{allowAttributes:["uploadId","uploadStatus"]}),e.commands.add("imageUpload",new cd(e)),l.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(n,t)=>{if(function(e){return Array.from(e.types).includes("text/html")&&""!==e.getData("text/html")}(t.dataTransfer))return;const l=Array.from(t.dataTransfer.files).filter(e=>!!e&&o.test(e.type)),i=t.targetRanges.map(n=>e.editing.mapper.toModelRange(n));e.model.change(t=>{t.setSelection(i),l.length&&(n.stop(),e.model.enqueueChange("default",()=>{e.execute("imageUpload",{file:l})}))})}),this.listenTo(e.plugins.get(Gs),"inputTransformation",(n,t)=>{const l=Array.from(e.editing.view.createRangeIn(t.content)).filter(e=>function(e){return!(!e.is("element","img")||!e.getAttribute("src"))&&(e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||e.getAttribute("src").match(/^blob:/g))}(e.item)&&!e.item.getAttribute("uploadProcessed")).map(e=>({promise:nd(e.item),imageElement:e.item}));if(!l.length)return;const o=new ad;for(const e of l){o.setAttribute("uploadProcessed",!0,e.imageElement);const n=i.createLoader(e.promise);n&&(o.setAttribute("src","",e.imageElement),o.setAttribute("uploadId",n.id,e.imageElement))}}),e.editing.view.document.on("dragover",(e,n)=>{n.preventDefault()}),n.on("change",()=>{const t=n.differ.getChanges({includeChangesInGraveyard:!0});for(const n of t)if("insert"==n.type&&"$text"!=n.name){const t=n.position.nodeAfter,l="$graveyard"==n.position.root.rootName;for(const n of pd(e,t)){const e=n.getAttribute("uploadId");if(!e)continue;const t=i.loaders.get(e);t&&(l?t.abort():"idle"==t.status&&this._readAndUpload(t,n))}}})}_readAndUpload(e,n){const t=this.editor,l=t.model,i=t.locale.t,o=t.plugins.get(zu),r=t.plugins.get(fc);return l.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","reading",n)}),e.read().then(()=>{const i=e.upload();if(kt){const e=t.editing.mapper.toViewElement(n).getChild(0);t.editing.view.once("render",()=>{if(!e.parent)return;const n=t.editing.view.domConverter.mapViewToDom(e.parent);if(!n)return;const l=n.style.display;n.style.display="none",n._ckHack=n.offsetHeight,n.style.display=l})}return l.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","uploading",n)}),i}).then(e=>{l.enqueueChange("transparent",t=>{t.setAttributes({uploadStatus:"complete",src:e.default},n),this._parseAndSetSrcsetAttributeOnImage(e,n,t)}),s()}).catch(t=>{if("error"!==e.status&&"aborted"!==e.status)throw t;"error"==e.status&&t&&r.showWarning(t,{title:i("aq"),namespace:"upload"}),s(),l.enqueueChange("transparent",e=>{e.remove(n)})});function s(){l.enqueueChange("transparent",e=>{e.removeAttribute("uploadId",n),e.removeAttribute("uploadStatus",n)}),o.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,n,t){let l=0;const i=Object.keys(e).filter(e=>{const n=parseInt(e,10);if(!isNaN(n))return l=Math.max(l,n),!0}).map(n=>`${e[n]} ${n}w`).join(", ");""!=i&&t.setAttribute("srcset",{data:i,width:l},n)}}function pd(e,n){return Array.from(e.model.createRangeOn(n)).filter(e=>e.item.is("image")).map(e=>e.item)}class fd extends Us{static get pluginName(){return"ImageUpload"}static get requires(){return[hd,td,ld]}}class md extends Ks{refresh(){const e=this.editor.model,n=ra(e.document.selection.getSelectedBlocks());this.value=!!n&&n.is("paragraph"),this.isEnabled=!!n&&gd(n,e.schema)}execute(e={}){const n=this.editor.model,t=n.document;n.change(l=>{const i=(e.selection||t.selection).getSelectedBlocks();for(const e of i)!e.is("paragraph")&&gd(e,n.schema)&&l.rename(e,"paragraph")})}}function gd(e,n){return n.checkChild(e.parent,"paragraph")&&!n.isObject(e)}class vd extends Us{static get pluginName(){return"Paragraph"}init(){const e=this.editor,n=e.model,t=e.data;e.commands.add("paragraph",new md(e)),n.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,n)=>vd.paragraphLikeElements.has(e.name)?e.isEmpty?null:n.createElement("paragraph"):null,converterPriority:"low"}),t.upcastDispatcher.on("element",(e,n,t)=>{t.consumable.test(n.viewItem,{name:n.viewItem.name})&&yd(n.viewItem,n.modelCursor,t.schema)&&Object.assign(n,_d(n.viewItem,n.modelCursor,t))},{priority:"low"}),t.upcastDispatcher.on("text",(e,n,t)=>{n.modelRange||yd(n.viewItem,n.modelCursor,t.schema)&&Object.assign(n,_d(n.viewItem,n.modelCursor,t))},{priority:"lowest"}),n.document.registerPostFixer(e=>this._autoparagraphEmptyRoots(e)),e.data.on("ready",()=>{n.enqueueChange("transparent",e=>this._autoparagraphEmptyRoots(e))},{priority:"lowest"})}_autoparagraphEmptyRoots(e){const n=this.editor.model;for(const t of n.document.getRootNames()){const l=n.document.getRoot(t);if(l.isEmpty&&"$graveyard"!=l.rootName&&n.schema.checkChild(l,"paragraph"))return e.insertElement("paragraph",l),!0}}}function _d(e,n,t){const l=t.writer.createElement("paragraph");return t.writer.insert(l,n),t.convertItem(e,t.writer.createPositionAt(l,0))}function yd(e,n,t){const l=t.createContext(n);return!!t.checkChild(l,"paragraph")&&!!t.checkChild(l.push("paragraph"),e)}vd.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td"]);class bd extends Ks{constructor(e,n){super(e),this.modelElements=n}refresh(){const e=ra(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(n=>wd(e,n,this.editor.model.schema))}execute(e){const n=this.editor.model,t=n.document,l=e.value;n.change(e=>{const i=Array.from(t.selection.getSelectedBlocks()).filter(e=>wd(e,l,n.schema));for(const n of i)n.is(l)||e.rename(n,l)})}}function wd(e,n,t){return t.checkChild(e.parent,n)&&!t.isObject(e)}const kd="paragraph";class Md extends Us{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[vd]}init(){const e=this.editor,n=e.config.get("heading.options"),t=[];for(const l of n)l.model!==kd&&(e.model.schema.register(l.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(l),t.push(l.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new bd(e,t))}afterInit(){const e=this.editor,n=e.commands.get("enter"),t=e.config.get("heading.options");n&&this.listenTo(n,"afterExecute",(n,l)=>{const i=e.model.document.selection.getFirstPosition().parent;t.some(e=>i.is(e.model))&&!i.is(kd)&&0===i.childCount&&l.writer.rename(i,kd)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:hn.get("low")+1})}}class Cd{constructor(e,n){n&&Bn(this,n),e&&this.set(e)}}kn(Cd,Gn),t(10);class xd extends Us{init(){const e=this.editor,n=e.t,t=function(e){const n=e.t,t={Paragraph:n("bw"),"Heading 1":n("bx"),"Heading 2":n("by"),"Heading 3":n("bz"),"Heading 4":n("ca"),"Heading 5":n("cb"),"Heading 6":n("cc")};return e.config.get("heading.options").map(e=>{const n=t[e.title];return n&&n!=e.title&&(e.title=n),e})}(e),l=n("f"),i=n("g");e.ui.componentFactory.add("heading",n=>{const o={},r=new dt,s=e.commands.get("heading"),u=e.commands.get("paragraph"),a=[s];for(const e of t){const n={type:"button",model:new Cd({label:e.title,class:e.class,withText:!0})};"paragraph"===e.model?(n.model.bind("isOn").to(u,"value"),n.model.set("commandName","paragraph"),a.push(u)):(n.model.bind("isOn").to(s,"value",n=>n===e.model),n.model.set({commandName:"heading",commandValue:e.model})),r.add(n),o[e.model]=e.title}const c=Ys(n);return Fs(c,r),c.buttonView.set({isOn:!1,withText:!0,tooltip:i}),c.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),c.bind("isEnabled").toMany(a,"isEnabled",(...e)=>e.some(e=>e)),c.buttonView.bind("label").to(s,"value",u,"value",(e,n)=>{const t=e||n&&"paragraph";return o[t]?o[t]:l}),this.listenTo(c,"execute",n=>{e.execute(n.source.commandName,n.source.commandValue?{value:n.source.commandValue}:void 0),e.editing.view.focus()}),c})}}function Dd(e){for(const n of e.getChildren())if(n&&n.is("caption"))return n;return null}function Sd(e){const n=e.parent;return"figcaption"==e.name&&n&&"figure"==n.name&&n.hasClass("image")?{name:!0}:null}class Td extends Us{static get pluginName(){return"ImageCaptionEditing"}init(){const e=this.editor,n=e.editing.view,t=e.data,l=e.editing,i=e.t;e.model.schema.register("caption",{allowIn:"image",allowContentOf:"$block",isLimit:!0}),e.model.document.registerPostFixer(e=>this._insertMissingModelCaptionElement(e)),e.conversion.for("upcast").elementToElement({view:Sd,model:"caption"}),t.downcastDispatcher.on("insert:caption",Ld(e=>e.createContainerElement("figcaption"),!1));const o=function(e,n){return t=>{const l=t.createEditableElement("figcaption");return t.setCustomProperty("imageCaption",!0,l),Rr({view:e,element:l,text:n}),Ca(l,t)}}(n,i("ar"));l.downcastDispatcher.on("insert:caption",Ld(o)),l.downcastDispatcher.on("insert",this._fixCaptionVisibility(e=>e.item),{priority:"high"}),l.downcastDispatcher.on("remove",this._fixCaptionVisibility(e=>e.position.parent),{priority:"high"}),n.document.registerPostFixer(e=>this._updateCaptionVisibility(e))}_updateCaptionVisibility(e){const n=this.editor.editing.mapper,t=this._lastSelectedCaption;let l;const i=this.editor.model.document.selection,o=i.getSelectedElement();if(o&&o.is("image")){const e=Dd(o);l=n.toViewElement(e)}const r=Pd(i.getFirstPosition().parent);if(r&&(l=n.toViewElement(r)),l)return t?(t===l||(Ad(t,e),this._lastSelectedCaption=l),Id(l,e)):(this._lastSelectedCaption=l,Id(l,e));if(t){const n=Ad(t,e);return this._lastSelectedCaption=null,n}return!1}_fixCaptionVisibility(e){return(n,t,l)=>{const i=Pd(e(t)),o=l.writer;if(i){const e=this.editor.editing.mapper.toViewElement(i);e&&(i.childCount?o.removeClass("ck-hidden",e):o.addClass("ck-hidden",e))}}}_insertMissingModelCaptionElement(e){const n=this.editor.model,t=n.document.differ.getChanges(),l=[];for(const i of t)if("insert"==i.type&&"$text"!=i.name){const e=i.position.nodeAfter;if(e.is("image")&&!Dd(e)&&l.push(e),!e.is("image")&&e.childCount)for(const t of n.createRangeIn(e).getItems())t.is("image")&&!Dd(t)&&l.push(t)}for(const i of l)e.appendElement("caption",i);return!!l.length}}function Ld(e,n=!0){return(t,l,i)=>{const o=l.item;if((o.childCount||n)&&Ta(o.parent)){if(!i.consumable.consume(l.item,"insert"))return;const n=i.mapper.toViewElement(l.range.start.parent),t=e(i.writer),r=i.writer;o.childCount||r.addClass("ck-hidden",t),function(e,n,t,l){const i=l.writer.createPositionAt(t,"end");l.writer.insert(i,e),l.mapper.bindElements(n,e)}(t,l.item,n,i)}}}function Pd(e){const n=e.getAncestors({includeSelf:!0}).find(e=>"caption"==e.name);return n&&n.parent&&"image"==n.parent.name?n:null}function Ad(e,n){return!e.childCount&&!e.hasClass("ck-hidden")&&(n.addClass("ck-hidden",e),!0)}function Id(e,n){return!!e.hasClass("ck-hidden")&&(n.removeClass("ck-hidden",e),!0)}t(71);class Ed extends Ks{constructor(e,n){super(e),this.defaultStyle=!1,this.styles=n.reduce((e,n)=>(e[n.name]=n,n.isDefault&&(this.defaultStyle=n.name),e),{})}refresh(){const e=this.editor.model.document.selection.getSelectedElement();if(this.isEnabled=Ta(e),e)if(e.hasAttribute("imageStyle")){const n=e.getAttribute("imageStyle");this.value=!!this.styles[n]&&n}else this.value=this.defaultStyle;else this.value=!1}execute(e){const n=e.value,t=this.editor.model,l=t.document.selection.getSelectedElement();t.change(e=>{this.styles[n].isDefault?e.removeAttribute("imageStyle",l):e.setAttribute("imageStyle",n,l)})}}function Od(e,n){for(const t of n)if(t.name===e)return t}var jd='',Yd='',Fd='',Nd='';const Rd={full:{name:"full",title:"Full size image",icon:jd,isDefault:!0},side:{name:"side",title:"Side image",icon:Nd,className:"image-style-side"},alignLeft:{name:"alignLeft",title:"Left aligned image",icon:Yd,className:"image-style-align-left"},alignCenter:{name:"alignCenter",title:"Centered image",icon:Fd,className:"image-style-align-center"},alignRight:{name:"alignRight",title:"Right aligned image",icon:Nd,className:"image-style-align-right"}},Vd={full:jd,left:Yd,right:Nd,center:Fd};function Hd(e=[]){return e.map(zd)}function zd(e){if("string"==typeof e){const n=e;Rd[n]?e=Object.assign({},Rd[n]):(console.warn(Object(an.a)("image-style-not-found: There is no such image style of given name."),{name:n}),e={name:n})}else if(Rd[e.name]){const n=Rd[e.name],t=Object.assign({},e);for(const l in n)e.hasOwnProperty(l)||(t[l]=n[l]);e=t}return"string"==typeof e.icon&&Vd[e.icon]&&(e.icon=Vd[e.icon]),e}class Bd extends Us{static get pluginName(){return"ImageStyleEditing"}init(){const e=this.editor,n=e.model.schema,t=e.data,l=e.editing;e.config.define("image.styles",["full","side"]);const i=Hd(e.config.get("image.styles"));n.extend("image",{allowAttributes:"imageStyle"});const o=function(e){return(n,t,l)=>{if(!l.consumable.consume(t.item,n.name))return;const i=Od(t.attributeNewValue,e),o=Od(t.attributeOldValue,e),r=l.mapper.toViewElement(t.item),s=l.writer;o&&s.removeClass(o.className,r),i&&s.addClass(i.className,r)}}(i);l.downcastDispatcher.on("attribute:imageStyle:image",o),t.downcastDispatcher.on("attribute:imageStyle:image",o),t.upcastDispatcher.on("element:figure",function(e){const n=e.filter(e=>!e.isDefault);return(e,t,l)=>{if(!t.modelRange)return;const i=t.viewItem,o=ra(t.modelRange.getItems());if(l.schema.checkAttribute(o,"imageStyle"))for(const r of n)l.consumable.consume(i,{classes:r.className})&&l.writer.setAttribute("imageStyle",r.name,o)}}(i),{priority:"low"}),e.commands.add("imageStyle",new Ed(e,i))}}t(73);class Ud extends Us{static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Full size image":e("h"),"Side image":e("i"),"Left aligned image":e("j"),"Centered image":e("k"),"Right aligned image":e("l")}}init(){const e=function(e,n){for(const t of e)n[t.title]&&(t.title=n[t.title]);return e}(Hd(this.editor.config.get("image.styles")),this.localizedDefaultStylesTitles);for(const n of e)this._createButton(n)}_createButton(e){const n=this.editor;n.ui.componentFactory.add("imageStyle:"+e.name,t=>{const l=n.commands.get("imageStyle"),i=new Ls(t);return i.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(l,"isEnabled"),i.bind("isOn").to(l,"value",n=>n===e.name),this.listenTo(i,"execute",()=>n.execute("imageStyle",{value:e.name})),i})}}class Wd extends Us{static get requires(){return[Wc]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const n=e.plugins.get("BalloonToolbar");this.listenTo(n,"show",n=>{(function(e){const n=e.getSelectedElement();return!(!n||!wa(n))})(e.editing.view.document.selection)&&n.stop()},{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:n,items:t,getRelatedElement:l,balloonClassName:i="ck-toolbar-container"}){const o=this.editor,r=o.t,s=new Ns(o.locale);if(s.ariaLabel=n||r("ax"),this._toolbarDefinitions.has(e))throw new an.b("widget-toolbar-duplicated: Toolbar with the given id was already added.",this,{toolbarId:e});s.fillFromConfig(t,o.ui.componentFactory),this._toolbarDefinitions.set(e,{view:s,getRelatedElement:l,balloonClassName:i})}_updateToolbarsVisibility(){let e=0,n=null,t=null;for(const l of this._toolbarDefinitions.values()){const i=l.getRelatedElement(this.editor.editing.view.document.selection);if(this.editor.ui.focusTracker.isFocused)if(i){const o=i.getAncestors().length;o>e&&(e=o,n=i,t=l)}else this._isToolbarInBalloon(l)&&this._hideToolbar(l);else this._isToolbarVisible(l)&&this._hideToolbar(l)}t&&this._showToolbar(t,n)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,n){this._isToolbarVisible(e)?qd(this.editor,n):this._isToolbarInBalloon(e)||(this._balloon.add({view:e.view,position:$d(this.editor,n),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const e of this._toolbarDefinitions.values())if(this._isToolbarVisible(e)){const n=e.getRelatedElement(this.editor.editing.view.document.selection);qd(this.editor,n)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function qd(e,n){const t=e.plugins.get("ContextualBalloon"),l=$d(e,n);t.updatePosition(l)}function $d(e,n){const t=Vc.defaultPositions;return{target:e.editing.view.domConverter.mapViewToDom(n),positions:[t.northArrowSouth,t.northArrowSouthWest,t.northArrowSouthEast,t.southArrowNorth,t.southArrowNorthWest,t.southArrowNorthEast]}}class Gd extends Ks{constructor(e){super(e),this._childCommands=[]}refresh(){}execute(...e){this._getFirstEnabledCommand().execute(e)}registerChildCommand(e){this._childCommands.push(e),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){return this._childCommands.find(e=>e.isEnabled)}}class Kd extends Us{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new Gd(e)),e.commands.add("outdent",new Gd(e))}}var Jd='\n',Qd='\n';class Zd extends Us{static get pluginName(){return"IndentUI"}init(){const e=this.editor,n=e.locale,t=e.t,l="ltr"==n.uiLanguageDirection?Jd:Qd,i="ltr"==n.uiLanguageDirection?Qd:Jd;this._defineButton("indent",t("q"),l),this._defineButton("outdent",t("r"),i)}_defineButton(e,n,t){const l=this.editor;l.ui.componentFactory.add(e,i=>{const o=l.commands.get(e),r=new Ls(i);return r.set({label:n,icon:t,tooltip:!0}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(r,"execute",()=>l.execute(e)),r})}}class Xd extends Fl{constructor(e){super(e),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}t(75);class eh extends as{constructor(e,n=[]){super(e);const t=e.t;this.focusTracker=new Yr,this.keystrokes=new Sr,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(t("bf"),jc,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("bg"),Yc,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(n),this.children=this._createFormChildren(n),this._focusables=new Ur,this._focusCycler=new _s({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const l=["ck","ck-link-form"];n.length&&l.push("ck-link-form_layout-vertical"),this.setTemplate({tag:"form",attributes:{class:l,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,n)=>(e[n.name]=n.isOn,e),{})}render(){super.render(),Oc({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,n=new Ic(this.locale,Ec);return n.label=e("bh"),n.inputView.placeholder="https://example.com",n}_createButton(e,n,t,l){const i=new Ls(this.locale);return i.set({label:e,icon:n,tooltip:!0}),i.extendTemplate({attributes:{class:t}}),l&&i.delegate("execute").to(this,l),i}_createManualDecoratorSwitches(e){const n=this.createCollection();for(const t of e){const e=new Os(this.locale);e.set({name:t.id,label:t.label,withText:!0}),e.bind("isOn").to(t,"value"),e.on("execute",()=>{t.set("value",!e.isOn)}),n.add(e)}return n}_createFormChildren(e){const n=this.createCollection();if(n.add(this.urlInputView),e.length){const e=new as;e.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(e=>({tag:"li",children:[e],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),n.add(e)}return n.add(this.saveButtonView),n.add(this.cancelButtonView),n}}t(77);class nh extends as{constructor(e){super(e);const n=e.t;this.focusTracker=new Yr,this.keystrokes=new Sr,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(n("bb"),'',"unlink"),this.editButtonView=this._createButton(n("bc"),'',"edit"),this.set("href"),this._focusables=new Ur,this._focusCycler=new _s({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render(),[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createButton(e,n,t){const l=new Ls(this.locale);return l.set({label:e,icon:n,tooltip:!0}),l.delegate("execute").to(this,t),l}_createPreviewButton(){const e=new Ls(this.locale),n=this.bindTemplate,t=this.t;return e.set({withText:!0,tooltip:t("bd")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:n.to("href",e=>e&&nc(e)),target:"_blank"}}),e.bind("label").to(this,"href",e=>e||t("be")),e.bind("isEnabled").to(this,"href",e=>!!e),e.template.tag="a",e.template.eventListeners={},e}}const th="Ctrl+K";class lh extends Us{static get requires(){return[Wc]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(Xd),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=e.plugins.get(Wc),this._createToolbarLinkButton(),this._enableUserBalloonInteractions()}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const e=this.editor,n=new nh(e.locale),t=e.commands.get("link"),l=e.commands.get("unlink");return n.bind("href").to(t,"value"),n.editButtonView.bind("isEnabled").to(t),n.unlinkButtonView.bind("isEnabled").to(l),this.listenTo(n,"edit",()=>{this._addFormView()}),this.listenTo(n,"unlink",()=>{e.execute("unlink"),this._hideUI()}),n.keystrokes.set("Esc",(e,n)=>{this._hideUI(),n()}),n.keystrokes.set(th,(e,n)=>{this._addFormView(),n()}),n}_createFormView(){const e=this.editor,n=e.commands.get("link"),t=new eh(e.locale,n.manualDecorators);return t.urlInputView.bind("value").to(n,"value"),t.urlInputView.bind("isReadOnly").to(n,"isEnabled",e=>!e),t.saveButtonView.bind("isEnabled").to(n),this.listenTo(t,"submit",()=>{e.execute("link",t.urlInputView.inputView.element.value,t.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(t,"cancel",()=>{this._closeFormView()}),t.keystrokes.set("Esc",(e,n)=>{this._closeFormView(),n()}),t}_createToolbarLinkButton(){const e=this.editor,n=e.commands.get("link"),t=e.t;e.keystrokes.set(th,(e,t)=>{t(),n.isEnabled&&this._showUI(!0)}),e.ui.componentFactory.add("link",e=>{const l=new Ls(e);return l.isEnabled=!0,l.label=t("as"),l.icon='',l.keystroke=th,l.tooltip=!0,l.isToggleable=!0,l.bind("isEnabled").to(n,"isEnabled"),l.bind("isOn").to(n,"value",e=>!!e),this.listenTo(l,"execute",()=>this._showUI(!0)),l})}_enableUserBalloonInteractions(){this.listenTo(this.editor.editing.view.document,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),this.editor.keystrokes.set("Tab",(e,n)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),n())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,n)=>{this._isUIVisible&&(this._hideUI(),n())}),js({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const e=this.editor.commands.get("link");this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.select(),this.formView.urlInputView.inputView.element.value=e.value||""}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus())}_showUI(e=!1){this.editor.commands.get("link").isEnabled&&(this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI())}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView)}_startUpdatingUI(){const e=this.editor,n=e.editing.view.document;let t=this._getSelectedLinkElement(),l=o();const i=()=>{const e=this._getSelectedLinkElement(),n=o();t&&!e||!t&&n!==l?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),t=e,l=n};function o(){return n.selection.focus.getAncestors().reverse().find(e=>e.is("element"))}this.listenTo(e.ui,"update",i),this.listenTo(this._balloon,"change:visibleView",i)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,n=e.document,t=this._getSelectedLinkElement();return{target:t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(n.selection.getFirstRange())}}_getSelectedLinkElement(){const e=this.editor.editing.view,n=e.document.selection;if(n.isCollapsed)return ih(n.getFirstPosition());{const t=n.getFirstRange().getTrimmed(),l=ih(t.start),i=ih(t.end);return l&&l==i&&e.createRangeIn(l).getTrimmed().isEqual(t)?l:null}}}function ih(e){return e.getAncestors().find(e=>function(e){return e.is("attributeElement")&&!!e.getCustomProperty("link")}(e))}class oh extends Ks{constructor(e,n){super(e),this.type=n}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,n=Array.from(e.document.selection.getSelectedBlocks()).filter(n=>sh(n,e.schema)),t=!0===this.value;e.change(e=>{if(t){let t=n[n.length-1].nextSibling,l=Number.POSITIVE_INFINITY,i=[];for(;t&&"listItem"==t.name&&0!==t.getAttribute("listIndent");){const e=t.getAttribute("listIndent");e=t;)o>i.getAttribute("listIndent")&&(o=i.getAttribute("listIndent")),i.getAttribute("listIndent")==o&&e[n?"unshift":"push"](i),i=i[n?"previousSibling":"nextSibling"]}}function sh(e,n){return n.checkChild(e.parent,"listItem")&&!n.isObject(e)}class uh extends Ks{constructor(e,n){super(e),this._indentBy="forward"==n?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;let n=Array.from(e.document.selection.getSelectedBlocks());e.change(e=>{const t=n[n.length-1];let l=t.nextSibling;for(;l&&"listItem"==l.name&&l.getAttribute("listIndent")>t.getAttribute("listIndent");)n.push(l),l=l.nextSibling;this._indentBy<0&&(n=n.reverse());for(const i of n){const n=i.getAttribute("listIndent")+this._indentBy;n<0?e.rename(i,"paragraph"):e.setAttribute("listIndent",n,i)}})}_checkEnabled(){const e=ra(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("listItem"))return!1;if(this._indentBy>0){const n=e.getAttribute("listIndent"),t=e.getAttribute("listType");let l=e.previousSibling;for(;l&&l.is("listItem")&&l.getAttribute("listIndent")>=n;){if(l.getAttribute("listIndent")==n)return l.getAttribute("listType")==t;l=l.previousSibling}return!1}return!0}}function ah(e,n,t,l){const i=n.parent,o=t.mapper,r=t.writer;let s=o.toViewPosition(l.createPositionBefore(e));const u=hh(e.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:e.getAttribute("listIndent")}),a=e.previousSibling;if(u&&u.getAttribute("listIndent")==e.getAttribute("listIndent")){const e=o.toViewElement(u);s=r.breakContainer(r.createPositionAfter(e))}else s=o.toViewPosition(a&&"listItem"==a.name?l.createPositionAt(a,"end"):l.createPositionBefore(e));if(s=dh(s),r.insert(s,i),a&&"listItem"==a.name){const e=o.toViewElement(a),t=r.createRange(r.createPositionAt(e,0),s).getWalker({ignoreElementEnd:!0});for(const l of t)if(l.item.is("li")){const e=r.breakContainer(r.createPositionBefore(l.item)),i=l.item.parent,o=r.createPositionAt(n,"end");ch(r,o.nodeBefore,o.nodeAfter),r.move(r.createRangeOn(i),o),t.position=e}}else{const t=i.nextSibling;if(t&&(t.is("ul")||t.is("ol"))){let l=null;for(const n of t.getChildren()){const t=o.toModelElement(n);if(!(t&&t.getAttribute("listIndent")>e.getAttribute("listIndent")))break;l=n}l&&(r.breakContainer(r.createPositionAfter(l)),r.move(r.createRangeOn(l.parent),r.createPositionAt(n,"end")))}}ch(r,i,i.nextSibling),ch(r,i.previousSibling,i)}function ch(e,n,t){return!n||!t||"ul"!=n.name&&"ol"!=n.name||n.name!=t.name||n.getAttribute("class")!==t.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(n))}function dh(e){return e.getLastMatchingPosition(e=>e.item.is("uiElement"))}function hh(e,n){const t=!!n.sameIndent,l=!!n.smallerIndent,i=n.listIndent;let o=e;for(;o&&"listItem"==o.name;){const e=o.getAttribute("listIndent");if(t&&i==e||l&&i>e)return o;o=o.previousSibling}return null}function ph(e,n,t,l){e.ui.componentFactory.add(n,i=>{const o=e.commands.get(n),r=new Ls(i);return r.set({label:t,icon:l,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.on("execute",()=>e.execute(n)),r})}function fh(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:Yn.call(this)}function mh(e){return(n,t,l)=>{const i=l.consumable;if(!i.test(t.item,"insert")||!i.test(t.item,"attribute:listType")||!i.test(t.item,"attribute:listIndent"))return;i.consume(t.item,"insert"),i.consume(t.item,"attribute:listType"),i.consume(t.item,"attribute:listIndent");const o=t.item;ah(o,function(e,n){const t=n.mapper,l=n.writer,i="numbered"==e.getAttribute("listType")?"ol":"ul",o=function(e){const n=e.createContainerElement("li");return n.getFillerOffset=fh,n}(l),r=l.createContainerElement(i,null);return l.insert(l.createPositionAt(r,0),o),t.bindElements(e,o),o}(o,l),l,e)}}function gh(e,n,t){if(!t.consumable.consume(n.item,"attribute:listType"))return;const l=t.mapper.toViewElement(n.item),i=t.writer;i.breakContainer(i.createPositionBefore(l)),i.breakContainer(i.createPositionAfter(l)),i.rename("numbered"==n.attributeNewValue?"ol":"ul",l.parent)}function vh(e,n,t){const l=t.mapper.toViewElement(n.item).parent,i=t.writer;ch(i,l,l.nextSibling),ch(i,l.previousSibling,l);for(const o of n.item.getChildren())t.consumable.consume(o,"insert")}function _h(e,n,t){if("listItem"!=n.item.name){let e=t.mapper.toViewPosition(n.range.start);const l=t.writer,i=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&"li"==(e=l.breakContainer(e)).parent.name;){const n=e,t=l.createPositionAt(e.parent,"end");if(!n.isEqual(t)){const e=l.remove(l.createRange(n,t));i.push(e)}e=l.createPositionAfter(e.parent)}if(i.length>0){for(let n=0;n0){const n=ch(l,t,t.nextSibling);n&&n.parent==t&&e.offset--}}ch(l,e.nodeBefore,e.nodeAfter)}}}function yh(e,n,t){const l=t.mapper.toViewPosition(n.position);ch(t.writer,l.nodeBefore,l.nodeAfter)}function bh(e,n,t){if(t.consumable.consume(n.viewItem,{name:!0})){const e=t.writer,l=e.createElement("listItem"),i=function(e){let n=0,t=e.parent;for(;t;){if(t.is("li"))n++;else{const e=t.previousSibling;e&&e.is("li")&&n++}t=t.parent}return n}(n.viewItem);e.setAttribute("listIndent",i,l),e.setAttribute("listType",n.viewItem.parent&&"ol"==n.viewItem.parent.name?"numbered":"bulleted",l);const o=t.splitToAllowedParent(l,n.modelCursor);if(!o)return;e.insert(l,o.position);const r=function(e,n,t){const{writer:l,schema:i}=t;let o=l.createPositionAfter(e);for(const r of n)if("ul"==r.name||"ol"==r.name)o=t.convertItem(r,o).modelCursor;else{const n=t.convertItem(r,l.createPositionAt(e,"end")),s=n.modelRange.start.nodeAfter;s&&s.is("element")&&!i.checkChild(e,s.name)&&(e=n.modelCursor.parent.is("listItem")?n.modelCursor.parent:xh(n.modelCursor),o=l.createPositionAfter(e))}return o}(l,n.viewItem.getChildren(),t);n.modelRange=e.createRange(n.modelCursor,r),n.modelCursor=o.cursorParent?e.createPositionAt(o.cursorParent,0):n.modelRange.end}}function wh(e,n,t){if(t.consumable.test(n.viewItem,{name:!0})){const e=Array.from(n.viewItem.getChildren());for(const n of e)!n.is("li")&&!Sh(n)&&n._remove()}}function kh(e,n,t){if(t.consumable.test(n.viewItem,{name:!0})){if(0===n.viewItem.childCount)return;const e=[...n.viewItem.getChildren()];let t=!1,l=!0;for(const n of e)t&&!Sh(n)&&n._remove(),n.is("text")?(l&&(n._data=n.data.replace(/^\s+/,"")),n.nextSibling&&!Sh(n.nextSibling)||(n._data=n.data.replace(/\s+$/,""))):Sh(n)&&(t=!0),l=!1}}function Mh(e){return(n,t)=>{if(t.isPhantom)return;const l=t.modelPosition.nodeBefore;if(l&&l.is("listItem")){const n=t.mapper.toViewElement(l),i=n.getAncestors().find(Sh),o=e.createPositionAt(n,0).getWalker();for(const e of o){if("elementStart"==e.type&&e.item.is("li")){t.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==i){t.viewPosition=e.nextPosition;break}}}}}function Ch(e,[n,t]){let l,i=n.is("documentFragment")?n.getChild(0):n;if(l=t?this.createSelection(t):this.document.selection,i&&i.is("listItem")){const e=l.getFirstPosition();let n=null;if(e.parent.is("listItem")?n=e.parent:e.nodeBefore&&e.nodeBefore.is("listItem")&&(n=e.nodeBefore),n){const e=n.getAttribute("listIndent");if(e>0)for(;i&&i.is("listItem");)i._setAttribute("listIndent",i.getAttribute("listIndent")+e),i=i.nextSibling}}}function xh(e){const n=new Ci({startPosition:e});let t;do{t=n.next()}while(!t.value.item.is("listItem"));return t.value.item}function Dh(e,n,t,l,i,o){const r=hh(n.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:e,foo:"b"}),s=i.mapper,u=i.writer,a=r?r.getAttribute("listIndent"):null;let c;if(r)if(a==e){const e=s.toViewElement(r).parent;c=u.createPositionAfter(e)}else{const e=o.createPositionAt(r,"end");c=s.toViewPosition(e)}else c=t;c=dh(c);for(const d of[...l.getChildren()])Sh(d)&&(c=u.move(u.createRangeOn(d),c).end,ch(u,d,d.nextSibling),ch(u,d.previousSibling,d))}function Sh(e){return e.is("ol")||e.is("ul")}class Th extends Us{static get pluginName(){return"ListEditing"}static get requires(){return[vd]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const n=e.data,t=e.editing;e.model.document.registerPostFixer(n=>function(e,n){const t=e.document.differ.getChanges(),l=new Map;let i=!1;for(const u of t)if("insert"==u.type&&"listItem"==u.name)o(u.position);else if("insert"==u.type&&"listItem"!=u.name){if("$text"!=u.name){const t=u.position.nodeAfter;t.hasAttribute("listIndent")&&(n.removeAttribute("listIndent",t),i=!0),t.hasAttribute("listType")&&(n.removeAttribute("listType",t),i=!0);for(const n of Array.from(e.createRangeIn(t)).filter(e=>e.item.is("listItem")))o(n.previousPosition)}o(u.position.getShiftedBy(u.length))}else"remove"==u.type&&"listItem"==u.name?o(u.position):("attribute"==u.type&&"listIndent"==u.attributeKey||"attribute"==u.type&&"listType"==u.attributeKey)&&o(u.range.start);for(const u of l.values())r(u),s(u);return i;function o(e){const n=e.nodeBefore;if(n&&n.is("listItem")){let t=n;if(l.has(t))return;for(;t.previousSibling&&t.previousSibling.is("listItem");)if(t=t.previousSibling,l.has(t))return;l.set(e.nodeBefore,t)}else{const n=e.nodeAfter;n&&n.is("listItem")&&l.set(n,n)}}function r(e){let t=0,l=null;for(;e&&e.is("listItem");){const o=e.getAttribute("listIndent");if(o>t){let r;null===l?(l=o-t,r=t):(l>o&&(l=o),r=o-l),n.setAttribute("listIndent",r,e),i=!0}else l=null,t=e.getAttribute("listIndent")+1;e=e.nextSibling}}function s(e){let t=[],l=null;for(;e&&e.is("listItem");){const o=e.getAttribute("listIndent");if(l&&l.getAttribute("listIndent")>o&&(t=t.slice(0,o+1)),0!=o)if(t[o]){const l=t[o];e.getAttribute("listType")!=l&&(n.setAttribute("listType",l,e),i=!0)}else t[o]=e.getAttribute("listType");l=e,e=e.nextSibling}}}(e.model,n)),t.mapper.registerViewToModelLength("li",Lh),n.mapper.registerViewToModelLength("li",Lh),t.mapper.on("modelToViewPosition",Mh(t.view)),t.mapper.on("viewToModelPosition",function(e){return(n,t)=>{const l=t.viewPosition,i=l.parent,o=t.mapper;if("ul"==i.name||"ol"==i.name){if(l.isAtEnd){const n=o.toModelElement(l.nodeBefore),i=o.getModelLength(l.nodeBefore);t.modelPosition=e.createPositionBefore(n).getShiftedBy(i)}else{const n=o.toModelElement(l.nodeAfter);t.modelPosition=e.createPositionBefore(n)}n.stop()}else if("li"==i.name&&l.nodeBefore&&("ul"==l.nodeBefore.name||"ol"==l.nodeBefore.name)){const r=o.toModelElement(i);let s=1,u=l.nodeBefore;for(;u&&Sh(u);)s+=o.getModelLength(u),u=u.previousSibling;t.modelPosition=e.createPositionBefore(r).getShiftedBy(s),n.stop()}}}(e.model)),n.mapper.on("modelToViewPosition",Mh(t.view)),t.downcastDispatcher.on("insert",_h,{priority:"high"}),t.downcastDispatcher.on("insert:listItem",mh(e.model)),n.downcastDispatcher.on("insert",_h,{priority:"high"}),n.downcastDispatcher.on("insert:listItem",mh(e.model)),t.downcastDispatcher.on("attribute:listType:listItem",gh,{priority:"high"}),t.downcastDispatcher.on("attribute:listType:listItem",vh,{priority:"low"}),t.downcastDispatcher.on("attribute:listIndent:listItem",function(e){return(n,t,l)=>{if(!l.consumable.consume(t.item,"attribute:listIndent"))return;const i=l.mapper.toViewElement(t.item),o=l.writer;o.breakContainer(o.createPositionBefore(i)),o.breakContainer(o.createPositionAfter(i));const r=i.parent,s=r.previousSibling,u=o.createRangeOn(r);o.remove(u),s&&s.nextSibling&&ch(o,s,s.nextSibling),Dh(t.attributeOldValue+1,t.range.start,u.start,i,l,e),ah(t.item,i,l,e);for(const e of t.item.getChildren())l.consumable.consume(e,"insert")}}(e.model)),t.downcastDispatcher.on("remove:listItem",function(e){return(n,t,l)=>{const i=l.mapper.toViewPosition(t.position).getLastMatchingPosition(e=>!e.item.is("li")).nodeAfter,o=l.writer;o.breakContainer(o.createPositionBefore(i)),o.breakContainer(o.createPositionAfter(i));const r=i.parent,s=r.previousSibling,u=o.createRangeOn(r),a=o.remove(u);s&&s.nextSibling&&ch(o,s,s.nextSibling),Dh(l.mapper.toModelElement(i).getAttribute("listIndent")+1,t.position,u.start,i,l,e);for(const e of o.createRangeIn(a).getItems())l.mapper.unbindViewElement(e);n.stop()}}(e.model)),t.downcastDispatcher.on("remove",yh,{priority:"low"}),n.upcastDispatcher.on("element:ul",wh,{priority:"high"}),n.upcastDispatcher.on("element:ol",wh,{priority:"high"}),n.upcastDispatcher.on("element:li",kh,{priority:"high"}),n.upcastDispatcher.on("element:li",bh),e.model.on("insertContent",Ch,{priority:"high"}),e.commands.add("numberedList",new oh(e,"numbered")),e.commands.add("bulletedList",new oh(e,"bulleted")),e.commands.add("indentList",new uh(e,"forward")),e.commands.add("outdentList",new uh(e,"backward"));const l=t.view.document;this.listenTo(l,"enter",(e,n)=>{const t=this.editor.model.document,l=t.selection.getLastPosition().parent;t.selection.isCollapsed&&"listItem"==l.name&&l.isEmpty&&(this.editor.execute("outdentList"),n.preventDefault(),e.stop())}),this.listenTo(l,"delete",(e,n)=>{if("backward"!==n.direction)return;const t=this.editor.model.document.selection;if(!t.isCollapsed)return;const l=t.getFirstPosition();if(!l.isAtStart)return;const i=l.parent;"listItem"===i.name&&(i.previousSibling&&"listItem"===i.previousSibling.name||(this.editor.execute("outdentList"),n.preventDefault(),e.stop()))},{priority:"high"});const i=e=>(n,t)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),t())};e.keystrokes.set("Tab",i("indentList")),e.keystrokes.set("Shift+Tab",i("outdentList"))}afterInit(){const e=this.editor.commands,n=e.get("indent"),t=e.get("outdent");n&&n.registerChildCommand(e.get("indentList")),t&&t.registerChildCommand(e.get("outdentList"))}}function Lh(e){let n=1;for(const t of e.getChildren())if("ul"==t.name||"ol"==t.name)for(const e of t.getChildren())n+=Lh(e);return n}class Ph extends Us{init(){const e=this.editor.t;ph(this.editor,"numberedList",e("o"),''),ph(this.editor,"bulletedList",e("p"),'')}}function Ah(e,n){return e=>{e.on("attribute:url:media",t)};function t(t,l,i){if(!i.consumable.consume(l.item,t.name))return;const o=l.attributeNewValue,r=i.writer,s=i.mapper.toViewElement(l.item);r.remove(r.createRangeIn(s));const u=e.getMediaViewElement(r,o,n);r.insert(r.createPositionAt(s,0),u)}}function Ih(e,n,t,l){const i=e.createContainerElement("figure",{class:"media"});return i.getFillerOffset=jh,e.insert(e.createPositionAt(i,0),n.getMediaViewElement(e,t,l)),i}function Eh(e){const n=e.getSelectedElement();return n&&n.is("media")?n:null}function Oh(e,n,t){e.change(l=>{const i=l.createElement("media",{url:n});e.insertContent(i,t),l.setSelection(i,"on")})}function jh(){return null}class Yh extends Ks{refresh(){const e=this.editor.model,n=e.document.selection,t=e.schema,l=n.getFirstPosition(),i=Eh(n);let o=l.parent;o!=o.root&&(o=o.parent),this.value=i?i.getAttribute("url"):null,this.isEnabled=t.checkChild(o,"media")}execute(e){const n=this.editor.model,t=n.document.selection,l=Eh(t);if(l)n.change(n=>{n.setAttribute("url",e,l)});else{const l=xa(t,n);Oh(n,e,l)}}}class Fh{constructor(e,n){const t=n.providers,l=n.extraProviders||[],i=new Set(n.removeProviders),o=t.concat(l).filter(e=>{const n=e.name;return n?!i.has(n):(console.warn(Object(an.a)("media-embed-no-provider-name: The configured media provider has no name and cannot be used."),{provider:e}),!1)});this.locale=e,this.providerDefinitions=o}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,n,t){return this._getMedia(n).getViewElement(e,t)}_getMedia(e){if(!e)return new Nh(this.locale);e=e.trim();for(const n of this.providerDefinitions){const t=n.html;let l=n.url;Array.isArray(l)||(l=[l]);for(const n of l){const l=this._getUrlMatches(e,n);if(l)return new Nh(this.locale,e,l,t)}}return null}_getUrlMatches(e,n){let t=e.match(n);if(t)return t;let l=e.replace(/^https?:\/\//,"");return(t=l.match(n))?t:(t=(l=l.replace(/^www\./,"")).match(n))||null}}class Nh{constructor(e,n,t,l){this.url=this._getValidUrl(n),this._t=e.t,this._match=t,this._previewRenderer=l}getViewElement(e,n){const t={};if(n.renderForEditingView||n.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(t["data-oembed-url"]=this.url),n.renderForEditingView&&(t.class="ck-media__wrapper");const l=this._getPreviewHtml(n);return e.createUIElement("div",t,(function(e){const n=this.toDomElement(e);return n.innerHTML=l,n}))}return this.url&&(t.url=this.url),e.createEmptyElement("oembed",t)}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new Ts,n=new Ss;return e.text=this._t("Open media in new tab"),n.content='',n.viewBox="0 0 64 42",new Wr({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[n]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]},e]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}t(79);class Rh extends Us{static get pluginName(){return"MediaEmbedEditing"}constructor(e){super(e),e.config.define("mediaEmbed",{providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:e=>`
`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:e=>`
`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)/,/^youtube\.com\/embed\/([\w-]+)/,/^youtu\.be\/([\w-]+)/],html:e=>`
`},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:e=>`
`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:/^google\.com\/maps/},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new Fh(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,n=e.model.schema,t=e.t,l=e.conversion,i=e.config.get("mediaEmbed.previewsInData"),o=this.registry;e.commands.add("mediaEmbed",new Yh(e)),n.register("media",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["url"]}),l.for("dataDowncast").elementToElement({model:"media",view:(e,n)=>{const t=e.getAttribute("url");return Ih(n,o,t,{renderMediaPreview:t&&i})}}),l.for("dataDowncast").add(Ah(o,{renderMediaPreview:i})),l.for("editingDowncast").elementToElement({model:"media",view:(e,n)=>{const l=e.getAttribute("url");return function(e,n,t){return n.setCustomProperty("media",!0,e),ka(e,n,{label:t})}(Ih(n,o,l,{renderForEditingView:!0}),n,t("ap"))}}),l.for("editingDowncast").add(Ah(o,{renderForEditingView:!0})),l.for("upcast").elementToElement({view:{name:"oembed",attributes:{url:!0}},model:(e,n)=>{const t=e.getAttribute("url");if(o.hasMedia(t))return n.createElement("media",{url:t})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(e,n)=>{const t=e.getAttribute("data-oembed-url");if(o.hasMedia(t))return n.createElement("media",{url:t})}})}}const Vh=/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=]+$/;class Hh extends Us{static get requires(){return[Gs,Ru]}static get pluginName(){return"AutoMediaEmbed"}constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,n=e.model.document;this.listenTo(e.plugins.get(Gs),"inputTransformation",()=>{const e=n.selection.getFirstRange(),t=fr.fromPosition(e.start);t.stickiness="toPrevious";const l=fr.fromPosition(e.end);l.stickiness="toNext",n.once("change:data",()=>{this._embedMediaBetweenPositions(t,l),t.detach(),l.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(sl.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,n){const t=this.editor,l=t.plugins.get(Rh).registry,i=new Ni(e,n),o=i.getWalker({ignoreElementEnd:!0});let r="";for(const s of o)s.item.is("textProxy")&&(r+=s.item.data);(r=r.trim()).match(Vh)&&l.hasMedia(r)&&t.commands.get("mediaEmbed").isEnabled&&(this._positionToInsert=fr.fromPosition(e),this._timeoutId=sl.window.setTimeout(()=>{t.model.change(e=>{let n;this._timeoutId=null,e.remove(i),"$graveyard"!==this._positionToInsert.root.rootName&&(n=this._positionToInsert),Oh(t.model,r,n),this._positionToInsert.detach(),this._positionToInsert=null})},100))}}t(81);class zh extends as{constructor(e,n){super(n);const t=n.t;this.focusTracker=new Yr,this.keystrokes=new Sr,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(t("bf"),jc,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("bg"),Yc,"ck-button-cancel","cancel"),this._focusables=new Ur,this._focusCycler=new _s({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),Oc({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element);const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e),this.listenTo(this.urlInputView.element,"selectstart",(e,n)=>{n.stopPropagation()},{priority:"high"})}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.inputView.element.value.trim()}set url(e){this.urlInputView.inputView.element.value=e.trim()}isValid(){this.resetFormStatus();for(const e of this._validators){const n=e(this);if(n)return this.urlInputView.errorText=n,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const e=this.locale.t,n=new Ic(this.locale,Ec),t=n.inputView;return this._urlInputViewInfoDefault=e("br"),this._urlInputViewInfoTip=e("bs"),n.label=e("bt"),n.infoText=this._urlInputViewInfoDefault,t.placeholder="https://example.com",t.on("input",()=>{n.infoText=t.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault}),n}_createButton(e,n,t,l){const i=new Ls(this.locale);return i.set({label:e,icon:n,tooltip:!0}),i.extendTemplate({attributes:{class:t}}),l&&i.delegate("execute").to(this,l),i}}class Bh extends Us{static get requires(){return[Rh]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,n=e.commands.get("mediaEmbed"),t=e.plugins.get(Rh).registry;this.form=new zh(function(e,n){return[n=>{if(!n.url.length)return e("an")},t=>{if(!n.hasMedia(t.url))return e("ao")}]}(e.t,t),e.locale),e.ui.componentFactory.add("mediaEmbed",t=>{const l=Ys(t);return this._setUpDropdown(l,this.form,n,e),this._setUpForm(this.form,l,n),l})}_setUpDropdown(e,n,t){const l=this.editor,i=l.t,o=e.buttonView;function r(){l.editing.view.focus(),e.isOpen=!1}e.bind("isEnabled").to(t),e.panelView.children.add(n),o.set({label:i("am"),icon:'',tooltip:!0}),o.on("open",()=>{n.url=t.value||"",n.urlInputView.select(),n.focus()},{priority:"low"}),e.on("submit",()=>{n.isValid()&&(l.execute("mediaEmbed",n.url),r())}),e.on("change:isOpen",()=>n.resetFormStatus()),e.on("cancel",()=>r())}_setUpForm(e,n,t){e.delegate("submit","cancel").to(n),e.urlInputView.bind("value").to(t,"value"),e.urlInputView.bind("isReadOnly").to(t,"isEnabled",e=>!e),e.saveButtonView.bind("isEnabled").to(t)}}function Uh(e){const n={},t=e.getStyle("mso-list");return t&&(n.id=parseInt(t.match(/(^|\s+)l(\d+)/i)[2]),n.order=parseInt(t.match(/\s*lfo(\d+)/i)[1]),n.indent=parseInt(t.match(/\s*level(\d+)/i)[1])),n}t(83);const Wh=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class qh{isActive(e){return Wh.test(e)}execute(e){const n=new ad;!function(e,n){for(const t of e.getChildren())if(t.is("b")&&"normal"===t.getStyle("font-weight")){const l=e.getChildIndex(t);n.remove(t),n.insertChild(l,t.getChildren(),e)}}(e.content,n),function(e,n){for(const t of n.createRangeIn(e)){const e=t.item;if(e.is("li")){const t=e.getChild(0);t.is("p")&&n.unwrapElement(t)}}}(e.content,n)}}function $h(e){return e.replace(/(\s+)<\/span>/g,(e,n)=>1===n.length?" ":Array(n.length+1).join("\xa0 ").substr(0,n.length))}function Gh(e){return btoa(e.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join(""))}const Kh=//i,Jh=/xmlns:o="urn:schemas-microsoft-com/i;class Qh{isActive(e){return Kh.test(e)||Jh.test(e)}execute(e){const{body:n,stylesString:t}=function(e){const n=new DOMParser,t=function(e){return $h($h(e)).replace(/([\s]*?)[\r\n]+(\s*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g,"\xa0<\/o:p>/g,"\xa0").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>(\s*[\r\n]\s*)<")}(function(e){const n=e.match(/<\/body>(.*?)(<\/html>|$)/);return n&&n[1]&&(e=e.slice(0,n.index)+e.slice(n.index).replace(n[1],"")),e}(e=e.replace(/