@progress/kendo-angular-editor 3.1.2-dev.202202251414 → 3.1.3-dev.202203091612

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core"),require("@progress/kendo-angular-toolbar"),require("@progress/kendo-angular-dialog"),require("@progress/kendo-angular-common"),require("@progress/kendo-angular-l10n"),require("@angular/forms"),require("@progress/kendo-angular-dropdowns"),require("rxjs"),require("@progress/kendo-angular-inputs"),require("@progress/kendo-licensing"),require("@angular/common"),require("@progress/kendo-angular-buttons"),require("@progress/kendo-angular-popup")):"function"==typeof define&&define.amd?define([,,,,,,,,,,,,],e):"object"==typeof exports?exports.KendoAngularEditor=e(require("@angular/core"),require("@progress/kendo-angular-toolbar"),require("@progress/kendo-angular-dialog"),require("@progress/kendo-angular-common"),require("@progress/kendo-angular-l10n"),require("@angular/forms"),require("@progress/kendo-angular-dropdowns"),require("rxjs"),require("@progress/kendo-angular-inputs"),require("@progress/kendo-licensing"),require("@angular/common"),require("@progress/kendo-angular-buttons"),require("@progress/kendo-angular-popup")):t.KendoAngularEditor=e(t.ng.core,t.KendoAngularToolbar,t.KendoAngularDialog,t.KendoAngularCommon,t.KendoAngularL10N,t.ng.forms,t.KendoAngularDropdowns,t.rxjs,t.KendoAngularInputs,t.KendoLicensing,t.ng.common,t.KendoAngularButtons,t.KendoAngularPopup)}(window,(function(t,e,n,r,o,i,s,a,c,u,l,d,p){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=36)}([function(t,e,n){"use strict";n.r(e),n.d(e,"__extends",(function(){return o})),n.d(e,"__assign",(function(){return i})),n.d(e,"__rest",(function(){return s})),n.d(e,"__decorate",(function(){return a})),n.d(e,"__param",(function(){return c})),n.d(e,"__metadata",(function(){return u})),n.d(e,"__awaiter",(function(){return l})),n.d(e,"__generator",(function(){return d})),n.d(e,"__createBinding",(function(){return p})),n.d(e,"__exportStar",(function(){return f})),n.d(e,"__values",(function(){return h})),n.d(e,"__read",(function(){return m})),n.d(e,"__spread",(function(){return v})),n.d(e,"__spreadArrays",(function(){return g})),n.d(e,"__await",(function(){return y})),n.d(e,"__asyncGenerator",(function(){return b})),n.d(e,"__asyncDelegator",(function(){return w})),n.d(e,"__asyncValues",(function(){return _})),n.d(e,"__makeTemplateObject",(function(){return x})),n.d(e,"__importStar",(function(){return k})),n.d(e,"__importDefault",(function(){return C})),n.d(e,"__classPrivateFieldGet",(function(){return S})),n.d(e,"__classPrivateFieldSet",(function(){return T}));
5
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core"),require("@progress/kendo-angular-toolbar"),require("@progress/kendo-angular-dialog"),require("@progress/kendo-angular-common"),require("@progress/kendo-angular-l10n"),require("@angular/forms"),require("@progress/kendo-angular-dropdowns"),require("rxjs"),require("rxjs/operators"),require("@progress/kendo-angular-inputs"),require("@progress/kendo-licensing"),require("@angular/common"),require("@progress/kendo-angular-buttons"),require("@progress/kendo-angular-popup")):"function"==typeof define&&define.amd?define([,,,,,,,,,,,,,],e):"object"==typeof exports?exports.KendoAngularEditor=e(require("@angular/core"),require("@progress/kendo-angular-toolbar"),require("@progress/kendo-angular-dialog"),require("@progress/kendo-angular-common"),require("@progress/kendo-angular-l10n"),require("@angular/forms"),require("@progress/kendo-angular-dropdowns"),require("rxjs"),require("rxjs/operators"),require("@progress/kendo-angular-inputs"),require("@progress/kendo-licensing"),require("@angular/common"),require("@progress/kendo-angular-buttons"),require("@progress/kendo-angular-popup")):t.KendoAngularEditor=e(t.ng.core,t.KendoAngularToolbar,t.KendoAngularDialog,t.KendoAngularCommon,t.KendoAngularL10N,t.ng.forms,t.KendoAngularDropdowns,t.rxjs,t.rxjs.operators,t.KendoAngularInputs,t.KendoLicensing,t.ng.common,t.KendoAngularButtons,t.KendoAngularPopup)}(window,(function(t,e,n,o,r,i,a,s,l,c,d,u,p,f){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=36)}([function(t,e,n){"use strict";n.r(e),n.d(e,"__extends",(function(){return r})),n.d(e,"__assign",(function(){return i})),n.d(e,"__rest",(function(){return a})),n.d(e,"__decorate",(function(){return s})),n.d(e,"__param",(function(){return l})),n.d(e,"__metadata",(function(){return c})),n.d(e,"__awaiter",(function(){return d})),n.d(e,"__generator",(function(){return u})),n.d(e,"__createBinding",(function(){return p})),n.d(e,"__exportStar",(function(){return f})),n.d(e,"__values",(function(){return h})),n.d(e,"__read",(function(){return m})),n.d(e,"__spread",(function(){return v})),n.d(e,"__spreadArrays",(function(){return g})),n.d(e,"__await",(function(){return y})),n.d(e,"__asyncGenerator",(function(){return b})),n.d(e,"__asyncDelegator",(function(){return w})),n.d(e,"__asyncValues",(function(){return k})),n.d(e,"__makeTemplateObject",(function(){return _})),n.d(e,"__importStar",(function(){return C})),n.d(e,"__importDefault",(function(){return x})),n.d(e,"__classPrivateFieldGet",(function(){return S})),n.d(e,"__classPrivateFieldSet",(function(){return E}));
6
6
  /*! *****************************************************************************
7
7
  Copyright (c) Microsoft Corporation.
8
8
 
@@ -17,4 +17,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
17
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
18
  PERFORMANCE OF THIS SOFTWARE.
19
19
  ***************************************************************************** */
20
- var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function s(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function a(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function c(t,e){return function(n,r){e(n,r,t)}}function u(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function l(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}function d(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function p(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}function f(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||(e[n]=t[n])}function h(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function v(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(m(arguments[e]));return t}function g(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r}function y(t){return this instanceof y?(this.v=t,this):new y(t)}function b(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(t,e||[]),i=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(t){o[t]&&(r[t]=function(e){return new Promise((function(n,r){i.push([t,e,n,r])>1||a(t,e)}))})}function a(t,e){try{(n=o[t](e)).value instanceof y?Promise.resolve(n.value.v).then(c,u):l(i[0][2],n)}catch(t){l(i[0][3],t)}var n}function c(t){a("next",t)}function u(t){a("throw",t)}function l(t,e){t(e),i.shift(),i.length&&a(i[0][0],i[0][1])}}function w(t){var e,n;return e={},r("next"),r("throw",(function(t){throw t})),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,o){e[r]=t[r]?function(e){return(n=!n)?{value:y(t[r](e)),done:"return"===r}:o?o(e):e}:o}}function _(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=h(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(e=t[n](e)).done,e.value)}))}}}function x(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function k(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function C(t){return t&&t.__esModule?t:{default:t}}function S(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function T(t,e,n){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,n),n}},function(e,n){e.exports=t},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(11),s=function(t){function e(e,n,r){return t.call(this,e,n,r)||this}return r.__extends(e,t),e=r.__decorate([r.__param(0,o.Inject(i.L10N_PREFIX)),r.__param(1,o.Optional()),r.__param(2,o.Optional()),r.__param(2,o.Inject(i.RTL)),r.__metadata("design:paramtypes",[String,i.MessageService,Boolean])],e)}(i.LocalizationService);e.EditorLocalizationService=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(12),s=n(15),a=n(22),c=n(4),u=n(7),l=n(10),d=n(8),p=n(37),f=n(38),h=n(23),m=n(41),v=n(43),g=n(9),y=n(24),b=n(25),w=n(26),_=n(11),x=n(2),k=n(44),C=n(27),S=n(5),T=n(28),E={convertMsLists:!1,removeAttributes:[],removeHtmlComments:!1,removeInvalidHTML:!0,removeMsClasses:!1,removeMsStyles:!1,stripTags:[]},M=g.conditionallyExecute(d.removeComments),O=g.conditionallyExecute(d.sanitize),D=function(t){if("all"===t.removeAttributes)return{"*":d.removeAttribute};var e=g.removeEmptyEntries({style:t.removeMsStyles?d.sanitizeStyleAttr:void 0,class:t.removeMsClasses?d.sanitizeClassAttr:void 0});return t.removeAttributes.reduce((function(t,e){var n;return r.__assign({},t,((n={})[e]=d.removeAttribute,n))}),e)},I=function(){function t(t,e,n,i,a,c){var u=this;this.dialogService=t,this.localization=e,this.cdr=n,this.ngZone=i,this.element=a,this.toolsService=c,this.iframe=!0,this.applyToWord=!1,this.preserveWhitespace=!1,this.resizable=!1,this.valueChange=new o.EventEmitter,this.onFocus=new o.EventEmitter,this.paste=new o.EventEmitter,this.onBlur=new o.EventEmitter,this.hostClass=!0,this.stateChange=new s.BehaviorSubject(v.initialToolBarState),this.valueModified=new s.Subject,this._readonly=!1,this._placeholder="",this.inForm=!1,this.afterViewInit=new s.Subject,this.contentAreaLoaded=new s.Subject,this.dispatchTransaction=function(t){var e=t.docChanged;if(!(u.disabled||u.readonly&&e)){if(e){var n=t.doc,r=d.getHtml({doc:n});u.trOnChange=t,u.htmlOnChange=r,u.ngZone.run((function(){u.valueModified.next(r)}))}e&&!u.inForm||u.view.updateState(u.view.state.apply(t))}},this.transformPastedHTML=function(t){var e=r.__assign({},E,u.pasteCleanupSettings),n=g.pipe(O(e.removeInvalidHTML),M(e.removeHtmlComments))(t),o=d.pasteCleanup(n,{convertMsLists:e.convertMsLists,stripTags:e.stripTags.join("|"),attributes:D(e)});if(l.hasObservers(u.paste)){var i=new T.EditorPasteEvent(o,t,u._pasteEvent);return u.ngZone.run((function(){return u.paste.emit(i)})),i.isDefaultPrevented()?"":i.cleanedHtml}return o},this.changeValue=function(t){var e=u._value;if(u._value=t,u._view){if(u.htmlOnChange===t&&u.trOnChange)u.view.updateState(u.view.state.apply(u.trOnChange));else if((e||"")!==(t||"")){if(u.iframe&&!u.container.element.nativeElement.contentWindow)return;var n=u.view.state,r=d.parseContent(t||"",n.schema,{preserveWhitespace:u.preserveWhitespace}),o=n.tr.setSelection(new d.AllSelection(n.doc)).replaceSelectionWith(r);u.view.updateState(n.apply(o))}u.trOnChange=null,u.htmlOnChange=null}},this.onChangeCallback=function(t){u.changeValue(t)},this.onTouchedCallback=function(t){},this.onPaste=function(t,e){return u._pasteEvent=e,!1},p.validatePackage(f.packageMetadata),this.direction=e.rtl?"rtl":"ltr",this.subs=s.zip(this.afterViewInit.asObservable(),this.contentAreaLoaded.asObservable()).subscribe((function(){return u.initialize()}))}var e;return e=t,Object.defineProperty(t.prototype,"value",{get:function(){if(this.trOnChange)return this.htmlOnChange;var t=this._view?this.getSource():this._value;return"<p></p>"===t?this._value?"":this._value:t},set:function(t){this.changeValue(t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this._disabled},set:function(t){this._disabled=t||!1,this._view&&this._view.updateState(this._view.state),this._disabled&&(this.readonly=!1),this._disabled||this._readonly?this.stateChange.next(v.disabledToolBarState):this.stateChange.next(v.initialToolBarState)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"readonly",{get:function(){return this._readonly},set:function(t){if(this._readonly=t||!1,this._view){var e=void 0,n=(e=this.iframe?this.container.element.nativeElement.contentWindow:window).getSelection().focusNode;this._view.dom.contains(n)&&e.getSelection().removeAllRanges();var r=this._view.state.doc,o=this._view.state.tr.setSelection(d.TextSelection.create(r,1));this._view.dispatch(o)}this._readonly?(this.toolbar&&(this.toolbar.tabindex=-1),this.stateChange.next(v.disabledToolBarState)):(this.toolbar&&(this.toolbar.tabindex=0),this.stateChange.next(v.initialToolBarState))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return this._schema},set:function(t){if(o.isDevMode){if(!(t instanceof d.Schema))throw new Error(C.EditorErrorMessages.schemaType);if(this._view)throw new Error(C.EditorErrorMessages.setSchemaOnce)}this._schema=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"plugins",{get:function(){return this._plugins},set:function(t){if(o.isDevMode){if("function"!=typeof t)throw new Error(C.EditorErrorMessages.pluginsCallbackType(t));if(this._view)throw new Error(C.EditorErrorMessages.setPluginsOnce)}this._plugins=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"placeholder",{get:function(){return this._placeholder},set:function(t){if(o.isDevMode&&this._view)throw new Error(C.EditorErrorMessages.setPlaceHolderOnce);this._placeholder=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"resizableClass",{get:function(){return!!this.resizable},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisabled",{get:function(){return this.disabled},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isReadonly",{get:function(){return this.readonly},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isIE",{get:function(){return this.iframe&&g.detectIE()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dir",{get:function(){return this.direction},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ariaDisabled",{get:function(){return this.disabled},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minWidth",{get:function(){var t=this.resizable;return t.minWidth?t.minWidth+"px":void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxWidth",{get:function(){var t=this.resizable;return t.maxWidth?t.maxWidth+"px":void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minHeight",{get:function(){var t=this.resizable;return t.minHeight?t.minHeight+"px":void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxHeight",{get:function(){var t=this.resizable;return t.maxHeight?t.maxHeight+"px":void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"toolbar",{get:function(){return this.defaultToolbarComponent||this.userToolBarComponent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"view",{get:function(){return this._view},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selectionText",{get:function(){return this._view&&this._view.state?d.getSelectionText(this._view.state):""},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this.subs.add(this.localization.changes.subscribe((function(e){var n=e.rtl;t.direction=n?"rtl":"ltr"}))),this.subs.add(this.toolsService.needsCheck.subscribe((function(){return t.cdr.markForCheck()})))},t.prototype.ngAfterViewInit=function(){this.afterViewInit.next(),this.iframe||this.contentAreaLoaded.next(),this.resizable&&this.normalizeSize()},t.prototype.ngOnChanges=function(t){var e=this;t.value&&this.view&&this.changeValue(t.value.currentValue),t.iframe&&!t.iframe.isFirstChange()&&this.ngZone.onStable.pipe(a.take(1)).subscribe((function(){return e.initialize()})),t.resizable&&!t.resizable.isFirstChange()&&this.normalizeSize()},t.prototype.setDisabledState=function(t){this.disabled=t},t.prototype.iframeOnLoad=function(){this.contentAreaLoaded.next()},t.prototype.exec=function(t,e){"setHTML"===t&&"string"==typeof e?e={content:e,parseOptions:{preserveWhitespace:this.preserveWhitespace}}:["fontFamily","fontSize","foreColor","backColor","createLink"].some((function(e){return e===t}))&&(e={value:e,applyToWord:this.applyToWord}),m.editorCommands[t](e)(this._view.state,this._view.dispatch,this._view)},t.prototype.openDialog=function(t){var e={createLink:{content:w.FileLinkDialogComponent},insertFile:{content:w.FileLinkDialogComponent},insertImage:{content:b.ImageDialogComponent},viewSource:{content:y.SourceDialogComponent,height:400,width:500}},n=Object.assign({appendTo:this.dialogContainer},e[t]);this.toolbar.toggle(!1);var r=this.dialogService.open(n).content.instance;"createLink"!==t&&"insertFile"!==t||(r.command=t),r.editor=this,r.setData(this._view.state,{applyToWord:this.applyToWord})},t.prototype.focus=function(){this.focusChangedProgrammatically=!0,this._view.focus(),this.focusChangedProgrammatically=!1},t.prototype.blur=function(){this.focusChangedProgrammatically=!0,this._view.dom.blur(),this.focusChangedProgrammatically=!1},t.prototype.getSource=function(){return d.getHtml(this._view.state)},t.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe(),this._styleObserver&&this._styleObserver.disconnect()},t.prototype.writeValue=function(t){this.inForm=!0,this.value=null===t?void 0:t},t.prototype.registerOnChange=function(t){this.onChangeCallback=t},t.prototype.registerOnTouched=function(t){this.onTouchedCallback=t},t.prototype.isEmpty=function(){return!1},t.prototype.initialize=function(){var t=this;if(l.isDocumentAvailable()){var e=this.schema||h.schema,n=this.container.element.nativeElement,r=d.parseContent((this.value||"").trim(),e,{preserveWhitespace:this.preserveWhitespace});if(this.iframe){var o=n.contentDocument,i=o.createElement("meta");i.setAttribute("charset","utf-8"),o.head.appendChild(i),[k.defaultStyle,k.tablesStyles,"rtl"===this.dir?k.rtlStyles:void 0].forEach((function(t){if(t){var e=o.createElement("style");e.appendChild(o.createTextNode(t)),o.head.appendChild(e)}})),(c=o.createElement("div")).classList.add("k-content"),o.body.appendChild(c)}else{var c=document.createElement("div");n.appendChild(c)}var u=[new d.Plugin({key:new d.PluginKey("editor-tabindex"),props:{attributes:function(){return{tabIndex:t.readonly?"0":""}}}}),new d.Plugin({key:new d.PluginKey("toolbar-tools-update"),view:function(){return{update:function(e){t.disabled||t.stateChange.next(t.readonly?v.disabledToolBarState:v.getToolbarState(e.state,{applyToWord:t.applyToWord}))}}}}),d.history(),d.keymap(d.buildListKeymap(e)),d.keymap(d.buildKeymap(e,{applyToWord:this.applyToWord})),d.keymap(d.baseKeymap),d.gapCursor(),d.imageResizing(),d.tableEditing(),d.caretColor()];this.placeholder&&u.push(d.placeholder(this.placeholder));var p=d.EditorState.create({schema:e,doc:r,plugins:g.isPresent(this.plugins)?this.plugins(u):u});if(this.iframe?this.viewMountElement=n.contentDocument.querySelector("div"):this.viewMountElement=n.querySelector("div"),this.ngZone.runOutsideAngular((function(){t._view=new d.EditorView({mount:t.viewMountElement},{state:p,editable:function(){return!t.readonly},dispatchTransaction:t.dispatchTransaction,transformPastedHTML:t.transformPastedHTML,handleDOMEvents:{paste:t.onPaste}})})),this._view){var f=void 0,m=this.element.nativeElement.querySelector(".k-editor-content").classList;f=this.iframe?this.container.element.nativeElement.contentDocument:this.container.element.nativeElement,this.subs.add(s.fromEvent(f,"focusin").subscribe((function(e){if(t.readonly&&m.add("k-focus"),!t.focusChangedProgrammatically||t.shouldEmitFocus){var n=e.relatedTarget;n&&n.classList.contains("k-colorpicker")&&!t.shouldEmitFocus||t.ngZone.run((function(){return t.onFocus.emit()})),t.shouldEmitFocus=!1}}))),this.subs.add(s.fromEvent(f,"focusout").subscribe((function(e){if(t.readonly&&m.remove("k-focus"),!t.focusChangedProgrammatically){var n=e.relatedTarget;n&&n.classList.contains("k-colorpicker")||t.ngZone.run((function(){return t.onBlur.emit()}))}})))}this.subs.add(this.stateChange.subscribe((function(){t.userToolBarComponent?t.userToolBarComponent.cdr.detectChanges():t.cdr.detectChanges()}))),this.subs.add(this.valueModified.subscribe((function(e){t.onChangeCallback(e),t.valueChange.emit(e),t.cdr.markForCheck()}))),this.subs.add(s.fromEvent(this.viewMountElement,"keyup").pipe(a.map((function(t){return t.keyCode})),a.filter((function(t){return 121===t})),a.map((function(){return t.userToolBarElement||t.defaultToolbar}))).subscribe((function(t){return t.nativeElement.focus()}))),this.subs.add(s.fromEvent(this.viewMountElement,"blur").pipe(a.filter((function(e){return!t.viewMountElement.contains(e.relatedTarget)}))).subscribe((function(){return t.onTouchedCallback()})))}},t.prototype.normalizeSize=function(){var t=this;if("object"==typeof this.resizable&&!this._styleObserver){var e=this.element.nativeElement;this._styleObserver=new MutationObserver((function(){t.ngZone.runOutsideAngular((function(){return t.normalizeProperties(e)}))})),this._styleObserver.observe(e,{attributeFilter:["style"]})}},t.prototype.normalizeProperties=function(t){var e=Object.keys(this.resizable),n=parseInt(t.style.width,10),r=parseInt(t.style.height,10),o=this.resizable;e.forEach((function(e){var i=e.startsWith("min"),s=!i,a=e.endsWith("Width"),c=!a;i&&a?n<o.minWidth&&(t.style.width=o.minWidth+"px"):i&&c?r<o.minHeight&&(t.style.height=o.minHeight+"px"):s&&a?n>o.maxWidth&&(t.style.width=o.maxWidth+"px"):r>o.maxHeight&&(t.style.height=o.maxHeight+"px")}))},r.__decorate([o.Input(),r.__metadata("design:type",String),r.__metadata("design:paramtypes",[String])],t.prototype,"value",null),r.__decorate([o.Input(),r.__metadata("design:type",Boolean),r.__metadata("design:paramtypes",[Boolean])],t.prototype,"disabled",null),r.__decorate([o.Input(),r.__metadata("design:type",Boolean),r.__metadata("design:paramtypes",[Boolean])],t.prototype,"readonly",null),r.__decorate([o.Input(),r.__metadata("design:type",Boolean)],t.prototype,"iframe",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Object)],t.prototype,"applyToWord",void 0),r.__decorate([o.Input(),r.__metadata("design:type",d.Schema),r.__metadata("design:paramtypes",[d.Schema])],t.prototype,"schema",null),r.__decorate([o.Input(),r.__metadata("design:type",Function),r.__metadata("design:paramtypes",[Function])],t.prototype,"plugins",null),r.__decorate([o.Input(),r.__metadata("design:type",String),r.__metadata("design:paramtypes",[String])],t.prototype,"placeholder",null),r.__decorate([o.Input(),r.__metadata("design:type",Object)],t.prototype,"preserveWhitespace",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Object)],t.prototype,"pasteCleanupSettings",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Object)],t.prototype,"resizable",void 0),r.__decorate([o.Output(),r.__metadata("design:type",o.EventEmitter)],t.prototype,"valueChange",void 0),r.__decorate([o.Output("focus"),r.__metadata("design:type",o.EventEmitter)],t.prototype,"onFocus",void 0),r.__decorate([o.Output(),r.__metadata("design:type",o.EventEmitter)],t.prototype,"paste",void 0),r.__decorate([o.Output("blur"),r.__metadata("design:type",o.EventEmitter)],t.prototype,"onBlur",void 0),r.__decorate([o.HostBinding("class.k-editor"),r.__metadata("design:type",Boolean)],t.prototype,"hostClass",void 0),r.__decorate([o.HostBinding("class.k-editor-resizable"),r.__metadata("design:type",Boolean),r.__metadata("design:paramtypes",[])],t.prototype,"resizableClass",null),r.__decorate([o.HostBinding("class.k-disabled"),r.__metadata("design:type",Boolean),r.__metadata("design:paramtypes",[])],t.prototype,"isDisabled",null),r.__decorate([o.HostBinding("class.k-readonly"),r.__metadata("design:type",Boolean),r.__metadata("design:paramtypes",[])],t.prototype,"isReadonly",null),r.__decorate([o.HostBinding("class.k-ie"),r.__metadata("design:type",Boolean),r.__metadata("design:paramtypes",[])],t.prototype,"isIE",null),r.__decorate([o.HostBinding("attr.dir"),r.__metadata("design:type",String),r.__metadata("design:paramtypes",[])],t.prototype,"dir",null),r.__decorate([o.HostBinding("attr.ariaDisabled"),r.__metadata("design:type",Boolean),r.__metadata("design:paramtypes",[])],t.prototype,"ariaDisabled",null),r.__decorate([o.HostBinding("style.minWidth"),r.__metadata("design:type",String),r.__metadata("design:paramtypes",[])],t.prototype,"minWidth",null),r.__decorate([o.HostBinding("style.maxWidth"),r.__metadata("design:type",String),r.__metadata("design:paramtypes",[])],t.prototype,"maxWidth",null),r.__decorate([o.HostBinding("style.minHeight"),r.__metadata("design:type",String),r.__metadata("design:paramtypes",[])],t.prototype,"minHeight",null),r.__decorate([o.HostBinding("style.maxHeight"),r.__metadata("design:type",String),r.__metadata("design:paramtypes",[])],t.prototype,"maxHeight",null),r.__decorate([o.ContentChild(c.ToolBarComponent,{static:!1}),r.__metadata("design:type",c.ToolBarComponent)],t.prototype,"userToolBarComponent",void 0),r.__decorate([o.ContentChild(c.ToolBarComponent,{read:o.ElementRef,static:!1}),r.__metadata("design:type",o.ElementRef)],t.prototype,"userToolBarElement",void 0),r.__decorate([o.ViewChild("dialogsContainer",{read:o.ViewContainerRef,static:!0}),r.__metadata("design:type",o.ViewContainerRef)],t.prototype,"dialogContainer",void 0),r.__decorate([o.ViewChild("content",{read:o.ViewContainerRef,static:!1}),r.__metadata("design:type",o.ViewContainerRef)],t.prototype,"container",void 0),r.__decorate([o.ViewChild("defaultToolbar",{read:o.ElementRef,static:!1}),r.__metadata("design:type",o.ElementRef)],t.prototype,"defaultToolbar",void 0),r.__decorate([o.ViewChild("defaultToolbar",{read:c.ToolBarComponent,static:!1}),r.__metadata("design:type",c.ToolBarComponent)],t.prototype,"defaultToolbarComponent",void 0),t=e=r.__decorate([o.Component({selector:"kendo-editor",providers:[x.EditorLocalizationService,S.EditorToolsService,{provide:_.LocalizationService,useExisting:x.EditorLocalizationService},{provide:_.L10N_PREFIX,useValue:"kendo.editor"},{provide:i.NG_VALUE_ACCESSOR,useExisting:o.forwardRef((function(){return e})),multi:!0},{provide:l.KendoInput,useExisting:o.forwardRef((function(){return e}))}],template:'\n <ng-container\n kendoEditorLocalizedMessages\n i18n-alignCenter="kendo.editor.alignCenter|The title of the tool that aligns text in the center."\n alignCenter="Center text"\n i18n-alignJustify="kendo.editor.alignJustify|The title of the tool that justifies text both left and right."\n alignJustify="Justify"\n i18n-alignLeft="kendo.editor.alignLeft|The title of the tool that aligns text on the left."\n alignLeft="Align text left"\n i18n-alignRight="kendo.editor.alignRight|The title of the tool that aligns text on the right."\n alignRight="Align text right"\n i18n-backColor="kendo.editor.backColor|The title of the tool that changes the text background color."\n backColor="Background color"\n i18n-blockquote="kendo.editor.blockquote|The title of the tool that wraps an element in a blockquote"\n blockquote="Quotation"\n i18n-bold="kendo.editor.bold|The title of the tool that makes text bold."\n bold="Bold"\n i18n-cleanFormatting="kendo.editor.cleanFormatting|The title of the Clean Formatting tool."\n cleanFormatting="Clean formatting"\n i18n-createLink="kendo.editor.createLink|The title of the tool that creates hyperlinks."\n createLink="Insert link"\n i18n-dialogApply="kendo.editor.dialogApply|The label of the **Apply** button in all editor dialogs."\n dialogApply="Apply"\n i18n-dialogCancel="kendo.editor.dialogCancel|The label of the **Cancel** button in all editor dialogs."\n dialogCancel="Cancel"\n i18n-dialogInsert="kendo.editor.dialogInsert|The label of the **Insert** button in all editor dialogs."\n dialogInsert="Insert"\n i18n-dialogUpdate="kendo.editor.dialogUpdate|The label of the **Update** button in all editor dialogs."\n dialogUpdate="Update"\n i18n-fileText="kendo.editor.fileText|The caption for the file text in the insertFile dialog."\n fileText="Text"\n i18n-fileTitle="kendo.editor.fileTitle|The caption for the file Title in the insertFile dialog."\n fileTitle="Title"\n i18n-fileWebAddress="kendo.editor.fileWebAddress|The caption for the file URL in the insertFile dialog."\n fileWebAddress="Web address"\n i18n-fontFamily="kendo.editor.fontFamily|The title of the tool that changes the text font."\n fontFamily="Select font family"\n i18n-fontSize="kendo.editor.fontSize|The title of the tool that changes the text size."\n fontSize="Select font size"\n i18n-foreColor="kendo.editor.foreColor|The title of the tool that changes the text color."\n foreColor="Color"\n i18n-format="kendo.editor.format|The title of the tool that lets users choose block formats."\n format="Format"\n i18n-imageAltText="kendo.editor.imageAltText|The caption for the image alternate text in the insertImage dialog."\n imageAltText="Alternate text"\n i18n-imageHeight="kendo.editor.imageHeight|The caption for the image height in the insertImage dialog."\n imageHeight="Height (px)"\n i18n-imageWebAddress="kendo.editor.imageWebAddress|The caption for the image URL in the insertImage dialog."\n imageWebAddress="Web address"\n i18n-imageWidth="kendo.editor.imageWidth|The caption for the image width in the insertImage dialog."\n imageWidth="Width (px)"\n i18n-indent="kendo.editor.indent|The title of the tool that indents the content."\n indent="Indent"\n i18n-insertFile="kendo.editor.insertFile|The title of the tool that inserts links to files."\n insertFile="Insert file"\n i18n-insertImage="kendo.editor.insertImage|The title of the tool that inserts images."\n insertImage="Insert image"\n i18n-insertOrderedList="kendo.editor.insertOrderedList|The title of the tool that inserts an ordered list."\n insertOrderedList="Insert ordered list"\n i18n-insertUnorderedList="kendo.editor.insertUnorderedList|The title of the tool that inserts an unordered list."\n insertUnorderedList="Insert unordered list"\n i18n-italic="kendo.editor.italic|The title of the tool that makes text italicized."\n italic="Italic"\n i18n-linkOpenInNewWindow="kendo.editor.linkOpenInNewWindow|The caption for the checkbox for opening the link in a new window in the createLink dialog."\n linkOpenInNewWindow="Open link in new window"\n i18n-linkText="kendo.editor.linkText|The caption for the link text in the createLink dialog."\n linkText="Text"\n i18n-linkTitle="kendo.editor.linkTitle|The caption for the link title in the createLink dialog."\n linkTitle="Title"\n i18n-linkWebAddress="kendo.editor.linkWebAddress|The caption for the URL in the createLink dialog."\n linkWebAddress="Web address"\n i18n-outdent="kendo.editor.outdent|The title of the tool that outdents the content."\n outdent="Outdent"\n i18n-print="kendo.editor.print|The title of the print tool."\n print="Print"\n i18n-redo="kendo.editor.redo|The title of the tool that undos the last action."\n redo="Redo"\n i18n-selectAll="kendo.editor.selectAll|The title of the tool that selects all content."\n selectAll="Select All"\n i18n-strikethrough="kendo.editor.strikethrough|The title of the tool that strikes through text."\n strikethrough="Strikethrough"\n i18n-subscript="kendo.editor.subscript|The title of the tool that makes text subscript."\n subscript="Subscript"\n i18n-superscript="kendo.editor.superscript|The title of the tool that makes text superscript."\n superscript="Superscript"\n i18n-underline="kendo.editor.underline|The title of the tool that underlines text."\n underline="Underline"\n i18n-unlink="kendo.editor.unlink|The title of the tool that removes hyperlinks."\n unlink="Remove Link"\n i18n-undo="kendo.editor.undo|The title of the tool that undos the last action."\n undo="Undo"\n i18n-viewSource="kendo.editor.viewSource|The title of the tool that shows the editor value as HTML."\n viewSource="View source"\n i18n-insertTable="kendo.editor.insertTable|The title of the tool that inserts table."\n insertTable="Insert Table"\n i18n-addColumnBefore="kendo.editor.addColumnBefore|The title of the tool that adds new column before currently selected column."\n addColumnBefore="Add column before"\n i18n-addColumnAfter="kendo.editor.addColumnAfter|The title of the tool that adds new column after currently selected column."\n addColumnAfter="Add column after"\n i18n-addRowBefore="kendo.editor.addRowBefore|The title of the tool that adds new row before currently selected row."\n addRowBefore="Add row before"\n i18n-addRowAfter="kendo.editor.addRowAfter|The title of the tool that adds new row after currently selected row."\n addRowAfter="Add row after"\n i18n-deleteColumn="kendo.editor.deleteColumn|The title of the tool that deletes a table column."\n deleteColumn="Delete column"\n i18n-deleteRow="kendo.editor.deleteRow|The title of the tool that deletes a table row."\n deleteRow="Delete row"\n i18n-deleteTable="kendo.editor.deleteTable|The title of the tool that deletes a table."\n deleteTable="Delete table"\n >\n </ng-container>\n\n <ng-content select="kendo-toolbar"></ng-content>\n <kendo-toolbar [overflow]="true" [tabindex]="readonly ? -1 : 0" *ngIf="!userToolBarElement" #defaultToolbar>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorBoldButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorItalicButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnderlineButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-dropdownlist kendoEditorFormat></kendo-toolbar-dropdownlist>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorAlignLeftButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignCenterButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignRightButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignJustifyButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertUnorderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorInsertOrderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorIndentButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorOutdentButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorCreateLinkButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnlinkButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertImageButton></kendo-toolbar-button>\n </kendo-toolbar>\n\n <div *ngIf="!iframe" #content [attr.dir]="direction" class="k-editor-content"></div>\n\n <div class="k-editor-content" *ngIf="iframe">\n <iframe #content srcdoc="<!DOCTYPE html>" frameborder="0" class="k-iframe" (load)="iframeOnLoad()"></iframe>\n </div>\n\n <ng-container #dialogsContainer></ng-container>\n ',styles:["\n >>> .k-editor-content > .ProseMirror {\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n outline: none;\n overflow: auto;\n }\n\n .k-iframe {\n width: 100%;\n height: 100%;\n display: block;\n }\n "]}),r.__metadata("design:paramtypes",[u.DialogService,_.LocalizationService,o.ChangeDetectorRef,o.NgZone,o.ElementRef,S.EditorToolsService])],t)}();e.EditorComponent=I},function(t,n){t.exports=e},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(15),s=function(){function t(){this.needsCheck=new i.Subject}return t=r.__decorate([o.Injectable()],t)}();e.EditorToolsService=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=function(t){function e(e,n,r,o,i){var s=t.call(this,e,n,r,o,i)||this;return s.command=e,s.button=n,s.editor=r,s.localization=o,s.toolsService=i,s}return r.__extends(e,t),e.prototype.clickHandler=function(){this.editor.exec(this.command,this.editor.applyToWord),this.editor.focus()},e.prototype.pointerdownHandler=function(t){t.preventDefault()},e.prototype.onStateChange=function(t){this.button.selected=t[this.command].selected,this.button.disabled=t[this.command].disabled},e}(n(34).EditorCommandBase);e.EditorCommandButton=o},function(t,e){t.exports=n},function(t,e,n){"use strict";function r(t){this.content=t}n.r(e),n.d(e,"getHtml",(function(){return Ae})),n.d(e,"setHtml",(function(){return Ne})),n.d(e,"parseContent",(function(){return Ie})),n.d(e,"trimWhitespace",(function(){return Ee})),n.d(e,"htmlToFragment",(function(){return Me})),n.d(e,"domToPmDoc",(function(){return De})),n.d(e,"pmDocToFragment",(function(){return Oe})),n.d(e,"applyInlineStyle",(function(){return ln})),n.d(e,"getInlineStyles",(function(){return an})),n.d(e,"toggleInlineFormat",(function(){return un})),n.d(e,"applyLink",(function(){return pn})),n.d(e,"removeLink",(function(){return dn})),n.d(e,"insertText",(function(){return fn})),n.d(e,"insertImage",(function(){return hn})),n.d(e,"alignBlocks",(function(){return Cn})),n.d(e,"isAligned",(function(){return Sn})),n.d(e,"cleanFormatting",(function(){return Tn})),n.d(e,"hasNode",(function(){return _n})),n.d(e,"activeNode",(function(){return kn})),n.d(e,"formatBlockElements",(function(){return gn})),n.d(e,"getBlockFormats",(function(){return bn})),n.d(e,"parentBlockFormat",(function(){return xn})),n.d(e,"changeTextBlock",(function(){return mn})),n.d(e,"blockNodes",(function(){return vn})),n.d(e,"cleanTextBlockFormatting",(function(){return yn})),n.d(e,"hasMark",(function(){return Qe})),n.d(e,"getMark",(function(){return nn})),n.d(e,"getActiveMarks",(function(){return rn})),n.d(e,"removeAllMarks",(function(){return Xe})),n.d(e,"cleanMarks",(function(){return Ze})),n.d(e,"selectionMarks",(function(){return en})),n.d(e,"indent",(function(){return Ar})),n.d(e,"canIndentAsListItem",(function(){return Or})),n.d(e,"outdent",(function(){return Nr})),n.d(e,"canOutdentAsListItem",(function(){return Dr})),n.d(e,"isIndented",(function(){return Mr})),n.d(e,"canBeIndented",(function(){return Ir})),n.d(e,"indentBlocks",(function(){return Er})),n.d(e,"toggleOrderedList",(function(){return $r})),n.d(e,"toggleUnorderedList",(function(){return jr})),n.d(e,"toggleList",(function(){return Vr})),n.d(e,"listStyle",(function(){return Lr})),n.d(e,"blockquote",(function(){return Sr})),n.d(e,"liftBlockquote",(function(){return Tr})),n.d(e,"hasSameMarkup",(function(){return Ve})),n.d(e,"getSelectionText",(function(){return je})),n.d(e,"getNodeFromSelection",(function(){return $e})),n.d(e,"selectedLineTextOnly",(function(){return We})),n.d(e,"expandSelection",(function(){return Je})),n.d(e,"expandToWordWrap",(function(){return Ke})),n.d(e,"canInsert",(function(){return Pe})),n.d(e,"insertNode",(function(){return Le})),n.d(e,"indentHtml",(function(){return He})),n.d(e,"alignLeftRules",(function(){return Hr})),n.d(e,"alignCenterRules",(function(){return Jr})),n.d(e,"alignRightRules",(function(){return qr})),n.d(e,"alignJustifyRules",(function(){return Kr})),n.d(e,"alignRemoveRules",(function(){return Ur})),n.d(e,"indentRules",(function(){return $n})),n.d(e,"outdentRules",(function(){return Wn})),n.d(e,"nodes",(function(){return Uc})),n.d(e,"marks",(function(){return $c})),n.d(e,"buildKeymap",(function(){return Fu})),n.d(e,"buildListKeymap",(function(){return Lu})),n.d(e,"bold",(function(){return Du})),n.d(e,"italic",(function(){return Iu})),n.d(e,"underline",(function(){return Au})),n.d(e,"strikethrough",(function(){return Nu})),n.d(e,"subscript",(function(){return Bu})),n.d(e,"superscript",(function(){return zu})),n.d(e,"link",(function(){return Pu})),n.d(e,"sanitize",(function(){return Gu})),n.d(e,"removeComments",(function(){return Yu})),n.d(e,"removeTag",(function(){return Xu})),n.d(e,"pasteCleanup",(function(){return rl})),n.d(e,"sanitizeClassAttr",(function(){return Qu})),n.d(e,"sanitizeStyleAttr",(function(){return nl})),n.d(e,"removeAttribute",(function(){return Zu})),n.d(e,"replaceImageSourcesFromRtf",(function(){return dl})),n.d(e,"convertMsLists",(function(){return Uu})),n.d(e,"find",(function(){return fl})),n.d(e,"findAt",(function(){return pl})),n.d(e,"findAll",(function(){return hl})),n.d(e,"replace",(function(){return ml})),n.d(e,"replaceAll",(function(){return vl})),n.d(e,"placeholder",(function(){return wl})),n.d(e,"spacesFix",(function(){return kl})),n.d(e,"textHighlight",(function(){return Sl})),n.d(e,"textHighlightKey",(function(){return Cl})),n.d(e,"imageResizing",(function(){return Bl})),n.d(e,"imageResizeKey",(function(){return Tl})),n.d(e,"caretColor",(function(){return Pl})),n.d(e,"caretColorKey",(function(){return zl})),n.d(e,"autoJoin",(function(){return gr})),n.d(e,"baseKeymap",(function(){return Cr})),n.d(e,"chainCommands",(function(){return yr})),n.d(e,"createParagraphNear",(function(){return or})),n.d(e,"deleteSelection",(function(){return Hn})),n.d(e,"exitCode",(function(){return rr})),n.d(e,"joinBackward",(function(){return qn})),n.d(e,"joinDown",(function(){return Qn})),n.d(e,"joinForward",(function(){return Gn})),n.d(e,"joinUp",(function(){return Zn})),n.d(e,"lift",(function(){return tr})),n.d(e,"liftEmptyBlock",(function(){return ir})),n.d(e,"macBaseKeymap",(function(){return xr})),n.d(e,"newlineInCode",(function(){return er})),n.d(e,"pcBaseKeymap",(function(){return _r})),n.d(e,"selectAll",(function(){return ur})),n.d(e,"selectNodeBackward",(function(){return Kn})),n.d(e,"selectNodeForward",(function(){return Yn})),n.d(e,"selectParentNode",(function(){return cr})),n.d(e,"selectTextblockEnd",(function(){return fr})),n.d(e,"selectTextblockStart",(function(){return pr})),n.d(e,"setBlockType",(function(){return mr})),n.d(e,"splitBlock",(function(){return sr})),n.d(e,"splitBlockKeepMarks",(function(){return ar})),n.d(e,"toggleMark",(function(){return vr})),n.d(e,"wrapIn",(function(){return hr})),n.d(e,"dropCursor",(function(){return Rl})),n.d(e,"GapCursor",(function(){return Ll})),n.d(e,"gapCursor",(function(){return jl})),n.d(e,"HistoryState",(function(){return eu})),n.d(e,"closeHistory",(function(){return uu})),n.d(e,"history",(function(){return pu})),n.d(e,"redo",(function(){return hu})),n.d(e,"redoDepth",(function(){return vu})),n.d(e,"undo",(function(){return fu})),n.d(e,"undoDepth",(function(){return mu})),n.d(e,"InputRule",(function(){return gu})),n.d(e,"closeDoubleQuote",(function(){return Cu})),n.d(e,"closeSingleQuote",(function(){return Tu})),n.d(e,"ellipsis",(function(){return xu})),n.d(e,"emDash",(function(){return _u})),n.d(e,"inputRules",(function(){return yu})),n.d(e,"openDoubleQuote",(function(){return ku})),n.d(e,"openSingleQuote",(function(){return Su})),n.d(e,"smartQuotes",(function(){return Eu})),n.d(e,"textblockTypeInputRule",(function(){return Ou})),n.d(e,"undoInputRule",(function(){return wu})),n.d(e,"wrappingInputRule",(function(){return Mu})),n.d(e,"keydownHandler",(function(){return uo})),n.d(e,"keymap",(function(){return co})),n.d(e,"ContentMatch",(function(){return N})),n.d(e,"DOMParser",(function(){return tt})),n.d(e,"DOMSerializer",(function(){return dt})),n.d(e,"Fragment",(function(){return i})),n.d(e,"Mark",(function(){return l})),n.d(e,"MarkType",(function(){return X})),n.d(e,"Node",(function(){return O})),n.d(e,"NodeRange",(function(){return T})),n.d(e,"NodeType",(function(){return K})),n.d(e,"ReplaceError",(function(){return d})),n.d(e,"ResolvedPos",(function(){return _})),n.d(e,"Schema",(function(){return Z})),n.d(e,"Slice",(function(){return p})),n.d(e,"addListNodes",(function(){return Bn})),n.d(e,"bulletList",(function(){return In})),n.d(e,"liftListItem",(function(){return Rn})),n.d(e,"listItem",(function(){return An})),n.d(e,"orderedList",(function(){return Dn})),n.d(e,"sinkListItem",(function(){return Fn})),n.d(e,"splitListItem",(function(){return Pn})),n.d(e,"wrapInList",(function(){return zn})),n.d(e,"AllSelection",(function(){return ae})),n.d(e,"EditorState",(function(){return ve})),n.d(e,"NodeSelection",(function(){return ie})),n.d(e,"Plugin",(function(){return be})),n.d(e,"PluginKey",(function(){return xe})),n.d(e,"Selection",(function(){return te})),n.d(e,"SelectionRange",(function(){return ne})),n.d(e,"TextSelection",(function(){return re})),n.d(e,"Transaction",(function(){return de})),n.d(e,"CellSelection",(function(){return Ma})),n.d(e,"TableMap",(function(){return ca})),n.d(e,"TableView",(function(){return wc})),n.d(e,"__clipCells",(function(){return Na})),n.d(e,"__insertCells",(function(){return Pa})),n.d(e,"__pastedCells",(function(){return Ia})),n.d(e,"addColSpan",(function(){return Ta})),n.d(e,"addColumn",(function(){return Xa})),n.d(e,"addColumnAfter",(function(){return Qa})),n.d(e,"addColumnBefore",(function(){return Za})),n.d(e,"addRow",(function(){return rc})),n.d(e,"cellAround",(function(){return ma})),n.d(e,"colCount",(function(){return xa})),n.d(e,"columnIsHeader",(function(){return Ea})),n.d(e,"columnResizing",(function(){return kc})),n.d(e,"columnResizingPluginKey",(function(){return xc})),n.d(e,"deleteColumn",(function(){return ec})),n.d(e,"deleteRow",(function(){return ac})),n.d(e,"deleteTable",(function(){return bc})),n.d(e,"findCell",(function(){return _a})),n.d(e,"fixTables",(function(){return Ga})),n.d(e,"fixTablesKey",(function(){return Ua})),n.d(e,"goToNextCell",(function(){return yc})),n.d(e,"handlePaste",(function(){return Wa})),n.d(e,"inSameTable",(function(){return wa})),n.d(e,"isInTable",(function(){return va})),n.d(e,"mergeCells",(function(){return uc})),n.d(e,"moveCellForward",(function(){return ba})),n.d(e,"nextCell",(function(){return ka})),n.d(e,"pointsAtCell",(function(){return ya})),n.d(e,"removeColSpan",(function(){return Sa})),n.d(e,"removeColumn",(function(){return tc})),n.d(e,"removeRow",(function(){return sc})),n.d(e,"rowIsHeader",(function(){return nc})),n.d(e,"selectedRect",(function(){return Ya})),n.d(e,"selectionCell",(function(){return ga})),n.d(e,"setAttr",(function(){return Ca})),n.d(e,"setCellAttr",(function(){return pc})),n.d(e,"splitCell",(function(){return lc})),n.d(e,"splitCellWithType",(function(){return dc})),n.d(e,"tableEditing",(function(){return Oc})),n.d(e,"tableEditingKey",(function(){return ha})),n.d(e,"tableNodeTypes",(function(){return fa})),n.d(e,"tableNodes",(function(){return pa})),n.d(e,"toggleHeader",(function(){return hc})),n.d(e,"toggleHeaderCell",(function(){return gc})),n.d(e,"toggleHeaderColumn",(function(){return vc})),n.d(e,"toggleHeaderRow",(function(){return mc})),n.d(e,"updateColumnsOnResize",(function(){return _c})),n.d(e,"AddMarkStep",(function(){return Vt})),n.d(e,"MapResult",(function(){return vt})),n.d(e,"Mapping",(function(){return yt})),n.d(e,"RemoveMarkStep",(function(){return jt})),n.d(e,"ReplaceAroundStep",(function(){return Et})),n.d(e,"ReplaceStep",(function(){return Tt})),n.d(e,"Step",(function(){return Ct})),n.d(e,"StepMap",(function(){return gt})),n.d(e,"StepResult",(function(){return St})),n.d(e,"Transform",(function(){return wt})),n.d(e,"TransformError",(function(){return bt})),n.d(e,"canJoin",(function(){return Bt})),n.d(e,"canSplit",(function(){return Nt})),n.d(e,"dropPoint",(function(){return Ft})),n.d(e,"findWrapping",(function(){return It})),n.d(e,"insertPoint",(function(){return Rt})),n.d(e,"joinPoint",(function(){return Pt})),n.d(e,"liftTarget",(function(){return Dt})),n.d(e,"replaceStep",(function(){return $t})),n.d(e,"Decoration",(function(){return Bs})),n.d(e,"DecorationSet",(function(){return Fs})),n.d(e,"EditorView",(function(){return Xs})),n.d(e,"__endComposition",(function(){return Cs})),n.d(e,"__parseFromClipboard",(function(){return Ji})),n.d(e,"__serializeForClipboard",(function(){return qi})),n.d(e,"createTable",(function(){return Jl})),n.d(e,"addRowAfter",(function(){return Gl})),n.d(e,"addRowBefore",(function(){return Ul})),n.d(e,"pmAddRowAfter",(function(){return ic})),n.d(e,"pmAddRowBefore",(function(){return oc})),r.prototype={constructor:r,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,i=o.find(t),s=o.content.slice();return-1==i?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new r(s)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new r(n)},addToStart:function(t,e){return new r([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new r(n)},addBefore:function(t,e,n){var o=this.remove(e),i=o.content.slice(),s=o.find(t);return i.splice(-1==s?i.length:s,0,e,n),new r(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=r.from(t)).size?new r(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=r.from(t)).size?new r(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=r.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},get size(){return this.content.length>>1}},r.from=function(t){if(t instanceof r)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new r(e)};var o=r;var i=function(t,e){if(this.content=t,this.size=e||0,null==e)for(var n=0;n<t.length;n++)this.size+=t[n].nodeSize},s={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};i.prototype.nodesBetween=function(t,e,n,r,o){void 0===r&&(r=0);for(var i=0,s=0;s<e;i++){var a=this.content[i],c=s+a.nodeSize;if(c>t&&!1!==n(a,r+s,o,i)&&a.content.size){var u=s+1;a.nodesBetween(Math.max(0,t-u),Math.min(a.content.size,e-u),n,r+u)}s=c}},i.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},i.prototype.textBetween=function(t,e,n,r){var o="",i=!0;return this.nodesBetween(t,e,(function(s,a){s.isText?(o+=s.text.slice(Math.max(t,a)-a,e-a),i=!n):s.isLeaf&&r?(o+="function"==typeof r?r(s):r,i=!n):!i&&s.isBlock&&(o+=n,i=!0)}),0),o},i.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new i(r,this.size+t.size)},i.prototype.cut=function(t,e){if(null==e&&(e=this.size),0==t&&e==this.size)return this;var n=[],r=0;if(e>t)for(var o=0,s=0;s<e;o++){var a=this.content[o],c=s+a.nodeSize;c>t&&((s<t||c>e)&&(a=a.isText?a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),n.push(a),r+=a.nodeSize),s=c}return new i(n,r)},i.prototype.cutByIndex=function(t,e){return t==e?i.empty:0==t&&e==this.content.length?this:new i(this.content.slice(t,e))},i.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new i(r,o)},i.prototype.addToStart=function(t){return new i([t].concat(this.content),this.size+t.nodeSize)},i.prototype.addToEnd=function(t){return new i(this.content.concat(t),this.size+t.nodeSize)},i.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0},s.firstChild.get=function(){return this.content.length?this.content[0]:null},s.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},s.childCount.get=function(){return this.content.length},i.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},i.prototype.maybeChild=function(t){return this.content[t]},i.prototype.forEach=function(t){for(var e=0,n=0;e<this.content.length;e++){var r=this.content[e];t(r,n,e),n+=r.nodeSize}},i.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),function t(e,n,r){for(var o=0;;o++){if(o==e.childCount||o==n.childCount)return e.childCount==n.childCount?null:r;var i=e.child(o),s=n.child(o);if(i!=s){if(!i.sameMarkup(s))return r;if(i.isText&&i.text!=s.text){for(var a=0;i.text[a]==s.text[a];a++)r++;return r}if(i.content.size||s.content.size){var c=t(i.content,s.content,r+1);if(null!=c)return c}r+=i.nodeSize}else r+=i.nodeSize}}(this,t,e)},i.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),function t(e,n,r,o){for(var i=e.childCount,s=n.childCount;;){if(0==i||0==s)return i==s?null:{a:r,b:o};var a=e.child(--i),c=n.child(--s),u=a.nodeSize;if(a!=c){if(!a.sameMarkup(c))return{a:r,b:o};if(a.isText&&a.text!=c.text){for(var l=0,d=Math.min(a.text.length,c.text.length);l<d&&a.text[a.text.length-l-1]==c.text[c.text.length-l-1];)l++,r--,o--;return{a:r,b:o}}if(a.content.size||c.content.size){var p=t(a.content,c.content,r-1,o-1);if(p)return p}r-=u,o-=u}else r-=u,o-=u}}(this,t,e,n)},i.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return c(0,t);if(t==this.size)return c(this.content.length,t);if(t>this.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,r=0;;n++){var o=r+this.child(n).nodeSize;if(o>=t)return o==t||e>0?c(n+1,o):c(n,r);r=o}},i.prototype.toString=function(){return"<"+this.toStringInner()+">"},i.prototype.toStringInner=function(){return this.content.join(", ")},i.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},i.fromJSON=function(t,e){if(!e)return i.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new i(e.map(t.nodeFromJSON))},i.fromArray=function(t){if(!t.length)return i.empty;for(var e,n=0,r=0;r<t.length;r++){var o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new i(e||t,n)},i.from=function(t){if(!t)return i.empty;if(t instanceof i)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new i([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(i.prototype,s);var a={index:0,offset:0};function c(t,e){return a.index=t,a.offset=e,a}function u(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;var n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(!u(t[r],e[r]))return!1}else{for(var o in t)if(!(o in e)||!u(t[o],e[o]))return!1;for(var i in e)if(!(i in t))return!1}return!0}i.empty=new i([],0);var l=function(t,e){this.type=t,this.attrs=e};function d(t){var e=Error.call(this,t);return e.__proto__=d.prototype,e}l.prototype.addToSet=function(t){for(var e,n=!1,r=0;r<t.length;r++){var o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e},l.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t},l.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},l.prototype.eq=function(t){return this==t||this.type==t.type&&u(this.attrs,t.attrs)},l.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},l.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");var n=t.marks[e.type];if(!n)throw new RangeError("There is no mark type "+e.type+" in this schema");return n.create(e.attrs)},l.sameSet=function(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0},l.setFrom=function(t){if(!t||0==t.length)return l.none;if(t instanceof l)return[t];var e=t.slice();return e.sort((function(t,e){return t.type.rank-e.type.rank})),e},l.none=[],d.prototype=Object.create(Error.prototype),d.prototype.constructor=d,d.prototype.name="ReplaceError";var p=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},f={size:{configurable:!0}};function h(t,e,n){if(n.openStart>t.depth)throw new d("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new d("Inconsistent open depths");return function t(e,n,r,o){var s=e.index(o),a=e.node(o);if(s==n.index(o)&&o<e.depth-r.openStart){var c=t(e,n,r,o+1);return a.copy(a.content.replaceChild(s,c))}if(r.content.size){if(r.openStart||r.openEnd||e.depth!=o||n.depth!=o){var u=function(t,e){for(var n=e.depth-t.openStart,r=e.node(n).copy(t.content),o=n-1;o>=0;o--)r=e.node(o).copy(i.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(r,e),l=u.start,d=u.end;return b(a,function t(e,n,r,o,s){var a=e.depth>s&&v(e,n,s+1),c=o.depth>s&&v(r,o,s+1),u=[];y(null,e,s,u),a&&c&&n.index(s)==r.index(s)?(m(a,c),g(b(a,t(e,n,r,o,s+1)),u)):(a&&g(b(a,w(e,n,s+1)),u),y(n,r,s,u),c&&g(b(c,w(r,o,s+1)),u));return y(o,null,s,u),new i(u)}(e,l,d,n,o))}var p=e.parent,f=p.content;return b(p,f.cut(0,e.parentOffset).append(r.content).append(f.cut(n.parentOffset)))}return b(a,w(e,n,o))}(t,e,n,0)}function m(t,e){if(!e.type.compatibleContent(t.type))throw new d("Cannot join "+e.type.name+" onto "+t.type.name)}function v(t,e,n){var r=t.node(n);return m(r,e.node(n)),r}function g(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function y(t,e,n,r){var o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(g(t.nodeAfter,r),i++));for(var a=i;a<s;a++)g(o.child(a),r);e&&e.depth==n&&e.textOffset&&g(e.nodeBefore,r)}function b(t,e){if(!t.type.validContent(e))throw new d("Invalid content for node "+t.type.name);return t.copy(e)}function w(t,e,n){var r=[];(y(null,t,n,r),t.depth>n)&&g(b(v(t,e,n+1),w(t,e,n+1)),r);return y(e,null,n,r),new i(r)}f.size.get=function(){return this.content.size-this.openStart-this.openEnd},p.prototype.insertAt=function(t,e){var n=function t(e,n,r,o){var i=e.findIndex(n),s=i.index,a=i.offset,c=e.maybeChild(s);if(a==n||c.isText)return o&&!o.canReplace(s,s,r)?null:e.cut(0,n).append(r).append(e.cut(n));var u=t(c.content,n-a-1,r);return u&&e.replaceChild(s,c.copy(u))}(this.content,t+this.openStart,e,null);return n&&new p(n,this.openStart,this.openEnd)},p.prototype.removeBetween=function(t,e){return new p(function t(e,n,r){var o=e.findIndex(n),i=o.index,s=o.offset,a=e.maybeChild(i),c=e.findIndex(r),u=c.index,l=c.offset;if(s==n||a.isText){if(l!=r&&!e.child(u).isText)throw new RangeError("Removing non-flat range");return e.cut(0,n).append(e.cut(r))}if(i!=u)throw new RangeError("Removing non-flat range");return e.replaceChild(i,a.copy(t(a.content,n-s-1,r-s-1)))}(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},p.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},p.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},p.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},p.fromJSON=function(t,e){if(!e)return p.empty;var n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new p(i.fromJSON(t,e.content),n,r)},p.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,r=0,o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new p(t,n,r)},Object.defineProperties(p.prototype,f),p.empty=new p(i.empty,0,0);var _=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},x={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};_.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},x.parent.get=function(){return this.node(this.depth)},x.doc.get=function(){return this.node(0)},_.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},_.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},_.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},_.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},_.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},_.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},_.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},x.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},x.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r},x.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},_.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1,o=0;o<t;o++)r+=n.child(o).nodeSize;return r},_.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return l.none;if(this.textOffset)return t.child(e).marks;var n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){var o=n;n=r,r=o}for(var i=n.marks,s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i},_.prototype.marksAcross=function(t){var e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;for(var n=e.marks,r=t.parent.maybeChild(t.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n},_.prototype.sharedDepth=function(t){for(var e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},_.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos<this.pos)return t.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new T(this,t,n)},_.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},_.prototype.max=function(t){return t.pos>this.pos?t:this},_.prototype.min=function(t){return t.pos<this.pos?t:this},_.prototype.toString=function(){for(var t="",e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset},_.resolve=function(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],r=0,o=e,i=t;;){var s=i.content.findIndex(o),a=s.index,c=s.offset,u=o-c;if(n.push(i,a,r+c),!u)break;if((i=i.child(a)).isText)break;o=u-1,r+=c+1}return new _(e,n,o)},_.resolveCached=function(t,e){for(var n=0;n<k.length;n++){var r=k[n];if(r.pos==e&&r.doc==t)return r}var o=k[C]=_.resolve(t,e);return C=(C+1)%S,o},Object.defineProperties(_.prototype,x);var k=[],C=0,S=12,T=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},E={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};E.start.get=function(){return this.$from.before(this.depth+1)},E.end.get=function(){return this.$to.after(this.depth+1)},E.parent.get=function(){return this.$from.node(this.depth)},E.startIndex.get=function(){return this.$from.index(this.depth)},E.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(T.prototype,E);var M=Object.create(null),O=function(t,e,n,r){this.type=t,this.attrs=e,this.content=n||i.empty,this.marks=r||l.none},D={nodeSize:{configurable:!0},childCount:{configurable:!0},textContent:{configurable:!0},firstChild:{configurable:!0},lastChild:{configurable:!0},isBlock:{configurable:!0},isTextblock:{configurable:!0},inlineContent:{configurable:!0},isInline:{configurable:!0},isText:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};D.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},D.childCount.get=function(){return this.content.childCount},O.prototype.child=function(t){return this.content.child(t)},O.prototype.maybeChild=function(t){return this.content.maybeChild(t)},O.prototype.forEach=function(t){this.content.forEach(t)},O.prototype.nodesBetween=function(t,e,n,r){void 0===r&&(r=0),this.content.nodesBetween(t,e,n,r,this)},O.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},D.textContent.get=function(){return this.textBetween(0,this.content.size,"")},O.prototype.textBetween=function(t,e,n,r){return this.content.textBetween(t,e,n,r)},D.firstChild.get=function(){return this.content.firstChild},D.lastChild.get=function(){return this.content.lastChild},O.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},O.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},O.prototype.hasMarkup=function(t,e,n){return this.type==t&&u(this.attrs,e||t.defaultAttrs||M)&&l.sameSet(this.marks,n||l.none)},O.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},O.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},O.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},O.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return p.empty;var r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new p(a,r.depth-i,o.depth-i)},O.prototype.replace=function(t,e,n){return h(this.resolve(t),this.resolve(e),n)},O.prototype.nodeAt=function(t){for(var e=this;;){var n=e.content.findIndex(t),r=n.index,o=n.offset;if(!(e=e.maybeChild(r)))return null;if(o==t||e.isText)return e;t-=o+1}},O.prototype.childAfter=function(t){var e=this.content.findIndex(t),n=e.index,r=e.offset;return{node:this.content.maybeChild(n),index:n,offset:r}},O.prototype.childBefore=function(t){if(0==t)return{node:null,index:0,offset:0};var e=this.content.findIndex(t),n=e.index,r=e.offset;if(r<t)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}},O.prototype.resolve=function(t){return _.resolveCached(this,t)},O.prototype.resolveNoCache=function(t){return _.resolve(this,t)},O.prototype.rangeHasMark=function(t,e,n){var r=!1;return e>t&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(r=!0),!r})),r},D.isBlock.get=function(){return this.type.isBlock},D.isTextblock.get=function(){return this.type.isTextblock},D.inlineContent.get=function(){return this.type.inlineContent},D.isInline.get=function(){return this.type.isInline},D.isText.get=function(){return this.type.isText},D.isLeaf.get=function(){return this.type.isLeaf},D.isAtom.get=function(){return this.type.isAtom},O.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),A(this.marks,t)},O.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},O.prototype.canReplace=function(t,e,n,r,o){void 0===n&&(n=i.empty),void 0===r&&(r=0),void 0===o&&(o=n.childCount);var s=this.contentMatchAt(t).matchFragment(n,r,o),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(var c=r;c<o;c++)if(!this.type.allowsMarks(n.child(c).marks))return!1;return!0},O.prototype.canReplaceWith=function(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd},O.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},O.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));for(var t=l.none,e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!l.sameSet(t,this.marks))throw new RangeError("Invalid collection of marks for node "+this.type.name+": "+this.marks.map((function(t){return t.type.name})));this.content.forEach((function(t){return t.check()}))},O.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((function(t){return t.toJSON()}))),t},O.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}var r=i.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)},Object.defineProperties(O.prototype,D);var I=function(t){function e(e,n,r,o){if(t.call(this,e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return e.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):A(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},e.prototype.textBetween=function(t,e){return this.text.slice(t,e)},n.nodeSize.get=function(){return this.text.length},e.prototype.mark=function(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)},e.prototype.withText=function(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)},e.prototype.cut=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.text.length),0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))},e.prototype.eq=function(t){return this.sameMarkup(t)&&this.text==t.text},e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.text=this.text,e},Object.defineProperties(e.prototype,n),e}(O);function A(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var N=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},B={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};N.parse=function(t,e){var n=new z(t,e);if(null==n.next)return N.empty;var r=R(n);n.next&&n.err("Unexpected trailing text");var o=function(t){var e=Object.create(null);return function n(r){var o=[];r.forEach((function(e){t[e].forEach((function(e){var n=e.term,r=e.to;if(n){var i=o.indexOf(n),s=i>-1&&o[i+1];W(t,r).forEach((function(t){s||o.push(n,s=[]),-1==s.indexOf(t)&&s.push(t)}))}}))}));for(var i=e[r.join(",")]=new N(r.indexOf(t.length-1)>-1),s=0;s<o.length;s+=2){var a=o[s+1].sort($);i.next.push(o[s],e[a.join(",")]||n(a))}return i}(W(t,0))}(function(t){var e=[[]];return o(function t(e,i){if("choice"==e.type)return e.exprs.reduce((function(e,n){return e.concat(t(n,i))}),[]);if("seq"==e.type)for(var s=0;;s++){var a=t(e.exprs[s],i);if(s==e.exprs.length-1)return a;o(a,i=n())}else{if("star"==e.type){var c=n();return r(i,c),o(t(e.expr,c),c),[r(c)]}if("plus"==e.type){var u=n();return o(t(e.expr,i),u),o(t(e.expr,u),u),[r(u)]}if("opt"==e.type)return[r(i)].concat(t(e.expr,i));if("range"==e.type){for(var l=i,d=0;d<e.min;d++){var p=n();o(t(e.expr,l),p),l=p}if(-1==e.max)o(t(e.expr,l),l);else for(var f=e.min;f<e.max;f++){var h=n();r(l,h),o(t(e.expr,l),h),l=h}return[r(l)]}if("name"==e.type)return[r(i,null,e.value)]}}(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){var o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach((function(t){return t.to=e}))}}(r));return function(t,e){for(var n=0,r=[t];n<r.length;n++){for(var o=r[n],i=!o.validEnd,s=[],a=0;a<o.next.length;a+=2){var c=o.next[a],u=o.next[a+1];s.push(c.name),!i||c.isText||c.hasRequiredAttrs()||(i=!1),-1==r.indexOf(u)&&r.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o},N.prototype.matchType=function(t){for(var e=0;e<this.next.length;e+=2)if(this.next[e]==t)return this.next[e+1];return null},N.prototype.matchFragment=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.childCount);for(var r=this,o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r},B.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},B.defaultType.get=function(){for(var t=0;t<this.next.length;t+=2){var e=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}},N.prototype.compatible=function(t){for(var e=0;e<this.next.length;e+=2)for(var n=0;n<t.next.length;n+=2)if(this.next[e]==t.next[n])return!0;return!1},N.prototype.fillBefore=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=0);var r=[this];return function o(s,a){var c=s.matchFragment(t,n);if(c&&(!e||c.validEnd))return i.from(a.map((function(t){return t.createAndFill()})));for(var u=0;u<s.next.length;u+=2){var l=s.next[u],d=s.next[u+1];if(!l.isText&&!l.hasRequiredAttrs()&&-1==r.indexOf(d)){r.push(d);var p=o(d,a.concat(l));if(p)return p}}}(this,[])},N.prototype.findWrapping=function(t){for(var e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];var n=this.computeWrapping(t);return this.wrapCache.push(t,n),n},N.prototype.computeWrapping=function(t){for(var e=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(t)){for(var i=[],s=r;s.type;s=s.via)i.push(s.type);return i.reverse()}for(var a=0;a<o.next.length;a+=2){var c=o.next[a];c.isLeaf||c.hasRequiredAttrs()||c.name in e||r.type&&!o.next[a+1].validEnd||(n.push({match:c.contentMatch,type:c,via:r}),e[c.name]=!0)}}},B.edgeCount.get=function(){return this.next.length>>1},N.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},N.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var r=1;r<n.next.length;r+=2)-1==t.indexOf(n.next[r])&&e(n.next[r])}(this),t.map((function(e,n){for(var r=n+(e.validEnd?"*":" ")+" ",o=0;o<e.next.length;o+=2)r+=(o?", ":"")+e.next[o].name+"->"+t.indexOf(e.next[o+1]);return r})).join("\n")},Object.defineProperties(N.prototype,B),N.empty=new N(!0);var z=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},P={next:{configurable:!0}};function R(t){var e=[];do{e.push(F(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function F(t){var e=[];do{e.push(L(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function L(t){for(var e=function(t){if(t.eat("(")){var e=R(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,r=n[e];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}0==o.length&&t.err("No node type or group '"+e+"' found");return o}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=j(t,e)}return e}function V(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function j(t,e){var n=V(t),r=n;return t.eat(",")&&(r="}"!=t.next?V(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function $(t,e){return e-t}function W(t,e){var n=[];return function e(r){var o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var s=o[i],a=s.term,c=s.to;a||-1!=n.indexOf(c)||e(c)}}(e),n.sort($)}function H(t){var e=Object.create(null);for(var n in t){var r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function q(t,e){var n=Object.create(null);for(var r in t){var o=e&&e[r];if(void 0===o){var i=t[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function J(t){var e=Object.create(null);if(t)for(var n in t)e[n]=new G(t[n]);return e}P.next.get=function(){return this.tokens[this.pos]},z.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},z.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(z.prototype,P);var K=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=J(n.attrs),this.defaultAttrs=H(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},U={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0},whitespace:{configurable:!0}};U.isInline.get=function(){return!this.isBlock},U.isTextblock.get=function(){return this.isBlock&&this.inlineContent},U.isLeaf.get=function(){return this.contentMatch==N.empty},U.isAtom.get=function(){return this.isLeaf||this.spec.atom},U.whitespace.get=function(){return this.spec.whitespace||(this.spec.code?"pre":"normal")},K.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},K.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},K.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:q(this.attrs,t)},K.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new O(this,this.computeAttrs(t),i.from(e),l.setFrom(n))},K.prototype.createChecked=function(t,e,n){if(e=i.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new O(this,this.computeAttrs(t),e,l.setFrom(n))},K.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=i.from(e)).size){var r=this.contentMatch.fillBefore(e);if(!r)return null;e=r.append(e)}var o=this.contentMatch.matchFragment(e).fillBefore(i.empty,!0);return o?new O(this,t,e.append(o),l.setFrom(n)):null},K.prototype.validContent=function(t){var e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(var n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0},K.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},K.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0},K.prototype.allowedMarks=function(t){if(null==this.markSet)return t;for(var e,n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:l.empty:t},K.compile=function(t,e){var n=Object.create(null);t.forEach((function(t,r){return n[t]=new K(t,e,r)}));var r=e.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(var o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(K.prototype,U);var G=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},Y={isRequired:{configurable:!0}};Y.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(G.prototype,Y);var X=function(t,e,n,r){this.name=t,this.schema=n,this.spec=r,this.attrs=J(r.attrs),this.rank=e,this.excluded=null;var o=H(this.attrs);this.instance=o&&new l(this,o)};X.prototype.create=function(t){return!t&&this.instance?this.instance:new l(this,q(this.attrs,t))},X.compile=function(t,e){var n=Object.create(null),r=0;return t.forEach((function(t,o){return n[t]=new X(t,r++,e,o)})),n},X.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t},X.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},X.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var Z=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=o.from(t.nodes),this.spec.marks=o.from(t.marks),this.nodes=K.compile(this.spec.nodes,this),this.marks=X.compile(this.spec.marks,this);var n=Object.create(null);for(var r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");var i=this.nodes[r],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=n[s]||(n[s]=N.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==a?null:a?Q(this,a.split(" ")):""!=a&&i.inlineContent?null:[]}for(var c in this.marks){var u=this.marks[c],l=u.spec.excludes;u.excluded=null==l?[u]:""==l?[]:Q(this,l.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function Q(t,e){for(var n=[],r=0;r<e.length;r++){var o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(var a in t.marks){var c=t.marks[a];("_"==o||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}Z.prototype.node=function(t,e,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof K))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)},Z.prototype.text=function(t,e){var n=this.nodes.text;return new I(n,n.defaultAttrs,t,l.setFrom(e))},Z.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},Z.prototype.nodeFromJSON=function(t){return O.fromJSON(this,t)},Z.prototype.markFromJSON=function(t){return l.fromJSON(this,t)},Z.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var tt=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))};tt.prototype.parse=function(t,e){void 0===e&&(e={});var n=new st(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},tt.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new st(this,e,!0);return n.addAll(t,null,e.from,e.to),p.maxOpen(n.finish())},tt.prototype.matchTag=function(t,e,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var o=this.tags[r];if(ct(t,o.tag)&&(void 0===o.namespace||t.namespaceURI==o.namespace)&&(!o.context||e.matchesContext(o.context))){if(o.getAttrs){var i=o.getAttrs(t);if(!1===i)continue;o.attrs=i}return o}}},tt.prototype.matchStyle=function(t,e,n,r){for(var o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){var i=this.styles[o];if(!(0!=i.style.indexOf(t)||i.context&&!n.matchesContext(i.context)||i.style.length>t.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var s=i.getAttrs(e);if(!1===s)continue;i.attrs=s}return i}}},tt.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,r=0;r<e.length;r++){var o=e[r];if((null==o.priority?50:o.priority)<n)break}e.splice(r,0,t)}var r=function(e){var r=t.marks[e].spec.parseDOM;r&&r.forEach((function(t){n(t=ut(t)),t.mark=e}))};for(var o in t.marks)r(o);var i;for(var s in t.nodes)i=void 0,(i=t.nodes[s].spec.parseDOM)&&i.forEach((function(t){n(t=ut(t)),t.node=s}));return e},tt.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new tt(t,tt.schemaRules(t)))};var et={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},nt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},rt={ol:!0,ul:!0};function ot(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}var it=function(t,e,n,r,o,i,s){this.type=t,this.attrs=e,this.solid=o,this.match=i||(4&s?null:t.contentMatch),this.options=s,this.content=[],this.marks=n,this.activeMarks=l.none,this.pendingMarks=r,this.stashMarks=[]};it.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(i.from(t));if(!e){var n,r=this.type.contentMatch;return(n=r.findWrapping(t.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)},it.prototype.finish=function(t){if(!(1&this.options)){var e,n=this.content[this.content.length-1];n&&n.isText&&(e=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length)))}var r=i.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(i.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r},it.prototype.popFromStashMark=function(t){for(var e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},it.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e<n.length;e++){var r=n[e];(this.type?this.type.allowsMarkType(r.type):lt(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}},it.prototype.inlineContext=function(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!et.hasOwnProperty(t.parentNode.nodeName.toLowerCase())};var st=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var r,o=e.topNode,i=ot(null,e.preserveWhitespace,0)|(n?4:0);r=o?new it(o.type,o.attrs,l.none,l.none,!0,e.topMatch||o.type.contentMatch,i):new it(n?null:t.schema.topNodeType,null,l.none,l.none,!0,null,i),this.nodes=[r],this.open=0,this.find=e.findPositions,this.needsBlock=!1},at={top:{configurable:!0},currentPos:{configurable:!0}};function ct(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ut(t){var e={};for(var n in t)e[n]=t[n];return e}function lt(t,e){var n=e.schema.nodes,r=function(r){var o=n[r];if(o.allowsMarkType(t)){var i=[],s=function(t){i.push(t);for(var n=0;n<t.edgeCount;n++){var r=t.edge(n),o=r.type,a=r.next;if(o==e)return!0;if(i.indexOf(a)<0&&s(a))return!0}};return s(o.contentMatch)?{v:!0}:void 0}};for(var o in n){var i=r(o);if(i)return i.v}}at.top.get=function(){return this.nodes[this.open]},st.prototype.addDOM=function(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){var e=t.getAttribute("style"),n=e?this.readStyles(function(t){var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(e)):null,r=this.top;if(null!=n)for(var o=0;o<n.length;o++)this.addPendingMark(n[o]);if(this.addElement(t),null!=n)for(var i=0;i<n.length;i++)this.removePendingMark(n[i],r)}},st.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if(2&n.options||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)e=2&n.options?e.replace(/\r\n?/g,"\n"):e.replace(/\r?\n|\r/g," ");else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){var r=n.content[n.content.length-1],o=t.previousSibling;(!r||o&&"BR"==o.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)},st.prototype.addElement=function(t,e){var n,r=t.nodeName.toLowerCase();rt.hasOwnProperty(r)&&this.parser.normalizeLists&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var r=1==e.nodeType?e.nodeName.toLowerCase():null;r&&rt.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):"li"==r?n=e:r&&(n=null)}}(t);var o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(o?o.ignore:nt.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);var i,s=this.top,a=this.needsBlock;if(et.hasOwnProperty(r))i=!0,s.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),i&&this.sync(s),this.needsBlock=a}else this.addElementByRule(t,o,!1===o.consuming?n:null)},st.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},st.prototype.ignoreFallback=function(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))},st.prototype.readStyles=function(t){var e=l.none;t:for(var n=0;n<t.length;n+=2)for(var r=null;;){var o=this.parser.matchStyle(t[n],t[n+1],this,r);if(!o)continue t;if(o.ignore)return null;if(e=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(e),!1!==o.consuming)break;r=o}return e},st.prototype.addElementByRule=function(t,e,n){var r,o,i,s=this;e.node?(o=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):r=this.enter(o,e.attrs,e.preserveWhitespace):(i=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(i));var a=this.top;if(o&&o.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((function(t){return s.insertNode(t)}));else{var c=e.contentElement;"string"==typeof c?c=t.querySelector(c):"function"==typeof c&&(c=c(t)),c||(c=t),this.findAround(t,c,!0),this.addAll(c,r)}r&&(this.sync(a),this.open--),i&&this.removePendingMark(i,a)},st.prototype.addAll=function(t,e,n,r){for(var o=n||0,i=n?t.childNodes[n]:t.firstChild,s=null==r?null:t.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i),e&&et.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,o)},st.prototype.findPlace=function(t){for(var e,n,r=this.open;r>=0;r--){var o=this.nodes[r],i=o.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=o,!i.length))break;if(o.solid)break}if(!e)return!1;this.sync(n);for(var s=0;s<e.length;s++)this.enterInner(e[s],null,!1);return!0},st.prototype.insertNode=function(t){if(t.isInline&&this.needsBlock&&!this.top.type){var e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();var n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));for(var r=n.activeMarks,o=0;o<t.marks.length;o++)n.type&&!n.type.allowsMarkType(t.marks[o].type)||(r=t.marks[o].addToSet(r));return n.content.push(t.mark(r)),!0}return!1},st.prototype.enter=function(t,e,n){var r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r},st.prototype.enterInner=function(t,e,n,r){this.closeExtra();var o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t,e);var i=ot(t,r,o.options);4&o.options&&0==o.content.length&&(i|=4),this.nodes.push(new it(t,e,o.activeMarks,o.pendingMarks,n,null,i)),this.open++},st.prototype.closeExtra=function(t){var e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},st.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},st.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},at.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,r=n.length-1;r>=0;r--)t+=n[r].nodeSize;e&&t++}return t},st.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)},st.prototype.findInside=function(t){if(this.find)for(var e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)},st.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node))e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},st.prototype.findInText=function(t){if(this.find)for(var e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))},st.prototype.matchesContext=function(t){var e=this;if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=function(t,a){for(;t>=0;t--){var c=n[t];if(""==c){if(t==n.length-1||0==t)continue;for(;a>=i;a--)if(s(t-1,a))return!0;return!1}var u=a>0||0==a&&o?e.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&-1==u.groups.indexOf(c))return!1;a--}return!0};return s(n.length-1,this.open)},st.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}},st.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},st.prototype.removePendingMark=function(t,e){for(var n=this.open;n>=0;n--){var r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);var o=r.popFromStashMark(t);o&&r.type&&r.type.allowsMarkType(o.type)&&(r.activeMarks=o.addToSet(r.activeMarks))}if(r==e)break}},Object.defineProperties(st.prototype,at);var dt=function(t,e){this.nodes=t||{},this.marks=e||{}};function pt(t){var e={};for(var n in t){var r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ft(t){return t.document||window.document}dt.prototype.serializeFragment=function(t,e,n){var r=this;void 0===e&&(e={}),n||(n=ft(e).createDocumentFragment());var o=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,s=0;n<i.length&&s<t.marks.length;){var a=t.marks[s];if(r.marks[a.type.name]){if(!a.eq(i[n])||!1===a.type.spec.spanning)break;n+=2,s++}else s++}for(;n<i.length;)o=i.pop(),i.pop();for(;s<t.marks.length;){var c=t.marks[s++],u=r.serializeMark(c,t.isInline,e);u&&(i.push(c,o),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(r.serializeNodeInner(t,e))})),n},dt.prototype.serializeNodeInner=function(t,e){void 0===e&&(e={});var n=dt.renderSpec(ft(e),this.nodes[t.type.name](t)),r=n.dom,o=n.contentDOM;if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");e.onContent?e.onContent(t,o,e):this.serializeFragment(t.content,e,o)}return r},dt.prototype.serializeNode=function(t,e){void 0===e&&(e={});for(var n=this.serializeNodeInner(t,e),r=t.marks.length-1;r>=0;r--){var o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n},dt.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var r=this.marks[t.type.name];return r&&dt.renderSpec(ft(n),r(t,e))},dt.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;var r=e[0],o=r.indexOf(" ");o>0&&(n=r.slice(0,o),r=r.slice(o+1));var i=null,s=n?t.createElementNS(n,r):t.createElement(r),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a))for(var u in c=2,a)if(null!=a[u]){var l=u.indexOf(" ");l>0?s.setAttributeNS(u.slice(0,l),u.slice(l+1),a[u]):s.setAttribute(u,a[u])}for(var d=c;d<e.length;d++){var p=e[d];if(0===p){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}var f=dt.renderSpec(t,p,n),h=f.dom,m=f.contentDOM;if(s.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:s,contentDOM:i}},dt.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new dt(this.nodesFromSchema(t),this.marksFromSchema(t)))},dt.nodesFromSchema=function(t){var e=pt(t.nodes);return e.text||(e.text=function(t){return t.text}),e},dt.marksFromSchema=function(t){return pt(t.marks)};var ht=Math.pow(2,16);function mt(t){return 65535&t}var vt=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},gt=function t(e,n){if(void 0===n&&(n=!1),!e.length&&t.empty)return t.empty;this.ranges=e,this.inverted=n};gt.prototype.recover=function(t){var e=0,n=mt(t);if(!this.inverted)for(var r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/ht}(t)},gt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},gt.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},gt.prototype._map=function(t,e,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?r:0);if(a>t)break;var c=this.ranges[s+o],u=this.ranges[s+i],l=a+c;if(t<=l){var d=a+r+((c?t==a?-1:t==l?1:e:e)<0?0:u);if(n)return d;var p=t==(e<0?a:l)?null:s/3+(t-a)*ht;return new vt(d,e<0?t!=a:t!=l,p)}r+=u-c}return n?t+r:new vt(t+r)},gt.prototype.touches=function(t,e){for(var n=0,r=mt(e),o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?n:0);if(a>t)break;var c=this.ranges[s+o];if(t<=a+c&&s==3*r)return!0;n+=this.ranges[s+i]-c}return!1},gt.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[r+e],u=this.ranges[r+n];t(s,s+c,a,a+u),o+=u-c}},gt.prototype.invert=function(){return new gt(this.ranges,!this.inverted)},gt.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},gt.offset=function(t){return 0==t?gt.empty:new gt(t<0?[0,-t,0]:[0,0,t])},gt.empty=new gt([]);var yt=function(t,e,n,r){this.maps=t||[],this.from=n||0,this.to=null==r?this.maps.length:r,this.mirror=e};function bt(t){var e=Error.call(this,t);return e.__proto__=bt.prototype,e}yt.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new yt(this.maps,this.mirror,t,e)},yt.prototype.copy=function(){return new yt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},yt.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},yt.prototype.appendMapping=function(t){for(var e=0,n=this.maps.length;e<t.maps.length;e++){var r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:null)}},yt.prototype.getMirror=function(t){if(this.mirror)for(var e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]},yt.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},yt.prototype.appendMappingInverted=function(t){for(var e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){var r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:null)}},yt.prototype.invert=function(){var t=new yt;return t.appendMappingInverted(this),t},yt.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t},yt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},yt.prototype._map=function(t,e,n){for(var r=!1,o=this.from;o<this.to;o++){var i=this.maps[o].mapResult(t,e);if(null!=i.recover){var s=this.getMirror(o);if(null!=s&&s>o&&s<this.to){o=s,t=this.maps[s].recover(i.recover);continue}}i.deleted&&(r=!0),t=i.pos}return n?t:new vt(t,r)},bt.prototype=Object.create(Error.prototype),bt.prototype.constructor=bt,bt.prototype.name="TransformError";var wt=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new yt},_t={before:{configurable:!0},docChanged:{configurable:!0}};function xt(){throw new Error("Override me")}_t.before.get=function(){return this.docs.length?this.docs[0]:this.doc},wt.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new bt(e.failed);return this},wt.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},_t.docChanged.get=function(){return this.steps.length>0},wt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(wt.prototype,_t);var kt=Object.create(null),Ct=function(){};Ct.prototype.apply=function(t){return xt()},Ct.prototype.getMap=function(){return gt.empty},Ct.prototype.invert=function(t){return xt()},Ct.prototype.map=function(t){return xt()},Ct.prototype.merge=function(t){return null},Ct.prototype.toJSON=function(){return xt()},Ct.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=kt[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},Ct.jsonID=function(t,e){if(t in kt)throw new RangeError("Duplicate use of step JSON ID "+t);return kt[t]=e,e.prototype.jsonID=t,e};var St=function(t,e){this.doc=t,this.failed=e};St.ok=function(t){return new St(t,null)},St.fail=function(t){return new St(null,t)},St.fromReplace=function(t,e,n,r){try{return St.ok(t.replace(e,n,r))}catch(t){if(t instanceof d)return St.fail(t.message);throw t}};var Tt=function(t){function e(e,n,r,o){t.call(this),this.from=e,this.to=n,this.slice=r,this.structure=!!o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Mt(t,this.from,this.to)?St.fail("Structure replace would overwrite content"):St.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new gt([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?p.empty:new p(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var r=this.slice.size+t.slice.size==0?p.empty:new p(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),r,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,p.fromJSON(t,n.slice),!!n.structure)},e}(Ct);Ct.jsonID("replace",Tt);var Et=function(t){function e(e,n,r,o,i,s,a){t.call(this),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=!!a}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Mt(t,this.from,this.gapFrom)||Mt(t,this.gapTo,this.to)))return St.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return St.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?St.fromReplace(t,this.from,this.to,n):St.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new gt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&r.deleted||o<n.pos||i>r.pos?null:new e(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,p.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(Ct);function Mt(t,e,n){for(var r=t.resolve(e),o=n-e,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function Ot(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Dt(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(0==n||r.type.spec.isolating||!Ot(r,o,i))break}}function It(t,e,n,r){void 0===r&&(r=t);var o=function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;var s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){var n=t.parent,r=t.startIndex,o=t.endIndex,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:e).contentMatch,c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);if(!a||!a.validEnd)return null;return s}(r,e);return i?o.map(At).concat({type:e,attrs:n}).concat(i.map(At)):null}function At(t){return{type:t,attrs:null}}function Nt(t,e,n,r){void 0===n&&(n=1);var o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,c=n-2;a>i;a--,c--){var u=o.node(a),l=o.index(a);if(u.type.spec.isolating)return!1;var d=u.content.cutByIndex(l,u.childCount),p=r&&r[c]||u;if(p!=u&&(d=d.replaceChild(0,p.type.create(p.attrs))),!u.canReplace(l+1,u.childCount)||!p.type.validContent(d))return!1}var f=o.indexAfter(i),h=r&&r[0];return o.node(i).canReplaceWith(f,f,h?h.type:o.node(i+1).type)}function Bt(t,e){var n=t.resolve(e),r=n.index();return zt(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function zt(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function Pt(t,e,n){void 0===n&&(n=-1);for(var r=t.resolve(e),o=r.depth;;o--){var i=void 0,s=void 0,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&zt(i,s)&&r.node(o).canReplace(a,a+1))return e;if(0==o)break;e=n<0?r.before(o):r.after(o)}}function Rt(t,e,n){var r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a<r.node(s).childCount)return null}}function Ft(t,e,n){var r=t.resolve(e);if(!n.content.size)return e;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(var a=r.depth;a>=0;a--){var c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,u=r.index(a)+(c>0?1:0),l=r.node(a),d=!1;if(1==s)d=l.canReplace(u,u,o);else{var p=l.contentMatchAt(u).findWrapping(o.firstChild.type);d=p&&l.canReplaceWith(u,u,p[0])}if(d)return 0==c?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function Lt(t,e,n){for(var r=[],o=0;o<t.childCount;o++){var s=t.child(o);s.content.size&&(s=s.copy(Lt(s.content,e,s))),s.isInline&&(s=e(s,n,o)),r.push(s)}return i.fromArray(r)}Ct.jsonID("replaceAround",Et),wt.prototype.lift=function(t,e){for(var n=t.$from,r=t.$to,o=t.depth,s=n.before(o+1),a=r.after(o+1),c=s,u=a,l=i.empty,d=0,f=o,h=!1;f>e;f--)h||n.index(f)>0?(h=!0,l=i.from(n.node(f).copy(l)),d++):c--;for(var m=i.empty,v=0,g=o,y=!1;g>e;g--)y||r.after(g+1)<r.end(g)?(y=!0,m=i.from(r.node(g).copy(m)),v++):u++;return this.step(new Et(c,u,s,a,new p(l.append(m),d,v),l.size-d,!0))},wt.prototype.wrap=function(t,e){for(var n=i.empty,r=e.length-1;r>=0;r--){if(n.size){var o=e[r].type.contentMatch.matchFragment(n);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=i.from(e[r].type.create(e[r].attrs,n))}var s=t.start,a=t.end;return this.step(new Et(s,a,s,a,new p(n,0,0),e.length,!0))},wt.prototype.setBlockType=function(t,e,n,r){var o=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var s=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(o.doc,o.mapping.slice(s).map(e),n)){o.clearIncompatible(o.mapping.slice(s).map(e,1),n);var a=o.mapping.slice(s),c=a.map(e,1),u=a.map(e+t.nodeSize,1);return o.step(new Et(c,u,c+1,u-1,new p(i.from(n.create(r,null,t.marks)),0,0),1,!0)),!1}})),this},wt.prototype.setNodeMarkup=function(t,e,n,r){var o=this.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);var s=e.create(n,null,r||o.marks);if(o.isLeaf)return this.replaceWith(t,t+o.nodeSize,s);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Et(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new p(i.from(s),0,0),1,!0))},wt.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var r=this.doc.resolve(t),o=i.empty,s=i.empty,a=r.depth,c=r.depth-e,u=e-1;a>c;a--,u--){o=i.from(r.node(a).copy(o));var l=n&&n[u];s=i.from(l?l.type.create(l.attrs,s):r.node(a).copy(s))}return this.step(new Tt(t,t,new p(o.append(s),e,e),!0))},wt.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Tt(t-e,t+e,p.empty,!0);return this.step(n)};var Vt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new p(Lt(n.content,(function(t,n){return t.isAtom&&n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),o),n.openStart,n.openEnd);return St.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new jt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(Ct);Ct.jsonID("addMark",Vt);var jt=function(t){function e(e,n,r){t.call(this),this.from=e,this.to=n,this.mark=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),r=new p(Lt(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return St.fromReplace(t,this.from,this.to,r)},e.prototype.invert=function(){return new Vt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(Ct);function $t(t,e,n,r){if(void 0===n&&(n=e),void 0===r&&(r=p.empty),e==n&&!r.size)return null;var o=t.resolve(e),i=t.resolve(n);return Wt(o,i,r)?new Tt(e,n,r):new Ht(o,i,r).fit()}function Wt(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}Ct.jsonID("removeMark",jt),wt.prototype.addMark=function(t,e,n){var r=this,o=[],i=[],s=null,a=null;return this.doc.nodesBetween(t,e,(function(r,c,u){if(r.isInline){var l=r.marks;if(!n.isInSet(l)&&u.type.allowsMarkType(n.type)){for(var d=Math.max(c,t),p=Math.min(c+r.nodeSize,e),f=n.addToSet(l),h=0;h<l.length;h++)l[h].isInSet(f)||(s&&s.to==d&&s.mark.eq(l[h])?s.to=p:o.push(s=new jt(d,p,l[h])));a&&a.to==d?a.to=p:i.push(a=new Vt(d,p,n))}}})),o.forEach((function(t){return r.step(t)})),i.forEach((function(t){return r.step(t)})),this},wt.prototype.removeMark=function(t,e,n){var r=this;void 0===n&&(n=null);var o=[],i=0;return this.doc.nodesBetween(t,e,(function(r,s){if(r.isInline){i++;var a=null;if(n instanceof X)for(var c,u=r.marks;c=n.isInSet(u);)(a||(a=[])).push(c),u=c.removeFromSet(u);else n?n.isInSet(r.marks)&&(a=[n]):a=r.marks;if(a&&a.length)for(var l=Math.min(s+r.nodeSize,e),d=0;d<a.length;d++){for(var p=a[d],f=void 0,h=0;h<o.length;h++){var m=o[h];m.step==i-1&&p.eq(o[h].style)&&(f=m)}f?(f.to=l,f.step=i):o.push({style:p,from:Math.max(s,t),to:l,step:i})}}})),o.forEach((function(t){return r.step(new jt(t.from,t.to,t.style))})),this},wt.prototype.clearIncompatible=function(t,e,n){void 0===n&&(n=e.contentMatch);for(var r=this.doc.nodeAt(t),o=[],s=t+1,a=0;a<r.childCount;a++){var c=r.child(a),u=s+c.nodeSize,l=n.matchType(c.type,c.attrs);if(l){n=l;for(var d=0;d<c.marks.length;d++)e.allowsMarkType(c.marks[d].type)||this.step(new jt(s,u,c.marks[d]))}else o.push(new Tt(s,u,p.empty));s=u}if(!n.validEnd){var f=n.fillBefore(i.empty,!0);this.replace(s,s,new p(f,0,0))}for(var h=o.length-1;h>=0;h--)this.step(o[h]);return this},wt.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=p.empty);var r=$t(this.doc,t,e,n);return r&&this.step(r),this},wt.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new p(i.from(n),0,0))},wt.prototype.delete=function(t,e){return this.replace(t,e,p.empty)},wt.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Ht=function(t,e,n){this.$to=e,this.$from=t,this.unplaced=n,this.frontier=[];for(var r=0;r<=t.depth;r++){var o=t.node(r);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(r))})}this.placed=i.empty;for(var s=t.depth;s>0;s--)this.placed=i.from(t.node(s).copy(this.placed))},qt={depth:{configurable:!0}};function Jt(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(Jt(t.firstChild.content,e-1,n)))}function Kt(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Kt(t.lastChild.content,e-1,n)))}function Ut(t,e){for(var n=0;n<e;n++)t=t.firstChild.content;return t}function Gt(t,e,n){if(e<=0)return t;var r=t.content;return e>1&&(r=r.replaceChild(0,Gt(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(i.empty,!0)))),t.copy(r)}function Yt(t,e,n,r,o){var i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(var r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function Xt(t,e,n,r,o){if(e<n){var s=t.firstChild;t=t.replaceChild(0,s.copy(Xt(s.content,e+1,n,r,s)))}if(e>r){var a=o.contentMatchAt(0),c=a.fillBefore(t).append(t);t=c.append(a.matchFragment(c).fillBefore(i.empty,!0))}return t}function Zt(t,e){for(var n=[],r=Math.min(t.depth,e.depth);r>=0;r--){var o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(o==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==o-1)&&n.push(r)}return n}qt.depth.get=function(){return this.frontier.length-1},Ht.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;for(var i=this.placed,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var c=new p(i,s,a);return e>-1?new Et(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Tt(r.pos,o.pos,c):void 0},Ht.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--)for(var n=void 0,r=(e?(n=Ut(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,o=this.depth;o>=0;o--){var s=this.frontier[o],a=s.type,c=s.match,u=void 0,l=void 0;if(1==t&&(r?c.matchType(r.type)||(l=c.fillBefore(i.from(r),!1)):a.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:o,parent:n,inject:l};if(2==t&&r&&(u=c.findWrapping(r.type)))return{sliceDepth:e,frontierDepth:o,parent:n,wrap:u};if(n&&c.matchType(n.type))break}},Ht.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Ut(e,n);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new p(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)},Ht.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,r=t.openEnd,o=Ut(e,n);if(o.childCount<=1&&n>0){var i=e.size-n<=n+o.size;this.unplaced=new p(Jt(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new p(Jt(e,n,1),n,r)},Ht.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,r=t.parent,o=t.inject,s=t.wrap;this.depth>n;)this.closeFrontierNode();if(s)for(var a=0;a<s.length;a++)this.openFrontierNode(s[a]);var c=this.unplaced,u=r?r.content:c.content,l=c.openStart-e,d=0,f=[],h=this.frontier[n],m=h.match,v=h.type;if(o){for(var g=0;g<o.childCount;g++)f.push(o.child(g));m=m.matchFragment(o)}for(var y=u.size+e-(c.content.size-c.openEnd);d<u.childCount;){var b=u.child(d),w=m.matchType(b.type);if(!w)break;(++d>1||0==l||b.content.size)&&(m=w,f.push(Gt(b.mark(v.allowedMarks(b.marks)),1==d?l:0,d==u.childCount?y:-1)))}var _=d==u.childCount;_||(y=-1),this.placed=Kt(this.placed,n,i.from(f)),this.frontier[n].match=m,_&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var x=0,k=u;x<y;x++){var C=k.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),k=C.content}this.unplaced=_?0==e?p.empty:new p(Jt(c.content,e-1,1),e-1,y<0?c.openEnd:e-1):new p(Jt(c.content,e,d),c.openStart,c.openEnd)},Ht.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock||this.$to.end()==this.$to.pos)return-1;var t,e=this.frontier[this.depth];if(!e.type.isTextblock||!Yt(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r},Ht.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var n=this.frontier[e],r=n.match,o=n.type,i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=Yt(t,e,o,r,i);if(s){for(var a=e-1;a>=0;a--){var c=this.frontier[a],u=c.match,l=Yt(t,a,c.type,u,!0);if(!l||l.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}},Ht.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Kt(this.placed,e.depth,e.fit)),t=e.move;for(var n=e.depth+1;n<=t.depth;n++){var r=t.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,o)}return t},Ht.prototype.openFrontierNode=function(t,e,n){var r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Kt(this.placed,this.depth,i.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},Ht.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(i.empty,!0);t.childCount&&(this.placed=Kt(this.placed,this.frontier.length,t))},Object.defineProperties(Ht.prototype,qt),wt.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var r=this.doc.resolve(t),o=this.doc.resolve(e);if(Wt(r,o,n))return this.step(new Tt(t,e,n));var i=Zt(r,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var s=-(r.depth+1);i.unshift(s);for(var a=r.depth,c=r.pos-1;a>0;a--,c--){var u=r.node(a).type.spec;if(u.defining||u.isolating)break;i.indexOf(a)>-1?s=a:r.before(a)==c&&i.splice(1,0,-a)}for(var l=i.indexOf(s),d=[],f=n.openStart,h=n.content,m=0;;m++){var v=h.firstChild;if(d.push(v),m==n.openStart)break;h=v.content}f>0&&d[f-1].type.spec.defining&&r.node(l).type!=d[f-1].type?f-=1:f>=2&&d[f-1].isTextblock&&d[f-2].type.spec.defining&&r.node(l).type!=d[f-2].type&&(f-=2);for(var g=n.openStart;g>=0;g--){var y=(g+f+1)%(n.openStart+1),b=d[y];if(b)for(var w=0;w<i.length;w++){var _=i[(w+l)%i.length],x=!0;_<0&&(x=!1,_=-_);var k=r.node(_-1),C=r.index(_-1);if(k.canReplaceWith(C,C,b.type,b.marks))return this.replace(r.before(_),x?o.after(_):e,new p(Xt(n.content,0,n.openStart,y),y,n.openEnd))}}for(var S=this.steps.length,T=i.length-1;T>=0&&(this.replace(t,e,n),!(this.steps.length>S));T--){var E=i[T];E<0||(t=r.before(E),e=o.after(E))}return this},wt.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var r=Rt(this.doc,t,n.type);null!=r&&(t=e=r)}return this.replaceRange(t,e,new p(i.from(n),0,0))},wt.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),r=this.doc.resolve(e),o=Zt(n,r),i=0;i<o.length;i++){var s=o[i],a=i==o.length-1;if(a&&0==s||n.node(s).type.contentMatch.validEnd)return this.delete(n.start(s),r.end(s));if(s>0&&(a||n.node(s-1).canReplace(n.index(s-1),r.indexAfter(s-1))))return this.delete(n.before(s),r.after(s))}for(var c=1;c<=n.depth&&c<=r.depth;c++)if(t-n.start(c)==n.depth-c&&e>n.end(c)&&r.end(c)-e!=r.depth-c)return this.delete(n.before(c),e);return this.delete(t,e)};var Qt=Object.create(null),te=function(t,e,n){this.ranges=n||[new ne(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},ee={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};ee.anchor.get=function(){return this.$anchor.pos},ee.head.get=function(){return this.$head.pos},ee.from.get=function(){return this.$from.pos},ee.to.get=function(){return this.$to.pos},ee.$from.get=function(){return this.ranges[0].$from},ee.$to.get=function(){return this.ranges[0].$to},ee.empty.get=function(){for(var t=this.ranges,e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0},te.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},te.prototype.replace=function(t,e){void 0===e&&(e=p.empty);for(var n=e.content.lastChild,r=null,o=0;o<e.openEnd;o++)r=n,n=n.lastChild;for(var i=t.steps.length,s=this.ranges,a=0;a<s.length;a++){var c=s[a],u=c.$from,l=c.$to,d=t.mapping.slice(i);t.replaceRange(d.map(u.pos),d.map(l.pos),a?p.empty:e),0==a&&le(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}},te.prototype.replaceWith=function(t,e){for(var n=t.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],s=i.$from,a=i.$to,c=t.mapping.slice(n),u=c.map(s.pos),l=c.map(a.pos);o?t.deleteRange(u,l):(t.replaceRangeWith(u,l,e),le(t,n,e.isInline?-1:1))}},te.findFrom=function(t,e,n){var r=t.parent.inlineContent?new re(t):ue(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(var o=t.depth-1;o>=0;o--){var i=e<0?ue(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):ue(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}},te.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new ae(t.node(0))},te.atStart=function(t){return ue(t,t,0,0,1)||new ae(t)},te.atEnd=function(t){return ue(t,t,t.content.size,t.childCount,-1)||new ae(t)},te.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Qt[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},te.jsonID=function(t,e){if(t in Qt)throw new RangeError("Duplicate use of selection JSON ID "+t);return Qt[t]=e,e.prototype.jsonID=t,e},te.prototype.getBookmark=function(){return re.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(te.prototype,ee),te.prototype.visible=!0;var ne=function(t,e){this.$from=t,this.$to=e},re=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));if(!o.parent.inlineContent)return t.near(o);var i=n.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:o,o)},e.prototype.replace=function(e,n){if(void 0===n&&(n=p.empty),t.prototype.replace.call(this,e,n),n==p.empty){var r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new oe(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))},e.between=function(n,r,o){var i=n.pos-r.pos;if(o&&!i||(o=i>=0?1:-1),!r.parent.inlineContent){var s=t.findFrom(r,o,!0)||t.findFrom(r,-o,!0);if(!s)return t.near(r,o);r=s.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-o,!0)||t.findFrom(n,o,!0)).$anchor).pos<r.pos!=i<0)&&(n=r),new e(n,r)},Object.defineProperties(e.prototype,n),e}(te);te.jsonID("text",re);var oe=function(t,e){this.anchor=t,this.head=e};oe.prototype.map=function(t){return new oe(t.map(this.anchor),t.map(this.head))},oe.prototype.resolve=function(t){return re.between(t.resolve(this.anchor),t.resolve(this.head))};var ie=function(t){function e(e){var n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);t.call(this,e,r),this.node=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=r.mapResult(this.anchor),i=o.deleted,s=o.pos,a=n.resolve(s);return i?t.near(a):new e(a)},e.prototype.content=function(){return new p(i.from(this.node),0,0)},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor},e.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},e.prototype.getBookmark=function(){return new se(this.anchor)},e.fromJSON=function(t,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(n.anchor))},e.create=function(t,e){return new this(t.resolve(e))},e.isSelectable=function(t){return!t.isText&&!1!==t.type.spec.selectable},e}(te);ie.prototype.visible=!1,te.jsonID("node",ie);var se=function(t){this.anchor=t};se.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,r=e.pos;return n?new oe(r,r):new se(r)},se.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&ie.isSelectable(n)?new ie(e):te.near(e)};var ae=function(t){function e(e){t.call(this,e.resolve(0),e.resolve(e.content.size))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.replace=function(e,n){if(void 0===n&&(n=p.empty),n==p.empty){e.delete(0,e.doc.content.size);var r=t.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else t.prototype.replace.call(this,e,n)},e.prototype.toJSON=function(){return{type:"all"}},e.fromJSON=function(t){return new e(t)},e.prototype.map=function(t){return new e(t)},e.prototype.eq=function(t){return t instanceof e},e.prototype.getBookmark=function(){return ce},e}(te);te.jsonID("all",ae);var ce={map:function(){return this},resolve:function(t){return new ae(t)}};function ue(t,e,n,r,o,i){if(e.inlineContent)return re.create(t,n);for(var s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){var a=e.child(s);if(a.isAtom){if(!i&&ie.isSelectable(a))return ie.create(t,n-(o<0?a.nodeSize:0))}else{var c=ue(t,a,n+o,o<0?a.childCount:0,o,i);if(c)return c}n+=a.nodeSize*o}}function le(t,e,n){var r=t.steps.length-1;if(!(r<e)){var o,i=t.steps[r];if(i instanceof Tt||i instanceof Et)t.mapping.maps[r].forEach((function(t,e,n,r){null==o&&(o=r)})),t.setSelection(te.near(t.doc.resolve(o),n))}}var de=function(t){function e(e){t.call(this,e.doc),this.time=Date.now(),this.curSelection=e.selection,this.curSelectionFor=0,this.storedMarks=e.storedMarks,this.updated=0,this.meta=Object.create(null)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={selection:{configurable:!0},selectionSet:{configurable:!0},storedMarksSet:{configurable:!0},isGeneric:{configurable:!0},scrolledIntoView:{configurable:!0}};return n.selection.get=function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection},e.prototype.setSelection=function(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return l.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||l.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(e);o=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.setSelection(te.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(wt);function pe(t,e){return e&&t?t.bind(e):t}var fe=function(t,e,n){this.name=t,this.init=pe(e.init,n),this.apply=pe(e.apply,n)},he=[new fe("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new fe("selection",{init:function(t,e){return t.selection||te.atStart(e.doc)},apply:function(t){return t.selection}}),new fe("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new fe("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],me=function(t,e){var n=this;this.schema=t,this.fields=he.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new fe(t.key,t.spec.state,t))}))},ve=function(t){this.config=t},ge={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};ge.schema.get=function(){return this.config.schema},ge.plugins.get=function(){return this.config.plugins},ve.prototype.apply=function(t){return this.applyTransaction(t).state},ve.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=e){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,t,this))return!1}return!0},ve.prototype.applyTransaction=function(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};for(var e=[t],n=this.applyInner(t),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var s=this.config.plugins[i];if(s.spec.appendTransaction){var a=r?r[i].n:0,c=r?r[i].state:this,u=a<e.length&&s.spec.appendTransaction.call(s,a?e.slice(a):e,c,n);if(u&&n.filterTransaction(u,i)){if(u.setMeta("appendedTransaction",t),!r){r=[];for(var l=0;l<this.config.plugins.length;l++)r.push(l<i?{state:n,n:e.length}:{state:this,n:0})}e.push(u),n=n.applyInner(u),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}},ve.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new ve(this.config),n=this.config.fields,r=0;r<n.length;r++){var o=n[r];e[o.name]=o.apply(t,this[o.name],this,e)}for(var i=0;i<ye.length;i++)ye[i](this,t,e);return e},ge.tr.get=function(){return new de(this)},ve.create=function(t){for(var e=new me(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new ve(e),r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n},ve.prototype.reconfigure=function(t){for(var e=new me(this.schema,t.plugins),n=e.fields,r=new ve(e),o=0;o<n.length;o++){var i=n[o].name;r[i]=this.hasOwnProperty(i)?this[i]:n[o].init(t,r)}return r},ve.prototype.toJSON=function(t){var e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((function(t){return t.toJSON()}))),t&&"object"==typeof t)for(var n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=t[n],o=r.spec.state;o&&o.toJSON&&(e[n]=o.toJSON.call(r,this[r.key]))}return e},ve.fromJSON=function(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var r=new me(t.schema,t.plugins),o=new ve(r);return r.fields.forEach((function(r){if("doc"==r.name)o.doc=O.fromJSON(t.schema,e.doc);else if("selection"==r.name)o.selection=te.fromJSON(o.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(var i in n){var s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(o[r.name]=a.fromJSON.call(s,t,e[i],o))}o[r.name]=r.init(t,o)}})),o},ve.addApplyListener=function(t){ye.push(t)},ve.removeApplyListener=function(t){var e=ye.indexOf(t);e>-1&&ye.splice(e,1)},Object.defineProperties(ve.prototype,ge);var ye=[];var be=function(t){this.props={},t.props&&function t(e,n,r){for(var o in e){var i=e[o];i instanceof Function?i=i.bind(n):"handleDOMEvents"==o&&(i=t(i,n,{})),r[o]=i}return r}(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:_e("plugin")};be.prototype.getState=function(t){return t[this.key]};var we=Object.create(null);function _e(t){return t in we?t+"$"+ ++we[t]:(we[t]=0,t+"$")}var xe=function(t){void 0===t&&(t="key"),this.key=_e(t)};xe.prototype.get=function(t){return t.config.pluginsByKey[this.key]},xe.prototype.getState=function(t){return t[this.key]};var ke="k-parent-node",Ce=["div","ol","ul","li","table","tbody","thead","tfoot","td","th","p","tr","col","colgroup","article","main","nav","header","footer","aside","section"],Se=function(t,e){var n=(t.ownerDocument||document).createElement(e);Array.from(t.rows).filter((function(t){return t.getAttribute(ke)===e})).forEach((function(t){t.removeAttribute(ke),n.appendChild(t)})),n.children.length&&t.appendChild(n)},Te=function(t,e){var n=e.toUpperCase();t.filter((function(t){return t.nodeName===n})).forEach((function(t){Array.from(t.children).forEach((function(n){n.setAttribute(ke,e),t.parentNode&&t.parentNode.insertBefore(n,t)})),t.remove()}))},Ee=function(t,e){void 0===e&&(e=Ce);var n=e.join("|");return t.replace(new RegExp("\\s*(<(?:"+n+")(?:\\s[^>]*?)?>)","g"),"$1").replace(new RegExp("(<\\/(?:"+n+")(?:\\s[^>]*?)?>)\\s*","g"),"$1")},Me=function(t){var e,n=document.createElement("template");if("content"in n)n.innerHTML=t,e=n.content;else{var r=(new DOMParser).parseFromString(t,"text/html");e=document.createDocumentFragment();for(var o=r.body;o&&o.firstChild;)e.appendChild(o.firstChild)}return e},Oe=function(t){var e=dt.fromSchema(t.type.schema).serializeFragment(t.content);return function(t){Array.from(t.querySelectorAll("table")).forEach((function(t){Se(t,"thead"),Se(t,"tbody"),Se(t,"tfoot");var e=Array.from(t.children).find((function(t){return 0===t.children.length}));e&&e.remove()}))}(e),e},De=function(t,e,n){return tt.fromSchema(e).parse(t,n)},Ie=function(t,e,n){var r,o=Me(t);return r=o,Array.from(r.querySelectorAll("table")).forEach((function(t){var e=Array.from(t.children);e.some((function(t){return"THEAD"===t.nodeName||"TFOOT"===t.nodeName}))&&(Te(e,"thead"),Te(e,"tbody"),Te(e,"tfoot"));var n=e.find((function(t){return"COLGROUP"===t.nodeName}));n&&(t.setAttribute("k-colgroup-data",n.outerHTML),n.remove())})),De(o,e,n)},Ae=function(t){var e=Oe(t.doc),n=document.createElement("div");return n.appendChild(e),n.innerHTML},Ne=function(t,e,n){return void 0===e&&(e="setHTML"),void 0===n&&(n={preserveWhitespace:"full"}),function(r,o){return o(r.tr.setSelection(new ae(r.doc)).replaceSelectionWith(Ie(t,r.schema,n)).setMeta("commandName",e))}},Be=n(0),ze=function(t,e){var n=e.style,r=e.value,o=e.newValue;if(!t)return{changed:!1,style:null};var i=t.split(/\s*;\s*/).filter((function(t){return Boolean(t)})),s=i.filter((function(t){var e=t.split(/\s*:\s*/);return!(e[0].toLowerCase()===n&&r.test(e[1]))}));return o&&s.push(n+": "+o),{style:s.join("; ")+(s.length?";":""),changed:Boolean(o)||s.length!==i.length}},Pe=function(t,e){for(var n=t.selection.$from,r=n.depth;r>=0;r--){var o=n.index(r);if(n.node(r).canReplaceWith(o,o,e))return!0}return!1},Re=function(t){return t instanceof O?t.type.name:t.name},Fe=function(t,e){return void 0===e&&(e=1),function(n){return function(t,e){return void 0===e&&(e=1),function(n){for(var r=n.$from,o=r.depth;o>0;o--){var i=r.node(o);if(t(i)&&0===(e-=1))return{depth:o,node:i}}}}((function(e){return Re(e)===Re(t)}),e)(n)}},Le=function(t,e){return function(n,r){var o=n.tr.replaceSelectionWith(t);e&&o.scrollIntoView(),r(o)}},Ve=function(t,e,n,r){var o=i.from(Ie(t,n,r)),s=i.from(Ie(e,n,r));return o.eq(s)},je=function(t){var e=t.selection;if(e instanceof re||e instanceof ae){var n=e.content().content;return n.textBetween(0,n.size)}return""},$e=function(t){if(t.selection instanceof ie)return t.selection.node},We=function(t){var e="",n=!1,r=t.selection,o=t.doc,i=r.$from,s=r.$to,a=r.from,c=r.to;return i.sameParent(s)&&(o.nodesBetween(a,c,(function(t){n=n||t.isLeaf&&!t.isText})),n||(e=je(t))),e},He=function(t){return t.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/gi,"</$1>\n").replace(/<(ul|ol)([^>]*)><li/gi,"<$1$2>\n<li").replace(/<br \/>/gi,"<br />\n").replace(/\n$/,"")},qe={before:/[^ !,?.\[\]{}()]+$/i,after:/^[^ !,?.\[\]{}()]+/i},Je=function(t,e,n){if(!n.applyToWord||!t.selection.empty)return{state:t,dispatch:e};var r=!0===n.applyToWord?qe:n.applyToWord,o=null,i=t.tr,s=t.selection,a=s.$head.nodeBefore,c=s.$head.nodeAfter;if(a&&"text"===a.type.name&&a.text&&c&&"text"===c.type.name&&c.text){var u=[];s.$head.parent.descendants((function(t,e){return u.push({node:t,pos:e}),!1}));for(var l=s.$head.parentOffset,d=u.findIndex((function(t){var e=t.node,n=t.pos;return n<=l&&n+e.nodeSize>=l})),p=u[d].node.text,f=!1,h=d-1;h>=0;h--){var m=u[h];!f&&m&&"text"===m.node.type.name?p=m.node.text+p:(f=!0,l-=m.node.nodeSize)}for(h=d+1;h<u.length;h++){if(!(m=u[h])||"text"!==m.node.type.name)break;p+=m.node.text}var v=p.substring(0,l),g=p.substring(l),y=r.before.exec(v),b=r.after.exec(g);if(y&&b){var w=y[0].length,_=b[0].length,x=o=s.from;i.setSelection(re.create(t.doc,x-w,x+_));return{state:{tr:i,selection:i.selection,doc:i.doc,storedMarks:null,schema:i.doc.type.schema},dispatch:function(t){t.setSelection(re.create(t.doc,o)),e(t)}}}}return{state:t,dispatch:e}},Ke=function(t,e){return function(n,r,o){var i=Je(n,r,e),s=i.state,a=i.dispatch;return t(e)(s,a)}},Ue=function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,s=o.$to,a=0===i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,s.pos,(function(t){if(a)return!1;a=t.inlineContent&&t.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1},Ge=function(t,e,n){return function(r,o){var i=r.selection,s=i.empty,a=i.$cursor,c=i.ranges;if(s&&!a||!Ue(r.doc,c,t))return!1;if(o)if(a)t.isInSet(r.storedMarks||a.marks())?o(n.removeStoredMark(t)):o(n.addStoredMark(t.create(e)));else{for(var u=!1,l=0;!u&&l<c.length;l++){var d=c[l],p=d.$from,f=d.$to;u=r.doc.rangeHasMark(p.pos,f.pos,t)}for(l=0;l<c.length;l++){var h=c[l];p=h.$from,f=h.$to;u?n.removeMark(p.pos,f.pos,t):n.addMark(p.pos,f.pos,t.create(e))}o(n.scrollIntoView())}return!0}},Ye=function(t,e,n,r){void 0===r&&(r=null);var o=[],i=0;return t.doc.nodesBetween(e,n,(function(t,s){if(t.isInline){i++;var a=null;if(r instanceof X){var c=r.isInSet(t.marks);c&&(a=[c])}else r?r.isInSet(t.marks)&&(a=[r]):a=t.marks;if(a&&a.length)for(var u=Math.min(s+t.nodeSize,n),l=0;l<a.length;l++){for(var d=a[l],p=void 0,f=0;f<o.length;f++){var h=o[f];h.step===i-1&&d.eq(h.style)&&(p=h)}p?(p.to=u,p.step=i):o.push({style:d,from:Math.max(s,e),to:u,step:i})}}})),o.forEach((function(e){return t.step(new jt(e.from,e.to,e.style))})),t},Xe=function(t){var e=(void 0===t?{}:t).except,n=void 0===e?[]:e;return function(t,e){var r,o=t.tr;Ze(o,{except:(r=n,r instanceof Array?r:[r])}),o.docChanged&&e(o)}},Ze=function(t,e){var n=e.except,r=t.doc,o=t.selection,i=r.type.schema,s=o.empty,a=o.ranges,c=(n||[]).map((function(t){return t.name}));if(!s){var u=Object.keys(i.marks).map((function(t){return i.marks[t]})).filter((function(t){return-1===c.indexOf(t.name)}));a.forEach((function(e){var n=e.$from,r=e.$to;u.forEach((function(e){return t.removeMark(n.pos,r.pos,e)}))}))}},Qe=function(t,e){var n,r=t.schema.marks,o=(e.altMarks||[]).filter((function(t){return r[t]})),i=e.altStyle,s=t.selection,a=s.from,c=s.$from,u=s.to,l=s.empty,d=r[e.mark],p=t.doc,f=!1;return l?(n=t.storedMarks||c.marks(),f=d&&d.isInSet(n)||o.some((function(t){return r[t].isInSet(n)}))):f=d&&p.rangeHasMark(a,u,d)||o.some((function(t){return p.rangeHasMark(a,u,r[t])})),!f&&i&&r.style?en(t,r.style).some((function(t){return null!==tn(t,i)})):Boolean(f)},tn=function(t,e){for(var n=(t&&t.attrs.style||"").split(/\s*;\s*/).filter((function(t){return Boolean(t)})),r=0;r<n.length;r++){var o=n[r].split(/\s*:\s*/);if(o[0].toLowerCase()===e.name&&e.value.test(o[1]))return o[1]}return null},en=function(t,e){var n=t.selection,r=n.from,o=n.$from,i=n.to,s=n.empty,a=[];return s?a.push(e.isInSet(t.storedMarks||o.marks())):t.doc.nodesBetween(r,i,(function(t){t.isInline&&a.push(e.isInSet(t.marks))})),a},nn=function(t,e){var n=en(t,e),r=n.filter((function(t){return Boolean(t)}));return n.length===r.length?n[0]:void 0},rn=function(t,e){var n=en(t,e),r=n.filter((function(t){return Boolean(t)}));return{hasNodesWithoutMarks:n.length!==r.length,marks:r}},on=function(t,e){var n=t.find((function(t){return"style"===t.type.name})),r=n&&n.attrs.style;return ze(r,e)},sn=function(t,e,n,r,o){var i=o.create({style:r.style}),s=[],a=[],c=null,u=null;return t.doc.nodesBetween(e,n,(function(t,l,d){if(t.isInline){var p=t.marks;if(!i.isInSet(p)&&d.type.allowsMarkType(i.type)){var f=Math.max(l,e),h=Math.min(l+t.nodeSize,n),m=on(p,r);if(m.changed||r.newValue){for(var v=m.changed?{style:m.style||null}:{style:[r.style]+": "+r.newValue+";"},g=o.isInSet(p)?p.find((function(t){return"style"===t.type.name})):null,y=g?Be.__assign({},g.attrs,v):v,b=o.create(y),w=b.addToSet(p),_=0;_<p.length;_++)p[_].isInSet(w)||(c&&c.to===f&&c.mark.eq(p[_])?c.to=h:(c=new jt(f,h,p[_]),s.push(c)));var x=u&&u.to===f,k=x&&b.attrs.style===u.mark.attrs.style;x&&k?u.to=h:Object.keys(y).some((function(t){return null!==y[t]}))&&(u=new Vt(f,h,b),a.push(u))}}}})),s.forEach((function(e){return t.step(e)})),a.forEach((function(e){return t.step(e)})),s.length+a.length>0},an=function(t,e){var n=t.schema.marks.style;return(n?en(t,n):[]).map((function(t){return tn(t,e)})).filter((function(t){return null!==t}))},cn=function(t,e){return function(n,r,o){var i=n.selection,s=i.empty,a=i.$cursor,c=i.ranges;if(s&&!a||!Ue(n.doc,c,t))return!1;var u,l,d,p,f=!1;if(r){var h=o||n.tr;if(a){var m=n.storedMarks||a.marks();if(t.isInSet(m)){var v=on(m,e),g=m.find((function(t){return"style"===t.type.name})),y=Be.__assign({},g?g.attrs:{},{style:v.style||null});if(u=g.attrs,l=y,d=Object.keys(u),p=Object.keys(l),d.length===p.length&&d.every((function(t){return u[t]===l[t]})))return!1;r(h.removeStoredMark(t)),Object.keys(y).some((function(t){return null!==y[t]}))&&r(h.addStoredMark(t.create(y))),f=!0}}else{for(var b=0;b<c.length;b++){var w=c[b],_=w.$from,x=w.$to;f=sn(h,_.pos,x.pos,e,t)}f&&(h.scrollIntoView(),r(h))}}return f}},un=function(t,e,n){return function(r,o){var i=r.schema.marks,s=t.altStyle,a=t.altMarks,c=void 0===a?[]:a,u=t.mark,l=e||r.tr,d=!1,p=!1,f=function(){return p=!0};s&&i.style&&(d=cn(i.style,{style:s.name,value:s.value})(r,f,l));var h=[u].concat(c).filter((function(t){return i[t]})).map((function(t){return Qe(r,{mark:t})&&i[t]})).filter((function(t){return t}));return h.length?function(t,e,n,r){var o=e.selection,i=o.$cursor,s=o.ranges;if(r=r||e.tr,i)t.forEach((function(t){t.isInSet(e.storedMarks||i.marks())&&n(r.removeStoredMark(t))}));else{for(var a=function(e){var n=s[e],o=n.$from,i=n.$to;t.forEach((function(t){Ye(r,o.pos,i.pos,t)}))},c=0;c<s.length;c++)a(c);n(r.scrollIntoView())}}(h,r,f,l):d||Ge(i[u],n,l)(r,f),p&&o(l),p}},ln=function(t,e){return function(n,r){var o=n.schema.marks.style,i={style:t.style,value:/^.+$/,newValue:t.value},s=n.tr;e&&s.setMeta("commandName",e),s.setMeta("args",t);var a=n.selection,c=a.empty,u=a.$cursor,l=a.ranges;if(c&&!u||!o||!Ue(n.doc,l,o))return!1;if(u){var d=n.storedMarks||u.marks(),p=o.isInSet(d)?d.find((function(t){return"style"===t.type.name})):null,f={style:null};if(p&&p.attrs.style){var h=ze(p.attrs.style,i);h.changed&&h.style&&(f.style=h.style)}else i.newValue&&(f.style=[i.style]+": "+i.newValue+";");var m=p?Be.__assign({},p.attrs,f):f;return Object.keys(m).some((function(t){return null!==m[t]}))?r(s.addStoredMark(o.create(m))):r(s.removeStoredMark(o)),!0}return cn(o,i)(n,r,s)}},dn=function(t,e){return function(n,r){var o=n.selection.$cursor;if(o){var i=o.parent,s=o.index(),a=n.schema.marks[t.mark],c=i.child(s).marks.find((function(t){return t.type===a})),u=i.childCount,l=o.pos-o.textOffset,d=i.child(s).nodeSize,p=void 0,f=void 0;for(p=s-1;p>=0&&c.isInSet(i.child(p).marks);)d+=f=i.child(p).nodeSize,l-=f,p-=1;for(p=s+1;p<u&&c.isInSet(i.child(p).marks);)d+=i.child(p).nodeSize,p+=1;r(Ye(e||n.tr,l,l+d,c))}else un(t,e)(n,r)}},pn=function(t,e){var n=t.mark,r=t.attrs;return void 0===e&&(e="link"),function(t,o){var i=t.schema.marks,s=t.tr;e&&(s.setMeta("commandName",e),s.setMeta("args",r));var a=!1,c=function(){return a=!0};if(function(t,e){var n=en(t,e);return 1===n.length&&n[0]?n[0]:null}(t,i[n]))!function(t,e){return function(n,r){var o=n.selection,i=o.$cursor,s=o.from,a=o.to,c=n.schema.marks[t.mark];if(i){var u=i.parent,l=i.index(),d=u.child(l).marks.find((function(t){return t.type===c})),p=u.childCount,f=i.pos-i.textOffset,h=u.child(l).nodeSize,m=void 0,v=void 0;for(m=l-1;m>=0&&d.isInSet(u.child(m).marks);)h+=v=u.child(m).nodeSize,f-=v,m-=1;for(m=l+1;m<p&&d.isInSet(u.child(m).marks);)h+=u.child(m).nodeSize,m+=1;e.removeMark(f,f+h,c),e.addMark(f,f+h,c.create(t.attrs)),r(e)}else e.doc.nodesBetween(s,a,(function(n,o){n.isInline&&c.isInSet(n.marks)&&(e.removeMark(o,o+n.nodeSize,c),e.addMark(o,o+n.nodeSize,c.create(t.attrs)),r(e))}))}}({mark:n,attrs:r},s)(t,c);else{var u=t;Qe(t,{mark:n})&&(dn({mark:n,attrs:r},s)(t,c),u=ve.create({doc:s.doc,selection:s.selection})),a?Ge(i[n],r,s)(u,c):un({mark:n},s,r)(u,c)}return a&&o(s),a}},fn=function(t){return function(e,n){n(e.tr.insertText(t.text,t.from,t.to))}},hn=function(t){return function(e,n){var r=e.schema.nodes.image,o=r.createAndFill(t);Le(o)(e,(function(e){return n(e.setMeta("commandName","insertImage").setMeta("args",t))}))}},mn=function(t,e,n,r){if(!n.isTextblock)return!1;t.selection.ranges.forEach((function(o){var s=t.steps.length,a=o.$from.pos,c=o.$to.pos;t.doc.nodesBetween(a,c,(function(o,a){if(o.eq(e)&&o.isTextblock&&!o.hasMarkup(n,r)&&function(t,e,n){var r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(t.doc,t.mapping.slice(s).map(a),n)){t.clearIncompatible(t.mapping.slice(s).map(a,1),n);var c=t.mapping.slice(s),u=c.map(a,1),l=c.map(a+o.nodeSize,1),d=new p(i.from(n.create(r,null,o.marks)),0,0);return t.step(new Et(u,l,u+1,l-1,d,1,!0)),!1}}))}))},vn=function(t,e){void 0===e&&(e={blocksInSelection:!1});var n=t.doc,r=t.selection,o=r.$from,i=r.ranges,s=e.blocksInSelection,a=[],c=r instanceof ie?r.node:void 0;return c?c.isBlock?(a.push(c),c.nodesBetween(0,c.content.size,(function(t){t.isBlock&&a.push(t)}))):!s&&o.parent&&o.parent.isBlock&&a.push(o.parent):i.forEach((function(t){var e=t.$from.pos,r=t.$to.pos;n.nodesBetween(e,r,(function(t,n,o,i){t.isBlock&&(!s||n>=e&&n+t.content.size+2<=r)&&a.push(t)}))})),a},gn=function(t,e){return function(n,r){var o=vn(n),i=n.schema.nodes,s=n.tr;s.setMeta("commandName",e),s.setMeta("args",{value:t}),o.forEach((function(e){if(e.type.isTextblock)if("p"===t){var n=e.attrs,r=n.level,o=Be.__rest(n,["level"]);mn(s,e,i.paragraph,o)}else if(/^h[1-6]$/i.test(t)){r=parseInt(t.substr(1),10);mn(s,e,i.heading,Be.__assign({},e.attrs,{level:r}))}else if("blockquote"===t){var a=e.attrs;r=a.level,o=Be.__rest(a,["level"]);mn(s,e,i.blockquote,o)}}));var a=s.docChanged;return a&&r(s.scrollIntoView()),a}},yn=function(t,e){void 0===e&&(e={blocksInSelection:!0});var n=t.doc,r=t.selection,o=e.blocksInSelection,i=e.blockNodeType;vn({doc:n,selection:r},{blocksInSelection:o}).filter((function(t){return t.isTextblock})).forEach((function(e){var n=e.attrs||{},r=n.style,o=void 0===r?"":r,s=n.class,a=void 0===s?"":s,c=Be.__rest(n,["style","class"]),u=i||e.type;(o||a||u!==e.type)&&mn(t,e,u,c)}))},bn=function(t){var e=vn(t),n=t.schema.nodes,r=[];return e.forEach((function(t){t.type===n.paragraph?r.push("p"):t.type===n.heading?r.push("h"+t.attrs.level):t.type===n.blockquote&&n.blockquote.isTextblock&&r.push("blockquote")})),r},wn=function(t,e){var n,r,o=t.attrs.style;o&&e.forEach((function(t){r={style:t.name,value:/^.+$/,newValue:t.value},n=ze(o,r),o=n.changed?n.style:o}));return o=o||e.reduce((function(t,e){return(t&&e.value?t+" ":"")+e.value?e.name+": "+e.value+";":""}),""),Object.assign({},t.attrs,{style:o||null})},_n=function(t,e){var n=t.selection,r=n.from,o=n.to,i=!1;return t.doc.nodesBetween(r,o,(function(t){return!(i=i||t.type===e)})),i},xn=function(t){var e=bn(t);return 1===new Set(e).size?e[0]:null},kn=function(t){return{tag:xn(t)||""}},Cn=function(t,e){return function(n,r){var o=vn(n),i=n.tr;i.setMeta("commandName",e),o.forEach((function(e){if(e.type.isTextblock){var n={},r=t.find((function(t){return t.node===e.type.name}));r&&(n=wn(e,r.style)),mn(i,e,e.type,n)}}));var s=i.docChanged;return s&&r(i.scrollIntoView()),s}},Sn=function(t,e){var n=vn(t),r=!1;return n.forEach((function(t){if(!r&&t.type.isTextblock&&t.attrs.style){var n=e.find((function(e){return e.node===t.type.name}));n&&(r=n.style.every((function(e){return!!e.value&&new RegExp(e.name+":\\s?"+e.value,"i").test(t.attrs.style)})))}})),r},Tn=function(t){return void 0===t&&(t={blocksInSelection:!0}),function(e,n){var r=e.tr,o=t.blocksInSelection,i=t.blockNodeType,s=(t.exceptMarks||[e.schema.marks.link]).filter(Boolean);Ze(r,{except:s}),yn(r,{blocksInSelection:o,blockNodeType:i});var a=r.docChanged;return a&&n&&n(r),a}},En=["ol",0],Mn=["ul",0],On=["li",0],Dn={attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:function(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1}}}],toDOM:function(t){return 1==t.attrs.order?En:["ol",{start:t.attrs.order},0]}},In={parseDOM:[{tag:"ul"}],toDOM:function(){return Mn}},An={parseDOM:[{tag:"li"}],toDOM:function(){return On},defining:!0};function Nn(t,e){var n={};for(var r in t)n[r]=t[r];for(var o in e)n[o]=e[o];return n}function Bn(t,e,n){return t.append({ordered_list:Nn(Dn,{content:"list_item+",group:n}),bullet_list:Nn(In,{content:"list_item+",group:n}),list_item:Nn(An,{content:e})})}function zn(t,e){return function(n,r){var o=n.selection,s=o.$from,a=o.$to,c=s.blockRange(a),u=!1,l=c;if(!c)return!1;if(c.depth>=2&&s.node(c.depth-1).type.compatibleContent(t)&&0==c.startIndex){if(0==s.index(c.depth-1))return!1;var d=n.doc.resolve(c.start-2);l=new T(d,d,c.depth),c.endIndex<c.parent.childCount&&(c=new T(s,n.doc.resolve(a.end(c.depth)),c.depth)),u=!0}var f=It(l,t,e,c);return!!f&&(r&&r(function(t,e,n,r,o){for(var s=i.empty,a=n.length-1;a>=0;a--)s=i.from(n[a].type.create(n[a].attrs,s));t.step(new Et(e.start-(r?2:0),e.end,e.start,e.end,new p(s,0,0),n.length,!0));for(var c=0,u=0;u<n.length;u++)n[u].type==o&&(c=u+1);for(var l=n.length-c,d=e.start+n.length-(r?2:0),f=e.parent,h=e.startIndex,m=e.endIndex,v=!0;h<m;h++,v=!1)!v&&Nt(t.doc,d,l)&&(t.split(d,l),d+=2*l),d+=f.child(h).nodeSize;return t}(n.tr,c,f,u,t).scrollIntoView()),!0)}}function Pn(t){return function(e,n){var r=e.selection,o=r.$from,s=r.$to,a=r.node;if(a&&a.isBlock||o.depth<2||!o.sameParent(s))return!1;var c=o.node(-1);if(c.type!=t)return!1;if(0==o.parent.content.size&&o.node(-1).childCount==o.indexAfter(-1)){if(2==o.depth||o.node(-3).type!=t||o.index(-2)!=o.node(-2).childCount-1)return!1;if(n){for(var u=i.empty,l=o.index(-1)?1:o.index(-2)?2:3,d=o.depth-l;d>=o.depth-3;d--)u=i.from(o.node(d).copy(u));var f=o.indexAfter(-1)<o.node(-2).childCount?1:o.indexAfter(-2)<o.node(-3).childCount?2:3;u=u.append(i.from(t.createAndFill()));var h=o.before(o.depth-(l-1)),m=e.tr.replace(h,o.after(-f),new p(u,4-l,0)),v=-1;m.doc.nodesBetween(h,m.doc.content.size,(function(t,e){if(v>-1)return!1;t.isTextblock&&0==t.content.size&&(v=e+1)})),v>-1&&m.setSelection(e.selection.constructor.near(m.doc.resolve(v))),n(m.scrollIntoView())}return!0}var g=s.pos==o.end()?c.contentMatchAt(0).defaultType:null,y=e.tr.delete(o.pos,s.pos),b=g&&[null,{type:g}];return!!Nt(y.doc,o.pos,2,b)&&(n&&n(y.split(o.pos,2,b).scrollIntoView()),!0)}}function Rn(t){return function(e,n){var r=e.selection,o=r.$from,s=r.$to,a=o.blockRange(s,(function(e){return e.childCount&&e.firstChild.type==t}));return!!a&&(!n||(o.node(a.depth-1).type==t?function(t,e,n,r){var o=t.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(o.step(new Et(s-1,a,s,a,new p(i.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new T(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));return e(o.lift(r,Dt(r)).scrollIntoView()),!0}(e,n,t,a):function(t,e,n){for(var r=t.tr,o=n.parent,s=n.end,a=n.endIndex-1,c=n.startIndex;a>c;a--)s-=o.child(a).nodeSize,r.delete(s-1,s+1);var u=r.doc.resolve(n.start),l=u.nodeAfter;if(r.mapping.map(n.end)!=n.start+u.nodeAfter.nodeSize)return!1;var d=0==n.startIndex,f=n.endIndex==o.childCount,h=u.node(-1),m=u.index(-1);if(!h.canReplace(m+(d?0:1),m+1,l.content.append(f?i.empty:i.from(o))))return!1;var v=u.pos,g=v+l.nodeSize;return r.step(new Et(v-(d?1:0),g+(f?1:0),v+1,g-1,new p((d?i.empty:i.from(o.copy(i.empty))).append(f?i.empty:i.from(o.copy(i.empty))),d?0:1,f?0:1),d?0:1)),e(r.scrollIntoView()),!0}(e,n,a)))}}function Fn(t){return function(e,n){var r=e.selection,o=r.$from,s=r.$to,a=o.blockRange(s,(function(e){return e.childCount&&e.firstChild.type==t}));if(!a)return!1;var c=a.startIndex;if(0==c)return!1;var u=a.parent,l=u.child(c-1);if(l.type!=t)return!1;if(n){var d=l.lastChild&&l.lastChild.type==u.type,f=i.from(d?t.create():null),h=new p(i.from(t.create(null,i.from(u.type.create(null,f)))),d?3:1,0),m=a.start,v=a.end;n(e.tr.step(new Et(m-(d?3:1),v,m,v,h,1,!0)).scrollIntoView())}return!0}}var Ln={orderedList:"ordered_list",bulletList:"bullet_list",listItem:"list_item"},Vn={listType:Ln.orderedList,types:Be.__assign({},Ln)},jn={listType:Ln.bulletList,types:Be.__assign({},Ln)},$n={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"}],listsTypes:Be.__assign({},Ln)},Wn={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"}],listsTypes:Be.__assign({},Ln)};function Hn(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function qn(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("backward",t):r.parentOffset>0))return!1;var o=Un(r);if(!o){var i=r.blockRange(),s=i&&Dt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}var a=o.nodeBefore;if(!a.type.spec.isolating&&lr(t,o,e))return!0;if(0==r.parent.content.size&&(Jn(a,"end")||ie.isSelectable(a))){var c=$t(t.doc,r.before(),r.after(),p.empty);if(c.slice.size<c.to-c.from){if(e){var u=t.tr.step(c);u.setSelection(Jn(a,"end")?te.findFrom(u.doc.resolve(u.mapping.map(o.pos,-1)),-1):ie.create(u.doc,o.pos-a.nodeSize)),e(u.scrollIntoView())}return!0}}return!(!a.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos-a.nodeSize,o.pos).scrollIntoView()),!0)}function Jn(t,e,n){for(;t;t="start"==e?t.firstChild:t.lastChild){if(t.isTextblock)return!0;if(n&&1!=t.childCount)return!1}return!1}function Kn(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=Un(o)}var s=i&&i.nodeBefore;return!(!s||!ie.isSelectable(s))&&(e&&e(t.tr.setSelection(ie.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)}function Un(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Gn(t,e,n){var r=t.selection.$cursor;if(!r||(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return!1;var o=Xn(r);if(!o)return!1;var i=o.nodeAfter;if(lr(t,o,e))return!0;if(0==r.parent.content.size&&(Jn(i,"start")||ie.isSelectable(i))){var s=$t(t.doc,r.before(),r.after(),p.empty);if(s.slice.size<s.to-s.from){if(e){var a=t.tr.step(s);a.setSelection(Jn(i,"start")?te.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):ie.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1)&&(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)}function Yn(t,e,n){var r=t.selection,o=r.$head,i=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=Xn(o)}var s=i&&i.nodeAfter;return!(!s||!ie.isSelectable(s))&&(e&&e(t.tr.setSelection(ie.create(t.doc,i.pos)).scrollIntoView()),!0)}function Xn(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){var n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function Zn(t,e){var n,r=t.selection,o=r instanceof ie;if(o){if(r.node.isTextblock||!Bt(t.doc,r.from))return!1;n=r.from}else if(null==(n=Pt(t.doc,r.from,-1)))return!1;if(e){var i=t.tr.join(n);o&&i.setSelection(ie.create(i.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0}function Qn(t,e){var n,r=t.selection;if(r instanceof ie){if(r.node.isTextblock||!Bt(t.doc,r.to))return!1;n=r.to}else if(null==(n=Pt(t.doc,r.to,1)))return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0}function tr(t,e){var n=t.selection,r=n.$from,o=n.$to,i=r.blockRange(o),s=i&&Dt(i);return null!=s&&(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)}function er(t,e){var n=t.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}function nr(t){for(var e=0;e<t.edgeCount;e++){var n=t.edge(e).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function rr(t,e){var n=t.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var i=r.node(-1),s=r.indexAfter(-1),a=nr(i.contentMatchAt(s));if(!i.canReplaceWith(s,s,a))return!1;if(e){var c=r.after(),u=t.tr.replaceWith(c,c,a.createAndFill());u.setSelection(te.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0}function or(t,e){var n=t.selection,r=n.$from,o=n.$to;if(n instanceof ae||r.parent.inlineContent||o.parent.inlineContent)return!1;var i=nr(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){var s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(re.create(a.doc,s+1)),e(a.scrollIntoView())}return!0}function ir(t,e){var n=t.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var r=n.before();if(Nt(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}var o=n.blockRange(),i=o&&Dt(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)}function sr(t,e){var n=t.selection,r=n.$from,o=n.$to;if(t.selection instanceof ie&&t.selection.node.isBlock)return!(!r.parentOffset||!Nt(t.doc,r.pos))&&(e&&e(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(e){var i=o.parentOffset==o.parent.content.size,s=t.tr;(t.selection instanceof re||t.selection instanceof ae)&&s.deleteSelection();var a=0==r.depth?null:nr(r.node(-1).contentMatchAt(r.indexAfter(-1))),c=i&&a?[{type:a}]:null,u=Nt(s.doc,s.mapping.map(r.pos),1,c);if(c||u||!Nt(s.doc,s.mapping.map(r.pos),1,a&&[{type:a}])||(c=[{type:a}],u=!0),u&&(s.split(s.mapping.map(r.pos),1,c),!i&&!r.parentOffset&&r.parent.type!=a)){var l=s.mapping.map(r.before()),d=s.doc.resolve(l);r.node(-1).canReplaceWith(d.index(),d.index()+1,a)&&s.setNodeMarkup(s.mapping.map(r.before()),a)}e(s.scrollIntoView())}return!0}function ar(t,e){return sr(t,e&&function(n){var r=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();r&&n.ensureMarks(r),e(n)})}function cr(t,e){var n,r=t.selection,o=r.$from,i=r.to,s=o.sharedDepth(i);return 0!=s&&(n=o.before(s),e&&e(t.tr.setSelection(ie.create(t.doc,n))),!0)}function ur(t,e){return e&&e(t.tr.setSelection(new ae(t.doc))),!0}function lr(t,e,n){var r,o,s=e.nodeBefore,a=e.nodeAfter;if(s.type.spec.isolating||a.type.spec.isolating)return!1;if(function(t,e,n){var r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!!(r&&o&&r.type.compatibleContent(o.type))&&(!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!(!e.parent.canReplace(i,i+1)||!o.isTextblock&&!Bt(t.doc,e.pos))&&(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0))}(t,e,n))return!0;var c=e.parent.canReplace(e.index(),e.index()+1);if(c&&(r=(o=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&o.matchType(r[0]||a.type).validEnd){if(n){for(var u=e.pos+a.nodeSize,l=i.empty,d=r.length-1;d>=0;d--)l=i.from(r[d].create(null,l));l=i.from(s.copy(l));var f=t.tr.step(new Et(e.pos-1,u,e.pos,u,new p(l,1,0),r.length,!0)),h=u+2*r.length;Bt(f.doc,h)&&f.join(h),n(f.scrollIntoView())}return!0}var m=te.findFrom(e,1),v=m&&m.$from.blockRange(m.$to),g=v&&Dt(v);if(null!=g&&g>=e.depth)return n&&n(t.tr.lift(v,g).scrollIntoView()),!0;if(c&&Jn(a,"start",!0)&&Jn(s,"end")){for(var y=s,b=[];b.push(y),!y.isTextblock;)y=y.lastChild;for(var w=a,_=1;!w.isTextblock;w=w.firstChild)_++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){for(var x=i.empty,k=b.length-1;k>=0;k--)x=i.from(b[k].copy(x));n(t.tr.step(new Et(e.pos-b.length,e.pos+a.nodeSize,e.pos+_,e.pos+a.nodeSize-_,new p(x,b.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function dr(t){return function(e,n){for(var r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(e.tr.setSelection(re.create(e.doc,t<0?o.start(i):o.end(i)))),!0)}}var pr=dr(-1),fr=dr(1);function hr(t,e){return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s),c=a&&It(a,t,e);return!!c&&(r&&r(n.tr.wrap(a,c).scrollIntoView()),!0)}}function mr(t,e){return function(n,r){var o=n.selection,i=o.from,s=o.to,a=!1;return n.doc.nodesBetween(i,s,(function(r,o){if(a)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)a=!0;else{var i=n.doc.resolve(o),s=i.index();a=i.parent.canReplaceWith(s,s+1,t)}})),!!a&&(r&&r(n.tr.setBlockType(i,s,t,e).scrollIntoView()),!0)}}function vr(t,e){return function(n,r){var o=n.selection,i=o.empty,s=o.$cursor,a=o.ranges;if(i&&!s||!function(t,e,n){for(var r=function(r){var o=e[r],i=o.$from,s=o.$to,a=0==i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,s.pos,(function(t){if(a)return!1;a=t.inlineContent&&t.type.allowsMarkType(n)})),a)return{v:!0}},o=0;o<e.length;o++){var i=r(o);if(i)return i.v}return!1}(n.doc,a,t))return!1;if(r)if(s)t.isInSet(n.storedMarks||s.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{for(var c=!1,u=n.tr,l=0;!c&&l<a.length;l++){var d=a[l],p=d.$from,f=d.$to;c=n.doc.rangeHasMark(p.pos,f.pos,t)}for(var h=0;h<a.length;h++){var m=a[h],v=m.$from,g=m.$to;if(c)u.removeMark(v.pos,g.pos,t);else{var y=v.pos,b=g.pos,w=v.nodeAfter,_=g.nodeBefore,x=w&&w.isText?/^\s*/.exec(w.text)[0].length:0,k=_&&_.isText?/\s*$/.exec(_.text)[0].length:0;y+x<b&&(y+=x,b-=k),u.addMark(y,b,t.create(e))}}r(u.scrollIntoView())}return!0}}function gr(t,e){if(Array.isArray(e)){var n=e;e=function(t){return n.indexOf(t.type.name)>-1}}return function(n,r,o){return t(n,r&&function(t,e){return function(n){if(!n.isGeneric)return t(n);for(var r=[],o=0;o<n.mapping.maps.length;o++){for(var i=n.mapping.maps[o],s=0;s<r.length;s++)r[s]=i.map(r[s]);i.forEach((function(t,e,n,o){return r.push(n,o)}))}for(var a=[],c=0;c<r.length;c+=2)for(var u=r[c],l=r[c+1],d=n.doc.resolve(u),p=d.sharedDepth(l),f=d.node(p),h=d.indexAfter(p),m=d.after(p+1);m<=l;++h){var v=f.maybeChild(h);if(!v)break;if(h&&-1==a.indexOf(m)){var g=f.child(h-1);g.type==v.type&&e(g,v)&&a.push(m)}m+=v.nodeSize}a.sort((function(t,e){return t-e}));for(var y=a.length-1;y>=0;y--)Bt(n.doc,a[y])&&n.join(a[y]);t(n)}}(r,e),o)}}function yr(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e,n,r){for(var o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var br=yr(Hn,qn,Kn),wr=yr(Hn,Gn,Yn),_r={Enter:yr(er,or,ir,sr),"Mod-Enter":rr,Backspace:br,"Mod-Backspace":br,"Shift-Backspace":br,Delete:wr,"Mod-Delete":wr,"Mod-a":ur},xr={"Ctrl-h":_r.Backspace,"Alt-Backspace":_r["Mod-Backspace"],"Ctrl-d":_r.Delete,"Ctrl-Alt-Backspace":_r["Mod-Delete"],"Alt-Delete":_r["Mod-Delete"],"Alt-d":_r["Mod-Delete"],"Ctrl-a":pr,"Ctrl-e":fr};for(var kr in _r)xr[kr]=_r[kr];_r.Home=pr,_r.End=fr;var Cr=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?xr:_r,Sr=function(t,e){return hr(t.schema.nodes.blockquote)(t,e)},Tr=function(t,e){var n=t.selection,r=n.$from,o=n.$to,i=t.schema.nodes.blockquote,s=t.doc,a=-1,c=r.blockRange(o);c&&s.nodesBetween(c.start,c.end,(function(t,e,n,r){t.type===i&&(a=e)}));var u=-1!==a;return e&&u&&e(t.tr.lift(c,s.resolve(a).depth)),u},Er=function(t,e,n){return function(r,o){var i=vn(r),s=r.tr;s.setMeta("commandName",e),i.forEach((function(e){if(e.type.isTextblock){var r=void 0,o=t.find((function(t){return t.node===e.type.name}));if(o){var i="rtl"===n?o.rtlStyle:o.style,a={name:i,value:o.step>0?""+o.step+o.unit:""};if(e.attrs.style){var c=new RegExp(i+":\\s?(\\d+)"+o.unit,"i"),u=e.attrs.style.match(c);if(u){var l=parseFloat(u[1])+o.step;l=l<=0?"":l,a.value=""+l+(l?o.unit:"")}}r=wn(e,[a])}r&&mn(s,e,e.type,r)}}));var a=s.docChanged;return a&&o(s.scrollIntoView()),a}},Mr=function(t,e,n){var r=vn(t),o=!1;return r.forEach((function(t){if(!o&&t.type.isTextblock&&t.attrs.style){var r=e.find((function(e){return e.node===t.type.name}));if(r){var i="rtl"===n?r.rtlStyle:r.style,s=new RegExp(i+":\\s?\\d+"+r.unit,"i");o=s.test(t.attrs.style)}}})),o},Or=function(t,e){return Fn(e)(t)},Dr=function(t,e){var n=t.schema.nodes[e.listsTypes.listItem],r=t.schema.nodes[e.listsTypes.orderedList],o=t.schema.nodes[e.listsTypes.bulletList],i=!!Fe(r,2)(t.selection),s=!!Fe(o,2)(t.selection);return(i||s)&&Rn(n)(t)},Ir=function(t,e){var n=t.schema.nodes,r=n[$n.listsTypes.listItem];return(Mr(t,e.nodes)||$n.nodes.some((function(e){return n[e.node]&&_n(t,n[e.node])})))&&!_n(t,r)},Ar=function(t,e){var n=t.schema.nodes[$n.listsTypes.listItem],r=Ir(t,$n);Or(t,n)?Fn(n)(t,e):r&&Er($n.nodes)(t,e)},Nr=function(t,e){var n=t.schema.nodes,r=n[Wn.listsTypes.listItem],o=Ir(t,Wn);_n(t,n.blockquote)?Tr(t,e):Dr(t,Wn)?Rn(r)(t,e):o&&Er(Wn.nodes)(t,e)},Br=function(t,e,n){for(var r=e.depth,o=t.nodes[n.bulletList],i=t.nodes[n.orderedList],s=t.nodes[n.listItem],a=e.depth;a>0;a--){var c=e.node(a);if(c.type!==o&&c.type!==i||(r=a),c.type!==o&&c.type!==i&&c.type!==s)break}return r-1};function zr(t){return function(e,n,r){if(!r)return!1;var o=(e=r.state).schema.nodes[t.listType],i=e.selection,s=i.$from,a=i.$to,c=s.node(-2),u=s.node(-3),l=function(t,e,n,r){return 0===function(t,e,n){var r=Array(),o=function(t,e){var n=["blockquote","bulletList","orderedList"];if(1===e.depth)return e;var r=e.node(e.depth),o=e;for(;e.depth>=1;)e=t.resolve(e.before(e.depth)),(r=e.node(e.depth))&&-1!==n.indexOf(r.type.name)&&(o=e);return o}(t,e).depth,i=t.resolve(e.start(o));for(;i.pos<=n.start(n.depth);){var s=Math.min(i.depth,o),a=i.node(s);if(a&&r.push(a),0===s)break;var c=t.resolve(i.after(s));if(c.start(s)>=t.nodeSize-2)break;c.depth!==i.depth&&(c=t.resolve(c.pos+2)),i=c.depth?t.resolve(c.start(c.depth)):t.resolve(c.end(c.depth))}return r}(t,e,n).filter((function(t){return t.type!==r})).length}(e.doc,s,a,o);return(c&&c.type===o||u&&u.type===o)&&l?Rr(t)(e,n):(l||(Rr(t)(e,n),e=r.state),function(t,e){void 0===e&&(e={});return gr(zn(t,e),(function(e,n){return e.type===n.type&&e.type===t}))}(o,t.listAttrs)(e,n))}}function Pr(t,e,n,r){var o=r||t.schema.nodes.listItem,s=e.$from,a=e.$to,c=s.blockRange(a,(function(t){return t.childCount&&t.firstChild.type===o}));if(!c||c.depth<2||s.node(c.depth-1).type!==o)return n;var u=c.end,l=a.end(c.depth);return u<l&&(n.step(new Et(u-1,l,u,l,new p(i.from(o.create(void 0,c.parent.copy())),1,0),1,!0)),c=new T(n.doc.resolve(s.pos),n.doc.resolve(l),c.depth)),n.lift(c,Dt(c)).scrollIntoView()}function Rr(t){return function(e,n){var r=e.tr,o=e.selection,i=o.$from,s=o.$to;return r.doc.nodesBetween(i.pos,s.pos,(function(n,o){if(n.isTextblock||"blockquote"===n.type.name||"div"===n.type.name){var i=new ie(r.doc.resolve(r.mapping.map(o))),s=i.$from.blockRange(i.$to);if(!s||i.$from.parent.type!==e.schema.nodes[t.listItem])return!1;var a=s&&Dt(s);if(null==a)return!1;r.lift(s,a)}})),n&&n(r),!0}}var Fr=/list\-style\-type:\s?([\w-]+)/,Lr=function(t){var e=t.style||"",n=Fr.exec(e);return n&&n[1]||""},Vr=function(t,e,n,r,o){var i=r.listType,s=r.listAttrs,a=void 0===s?{style:null}:s,c=t.selection,u=c.$from.node(c.$from.depth-2),l=c.$to.node(c.$to.depth-2);if(u&&u.type.name===i&&Lr(u.attrs)===Lr(a)&&l&&l.type.name===i&&Lr(l.attrs)===Lr(a)){var d=n.state.schema.nodes,p={bulletList:d[r.bulletList],orderedList:d[r.orderedList],listItem:d[r.listItem]},f=function(t,e){for(var n,r=e.bulletList,o=e.orderedList,i=e.listItem,s=t.depth-1;s>0;s--){var a=t.node(s);if(a.type!==r&&a.type!==o||(n=s),a.type!==r&&a.type!==o&&a.type!==i)break}return n}(c.$to,p),h=function(t,e,n,r,o,i){i||(i=t.schema.nodes.listItem);var s=!1;return o.doc.nodesBetween(e,n,(function(n,a){if(!s&&n.type===i&&a>e){s=!0;for(var c=r+3;c>r+2;){var u=o.doc.resolve(o.mapping.map(a));c=u.depth;var l=o.doc.resolve(o.mapping.map(a+n.textContent.length)),d=new re(u,l);o=Pr(t,d,o,i)}}})),o}(t,c.$to.pos,c.$to.end(f),f,n.state.tr,p.listItem);return(h=function(t,e,n){var r=t.selection,o=r.from,i=r.to,s=t.schema.nodes,a=s.paragraph,c=s.heading,u=[];e.doc.nodesBetween(o,i,(function(t,e){t.type!==a&&t.type!==c||u.push({node:t,pos:e})}));for(var l=u.length-1;l>=0;l--){var d=u[l],p=e.doc.resolve(e.mapping.map(d.pos));if(p.depth>0){var f=void 0;f=d.node.textContent&&d.node.textContent.length>0?e.doc.resolve(e.mapping.map(d.pos+d.node.textContent.length)):e.doc.resolve(e.mapping.map(d.pos+1));var h=p.blockRange(f);h&&e.lift(h,Br(t.schema,p,n))}}return e}(t,h,r)).setMeta("commandName",o),e(h),!0}return zr(r)(t,e,n)};function jr(t,e,n){return Vr(t,e,n,Be.__assign({listType:jn.listType},jn.types))}function $r(t,e,n){return Vr(t,e,n,Be.__assign({listType:Vn.listType},Vn.types))}for(var Wr=function(t,e){return{name:t,value:e}},Hr=[{node:"paragraph",style:[Wr("text-align","left")]},{node:"heading",style:[Wr("text-align","left")]}],qr=[{node:"paragraph",style:[Wr("text-align","right")]},{node:"heading",style:[Wr("text-align","right")]}],Jr=[{node:"paragraph",style:[Wr("text-align","center")]},{node:"heading",style:[Wr("text-align","center")]}],Kr=[{node:"paragraph",style:[Wr("text-align","justify")]},{node:"heading",style:[Wr("text-align","justify")]}],Ur=[{node:"paragraph",style:[Wr("text-align","")]},{node:"heading",style:[Wr("text-align","")]}],Gr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},Yr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},Xr="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Zr="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),Qr="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),to="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),eo="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),no=Xr&&(to||+Xr[1]<57)||Qr&&to,ro=0;ro<10;ro++)Gr[48+ro]=Gr[96+ro]=String(ro);for(ro=1;ro<=24;ro++)Gr[ro+111]="F"+ro;for(ro=65;ro<=90;ro++)Gr[ro]=String.fromCharCode(ro+32),Yr[ro]=String.fromCharCode(ro);for(var oo in Gr)Yr.hasOwnProperty(oo)||(Yr[oo]=Gr[oo]);var io="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function so(t){var e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(var a=0;a<i.length-1;a++){var c=i[a];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))e=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);io?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function ao(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}function co(t){return new be({props:{handleKeyDown:uo(t)}})}function uo(t){var e=function(t){var e=Object.create(null);for(var n in t)e[so(n)]=t[n];return e}(t);return function(t,n){var r,o=function(t){var e=!(no&&(t.ctrlKey||t.altKey||t.metaKey)||(Zr||eo)&&t.shiftKey&&t.key&&1==t.key.length)&&t.key||(t.shiftKey?Yr:Gr)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(n),i=1==o.length&&" "!=o,s=e[ao(o,n,!i)];if(s&&s(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey||o.charCodeAt(0)>127)&&(r=Gr[n.keyCode])&&r!=o){var a=e[ao(r,n,!0)];if(a&&a(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var c=e[ao(o,n,!0)];if(c&&c(t.state,t.dispatch,t))return!0}return!1}}var lo={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var po=/Edge\/(\d+)/.exec(navigator.userAgent),fo=/MSIE \d/.test(navigator.userAgent),ho=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),mo=lo.ie=!!(fo||ho||po);lo.ie_version=fo?document.documentMode||6:ho?+ho[1]:po?+po[1]:null,lo.gecko=!mo&&/gecko\/(\d+)/i.test(navigator.userAgent),lo.gecko_version=lo.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var vo=!mo&&/Chrome\/(\d+)/.exec(navigator.userAgent);lo.chrome=!!vo,lo.chrome_version=vo&&+vo[1],lo.safari=!mo&&/Apple Computer/.test(navigator.vendor),lo.ios=lo.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),lo.mac=lo.ios||/Mac/.test(navigator.platform),lo.android=/Android \d/.test(navigator.userAgent),lo.webkit="webkitFontSmoothing"in document.documentElement.style,lo.webkit_version=lo.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var go=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},yo=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},bo=null,wo=function(t,e,n){var r=bo||(bo=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},_o=function(t,e,n,r){return n&&(ko(t,e,n,r,-1)||ko(t,e,n,r,1))},xo=/^(img|br|input|textarea|hr)$/i;function ko(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Co(t))){var i=t.parentNode;if(1!=i.nodeType||So(t)||xo.test(t.nodeName)||"false"==t.contentEditable)return!1;e=go(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(o<0?-1:0)]).contentEditable)return!1;e=o<0?Co(t):0}}}function Co(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function So(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var To=function(t){var e=t.isCollapsed;return e&&lo.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function Eo(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Mo(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Oo(t,e){return"number"==typeof t?t:t[e]}function Do(t){var e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Io(t,e,n){for(var r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,s=n||t.dom;s;s=yo(s))if(1==s.nodeType){var a=s==i.body||1!=s.nodeType,c=a?Mo(i):Do(s),u=0,l=0;if(e.top<c.top+Oo(r,"top")?l=-(c.top-e.top+Oo(o,"top")):e.bottom>c.bottom-Oo(r,"bottom")&&(l=e.bottom-c.bottom+Oo(o,"bottom")),e.left<c.left+Oo(r,"left")?u=-(c.left-e.left+Oo(o,"left")):e.right>c.right-Oo(r,"right")&&(u=e.right-c.right+Oo(o,"right")),u||l)if(a)i.defaultView.scrollBy(u,l);else{var d=s.scrollLeft,p=s.scrollTop;l&&(s.scrollTop+=l),u&&(s.scrollLeft+=u);var f=s.scrollLeft-d,h=s.scrollTop-p;e={left:e.left-f,top:e.top-h,right:e.right-f,bottom:e.bottom-h}}if(a)break}}function Ao(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=yo(t));return e}function No(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=r.dom,i=r.top,s=r.left;o.scrollTop!=i+e&&(o.scrollTop=i+e),o.scrollLeft!=s&&(o.scrollLeft=s)}}var Bo=null;function zo(t,e){for(var n,r,o=2e8,i=0,s=e.top,a=e.top,c=t.firstChild,u=0;c;c=c.nextSibling,u++){var l=void 0;if(1==c.nodeType)l=c.getClientRects();else{if(3!=c.nodeType)continue;l=wo(c).getClientRects()}for(var d=0;d<l.length;d++){var p=l[d];if(p.top<=s&&p.bottom>=a){s=Math.max(p.bottom,s),a=Math.min(p.top,a);var f=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(f<o){n=c,o=f,r=f&&3==n.nodeType?{left:p.right<e.left?p.right:p.left,top:e.top}:e,1==c.nodeType&&f&&(i=u+(e.left>=(p.left+p.right)/2?1:0));continue}}!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=u+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,r=document.createRange(),o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);var i=Fo(r,1);if(i.top!=i.bottom&&Po(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:t,offset:i}:zo(n,r)}function Po(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ro(t,e){var n,r,o,i,s=t.dom.ownerDocument;if(s.caretPositionFromPoint)try{var a=s.caretPositionFromPoint(e.left,e.top);a&&(o=(n=a).offsetNode,i=n.offset)}catch(t){}if(!o&&s.caretRangeFromPoint){var c=s.caretRangeFromPoint(e.left,e.top);c&&(o=(r=c).startContainer,i=r.startOffset)}var u,l=(t.root.elementFromPoint?t.root:s).elementFromPoint(e.left,e.top+1);if(!l||!t.dom.contains(1!=l.nodeType?l.parentNode:l)){var d=t.dom.getBoundingClientRect();if(!Po(e,d))return null;if(!(l=function t(e,n,r){var o=e.childNodes.length;if(o&&r.top<r.bottom)for(var i=Math.max(0,Math.min(o-1,Math.floor(o*(n.top-r.top)/(r.bottom-r.top))-2)),s=i;;){var a=e.childNodes[s];if(1==a.nodeType)for(var c=a.getClientRects(),u=0;u<c.length;u++){var l=c[u];if(Po(n,l))return t(a,n,l)}if((s=(s+1)%o)==i)break}return e}(t.dom,e,d)))return null}if(lo.safari)for(var p=l;o&&p;p=yo(p))p.draggable&&(o=i=null);if(l=function(t,e){var n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(l,e),o){if(lo.gecko&&1==o.nodeType&&(i=Math.min(i,o.childNodes.length))<o.childNodes.length){var f,h=o.childNodes[i];"IMG"==h.nodeName&&(f=h.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}o==t.dom&&i==o.childNodes.length-1&&1==o.lastChild.nodeType&&e.top>o.lastChild.getBoundingClientRect().bottom?u=t.state.doc.content.size:0!=i&&1==o.nodeType&&"BR"==o.childNodes[i-1].nodeName||(u=function(t,e,n,r){for(var o=-1,i=e;i!=t.dom;){var s=t.docView.nearestDesc(i,!0);if(!s)return null;if(s.node.isBlock&&s.parent){var a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)o=s.posBefore;else{if(!(a.right<r.left||a.bottom<r.top))break;o=s.posAfter}}i=s.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n)}(t,o,i,e))}null==u&&(u=function(t,e,n){var r=zo(e,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(o,i,s)}(t,l,e));var m=t.docView.nearestDesc(l,!0);return{pos:u,inside:m?m.posAtStart-m.border:-1}}function Fo(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var Lo=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Vo(t,e,n){var r=t.docView.domFromPos(e,n<0?-1:1),o=r.node,i=r.offset,s=lo.webkit||lo.gecko;if(3==o.nodeType){if(!s||!Lo.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var a=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==o.nodeValue.length?(a--,u=1):n<0?a--:c++,jo(Fo(wo(o,a,c),u),u<0)}var l=Fo(wo(o,i,i),n);if(lo.gecko&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var d=Fo(wo(o,i-1,i-1),-1);if(d.top==l.top){var p=Fo(wo(o,i,i+1),-1);if(p.top!=l.top)return jo(p,p.left<d.left)}}return l}if(!t.state.doc.resolve(e).parent.inlineContent){if(i&&(n<0||i==Co(o))){var f=o.childNodes[i-1];if(1==f.nodeType)return $o(f.getBoundingClientRect(),!1)}if(i<Co(o)){var h=o.childNodes[i];if(1==h.nodeType)return $o(h.getBoundingClientRect(),!0)}return $o(o.getBoundingClientRect(),n>=0)}if(i&&(n<0||i==Co(o))){var m=o.childNodes[i-1],v=3==m.nodeType?wo(m,Co(m)-(s?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(v)return jo(Fo(v,1),!1)}if(i<Co(o)){for(var g=o.childNodes[i];g.pmViewDesc&&g.pmViewDesc.ignoreForCoords;)g=g.nextSibling;var y=g?3==g.nodeType?wo(g,0,s?0:1):1==g.nodeType?g:null:null;if(y)return jo(Fo(y,-1),!0)}return jo(Fo(3==o.nodeType?wo(o):o,-n),n>=0)}function jo(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function $o(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Wo(t,e,n){var r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}var Ho=/[\u0590-\u08ac]/;var qo=null,Jo=null,Ko=!1;function Uo(t,e,n){return qo==e&&Jo==n?Ko:(qo=e,Jo=n,Ko="up"==n||"down"==n?function(t,e,n){var r=e.selection,o="up"==n?r.$from:r.$to;return Wo(t,e,(function(){for(var e=t.docView.domFromPos(o.pos,"up"==n?-1:1).node;;){var r=t.docView.nearestDesc(e,!0);if(!r)break;if(r.node.isBlock){e=r.dom;break}e=r.dom.parentNode}for(var i=Vo(t,o.pos,1),s=e.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=wo(s,0,s.nodeValue.length).getClientRects()}for(var c=0;c<a.length;c++){var u=a[c];if(u.bottom>u.top+1&&("up"==n?i.top-u.top>2*(u.bottom-i.top):u.bottom-i.bottom>2*(i.bottom-u.top)))return!1}}return!0}))}(t,e,n):function(t,e,n){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=t.root.getSelection();return Ho.test(r.parent.textContent)&&a.modify?Wo(t,e,(function(){var e=a.getRangeAt(0),o=a.focusNode,i=a.focusOffset,s=a.caretBidiLevel;a.modify("move",n,"character");var c=!(r.depth?t.docView.domAfterPos(r.before()):t.dom).contains(1==a.focusNode.nodeType?a.focusNode:a.focusNode.parentNode)||o==a.focusNode&&i==a.focusOffset;return a.removeAllRanges(),a.addRange(e),null!=s&&(a.caretBidiLevel=s),c})):"left"==n||"backward"==n?i:s}(t,e,n))}var Go=function(t,e,n,r){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=r,this.dirty=0},Yo={size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};Go.prototype.matchesWidget=function(){return!1},Go.prototype.matchesMark=function(){return!1},Go.prototype.matchesNode=function(){return!1},Go.prototype.matchesHack=function(t){return!1},Go.prototype.parseRule=function(){return null},Go.prototype.stopEvent=function(){return!1},Yo.size.get=function(){for(var t=0,e=0;e<this.children.length;e++)t+=this.children[e].size;return t},Yo.border.get=function(){return 0},Go.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var t=0;t<this.children.length;t++)this.children[t].destroy()},Go.prototype.posBeforeChild=function(t){for(var e=0,n=this.posAtStart;e<this.children.length;e++){var r=this.children[e];if(r==t)return n;n+=r.size}},Yo.posBefore.get=function(){return this.parent.posBeforeChild(this)},Yo.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},Yo.posAfter.get=function(){return this.posBefore+this.size},Yo.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},Go.prototype.localPosFromDOM=function(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){var r,o;if(t==this.contentDOM)r=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;r=t.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,s;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(s=i.pmViewDesc)||s.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}var a;if(t==this.dom&&this.contentDOM)a=e>go(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var c=t;;c=c.parentNode){if(c==this.dom){a=!1;break}if(c.parentNode.firstChild!=c)break}if(null==a&&e==t.childNodes.length)for(var u=t;;u=u.parentNode){if(u==this.dom){a=!0;break}if(u.parentNode.lastChild!=u)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart},Go.prototype.nearestDesc=function(t,e){for(var n=!0,r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!o.nodeDOM||(1==o.nodeDOM.nodeType?o.nodeDOM.contains(1==t.nodeType?t:t.parentNode):o.nodeDOM==t))return o;n=!1}}},Go.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},Go.prototype.posFromDOM=function(t,e,n){for(var r=t;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}return-1},Go.prototype.descAt=function(t){for(var e=0,n=0;e<this.children.length;e++){var r=this.children[e],o=n+r.size;if(n==t&&o!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(t<o)return r.descAt(t-n-r.border);n=o}},Go.prototype.domFromPos=function(t,e){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,r=0,o=0;n<this.children.length;n++){var i=this.children[n],s=o+i.size;if(s>t||i instanceof oi){r=t-o;break}o=s}if(r)return this.children[n].domFromPos(r-this.children[n].border,e);for(var a=void 0;n&&!(a=this.children[n-1]).size&&a instanceof Zo&&a.widget.type.side>=0;n--);if(e<=0){for(var c,u=!0;(c=n?this.children[n-1]:null)&&c.dom.parentNode!=this.contentDOM;n--,u=!1);return c&&e&&u&&!c.border&&!c.domAtom?c.domFromPos(c.size,e):{node:this.contentDOM,offset:c?go(c.dom)+1:0}}for(var l,d=!0;(l=n<this.children.length?this.children[n]:null)&&l.dom.parentNode!=this.contentDOM;n++,d=!1);return l&&d&&!l.border&&!l.domAtom?l.domFromPos(0,e):{node:this.contentDOM,offset:l?go(l.dom):this.contentDOM.childNodes.length}},Go.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],c=i+a.size;if(-1==r&&t<=c){var u=i+a.border;if(t>=u&&e<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,e,u);t=i;for(var l=s;l>0;l--){var d=this.children[l-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){r=go(d.dom)+1;break}t-=d.size}-1==r&&(r=0)}if(r>-1&&(c>e||s==this.children.length-1)){e=c;for(var p=s+1;p<this.children.length;p++){var f=this.children[p];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=go(f.dom);break}e+=f.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}},Go.prototype.emptyChildAt=function(t){if(this.border||!this.contentDOM||!this.children.length)return!1;var e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)},Go.prototype.domAfterPos=function(t){var e=this.domFromPos(t,0),n=e.node,r=e.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]},Go.prototype.setSelection=function(t,e,n,r){for(var o=Math.min(t,e),i=Math.max(t,e),s=0,a=0;s<this.children.length;s++){var c=this.children[s],u=a+c.size;if(o>a&&i<u)return c.setSelection(t-a-c.border,e-a-c.border,n,r);a=u}var l=this.domFromPos(t,t?-1:1),d=e==t?l:this.domFromPos(e,e?-1:1),p=n.getSelection(),f=!1;if((lo.gecko||lo.safari)&&t==e){var h=l.node,m=l.offset;if(3==h.nodeType){if((f=m&&"\n"==h.nodeValue[m-1])&&m==h.nodeValue.length)for(var v=h,g=void 0;v;v=v.parentNode){if(g=v.nextSibling){"BR"==g.nodeName&&(l=d={node:g.parentNode,offset:go(g)+1});break}var y=v.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{var b=h.childNodes[m-1];f=b&&("BR"==b.nodeName||"false"==b.contentEditable)}}if(lo.gecko&&p.focusNode&&p.focusNode!=d.node&&1==p.focusNode.nodeType){var w=p.focusNode.childNodes[p.focusOffset];w&&"false"==w.contentEditable&&(r=!0)}if(r||f&&lo.safari||!_o(l.node,l.offset,p.anchorNode,p.anchorOffset)||!_o(d.node,d.offset,p.focusNode,p.focusOffset)){var _=!1;if((p.extend||t==e)&&!f){p.collapse(l.node,l.offset);try{t!=e&&p.extend(d.node,d.offset),_=!0}catch(t){if(!(t instanceof DOMException))throw t}}if(!_){if(t>e){var x=l;l=d,d=x}var k=document.createRange();k.setEnd(d.node,d.offset),k.setStart(l.node,l.offset),p.removeAllRanges(),p.addRange(k)}}},Go.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},Yo.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},Go.prototype.markDirty=function(t,e){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?t<=i&&e>=n:t<i&&e>n){var s=n+o.border,a=i-o.border;if(t>=s&&e<=a)return this.dirty=t==n||e==i?2:1,void(t!=s||e!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-s,e-s):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2},Go.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty<n&&(e.dirty=n)}},Yo.domAtom.get=function(){return!1},Yo.ignoreForCoords.get=function(){return!1},Object.defineProperties(Go.prototype,Yo);var Xo=[],Zo=function(t){function e(e,n,r,o){var i,s=n.type.toDOM;if("function"==typeof s&&(s=s(r,(function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:o}))),!n.type.spec.raw){if(1!=s.nodeType){var a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable=!1,s.classList.add("ProseMirror-widget")}t.call(this,e,Xo,s,null),this.widget=n,i=this}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.matchesWidget=function(t){return 0==this.dirty&&t.type.eq(this.widget.type)},e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.stopEvent=function(t){var e=this.widget.spec.stopEvent;return!!e&&e(t)},e.prototype.ignoreMutation=function(t){return"selection"!=t.type||this.widget.spec.ignoreSelection},e.prototype.destroy=function(){this.widget.type.destroy(this.dom),t.prototype.destroy.call(this)},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(Go),Qo=function(t){function e(e,n,r,o){t.call(this,e,Xo,n,null),this.textDOM=r,this.text=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},e.prototype.localPosFromDOM=function(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e},e.prototype.domFromPos=function(t){return{node:this.textDOM,offset:t}},e.prototype.ignoreMutation=function(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue},Object.defineProperties(e.prototype,n),e}(Go),ti=function(t){function e(e,n,r,o){t.call(this,e,[],r,o),this.mark=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.create=function(t,n,r,o){var i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return s&&s.dom||(s=dt.renderSpec(document,n.type.spec.toDOM(n,r))),new e(t,n,s.dom,s.contentDOM||s.dom)},e.prototype.parseRule=function(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},e.prototype.matchesMark=function(t){return 3!=this.dirty&&this.mark.eq(t)},e.prototype.markDirty=function(e,n){if(t.prototype.markDirty.call(this,e,n),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}},e.prototype.slice=function(t,n,r){var o=e.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=vi(i,n,s,r)),t>0&&(i=vi(i,0,t,r));for(var a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o},e}(Go),ei=function(t){function e(e,n,r,o,i,s,a,c,u){t.call(this,e,n.isLeaf?Xo:[],i,s),this.nodeDOM=a,this.node=n,this.outerDeco=r,this.innerDeco=o,s&&this.updateChildren(c,u)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return e.create=function(t,n,r,o,i,s){var a,c,u=i.nodeViews[n.type.name],l=u&&u(n,i,(function(){return c?c.parent?c.parent.posBeforeChild(c):void 0:s}),r,o),d=l&&l.dom,p=l&&l.contentDOM;if(n.isText)if(d){if(3!=d.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(n.text);else d||(d=(a=dt.renderSpec(document,n.type.spec.toDOM(n))).dom,p=a.contentDOM);p||n.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable=!1),n.type.spec.draggable&&(d.draggable=!0));var f=d;return d=di(d,r,n),l?c=new ii(t,n,r,o,d,p,f,l,i,s+1):n.isText?new ri(t,n,r,o,d,f,i):new e(t,n,r,o,d,p,f,i,s+1)},e.prototype.parseRule=function(){var t=this;if(this.node.type.spec.reparseInView)return null;var e={node:this.node.type.name,attrs:this.node.attrs};return"pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?e.contentElement=this.contentDOM:e.getContent=function(){return t.contentDOM?i.empty:t.node.content},e},e.prototype.matchesNode=function(t,e,n){return 0==this.dirty&&t.eq(this.node)&&pi(e,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},e.prototype.updateChildren=function(t,e){var n=this,r=this.node.inlineContent,o=e,i=t.composing&&this.localCompositionInfo(t,e),s=i&&i.pos>-1?i:null,a=i&&i.pos<0,c=new hi(this,s&&s.node);!function(t,e,n,r){var o=e.locals(t),i=0;if(0==o.length){for(var s=0;s<t.childCount;s++){var a=t.child(s);r(a,o,e.forChild(i,a),s),i+=a.nodeSize}return}for(var c=0,u=[],l=null,d=0;;){if(c<o.length&&o[c].to==i){for(var p=o[c++],f=void 0;c<o.length&&o[c].to==i;)(f||(f=[p])).push(o[c++]);if(f){f.sort(mi);for(var h=0;h<f.length;h++)n(f[h],d,!!l)}else n(p,d,!!l)}var m=void 0,v=void 0;if(l)v=-1,m=l,l=null;else{if(!(d<t.childCount))break;v=d,m=t.child(d++)}for(var g=0;g<u.length;g++)u[g].to<=i&&u.splice(g--,1);for(;c<o.length&&o[c].from<=i&&o[c].to>i;)u.push(o[c++]);var y=i+m.nodeSize;if(m.isText){var b=y;c<o.length&&o[c].from<b&&(b=o[c].from);for(var w=0;w<u.length;w++)u[w].to<b&&(b=u[w].to);b<y&&(l=m.cut(b-i),m=m.cut(0,b-i),y=b,v=-1)}var _=u.length?m.isInline&&!m.isLeaf?u.filter((function(t){return!t.inline})):u.slice():Xo;r(m,_,e.forChild(i,m),v),i=y}}(this.node,this.innerDeco,(function(e,i,s){e.spec.marks?c.syncToMarks(e.spec.marks,r,t):e.type.side>=0&&!s&&c.syncToMarks(i==n.node.childCount?l.none:n.node.child(i).marks,r,t),c.placeWidget(e,t,o)}),(function(e,n,s,u){var l;c.syncToMarks(e.marks,r,t),c.findNodeMatch(e,n,s,u)||a&&t.state.selection.from>o&&t.state.selection.to<o+e.nodeSize&&(l=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(e,n,s,l,t)||c.updateNextNode(e,n,s,t,u)||c.addNode(e,n,s,t,o),o+=e.nodeSize})),c.syncToMarks(Xo,r,t),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||2==this.dirty)&&(s&&this.protectLocalComposition(t,s),function t(e,n,r){for(var o=e.firstChild,i=!1,s=0;s<n.length;s++){var a=n[s],c=a.dom;if(c.parentNode==e){for(;c!=o;)o=fi(o),i=!0;o=o.nextSibling}else i=!0,e.insertBefore(c,o);if(a instanceof ti){var u=o?o.previousSibling:e.lastChild;t(a.contentDOM,a.children,r),o=u?u.nextSibling:e.firstChild}}for(;o;)o=fi(o),i=!0;i&&r.trackWrites==e&&(r.trackWrites=null)}(this.contentDOM,this.children,t),lo.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))},e.prototype.localCompositionInfo=function(t,e){var n=t.state.selection,r=n.from,o=n.to;if(!(!(t.state.selection instanceof re)||r<e||o>e+this.node.content.size)){var i=t.root.getSelection(),s=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];t=t.childNodes[e-1],e=Co(t)}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(i.focusNode,i.focusOffset);if(s&&this.dom.contains(s.parentNode)){if(this.node.inlineContent){var a=s.nodeValue,c=function(t,e,n,r){for(var o=0,i=0;o<t.childCount&&i<=r;){var s=t.child(o++),a=i;if(i+=s.nodeSize,s.isText){for(var c=s.text;o<t.childCount;){var u=t.child(o++);if(i+=u.nodeSize,!u.isText)break;c+=u.text}if(i>=n&&a<r){var l=c.lastIndexOf(e,r-a-1);if(l>=0&&l+e.length+a>=n)return a+l}}}return-1}(this.node.content,a,r-e,o-e);return c<0?null:{node:s,pos:c,text:a}}return{node:s,pos:-1}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,r=e.pos,o=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var s=new Qo(this,i,n,o);t.compositionNodes.push(s),this.children=vi(this.children,r,r+o.length,t,s)}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)},e.prototype.updateInner=function(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!pi(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ui(this.dom,this.nodeDOM,ci(this.outerDeco,this.node,e),ci(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(e.prototype,n),e}(Go);function ni(t,e,n,r,o){return di(r,e,t),new ei(null,t,e,n,r,r,r,o,0)}var ri=function(t){function e(e,n,r,o,i,s,a){t.call(this,e,n,r,o,i,null,s,a)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){for(var t=this.nodeDOM.parentNode;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}},e.prototype.update=function(t,e,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,r)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,r){var o=this.node.cut(t,n),i=document.createTextNode(o.text);return new e(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)},e.prototype.markDirty=function(e,n){t.prototype.markDirty.call(this,e,n),this.dom==this.nodeDOM||0!=e&&n!=this.nodeDOM.nodeValue.length||(this.dirty=3)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(ei),oi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};return e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(t){return 0==this.dirty&&this.dom.nodeName==t},n.domAtom.get=function(){return!0},n.ignoreForCoords.get=function(){return"IMG"==this.dom.nodeName},Object.defineProperties(e.prototype,n),e}(Go),ii=function(t){function e(e,n,r,o,i,s,a,c,u,l){t.call(this,e,n,r,o,i,s,a,u,l),this.spec=c}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,r,o){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,r,o)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):t.prototype.setSelection.call(this,e,n,r,o)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(ei);function si(t){t&&(this.nodeName=t)}si.prototype=Object.create(null);var ai=[new si];function ci(t,e,n){if(0==t.length)return ai;for(var r=n?ai[0]:new si,o=[r],i=0;i<t.length;i++){var s=t[i].type.attrs;if(s)for(var a in s.nodeName&&o.push(r=new si(s.nodeName)),s){var c=s[a];null!=c&&(n&&1==o.length&&o.push(r=new si(e.isInline?"span":"div")),"class"==a?r.class=(r.class?r.class+" ":"")+c:"style"==a?r.style=(r.style?r.style+";":"")+c:"nodeName"!=a&&(r[a]=c))}}return o}function ui(t,e,n,r){if(n==ai&&r==ai)return e;for(var o=e,i=0;i<r.length;i++){var s=r[i],a=n[i];if(i){var c=void 0;a&&a.nodeName==s.nodeName&&o!=t&&(c=o.parentNode)&&c.tagName.toLowerCase()==s.nodeName||((c=document.createElement(s.nodeName)).pmIsDeco=!0,c.appendChild(o),a=ai[0]),o=c}li(o,a||ai[0],s)}return o}function li(t,e,n){for(var r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){for(var i=e.class?e.class.split(" ").filter(Boolean):Xo,s=n.class?n.class.split(" ").filter(Boolean):Xo,a=0;a<i.length;a++)-1==s.indexOf(i[a])&&t.classList.remove(i[a]);for(var c=0;c<s.length;c++)-1==i.indexOf(s[c])&&t.classList.add(s[c]);0==t.classList.length&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style)for(var u,l=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;u=l.exec(e.style);)t.style.removeProperty(u[1]);n.style&&(t.style.cssText+=n.style)}}function di(t,e,n){return ui(t,t,ai,ci(e,n,1!=t.nodeType))}function pi(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function fi(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}var hi=function(t,e){this.top=t,this.lock=e,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(t,e){var n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];t:for(;o>0;){for(var a=void 0;;)if(r){var c=n.children[r-1];if(!(c instanceof ti)){a=c,r--;break}n=c,r=c.children.length}else{if(n==e)break t;r=n.parent.children.indexOf(n),n=n.parent}var u=a.node;if(u){if(u!=t.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(t.node.content,t)};function mi(t,e){return t.type.side-e.type.side}function vi(t,e,n,r,o){for(var i=[],s=0,a=0;s<t.length;s++){var c=t[s],u=a,l=a+=c.size;u>=n||l<=e?i.push(c):(u<e&&i.push(c.slice(0,e-u,r)),o&&(i.push(o),o=null),l>n&&i.push(c.slice(n-u,c.size,r)))}return i}function gi(t,e){var n=t.root.getSelection(),r=t.state.doc;if(!n.focusNode)return null;var o=t.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(s<0)return null;var a,c,u=r.resolve(s);if(To(n)){for(a=u;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&ie.isSelectable(o.node)&&o.parent&&(!o.node.isInline||!function(t,e,n){for(var r=0==e,o=e==Co(t);r||o;){if(t==n)return!0;var i=go(t);if(!(t=t.parentNode))return!1;r=r&&0==i,o=o&&i==Co(t)}}(n.focusNode,n.focusOffset,o.dom))){var l=o.posBefore;c=new ie(s==l?u:r.resolve(l))}}else{var d=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(d<0)return null;a=r.resolve(d)}c||(c=Ti(t,a,u,"pointer"==e||t.state.selection.head<u.pos&&!i?1:-1));return c}function yi(t){return t.editable?t.hasFocus():Ei(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function bi(t,e){var n=t.state.selection;if(Ci(t,n),yi(t)){if(!e&&t.mouseDown&&t.mouseDown.allowDefault&&lo.chrome){var r=t.root.getSelection(),o=t.domObserver.currentSelection;if(r.anchorNode&&_o(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset))return t.mouseDown.delayedSelectionSync=!0,void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){var e=t.root.getSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o="IMG"==r.nodeName;o?n.setEnd(r.parentNode,go(r)+1):n.setEnd(r,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&lo.ie&&lo.ie_version<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{var i,s,a=n.anchor,c=n.head;!wi||n instanceof re||(n.$from.parent.inlineContent||(i=_i(t,n.from)),n.empty||n.$from.parent.inlineContent||(s=_i(t,n.to))),t.docView.setSelection(a,c,t.root,e),wi&&(i&&ki(i),s&&ki(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){var e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.hideSelectionGuard);var n=t.root.getSelection(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.hideSelectionGuard),setTimeout((function(){yi(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}hi.prototype.destroyBetween=function(t,e){if(t!=e){for(var n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}},hi.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},hi.prototype.syncToMarks=function(t,e,n){for(var r=0,o=this.stack.length>>1,i=Math.min(o,t.length);r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(t[r])&&!1!==t[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);for(var s=-1,a=this.index;a<Math.min(this.index+3,this.top.children.length);a++)if(this.top.children[a].matchesMark(t[o])){s=a;break}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{var c=ti.create(this.top,t[o],e,n);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}},hi.prototype.findNodeMatch=function(t,e,n,r){var o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(t,e,n))i=this.top.children.indexOf(o,this.index);else for(var s=this.index,a=Math.min(this.top.children.length,s+5);s<a;s++){var c=this.top.children[s];if(c.matchesNode(t,e,n)&&!this.preMatch.matched.has(c)){i=s;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)},hi.prototype.updateNodeAt=function(t,e,n,r,o){return!!this.top.children[r].update(t,e,n,o)&&(this.destroyBetween(this.index,r),this.index=r+1,!0)},hi.prototype.findIndexWithChild=function(t){for(;;){var e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){var n=t.pmViewDesc;if(n)for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r;return-1}t=e}},hi.prototype.updateNextNode=function(t,e,n,r,o){for(var i=this.index;i<this.top.children.length;i++){var s=this.top.children[i];if(s instanceof ei){var a=this.preMatch.matched.get(s);if(null!=a&&a!=o)return!1;var c=s.dom;if(!(this.lock&&(c==this.lock||1==c.nodeType&&c.contains(this.lock.parentNode))&&!(t.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==t.text&&3!=s.dirty&&pi(e,s.outerDeco)))&&s.update(t,e,n,r))return this.destroyBetween(this.index,i),s.dom!=c&&(this.changed=!0),this.index++,!0;break}}return!1},hi.prototype.addNode=function(t,e,n,r,o){this.top.children.splice(this.index++,0,ei.create(this.top,t,e,n,r,o)),this.changed=!0},hi.prototype.placeWidget=function(t,e,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){var o=new Zo(this.top,t,e,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++},hi.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof ti;)t=t.children[t.children.length-1];t&&t instanceof ri&&!/\n$/.test(t.node.text)||((lo.safari||lo.chrome)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG"),this.addHackNode("BR"))},hi.prototype.addHackNode=function(t){if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack(t))this.index++;else{var e=document.createElement(t);"IMG"==t&&(e.className="ProseMirror-separator"),"BR"==t&&(e.className="ProseMirror-trailingBreak"),this.top.children.splice(this.index++,0,new oi(this.top,Xo,e,null)),this.changed=!0}};var wi=lo.safari||lo.chrome&&lo.chrome_version<63;function _i(t,e){var n=t.docView.domFromPos(e,0),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,s=o?r.childNodes[o-1]:null;if(lo.safari&&i&&"false"==i.contentEditable)return xi(i);if(!(i&&"false"!=i.contentEditable||s&&"false"!=s.contentEditable)){if(i)return xi(i);if(s)return xi(s)}}function xi(t){return t.contentEditable="true",lo.safari&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ki(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Ci(t,e){if(e instanceof ie){var n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Si(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Si(t)}function Si(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=null)}function Ti(t,e,n,r){return t.someProp("createSelectionBetween",(function(r){return r(t,e,n)}))||re.between(e,n,r)}function Ei(t){var e=t.root.getSelection();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Mi(t,e){var n=t.selection,r=n.$anchor,o=n.$head,i=e>0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&te.findFrom(s,e)}function Oi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Di(t,e,n){var r=t.state.selection;if(!(r instanceof re)){if(r instanceof ie&&r.node.isInline)return Oi(t,new re(e>0?r.$to:r.$from));var o=Mi(t.state,e);return!!o&&Oi(t,o)}if(!r.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var i=Mi(t.state,e);return!!(i&&i instanceof ie)&&Oi(t,i)}if(!(lo.mac&&n.indexOf("m")>-1)){var s,a=r.$head,c=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!c||c.isText)return!1;var u=e<0?a.pos-c.nodeSize:a.pos;return!!(c.isAtom||(s=t.docView.descAt(u))&&!s.contentDOM)&&(ie.isSelectable(c)?Oi(t,new ie(e<0?t.state.doc.resolve(a.pos-c.nodeSize):a)):!!lo.webkit&&Oi(t,new re(t.state.doc.resolve(e<0?u:u+c.nodeSize))))}}function Ii(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Ai(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function Ni(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){var o,i,s=!1;for(lo.gecko&&1==n.nodeType&&r<Ii(n)&&Ai(n.childNodes[r])&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(Ai(a))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(zi(n))break;for(var c=n.previousSibling;c&&Ai(c);)o=n.parentNode,i=go(c),c=c.previousSibling;if(c)r=Ii(n=c);else{if((n=n.parentNode)==t.dom)break;r=0}}s?Pi(t,e,n,r):o&&Pi(t,e,o,i)}}function Bi(t){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n){for(var o,i,s=Ii(n);;)if(r<s){if(1!=n.nodeType)break;if(!Ai(n.childNodes[r]))break;o=n,i=++r}else{if(zi(n))break;for(var a=n.nextSibling;a&&Ai(a);)o=a.parentNode,i=go(a)+1,a=a.nextSibling;if(a)r=0,s=Ii(n=a);else{if((n=n.parentNode)==t.dom)break;r=s=0}}o&&Pi(t,e,o,i)}}function zi(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Pi(t,e,n,r){if(To(e)){var o=document.createRange();o.setEnd(n,r),o.setStart(n,r),e.removeAllRanges(),e.addRange(o)}else e.extend&&e.extend(n,r);t.domObserver.setCurSelection();var i=t.state;setTimeout((function(){t.state==i&&bi(t)}),50)}function Ri(t,e,n){var r=t.state.selection;if(r instanceof re&&!r.empty||n.indexOf("s")>-1)return!1;if(lo.mac&&n.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var s=Mi(t.state,e);if(s&&s instanceof ie)return Oi(t,s)}if(!o.parent.inlineContent){var a=e<0?o:i,c=r instanceof ae?te.near(a,e):te.findFrom(a,e);return!!c&&Oi(t,c)}return!1}function Fi(t,e){if(!(t.state.selection instanceof re))return!0;var n=t.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=t.state.tr;return e<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),t.dispatch(a),!0}return!1}function Li(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Vi(t,e){var n=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||lo.mac&&72==n&&"c"==r?Fi(t,-1)||Ni(t):46==n||lo.mac&&68==n&&"c"==r?Fi(t,1)||Bi(t):13==n||27==n||(37==n?Di(t,-1,r)||Ni(t):39==n?Di(t,1,r)||Bi(t):38==n?Ri(t,-1,r)||Ni(t):40==n?function(t){if(lo.safari&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,r=e.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;Li(t,o,!0),setTimeout((function(){return Li(t,o,!1)}),20)}}}(t)||Ri(t,1,r)||Bi(t):r==(lo.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function ji(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(lo.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||lo.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function $i(t,e,n,r,o){if(e<0){var s=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,a=gi(t,s);if(a&&!t.state.selection.eq(a)){var c=t.state.tr.setSelection(a);"pointer"==s?c.setMeta("pointer",!0):"key"==s&&c.scrollIntoView(),t.dispatch(c)}}else{var u=t.state.doc.resolve(e),l=u.sharedDepth(n);e=u.before(l+1),n=t.state.doc.resolve(n).after(l+1);var d=t.state.selection,p=function(t,e,n){var r=t.docView.parseRange(e,n),o=r.node,i=r.fromOffset,s=r.toOffset,a=r.from,c=r.to,u=t.root.getSelection(),l=null,d=u.anchorNode;if(d&&t.dom.contains(1==d.nodeType?d:d.parentNode)&&(l=[{node:d,offset:u.anchorOffset}],To(u)||l.push({node:u.focusNode,offset:u.focusOffset})),lo.chrome&&8===t.lastKeyCode)for(var p=s;p>i;p--){var f=o.childNodes[p-1],h=f.pmViewDesc;if("BR"==f.nodeName&&!h){s=p;break}if(!h||h.size)break}var m=t.state.doc,v=t.someProp("domParser")||tt.fromSchema(t.state.schema),g=m.resolve(a),y=null,b=v.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=g.parent.type.whitespace||"full",editableContent:!0,findPositions:l,ruleFromNode:ji,context:g});if(l&&null!=l[0].pos){var w=l[0].pos,_=l[1]&&l[1].pos;null==_&&(_=w),y={anchor:w+a,head:_+a}}return{doc:b,sel:y,from:a,to:c}}(t,e,n);if(lo.chrome&&t.cursorWrapper&&p.sel&&p.sel.anchor==t.cursorWrapper.deco.from){var f=t.cursorWrapper.deco.type.toDOM.nextSibling,h=f&&f.nodeValue?f.nodeValue.length:1;p.sel={anchor:p.sel.anchor+h,head:p.sel.anchor+h}}var m,v,g=t.state.doc,y=g.slice(p.from,p.to);8===t.lastKeyCode&&Date.now()-100<t.lastKeyCodeTime?(m=t.state.selection.to,v="end"):(m=t.state.selection.from,v="start"),t.lastKeyCode=null;var b=function(t,e,n,r,o){var i=t.findDiffStart(e,n);if(null==i)return null;var s=t.findDiffEnd(e,n+t.size,n+e.size),a=s.a,c=s.b;if("end"==o){var u=Math.max(0,i-Math.min(a,c));r-=a+u-i}if(a<i&&t.size<e.size){c=(i-=r<=i&&r>=a?i-r:0)+(c-a),a=i}else if(c<i){a=(i-=r<=i&&r>=c?i-r:0)+(a-c),c=i}return{start:i,endA:a,endB:c}}(y.content,p.doc.content,p.from,m,v);if(!b){if(!(r&&d instanceof re&&!d.empty&&d.$head.sameParent(d.$anchor))||t.composing||p.sel&&p.sel.anchor!=p.sel.head){if((lo.ios&&t.lastIOSEnter>Date.now()-225||lo.android)&&o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))&&t.someProp("handleKeyDown",(function(e){return e(t,Eo(13,"Enter"))})))return void(t.lastIOSEnter=0);if(p.sel){var w=Wi(t,t.state.doc,p.sel);w&&!w.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(w))}return}b={start:d.from,endA:d.to,endB:d.to}}t.domChangeCount++,t.state.selection.from<t.state.selection.to&&b.start==b.endB&&t.state.selection instanceof re&&(b.start>t.state.selection.from&&b.start<=t.state.selection.from+2?b.start=t.state.selection.from:b.endA<t.state.selection.to&&b.endA>=t.state.selection.to-2&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),lo.ie&&lo.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>p.from&&"  "==p.doc.textBetween(b.start-p.from-1,b.start-p.from+1)&&(b.start--,b.endA--,b.endB--);var _,x=p.doc.resolveNoCache(b.start-p.from),k=p.doc.resolveNoCache(b.endB-p.from),C=x.sameParent(k)&&x.parent.inlineContent;if((lo.ios&&t.lastIOSEnter>Date.now()-225&&(!C||o.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName})))||!C&&x.pos<p.doc.content.size&&(_=te.findFrom(p.doc.resolve(x.pos+1),1,!0))&&_.head==k.pos)&&t.someProp("handleKeyDown",(function(e){return e(t,Eo(13,"Enter"))})))t.lastIOSEnter=0;else if(t.state.selection.anchor>b.start&&function(t,e,n,r,o){if(!r.parent.isTextblock||n-e<=o.pos-r.pos||Hi(r,!0,!1)<o.pos)return!1;var i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var s=t.resolve(Hi(i,!0,!0));if(!s.parent.isTextblock||s.pos>n||Hi(s,!0,!1)<n)return!1;return r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(g,b.start,b.endA,x,k)&&t.someProp("handleKeyDown",(function(e){return e(t,Eo(8,"Backspace"))})))lo.android&&lo.chrome&&t.domObserver.suppressSelectionUpdates();else{lo.chrome&&lo.android&&b.toB==b.from&&(t.lastAndroidDelete=Date.now()),lo.android&&!C&&x.start()!=k.start()&&0==k.parentOffset&&x.depth==k.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==b.endA&&(b.endB-=2,k=p.doc.resolveNoCache(b.endB-p.from),setTimeout((function(){t.someProp("handleKeyDown",(function(e){return e(t,Eo(13,"Enter"))}))}),20));var S,T,E,M,O=b.start,D=b.endA;if(C)if(x.pos==k.pos)lo.ie&&lo.ie_version<=11&&0==x.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((function(){return bi(t)}),20)),S=t.state.tr.delete(O,D),T=g.resolve(b.start).marksAcross(g.resolve(b.endA));else if(b.endA==b.endB&&(M=g.resolve(b.start))&&(E=function(t,e){for(var n,r,o,s=t.firstChild.marks,a=e.firstChild.marks,c=s,u=a,l=0;l<a.length;l++)c=a[l].removeFromSet(c);for(var d=0;d<s.length;d++)u=s[d].removeFromSet(u);if(1==c.length&&0==u.length)r=c[0],n="add",o=function(t){return t.mark(r.addToSet(t.marks))};else{if(0!=c.length||1!=u.length)return null;r=u[0],n="remove",o=function(t){return t.mark(r.removeFromSet(t.marks))}}for(var p=[],f=0;f<e.childCount;f++)p.push(o(e.child(f)));if(i.from(p).eq(t))return{mark:r,type:n}}(x.parent.content.cut(x.parentOffset,k.parentOffset),M.parent.content.cut(M.parentOffset,b.endA-M.start()))))S=t.state.tr,"add"==E.type?S.addMark(O,D,E.mark):S.removeMark(O,D,E.mark);else if(x.parent.child(x.index()).isText&&x.index()==k.index()-(k.textOffset?0:1)){var I=x.parent.textBetween(x.parentOffset,k.parentOffset);if(t.someProp("handleTextInput",(function(e){return e(t,O,D,I)})))return;S=t.state.tr.insertText(I,O,D)}if(S||(S=t.state.tr.replace(O,D,p.doc.slice(b.start-p.from,b.endB-p.from))),p.sel){var A=Wi(t,S.doc,p.sel);A&&!(lo.chrome&&lo.android&&t.composing&&A.empty&&(b.start!=b.endB||t.lastAndroidDelete<Date.now()-100)&&(A.head==O||A.head==S.mapping.map(D)-1)||lo.ie&&A.empty&&A.head==O)&&S.setSelection(A)}T&&S.ensureMarks(T),t.dispatch(S.scrollIntoView())}}}function Wi(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ti(t,e.resolve(n.anchor),e.resolve(n.head))}function Hi(t,e,n){for(var r=t.depth,o=e?t.end():t.pos;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n)for(var i=t.node(r).maybeChild(t.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function qi(t,e){for(var n=[],r=e.content,o=e.openStart,i=e.openEnd;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;var s=r.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),r=s.content}var a=t.someProp("clipboardSerializer")||dt.fromSchema(t.state.schema),c=Qi(),u=c.createElement("div");u.appendChild(a.serializeFragment(r,{document:c}));for(var l,d=u.firstChild;d&&1==d.nodeType&&(l=Xi[d.nodeName.toLowerCase()]);){for(var p=l.length-1;p>=0;p--){for(var f=c.createElement(l[p]);u.firstChild;)f.appendChild(u.firstChild);u.appendChild(f),"tbody"!=l[p]&&(o++,i++)}d=u.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",o+" "+i+" "+JSON.stringify(n)),{dom:u,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function Ji(t,e,n,r,o){var s,a,c=o.parent.type.spec.code;if(!n&&!e)return null;var u=e&&(r||c||!n);if(u){if(t.someProp("transformPastedText",(function(t){e=t(e,c||r)})),c)return e?new p(i.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0):p.empty;var l=t.someProp("clipboardTextParser",(function(t){return t(e,o,r)}));if(l)a=l;else{var d=o.marks(),f=t.state.schema,h=dt.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((function(t){var e=s.appendChild(document.createElement("p"));t&&e.appendChild(h.serializeNode(f.text(t,d)))}))}}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),s=function(t){var e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,r=Qi().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t);(n=o&&Xi[o[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return"</"+t+">"})).reverse().join(""));if(r.innerHTML=t,n)for(var i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),lo.webkit&&function(t){for(var e=t.querySelectorAll(lo.chrome?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<e.length;n++){var r=e[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(s);var m=s&&s.querySelector("[data-pm-slice]"),v=m&&/^(\d+) (\d+) (.*)/.exec(m.getAttribute("data-pm-slice"));if(!a){var g=t.someProp("clipboardParser")||t.someProp("domParser")||tt.fromSchema(t.state.schema);a=g.parseSlice(s,{preserveWhitespace:!(!u&&!v),context:o,ruleFromNode:function(t){if("BR"==t.nodeName&&!t.nextSibling&&t.parentNode&&!Ki.test(t.parentNode.nodeName))return{ignore:!0}}})}if(v)a=function(t,e){if(!t.size)return t;var n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}for(var o=t.content,s=t.openStart,a=t.openEnd,c=n.length-2;c>=0;c-=2){var u=r.nodes[n[c]];if(!u||u.hasRequiredAttrs())break;o=i.from(u.create(n[c+1],o)),s++,a++}return new p(o,s,a)}(Yi(a,+v[1],+v[2]),v[3]);else if((a=p.maxOpen(function(t,e){if(t.childCount<2)return t;for(var n=function(n){var r=e.node(n).contentMatchAt(e.index(n)),o=void 0,s=[];if(t.forEach((function(t){if(s){var e,n=r.findWrapping(t.type);if(!n)return s=null;if(e=s.length&&o.length&&function t(e,n,r,o,s){if(s<e.length&&s<n.length&&e[s]==n[s]){var a=t(e,n,r,o.lastChild,s+1);if(a)return o.copy(o.content.replaceChild(o.childCount-1,a));if(o.contentMatchAt(o.childCount).matchType(s==e.length-1?r.type:e[s+1]))return o.copy(o.content.append(i.from(Ui(r,e,s+1))))}}(n,o,t,s[s.length-1],0))s[s.length-1]=e;else{s.length&&(s[s.length-1]=function t(e,n){if(0==n)return e;var r=e.content.replaceChild(e.childCount-1,t(e.lastChild,n-1)),o=e.contentMatchAt(e.childCount).fillBefore(i.empty,!0);return e.copy(r.append(o))}(s[s.length-1],o.length));var a=Ui(t,n);s.push(a),r=r.matchType(a.type,a.attrs),o=n}}})),s)return{v:i.from(s)}},r=e.depth;r>=0;r--){var o=n(r);if(o)return o.v}return t}(a.content,o),!0)).openStart||a.openEnd){for(var y=0,b=0,w=a.content.firstChild;y<a.openStart&&!w.type.spec.isolating;y++,w=w.firstChild);for(var _=a.content.lastChild;b<a.openEnd&&!_.type.spec.isolating;b++,_=_.lastChild);a=Yi(a,y,b)}return t.someProp("transformPasted",(function(t){a=t(a)})),a}var Ki=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ui(t,e,n){void 0===n&&(n=0);for(var r=e.length-1;r>=n;r--)t=e[r].create(null,i.from(t));return t}function Gi(t,e,n,r,o,s){var a=e<0?t.firstChild:t.lastChild,c=a.content;return o<r-1&&(c=Gi(c,e,n,r,o+1,s)),o>=n&&(c=e<0?a.contentMatchAt(0).fillBefore(c,t.childCount>1||s<=o).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(i.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(c))}function Yi(t,e,n){return e<t.openStart&&(t=new p(Gi(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new p(Gi(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}var Xi={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},Zi=null;function Qi(){return Zi||(Zi=document.implementation.createHTMLDocument("title"))}var ts={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},es=lo.ie&&lo.ie_version<=11,ns=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};ns.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},ns.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var rs=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;e<t.length;e++)n.queue.push(t[e]);lo.ie&&lo.ie_version<=11&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new ns,es&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};rs.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){t.flushingSoon=-1,t.flush()}),20))},rs.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},rs.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,ts),es&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},rs.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout((function(){return t.flush()}),20)}this.observer.disconnect()}es&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},rs.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},rs.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},rs.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return t.suppressingSelectionUpdates=!1}),50)},rs.prototype.onSelectionChange=function(){if((!(t=this.view).editable||t.root.activeElement==t.dom)&&Ei(t)){var t;if(this.suppressingSelectionUpdates)return bi(this.view);if(lo.ie&&lo.ie_version<=11&&!this.view.state.selection.empty){var e=this.view.root.getSelection();if(e.focusNode&&_o(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}},rs.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},rs.prototype.ignoreSelectionChange=function(t){if(0==t.rangeCount)return!0;var e=t.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(e);return n&&n.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0},rs.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Ei(this.view)&&!this.ignoreSelectionChange(e),r=-1,o=-1,i=!1,s=[];if(this.view.editable)for(var a=0;a<t.length;a++){var c=this.registerMutation(t[a],s);c&&(r=r<0?c.from:Math.min(c.from,r),o=o<0?c.to:Math.max(c.to,o),c.typeOver&&(i=!0))}if(lo.gecko&&s.length>1){var u=s.filter((function(t){return"BR"==t.nodeName}));if(2==u.length){var l=u[0],d=u[1];l.parentNode&&l.parentNode.parentNode==d.parentNode?d.remove():l.remove()}}(r>-1||n)&&(r>-1&&(this.view.docView.markDirty(r,o),function(t){if(is)return;is=!0,"normal"==getComputedStyle(t.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(r,o,i,s),this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||bi(this.view),this.currentSelection.set(e))}},rs.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(var r=0;r<t.addedNodes.length;r++)e.push(t.addedNodes[r]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};var o=t.previousSibling,i=t.nextSibling;if(lo.ie&&lo.ie_version<=11&&t.addedNodes.length)for(var s=0;s<t.addedNodes.length;s++){var a=t.addedNodes[s],c=a.previousSibling,u=a.nextSibling;(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(o=c),(!u||Array.prototype.indexOf.call(t.addedNodes,u)<0)&&(i=u)}var l=o&&o.parentNode==t.target?go(o)+1:0,d=n.localPosFromDOM(t.target,l,-1),p=i&&i.parentNode==t.target?go(i):t.target.childNodes.length;return{from:d,to:n.localPosFromDOM(t.target,p,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}};var is=!1;var ss={},as={};function cs(t,e){t.lastSelectionOrigin=e,t.lastSelectionTime=Date.now()}function us(t){t.someProp("handleDOMEvents",(function(e){for(var n in e)t.eventHandlers[n]||t.dom.addEventListener(n,t.eventHandlers[n]=function(e){return ls(t,e)})}))}function ls(t,e){return t.someProp("handleDOMEvents",(function(n){var r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function ds(t){return{left:t.clientX,top:t.clientY}}function ps(t,e,n,r,o){if(-1==r)return!1;for(var i=t.state.doc.resolve(r),s=function(r){if(t.someProp(e,(function(e){return r>i.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)})))return{v:!0}},a=i.depth+1;a>0;a--){var c=s(a);if(c)return c.v}return!1}function fs(t,e,n){t.focused||t.focus();var r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function hs(t,e,n,r,o){return ps(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(function(n){return n(t,e,r)}))||(o?function(t,e){if(-1==e)return!1;var n,r,o=t.state.selection;o instanceof ie&&(n=o.node);for(var i=t.state.doc.resolve(e),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(ie.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(fs(t,ie.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&ie.isSelectable(r))&&(fs(t,new ie(n),"pointer"),!0)}(t,n))}function ms(t,e,n,r){return ps(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(function(n){return n(t,e,r)}))}function vs(t,e,n,r){return ps(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(function(n){return n(t,e,r)}))||function(t,e,n){if(0!=n.button)return!1;var r=t.state.doc;if(-1==e)return!!r.inlineContent&&(fs(t,re.create(r,0,r.content.size),"pointer"),!0);for(var o=r.resolve(e),i=o.depth+1;i>0;i--){var s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)fs(t,re.create(r,a+1,a+1+s.content.size),"pointer");else{if(!ie.isSelectable(s))continue;fs(t,ie.create(r,a),"pointer")}return!0}}(t,n,r)}function gs(t){return Cs(t)}as.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!ws(t,e)&&(t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!lo.android||!lo.chrome||13!=e.keyCode))if(229!=e.keyCode&&t.domObserver.forceFlush(),!lo.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",(function(n){return n(t,e)}))||Vi(t,e)?e.preventDefault():cs(t,"key");else{var n=Date.now();t.lastIOSEnter=n,t.lastIOSEnterFallbackTimeout=setTimeout((function(){t.lastIOSEnter==n&&(t.someProp("handleKeyDown",(function(e){return e(t,Eo(13,"Enter"))})),t.lastIOSEnter=0)}),200)}},as.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},as.keypress=function(t,e){if(!(ws(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||lo.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof re&&n.$from.sameParent(n.$to))){var r=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,r)}))||t.dispatch(t.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}}};var ys=lo.mac?"metaKey":"ctrlKey";ss.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=gs(t),r=Date.now(),o="singleClick";r-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(e,t.lastClick)&&!e[ys]&&("singleClick"==t.lastClick.type?o="doubleClick":"doubleClick"==t.lastClick.type&&(o="tripleClick")),t.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};var i=t.posAtCoords(ds(e));i&&("singleClick"==o?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new bs(t,i,e,n)):("doubleClick"==o?ms:vs)(t,i.pos,i.inside,e)?e.preventDefault():cs(t,"pointer"))};var bs=function(t,e,n,r){var o,i,s=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=r,this.selectNode=n[ys],this.allowDefault=n.shiftKey,this.delayedSelectionSync=!1,e.inside>-1)o=t.state.doc.nodeAt(e.inside),i=e.inside;else{var a=t.state.doc.resolve(e.pos);o=a.parent,i=a.depth?a.before():0}this.mightDrag=null;var c=r?null:n.target,u=c?t.docView.nearestDesc(c,!0):null;this.target=u?u.dom:null;var l=t.state.selection;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof ie&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&lo.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){s.view.mouseDown==s&&s.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),cs(t,"pointer")};function ws(t,e){return!!t.composing||!!(lo.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}bs.prototype.done=function(){var t=this;this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((function(){return bi(t.view)})),this.view.mouseDown=null},bs.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(ds(t))),this.allowDefault||!e?cs(this.view,"pointer"):hs(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||lo.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||lo.chrome&&!(this.view.state.selection instanceof re)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(fs(this.view,te.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):cs(this.view,"pointer")}},bs.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),cs(this.view,"pointer"),0==t.buttons&&this.done()},ss.touchdown=function(t){gs(t),cs(t,"pointer")},ss.contextmenu=function(t){return gs(t)};var _s=lo.android?5e3:-1;function xs(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Cs(t)}),e))}function ks(t){var e;for(t.composing&&(t.composing=!1,t.compositionEndedAt=((e=document.createEvent("Event")).initEvent("event",!0,!0),e.timeStamp));t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function Cs(t,e){if(!(lo.android&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ks(t),e||t.docView.dirty){var n=gi(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}as.compositionstart=as.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),Cs(t,!0),t.markCursor=null;else if(Cs(t),lo.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=t.root.getSelection(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){r.collapse(s,s.nodeValue.length);break}o=s,i=-1}t.composing=!0}xs(t,_s)},as.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,xs(t,20))};var Ss=lo.ie&&lo.ie_version<15||lo.ios&&lo.webkit_version<604;function Ts(t,e,n,r){var o=Ji(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(function(e){return e(t,r,o||p.empty)})))return!0;if(!o)return!1;var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),s=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(o);return t.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}ss.copy=as.cut=function(t,e){var n=t.state.selection,r="cut"==e.type;if(!n.empty){var o=Ss?null:e.clipboardData,i=qi(t,n.content()),s=i.dom,a=i.text;o?(e.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",a)):function(t,e){if(t.dom.parentNode){var n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}}(t,s),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},as.paste=function(t,e){if(!t.composing||lo.android){var n=Ss?null:e.clipboardData;n&&Ts(t,n.getData("text/plain"),n.getData("text/html"),e)?e.preventDefault():function(t,e){if(t.dom.parentNode){var n=t.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout((function(){t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ts(t,r.value,null,e):Ts(t,r.textContent,r.innerHTML,e)}),50)}}(t,e)}};var Es=function(t,e){this.slice=t,this.move=e},Ms=lo.mac?"altKey":"ctrlKey";for(var Os in ss.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var r=t.state.selection,o=r.empty?null:t.posAtCoords(ds(e));if(o&&o.pos>=r.from&&o.pos<=(r instanceof ie?r.to-1:r.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(ie.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);i&&i.node.type.spec.draggable&&i!=t.docView&&t.dispatch(t.state.tr.setSelection(ie.create(t.state.doc,i.posBefore)))}var s=t.state.selection.content(),a=qi(t,s),c=a.dom,u=a.text;e.dataTransfer.clearData(),e.dataTransfer.setData(Ss?"Text":"text/html",c.innerHTML),e.dataTransfer.effectAllowed="copyMove",Ss||e.dataTransfer.setData("text/plain",u),t.dragging=new Es(s,!e[Ms])}},ss.dragend=function(t){var e=t.dragging;window.setTimeout((function(){t.dragging==e&&(t.dragging=null)}),50)},as.dragover=as.dragenter=function(t,e){return e.preventDefault()},as.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var r=t.posAtCoords(ds(e));if(r){var o=t.state.doc.resolve(r.pos);if(o){var i=n&&n.slice;i?t.someProp("transformPasted",(function(t){i=t(i)})):i=Ji(t,e.dataTransfer.getData(Ss?"Text":"text/plain"),Ss?null:e.dataTransfer.getData("text/html"),!1,o);var s=n&&!e[Ms];if(t.someProp("handleDrop",(function(n){return n(t,e,i||p.empty,s)})))e.preventDefault();else if(i){e.preventDefault();var a=i?Ft(t.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);var c=t.state.tr;s&&c.deleteSelection();var u=c.mapping.map(a),l=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,d=c.doc;if(l?c.replaceRangeWith(u,u,i.content.firstChild):c.replaceRange(u,u,i),!c.doc.eq(d)){var f=c.doc.resolve(u);if(l&&ie.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new ie(f));else{var h=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((function(t,e,n,r){return h=r})),c.setSelection(Ti(t,f,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}}}}}},ss.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&bi(t)}),20))},ss.blur=function(t,e){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),e.relatedTarget&&t.dom.contains(e.relatedTarget)&&t.domObserver.currentSelection.set({}),t.focused=!1)},ss.beforeinput=function(t,e){if(lo.chrome&&lo.android&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,Eo(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},as)ss[Os]=as[Os];function Ds(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var r in e)if(!(r in t))return!1;return!0}var Is=function(t,e){this.spec=e||Rs,this.side=this.spec.side||0,this.toDOM=t};Is.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Bs(i-n,i-n,this)},Is.prototype.valid=function(){return!0},Is.prototype.eq=function(t){return this==t||t instanceof Is&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Ds(this.spec,t.spec))},Is.prototype.destroy=function(t){this.spec.destroy&&this.spec.destroy(t)};var As=function(t,e){this.spec=e||Rs,this.attrs=t};As.prototype.map=function(t,e,n,r){var o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Bs(o,i,this)},As.prototype.valid=function(t,e){return e.from<e.to},As.prototype.eq=function(t){return this==t||t instanceof As&&Ds(this.attrs,t.attrs)&&Ds(this.spec,t.spec)},As.is=function(t){return t.type instanceof As};var Ns=function(t,e){this.spec=e||Rs,this.attrs=t};Ns.prototype.map=function(t,e,n,r){var o=t.mapResult(e.from+r,1);if(o.deleted)return null;var i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Bs(o.pos-n,i.pos-n,this)},Ns.prototype.valid=function(t,e){var n,r=t.content.findIndex(e.from),o=r.index,i=r.offset;return i==e.from&&!(n=t.child(o)).isText&&i+n.nodeSize==e.to},Ns.prototype.eq=function(t){return this==t||t instanceof Ns&&Ds(this.attrs,t.attrs)&&Ds(this.spec,t.spec)};var Bs=function(t,e,n){this.from=t,this.to=e,this.type=n},zs={spec:{configurable:!0},inline:{configurable:!0}};Bs.prototype.copy=function(t,e){return new Bs(t,e,this.type)},Bs.prototype.eq=function(t,e){return void 0===e&&(e=0),this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to},Bs.prototype.map=function(t,e,n){return this.type.map(t,this,e,n)},Bs.widget=function(t,e,n){return new Bs(t,t,new Is(e,n))},Bs.inline=function(t,e,n,r){return new Bs(t,e,new As(n,r))},Bs.node=function(t,e,n,r){return new Bs(t,e,new Ns(n,r))},zs.spec.get=function(){return this.type.spec},zs.inline.get=function(){return this.type instanceof As},Object.defineProperties(Bs.prototype,zs);var Ps=[],Rs={},Fs=function(t,e){this.local=t&&t.length?t:Ps,this.children=e&&e.length?e:Ps};Fs.create=function(t,e){return e.length?Hs(e,t,0,Rs):Ls},Fs.prototype.find=function(t,e,n){var r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r},Fs.prototype.findInner=function(t,e,n,r,o){for(var i=0;i<this.local.length;i++){var s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;a<this.children.length;a+=3)if(this.children[a]<e&&this.children[a+1]>t){var c=this.children[a]+1;this.children[a+2].findInner(t-c,e-c,n,r+c,o)}},Fs.prototype.map=function(t,e,n){return this==Ls||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Rs)},Fs.prototype.mapInner=function(t,e,n,r,o){for(var i,s=0;s<this.local.length;s++){var a=this.local[s].map(t,n,r);a&&a.type.valid(e,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,o,i,s){for(var a=t.slice(),c=function(t,e,n,r){for(var s=0;s<a.length;s+=3){var c=a[s+1],u=void 0;-1==c||t>c+i||(e>=a[s]+i?a[s+1]=-1:n>=o&&(u=r-n-(e-t))&&(a[s]+=u,a[s+1]+=u))}},u=0;u<n.maps.length;u++)n.maps[u].forEach(c);for(var l=!1,d=0;d<a.length;d+=3)if(-1==a[d+1]){var p=n.map(t[d]+i),f=p-o;if(f<0||f>=r.content.size){l=!0;continue}var h=n.map(t[d+1]+i,-1)-o,m=r.content.findIndex(f),v=m.index,g=m.offset,y=r.maybeChild(v);if(y&&g==f&&g+y.nodeSize==h){var b=a[d+2].mapInner(n,y,p+1,t[d]+i+1,s);b!=Ls?(a[d]=f,a[d+1]=h,a[d+2]=b):(a[d+1]=-2,l=!0)}else l=!0}if(l){var w=Hs(function(t,e,n,r,o,i,s){function a(t,e){for(var i=0;i<t.local.length;i++){var c=t.local[i].map(r,o,e);c?n.push(c):s.onRemove&&s.onRemove(t.local[i].spec)}for(var u=0;u<t.children.length;u+=3)a(t.children[u+2],t.children[u]+e+1)}for(var c=0;c<t.length;c+=3)-1==t[c+1]&&a(t[c+2],e[c]+i+1);return n}(a,t,e||[],n,o,i,s),r,0,s);e=w.local;for(var _=0;_<a.length;_+=3)a[_+1]<0&&(a.splice(_,3),_-=3);for(var x=0,k=0;x<w.children.length;x+=3){for(var C=w.children[x];k<a.length&&a[k]<C;)k+=3;a.splice(k,0,w.children[x],w.children[x+1],w.children[x+2])}}return new Fs(e&&e.sort(qs),a)}(this.children,i,t,e,n,r,o):i?new Fs(i.sort(qs)):Ls},Fs.prototype.add=function(t,e){return e.length?this==Ls?Fs.create(t,e):this.addInner(t,e,0):this},Fs.prototype.addInner=function(t,e,n){var r,o=this,i=0;t.forEach((function(t,s){var a,c=s+n;if(a=$s(e,t,c)){for(r||(r=o.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(t,a,c+1):r.splice(i,0,s,s+t.nodeSize,Hs(a,t,c+1,Rs)),i+=3}}));for(var s=js(i?Ws(e):e,-n),a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new Fs(s.length?this.local.concat(s).sort(qs):this.local,r||this.children)},Fs.prototype.remove=function(t){return 0==t.length||this==Ls?this:this.removeInner(t,0)},Fs.prototype.removeInner=function(t,e){for(var n=this.children,r=this.local,o=0;o<n.length;o+=3){for(var i=void 0,s=n[o]+e,a=n[o+1]+e,c=0,u=void 0;c<t.length;c++)(u=t[c])&&u.from>s&&u.to<a&&(t[c]=null,(i||(i=[])).push(u));if(i){n==this.children&&(n=this.children.slice());var l=n[o+2].removeInner(i,s+1);l!=Ls?n[o+2]=l:(n.splice(o,3),o-=3)}}if(r.length)for(var d=0,p=void 0;d<t.length;d++)if(p=t[d])for(var f=0;f<r.length;f++)r[f].eq(p,e)&&(r==this.local&&(r=this.local.slice()),r.splice(f--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Fs(r,n):Ls},Fs.prototype.forChild=function(t,e){if(this==Ls)return this;if(e.isLeaf)return Fs.empty;for(var n,r,o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(n=this.children[o+2]);break}for(var i=t+1,s=i+e.content.size,a=0;a<this.local.length;a++){var c=this.local[a];if(c.from<s&&c.to>i&&c.type instanceof As){var u=Math.max(i,c.from)-i,l=Math.min(s,c.to)-i;u<l&&(r||(r=[])).push(c.copy(u,l))}}if(r){var d=new Fs(r.sort(qs));return n?new Vs([d,n]):d}return n||Ls},Fs.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof Fs)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0},Fs.prototype.locals=function(t){return Js(this.localsInner(t))},Fs.prototype.localsInner=function(t){if(this==Ls)return Ps;if(t.inlineContent||!this.local.some(As.is))return this.local;for(var e=[],n=0;n<this.local.length;n++)this.local[n].type instanceof As||e.push(this.local[n]);return e};var Ls=new Fs;Fs.empty=Ls,Fs.removeOverlap=Js;var Vs=function(t){this.members=t};function js(t,e){if(!e||!t.length)return t;for(var n=[],r=0;r<t.length;r++){var o=t[r];n.push(new Bs(o.from+e,o.to+e,o.type))}return n}function $s(t,e,n){if(e.isLeaf)return null;for(var r=n+e.nodeSize,o=null,i=0,s=void 0;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Ws(t){for(var e=[],n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function Hs(t,e,n,r){var o=[],i=!1;e.forEach((function(e,s){var a=$s(t,e,s+n);if(a){i=!0;var c=Hs(a,e,n+s+1,r);c!=Ls&&o.push(s,s+e.nodeSize,c)}}));for(var s=js(i?Ws(t):t,-n).sort(qs),a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Fs(s,o):Ls}function qs(t,e){return t.from-e.from||t.to-e.to}function Js(t){for(var e=t,n=0;n<e.length-1;n++){var r=e[n];if(r.from!=r.to)for(var o=n+1;o<e.length;o++){var i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Ks(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Ks(e,o+1,i.copy(r.to,i.to)))}}return e}function Ks(t,e,n){for(;e<t.length&&qs(n,t[e])>0;)e++;t.splice(e,0,n)}function Us(t){var e=[];return t.someProp("decorations",(function(n){var r=n(t.state);r&&r!=Ls&&e.push(r)})),t.cursorWrapper&&e.push(Fs.create(t.state.doc,[t.cursorWrapper.deco])),Vs.from(e)}Vs.prototype.map=function(t,e){var n=this.members.map((function(n){return n.map(t,e,Rs)}));return Vs.from(n)},Vs.prototype.forChild=function(t,e){if(e.isLeaf)return Fs.empty;for(var n=[],r=0;r<this.members.length;r++){var o=this.members[r].forChild(t,e);o!=Ls&&(o instanceof Vs?n=n.concat(o.members):n.push(o))}return Vs.from(n)},Vs.prototype.eq=function(t){if(!(t instanceof Vs)||t.members.length!=this.members.length)return!1;for(var e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0},Vs.prototype.locals=function(t){for(var e,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(var i=0;i<o.length;i++)e.push(o[i])}else e=o}return e?Js(n?e:e.sort(qs)):Ps},Vs.from=function(t){switch(t.length){case 0:return Ls;case 1:return t[0];default:return new Vs(t)}};var Gs,Ys,Xs=function(t,e){this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(ra),this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):t.apply?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=ea(this),this.markCursor=null,this.cursorWrapper=null,ta(this),this.nodeViews=na(this),this.docView=ni(this.state.doc,Qs(this),Us(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(t){t.shiftKey=!1,t.mouseDown=null,t.lastKeyCode=null,t.lastKeyCodeTime=0,t.lastClick={time:0,x:0,y:0,type:""},t.lastSelectionOrigin=null,t.lastSelectionTime=0,t.lastIOSEnter=0,t.lastIOSEnterFallbackTimeout=null,t.lastAndroidDelete=0,t.composing=!1,t.composingTimeout=null,t.compositionNodes=[],t.compositionEndedAt=-2e8,t.domObserver=new rs(t,(function(e,n,r,o){return $i(t,e,n,r,o)})),t.domObserver.start(),t.domChangeCount=0,t.eventHandlers=Object.create(null);var e=function(e){var n=ss[e];t.dom.addEventListener(e,t.eventHandlers[e]=function(e){!function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}(t,e)||ls(t,e)||!t.editable&&e.type in as||n(t,e)})};for(var n in ss)e(n);lo.safari&&t.dom.addEventListener("input",(function(){return null})),us(t)}(this),this.prevDirectPlugins=[],this.pluginViews=[],this.updatePluginViews()},Zs={props:{configurable:!0},root:{configurable:!0},isDestroyed:{configurable:!0}};function Qs(t){var e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),e.translate="no",t.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(t.state)),n)for(var r in n)"class"==r&&(e.class+=" "+n[r]),"style"==r?e.style=(e.style?e.style+";":"")+n[r]:e[r]||"contenteditable"==r||"nodeName"==r||(e[r]=String(n[r]))})),[Bs.node(0,t.state.doc.content.size,e)]}function ta(t){if(t.markCursor){var e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),t.cursorWrapper={dom:e,deco:Bs.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ea(t){return!t.someProp("editable",(function(e){return!1===e(t.state)}))}function na(t){var e={};return t.someProp("nodeViews",(function(t){for(var n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])})),e}function ra(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}if(Zs.props.get=function(){if(this._props.state!=this.state){var t=this._props;for(var e in this._props={},t)this._props[e]=t[e];this._props.state=this.state}return this._props},Xs.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&us(this),this._props=t,t.plugins&&(t.plugins.forEach(ra),this.directPlugins=t.plugins),this.updateStateInner(t.state,!0)},Xs.prototype.setProps=function(t){var e={};for(var n in this._props)e[n]=this._props[n];for(var r in e.state=this.state,t)e[r]=t[r];this.update(e)},Xs.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},Xs.prototype.updateStateInner=function(t,e){var n=this,r=this.state,o=!1,i=!1;if(t.storedMarks&&this.composing&&(ks(this),i=!0),this.state=t,e){var s=na(this);(function(t,e){var n=0,r=0;for(var o in t){if(t[o]!=e[o])return!0;n++}for(var i in e)r++;return n!=r})(s,this.nodeViews)&&(this.nodeViews=s,o=!0),us(this)}this.editable=ea(this),ta(this);var a=Us(this),c=Qs(this),u=e?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",l=o||!this.docView.matchesNode(t.doc,c,a);!l&&t.selection.eq(r.selection)||(i=!0);var d,p,f,h,m,v,g,y,b,w,_,x="preserve"==u&&i&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){var a=t.root.elementFromPoint(i,s);if(a!=t.dom&&t.dom.contains(a)){var c=a.getBoundingClientRect();if(c.top>=o-20){e=a,n=c.top;break}}}return{refDOM:e,refTop:n,stack:Ao(t.dom)}}(this);if(i){this.domObserver.stop();var k=l&&(lo.ie||lo.chrome)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&(h=r.selection,m=t.selection,v=Math.min(h.$anchor.sharedDepth(h.head),m.$anchor.sharedDepth(m.head)),h.$anchor.start(v)!=m.$anchor.start(v));if(l){var C=lo.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!o&&this.docView.update(t.doc,c,a,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=ni(t.doc,c,a,this.dom,this)),C&&!this.trackWrites&&(k=!0)}k||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(d=this,p=d.docView.domFromPos(d.state.selection.anchor,0),f=d.root.getSelection(),_o(p.node,p.offset,f.anchorNode,f.anchorOffset)))?bi(this,k):(Ci(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(r),"reset"==u)this.dom.scrollTop=0;else if("to selection"==u){var S=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof ie?Io(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),S):Io(this,this.coordsAtPos(t.selection.head,1),S))}else x&&(y=(g=x).refDOM,b=g.refTop,w=g.stack,_=y?y.getBoundingClientRect().top:0,No(w,0==_?0:_-b))},Xs.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},Xs.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var e=0;e<this.pluginViews.length;e++){var n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var r=0;r<this.directPlugins.length;r++){var o=this.directPlugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(var i=0;i<this.state.plugins.length;i++){var s=this.state.plugins[i];s.spec.view&&this.pluginViews.push(s.spec.view(this))}}},Xs.prototype.someProp=function(t,e){var n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;for(var o=0;o<this.directPlugins.length;o++){var i=this.directPlugins[o].props[t];if(null!=i&&(n=e?e(i):i))return n}var s=this.state.plugins;if(s)for(var a=0;a<s.length;a++){var c=s[a].props[t];if(null!=c&&(n=e?e(c):c))return n}},Xs.prototype.hasFocus=function(){return this.root.activeElement==this.dom},Xs.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(Bo)return t.focus(Bo);var e=Ao(t);t.focus(null==Bo?{get preventScroll(){return Bo={preventScroll:!0},!0}}:void 0),Bo||(Bo=!1,No(e,0))}(this.dom),bi(this),this.domObserver.start()},Zs.root.get=function(){var t=this._root;if(null==t)for(var e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=function(){return document.getSelection()}),this._root=e;return t||document},Xs.prototype.posAtCoords=function(t){return Ro(this,t)},Xs.prototype.coordsAtPos=function(t,e){return void 0===e&&(e=1),Vo(this,t,e)},Xs.prototype.domAtPos=function(t,e){return void 0===e&&(e=0),this.docView.domFromPos(t,e)},Xs.prototype.nodeDOM=function(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null},Xs.prototype.posAtDOM=function(t,e,n){void 0===n&&(n=-1);var r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r},Xs.prototype.endOfTextblock=function(t,e){return Uo(this,e||this.state,t)},Xs.prototype.destroy=function(){this.docView&&(!function(t){for(var e in t.domObserver.stop(),t.eventHandlers)t.dom.removeEventListener(e,t.eventHandlers[e]);clearTimeout(t.composingTimeout),clearTimeout(t.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Us(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},Zs.isDestroyed.get=function(){return null==this.docView},Xs.prototype.dispatchEvent=function(t){return function(t,e){ls(t,e)||!ss[e.type]||!t.editable&&e.type in as||ss[e.type](t,e)}(this,t)},Xs.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))},Object.defineProperties(Xs.prototype,Zs),"undefined"!=typeof WeakMap){var oa=new WeakMap;Gs=function(t){return oa.get(t)},Ys=function(t,e){return oa.set(t,e),e}}else{var ia=[],sa=0;Gs=function(t){for(var e=0;e<ia.length;e+=2)if(ia[e]==t)return ia[e+1]},Ys=function(t,e){return 10==sa&&(sa=0),ia[sa++]=t,ia[sa++]=e}}var aa=function(t,e,n,r){this.left=t,this.top=e,this.right=n,this.bottom=r},ca=function(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r};function ua(t){if(t.colwidth)return t.colwidth.slice();for(var e=[],n=0;n<t.colspan;n++)e.push(0);return e}function la(t,e){var n=t.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((function(t){return Number(t)})):null,o=Number(t.getAttribute("colspan")||1),i={colspan:o,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:r&&r.length==o?r:null};for(var s in e){var a=e[s].getFromDOM,c=a&&a(t);null!=c&&(i[s]=c)}return i}function da(t,e){var n={};for(var r in 1!=t.attrs.colspan&&(n.colspan=t.attrs.colspan),1!=t.attrs.rowspan&&(n.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(n["data-colwidth"]=t.attrs.colwidth.join(",")),e){var o=e[r].setDOMAttr;o&&o(t.attrs[r],n)}return n}function pa(t){var e=t.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(var r in e)n[r]={default:e[r].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM:function(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:function(){return["tr",0]}},table_cell:{content:t.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:function(t){return la(t,e)}}],toDOM:function(t){return["td",da(t,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:function(t){return la(t,e)}}],toDOM:function(t){return["th",da(t,e),0]}}}}function fa(t){var e=t.cached.tableNodeTypes;if(!e)for(var n in e=t.cached.tableNodeTypes={},t.nodes){var r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}return e}ca.prototype.findCell=function(t){for(var e=0;e<this.map.length;e++){var n=this.map[e];if(n==t){for(var r=e%this.width,o=e/this.width|0,i=r+1,s=o+1,a=1;i<this.width&&this.map[e+a]==n;a++)i++;for(var c=1;s<this.height&&this.map[e+this.width*c]==n;c++)s++;return new aa(r,o,i,s)}}throw new RangeError("No cell with offset "+t+" found")},ca.prototype.colCount=function(t){for(var e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError("No cell with offset "+t+" found")},ca.prototype.nextCell=function(t,e,n){var r=this.findCell(t),o=r.left,i=r.right,s=r.top,a=r.bottom;return"horiz"==e?(n<0?0==o:i==this.width)?null:this.map[s*this.width+(n<0?o-1:i)]:(n<0?0==s:a==this.height)?null:this.map[o+this.width*(n<0?s-1:a)]},ca.prototype.rectBetween=function(t,e){var n=this.findCell(t),r=n.left,o=n.right,i=n.top,s=n.bottom,a=this.findCell(e),c=a.left,u=a.right,l=a.top,d=a.bottom;return new aa(Math.min(r,c),Math.min(i,l),Math.max(o,u),Math.max(s,d))},ca.prototype.cellsInRect=function(t){for(var e=[],n={},r=t.top;r<t.bottom;r++)for(var o=t.left;o<t.right;o++){var i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,o==t.left&&o&&this.map[i-1]==s||r==t.top&&r&&this.map[i-this.width]==s||e.push(s))}return e},ca.prototype.positionAt=function(t,e,n){for(var r=0,o=0;;r++){var i=o+n.child(r).nodeSize;if(r==t){for(var s=e+t*this.width,a=(t+1)*this.width;s<a&&this.map[s]<o;)s++;return s==a?i-1:this.map[s]}o=i}},ca.get=function(t){return Gs(t)||Ys(t,function(t){if("table"!=t.type.spec.tableRole)throw new RangeError("Not a table node: "+t.type.name);for(var e=function(t){for(var e=-1,n=!1,r=0;r<t.childCount;r++){var o=t.child(r),i=0;if(n)for(var s=0;s<r;s++)for(var a=t.child(s),c=0;c<a.childCount;c++){var u=a.child(c);s+u.attrs.rowspan>r&&(i+=u.attrs.colspan)}for(var l=0;l<o.childCount;l++){var d=o.child(l);i+=d.attrs.colspan,d.attrs.rowspan>1&&(n=!0)}-1==e?e=i:e!=i&&(e=Math.max(e,i))}return e}(t),n=t.childCount,r=[],o=0,i=null,s=[],a=0,c=e*n;a<c;a++)r[a]=0;for(var u=0,l=0;u<n;u++){var d=t.child(u);l++;for(var p=0;;p++){for(;o<r.length&&0!=r[o];)o++;if(p==d.childCount)break;for(var f=d.child(p),h=f.attrs,m=h.colspan,v=h.rowspan,g=h.colwidth,y=0;y<v;y++){if(y+u>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:l,n:v-y});break}for(var b=o+y*e,w=0;w<m;w++){0==r[b+w]?r[b+w]=l:(i||(i=[])).push({type:"collision",row:u,pos:l,n:m-w});var _=g&&g[w];if(_){var x=(b+w)%e*2,k=s[x];null==k||k!=_&&1==s[x+1]?(s[x]=_,s[x+1]=1):k==_&&s[x+1]++}}}o+=m,l+=f.nodeSize}for(var C=(u+1)*e,S=0;o<C;)0==r[o++]&&S++;S&&(i||(i=[])).push({type:"missing",row:u,n:S}),l++}for(var T=new ca(e,n,r,i),E=!1,M=0;!E&&M<s.length;M+=2)null!=s[M]&&s[M+1]<n&&(E=!0);E&&function(t,e,n){t.problems||(t.problems=[]);for(var r=0,o={};r<t.map.length;r++){var i=t.map[r];if(!o[i]){o[i]=!0;for(var s=n.nodeAt(i),a=null,c=0;c<s.attrs.colspan;c++){var u=(r+c)%t.width,l=e[2*u];null==l||s.attrs.colwidth&&s.attrs.colwidth[c]==l||((a||(a=ua(s.attrs)))[c]=l)}a&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}}(T,s,t);return T}(t))};var ha=new xe("selectingCells");function ma(t){for(var e=t.depth-1;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return t.node(0).resolve(t.before(e+1));return null}function va(t){for(var e=t.selection.$head,n=e.depth;n>0;n--)if("row"==e.node(n).type.spec.tableRole)return!0;return!1}function ga(t){var e=t.selection;return e.$anchorCell?e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell:e.node&&"cell"==e.node.type.spec.tableRole?e.$anchor:ma(e.$head)||function(t){for(var e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){var r=e.type.spec.tableRole;if("cell"==r||"header_cell"==r)return t.doc.resolve(n)}for(var o=t.nodeBefore,i=t.pos;o;o=o.lastChild,i--){var s=o.type.spec.tableRole;if("cell"==s||"header_cell"==s)return t.doc.resolve(i-o.nodeSize)}}(e.$head)}function ya(t){return"row"==t.parent.type.spec.tableRole&&t.nodeAfter}function ba(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function wa(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function _a(t){return ca.get(t.node(-1)).findCell(t.pos-t.start(-1))}function xa(t){return ca.get(t.node(-1)).colCount(t.pos-t.start(-1))}function ka(t,e,n){var r=t.start(-1),o=ca.get(t.node(-1)).nextCell(t.pos-r,e,n);return null==o?null:t.node(0).resolve(r+o)}function Ca(t,e,n){var r={};for(var o in t)r[o]=t[o];return r[e]=n,r}function Sa(t,e,n){void 0===n&&(n=1);var r=Ca(t,"colspan",t.colspan-n);return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some((function(t){return t>0}))||(r.colwidth=null)),r}function Ta(t,e,n){void 0===n&&(n=1);var r=Ca(t,"colspan",t.colspan+n);if(r.colwidth){r.colwidth=r.colwidth.slice();for(var o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function Ea(t,e,n){for(var r=fa(e.type.schema).header_cell,o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var Ma=function(t){function e(e,n){void 0===n&&(n=e);var r=e.node(-1),o=ca.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,n.pos-i),a=e.node(0),c=o.cellsInRect(s).filter((function(t){return t!=n.pos-i}));c.unshift(n.pos-i);var u=c.map((function(t){var e=r.nodeAt(t),n=t+i+1;return new ne(a.resolve(n),a.resolve(n+e.content.size))}));t.call(this,u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(t,n){var r=t.resolve(n.map(this.$anchorCell.pos)),o=t.resolve(n.map(this.$headCell.pos));if(ya(r)&&ya(o)&&wa(r,o)){var i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?e.rowSelection(r,o):i&&this.isColSelection()?e.colSelection(r,o):new e(r,o)}return re.between(r,o)},e.prototype.content=function(){for(var t=this.$anchorCell.node(-1),e=ca.get(t),n=this.$anchorCell.start(-1),r=e.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},s=[],a=r.top;a<r.bottom;a++){for(var c=[],u=a*e.width+r.left,l=r.left;l<r.right;l++,u++){var d=e.map[u];if(!o[d]){o[d]=!0;var f=e.findCell(d),h=t.nodeAt(d),m=r.left-f.left,v=f.right-r.right;if(m>0||v>0){var g=h.attrs;m>0&&(g=Sa(g,0,m)),v>0&&(g=Sa(g,g.colspan-v,v)),h=f.left<r.left?h.type.createAndFill(g):h.type.create(g,h.content)}if(f.top<r.top||f.bottom>r.bottom){var y=Ca(h.attrs,"rowspan",Math.min(f.bottom,r.bottom)-Math.max(f.top,r.top));h=f.top<r.top?h.type.createAndFill(y):h.type.create(y,h.content)}c.push(h)}}s.push(t.child(a).copy(i.from(c)))}var b=this.isColSelection()&&this.isRowSelection()?t:s;return new p(i.from(b),1,1)},e.prototype.replace=function(e,n){void 0===n&&(n=p.empty);for(var r=e.steps.length,o=this.ranges,i=0;i<o.length;i++){var s=o[i],a=s.$from,c=s.$to,u=e.mapping.slice(r);e.replace(u.map(a.pos),u.map(c.pos),i?p.empty:n)}var l=t.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);l&&e.setSelection(l)},e.prototype.replaceWith=function(t,e){this.replace(t,new p(i.from(e),0,0))},e.prototype.forEachCell=function(t){for(var e=this.$anchorCell.node(-1),n=ca.get(e),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r)),i=0;i<o.length;i++)t(e.nodeAt(o[i]),r+o[i])},e.prototype.isColSelection=function(){var t=this.$anchorCell.index(-1),e=this.$headCell.index(-1);if(Math.min(t,e)>0)return!1;var n=t+this.$anchorCell.nodeAfter.attrs.rowspan,r=e+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount},e.colSelection=function(t,n){void 0===n&&(n=t);var r=ca.get(t.node(-1)),o=t.start(-1),i=r.findCell(t.pos-o),s=r.findCell(n.pos-o),a=t.node(0);return i.top<=s.top?(i.top>0&&(t=a.resolve(o+r.map[i.left])),s.bottom<r.height&&(n=a.resolve(o+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(n=a.resolve(o+r.map[s.left])),i.bottom<r.height&&(t=a.resolve(o+r.map[r.width*(r.height-1)+i.right-1]))),new e(t,n)},e.prototype.isRowSelection=function(){var t=ca.get(this.$anchorCell.node(-1)),e=this.$anchorCell.start(-1),n=t.colCount(this.$anchorCell.pos-e),r=t.colCount(this.$headCell.pos-e);if(Math.min(n,r)>0)return!1;var o=n+this.$anchorCell.nodeAfter.attrs.colspan,i=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,i)==t.width},e.prototype.eq=function(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos},e.rowSelection=function(t,n){void 0===n&&(n=t);var r=ca.get(t.node(-1)),o=t.start(-1),i=r.findCell(t.pos-o),s=r.findCell(n.pos-o),a=t.node(0);return i.left<=s.left?(i.left>0&&(t=a.resolve(o+r.map[i.top*r.width])),s.right<r.width&&(n=a.resolve(o+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(n=a.resolve(o+r.map[s.top*r.width])),i.right<r.width&&(t=a.resolve(o+r.map[r.width*(i.top+1)-1]))),new e(t,n)},e.prototype.toJSON=function(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}},e.fromJSON=function(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,n,r){return void 0===r&&(r=n),new e(t.resolve(n),t.resolve(r))},e.prototype.getBookmark=function(){return new Oa(this.$anchorCell.pos,this.$headCell.pos)},e}(te);Ma.prototype.visible=!1,te.jsonID("cell",Ma);var Oa=function(t,e){this.anchor=t,this.head=e};function Da(t){if(!(t.selection instanceof Ma))return null;var e=[];return t.selection.forEachCell((function(t,n){e.push(Bs.node(n,n+t.nodeSize,{class:"selectedCell"}))})),Fs.create(t.doc,e)}function Ia(t){if(!t.size)return null;for(var e=t.content,n=t.openStart,r=t.openEnd;1==e.childCount&&(n>0&&r>0||"table"==e.firstChild.type.spec.tableRole);)n--,r--,e=e.firstChild.content;var o=e.firstChild,s=o.type.spec.tableRole,a=o.type.schema,c=[];if("row"==s)for(var u=0;u<e.childCount;u++){var l=e.child(u).content,d=u?0:Math.max(0,n-1),f=u<e.childCount-1?0:Math.max(0,r-1);(d||f)&&(l=Aa(fa(a).row,new p(l,d,f)).content),c.push(l)}else{if("cell"!=s&&"header_cell"!=s)return null;c.push(n||r?Aa(fa(a).row,new p(e,n,r)).content:e)}return function(t,e){for(var n=[],r=0;r<e.length;r++)for(var o=e[r],s=o.childCount-1;s>=0;s--)for(var a=o.child(s).attrs,c=a.rowspan,u=a.colspan,l=r;l<r+c;l++)n[l]=(n[l]||0)+u;for(var d=0,p=0;p<n.length;p++)d=Math.max(d,n[p]);for(var f=0;f<n.length;f++)if(f>=e.length&&e.push(i.empty),n[f]<d){for(var h=fa(t).cell.createAndFill(),m=[],v=n[f];v<d;v++)m.push(h);e[f]=e[f].append(i.from(m))}return{height:e.length,width:d,rows:e}}(a,c)}function Aa(t,e){var n=t.createAndFill();return new wt(n).replace(0,n.content.size,e).doc}function Na(t,e,n){var r=t.width,o=t.height,s=t.rows;if(r!=e){for(var a=[],c=[],u=0;u<s.length;u++){for(var l=s[u],d=[],p=a[u]||0,f=0;p<e;f++){var h=l.child(f%l.childCount);p+h.attrs.colspan>e&&(h=h.type.create(Sa(h.attrs,h.attrs.colspan,p+h.attrs.colspan-e),h.content)),d.push(h),p+=h.attrs.colspan;for(var m=1;m<h.attrs.rowspan;m++)a[u+m]=(a[u+m]||0)+h.attrs.colspan}c.push(i.from(d))}s=c,r=e}if(o!=n){for(var v=[],g=0,y=0;g<n;g++,y++){for(var b=[],w=s[y%o],_=0;_<w.childCount;_++){var x=w.child(_);g+x.attrs.rowspan>n&&(x=x.type.create(Ca(x.attrs,"rowspan",Math.max(1,n-x.attrs.rowspan)),x.content)),b.push(x)}v.push(i.from(b))}s=v,o=n}return{width:r,height:o,rows:s}}function Ba(t,e,n,r,o,i,s,a){if(0==s||s==e.height)return!1;for(var c=!1,u=o;u<i;u++){var l=s*e.width+u,d=e.map[l];if(e.map[l-e.width]==d){c=!0;var p=n.nodeAt(d),f=e.findCell(d),h=f.top,m=f.left;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,Ca(p.attrs,"rowspan",s-h)),t.insert(t.mapping.slice(a).map(e.positionAt(s,m,n)),p.type.createAndFill(Ca(p.attrs,"rowspan",h+p.attrs.rowspan-s))),u+=p.attrs.colspan-1}}return c}function za(t,e,n,r,o,i,s,a){if(0==s||s==e.width)return!1;for(var c=!1,u=o;u<i;u++){var l=u*e.width+s,d=e.map[l];if(e.map[l-1]==d){c=!0;var p=n.nodeAt(d),f=e.colCount(d),h=t.mapping.slice(a).map(d+r);t.setNodeMarkup(h,null,Sa(p.attrs,s-f,p.attrs.colspan-(s-f))),t.insert(h+p.nodeSize,p.type.createAndFill(Sa(p.attrs,0,s-f))),u+=p.attrs.rowspan-1}}return c}function Pa(t,e,n,r,o){var s=n?t.doc.nodeAt(n-1):t.doc,a=ca.get(s),c=r.top,u=r.left,l=u+o.width,d=c+o.height,f=t.tr,h=0;function m(){s=n?f.doc.nodeAt(n-1):f.doc,a=ca.get(s),h=f.mapping.maps.length}(function(t,e,n,r,o,s,a){var c,u,l=fa(t.doc.type.schema);if(o>e.width)for(var d=0,p=0;d<e.height;d++){var f=n.child(d);p+=f.nodeSize;var h=[],m=void 0;m=null==f.lastChild||f.lastChild.type==l.cell?c||(c=l.cell.createAndFill()):u||(u=l.header_cell.createAndFill());for(var v=e.width;v<o;v++)h.push(m);t.insert(t.mapping.slice(a).map(p-1+r),h)}if(s>e.height){for(var g=[],y=0,b=(e.height-1)*e.width;y<Math.max(e.width,o);y++){var w=!(y>=e.width)&&n.nodeAt(e.map[b+y]).type==l.header_cell;g.push(w?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}for(var _=l.row.create(null,i.from(g)),x=[],k=e.height;k<s;k++)x.push(_);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),x)}return!(!c&&!u)})(f,a,s,n,l,d,h)&&m(),Ba(f,a,s,n,u,l,c,h)&&m(),Ba(f,a,s,n,u,l,d,h)&&m(),za(f,a,s,n,c,d,u,h)&&m(),za(f,a,s,n,c,d,l,h)&&m();for(var v=c;v<d;v++){var g=a.positionAt(v,u,s),y=a.positionAt(v,l,s);f.replace(f.mapping.slice(h).map(g+n),f.mapping.slice(h).map(y+n),new p(o.rows[v-c],0,0))}m(),f.setSelection(new Ma(f.doc.resolve(n+a.positionAt(c,u,s)),f.doc.resolve(n+a.positionAt(d-1,l-1,s)))),e(f)}Oa.prototype.map=function(t){return new Oa(t.map(this.anchor),t.map(this.head))},Oa.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=t.resolve(this.head);return"row"==e.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&e.index()<e.parent.childCount&&n.index()<n.parent.childCount&&wa(e,n)?new Ma(e,n):te.near(n,1)};var Ra=uo({ArrowLeft:La("horiz",-1),ArrowRight:La("horiz",1),ArrowUp:La("vert",-1),ArrowDown:La("vert",1),"Shift-ArrowLeft":Va("horiz",-1),"Shift-ArrowRight":Va("horiz",1),"Shift-ArrowUp":Va("vert",-1),"Shift-ArrowDown":Va("vert",1),Backspace:ja,"Mod-Backspace":ja,Delete:ja,"Mod-Delete":ja});function Fa(t,e,n){return!n.eq(t.selection)&&(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function La(t,e){return function(n,r,o){var i=n.selection;if(i instanceof Ma)return Fa(n,r,te.near(i.$headCell,e));if("horiz"!=t&&!i.empty)return!1;var s=qa(o,t,e);if(null==s)return!1;if("horiz"==t)return Fa(n,r,te.near(n.doc.resolve(i.head+e),e));var a,c=n.doc.resolve(s),u=ka(c,t,e);return a=u?te.near(u,1):e<0?te.near(n.doc.resolve(c.before(-1)),-1):te.near(n.doc.resolve(c.after(-1)),1),Fa(n,r,a)}}function Va(t,e){return function(n,r,o){var i=n.selection;if(!(i instanceof Ma)){var s=qa(o,t,e);if(null==s)return!1;i=new Ma(n.doc.resolve(s))}var a=ka(i.$headCell,t,e);return!!a&&Fa(n,r,new Ma(i.$anchorCell,a))}}function ja(t,e){var n=t.selection;if(!(n instanceof Ma))return!1;if(e){var r=t.tr,o=fa(t.schema).cell.createAndFill().content;n.forEachCell((function(t,e){t.content.eq(o)||r.replace(r.mapping.map(e+1),r.mapping.map(e+t.nodeSize-1),new p(o,0,0))})),r.docChanged&&e(r)}return!0}function $a(t,e){var n=ma(t.state.doc.resolve(e));return!!n&&(t.dispatch(t.state.tr.setSelection(new Ma(n))),!0)}function Wa(t,e,n){if(!va(t.state))return!1;var r=Ia(n),o=t.state.selection;if(o instanceof Ma){r||(r={width:1,height:1,rows:[i.from(Aa(fa(t.state.schema).cell,n))]});var s=o.$anchorCell.node(-1),a=o.$anchorCell.start(-1),c=ca.get(s).rectBetween(o.$anchorCell.pos-a,o.$headCell.pos-a);return r=Na(r,c.right-c.left,c.bottom-c.top),Pa(t.state,t.dispatch,a,c,r),!0}if(r){var u=ga(t.state),l=u.start(-1);return Pa(t.state,t.dispatch,l,ca.get(u.node(-1)).findCell(u.pos-l),r),!0}return!1}function Ha(t,e){if(!e.ctrlKey&&!e.metaKey){var n,r=Ja(t,e.target);if(e.shiftKey&&t.state.selection instanceof Ma)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&null!=(n=ma(t.state.selection.$anchor))&&Ka(t,e).pos!=n.pos)o(n,e),e.preventDefault();else if(!r)return;t.root.addEventListener("mouseup",i),t.root.addEventListener("dragstart",i),t.root.addEventListener("mousemove",s)}function o(e,n){var r=Ka(t,n),o=null==ha.getState(t.state);if(!r||!wa(e,r)){if(!o)return;r=e}var i=new Ma(e,r);if(o||!t.state.selection.eq(i)){var s=t.state.tr.setSelection(i);o&&s.setMeta(ha,e.pos),t.dispatch(s)}}function i(){t.root.removeEventListener("mouseup",i),t.root.removeEventListener("dragstart",i),t.root.removeEventListener("mousemove",s),null!=ha.getState(t.state)&&t.dispatch(t.state.tr.setMeta(ha,-1))}function s(n){var s,a=ha.getState(t.state);if(null!=a)s=t.state.doc.resolve(a);else if(Ja(t,n.target)!=r&&!(s=Ka(t,e)))return i();s&&o(s,n)}}function qa(t,e,n){if(!(t.state.selection instanceof re))return null;for(var r=t.state.selection.$head,o=r.depth-1;o>=0;o--){var i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){var s=r.before(o),a="vert"==e?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?s:null}}return null}function Ja(t,e){for(;e&&e!=t.dom;e=e.parentNode)if("TD"==e.nodeName||"TH"==e.nodeName)return e}function Ka(t,e){var n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?ma(t.state.doc.resolve(n.pos)):null}var Ua=new xe("fix-tables");function Ga(t,e){var n,r=function(e,r){"table"==e.type.spec.tableRole&&(n=function(t,e,n,r){var o=ca.get(e);if(!o.problems)return r;r||(r=t.tr);for(var i,s,a=[],c=0;c<o.height;c++)a.push(0);for(var u=0;u<o.problems.length;u++){var l=o.problems[u];if("collision"==l.type){for(var d=e.nodeAt(l.pos),p=0;p<d.attrs.rowspan;p++)a[l.row+p]+=l.n;r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,Sa(d.attrs,d.attrs.colspan-l.n,l.n))}else if("missing"==l.type)a[l.row]+=l.n;else if("overlong_rowspan"==l.type){var f=e.nodeAt(l.pos);r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,Ca(f.attrs,"rowspan",f.attrs.rowspan-l.n))}else if("colwidth mismatch"==l.type){var h=e.nodeAt(l.pos);r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,Ca(h.attrs,"colwidth",l.colwidth))}}for(var m=0;m<a.length;m++)a[m]&&(null==i&&(i=m),s=m);for(var v=0,g=n+1;v<o.height;v++){var y=e.child(v),b=g+y.nodeSize,w=a[v];if(w>0){var _="cell";y.firstChild&&(_=y.firstChild.type.spec.tableRole);for(var x=[],k=0;k<w;k++)x.push(fa(t.schema)[_].createAndFill());var C=0!=v&&i!=v-1||s!=v?b-1:g+1;r.insert(r.mapping.map(C),x)}g=b}return r.setMeta(Ua,{fixTables:!0})}(t,e,r,n))};return e?e.doc!=t.doc&&function t(e,n,r,o){var i=e.childCount,s=n.childCount;t:for(var a=0,c=0;a<s;a++){for(var u=n.child(a),l=c,d=Math.min(i,a+3);l<d;l++)if(e.child(l)==u){c=l+1,r+=u.nodeSize;continue t}o(u,r),c<i&&e.child(c).sameMarkup(u)?t(e.child(c),u,r+1,o):u.nodesBetween(0,u.content.size,o,r+1),r+=u.nodeSize}}(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Ya(t){var e,n=t.selection,r=ga(t),o=r.node(-1),i=r.start(-1),s=ca.get(o);return(e=n instanceof Ma?s.rectBetween(n.$anchorCell.pos-i,n.$headCell.pos-i):s.findCell(r.pos-i)).tableStart=i,e.map=s,e.table=o,e}function Xa(t,e,n){var r=e.map,o=e.tableStart,i=e.table,s=n>0?-1:0;Ea(r,i,n+s)&&(s=0==n||n==r.width?null:0);for(var a=0;a<r.height;a++){var c=a*r.width+n;if(n>0&&n<r.width&&r.map[c-1]==r.map[c]){var u=r.map[c],l=i.nodeAt(u);t.setNodeMarkup(t.mapping.map(o+u),null,Ta(l.attrs,n-r.colCount(u))),a+=l.attrs.rowspan-1}else{var d=null==s?fa(i.type.schema).cell:i.nodeAt(r.map[c+s]).type,p=r.positionAt(a,n,i);t.insert(t.mapping.map(o+p),d.createAndFill())}}return t}function Za(t,e){if(!va(t))return!1;if(e){var n=Ya(t);e(Xa(t.tr,n,n.left))}return!0}function Qa(t,e){if(!va(t))return!1;if(e){var n=Ya(t);e(Xa(t.tr,n,n.right))}return!0}function tc(t,e,n){for(var r=e.map,o=e.table,i=e.tableStart,s=t.mapping.maps.length,a=0;a<r.height;){var c=a*r.width+n,u=r.map[c],l=o.nodeAt(u);if(n>0&&r.map[c-1]==u||n<r.width-1&&r.map[c+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(i+u),null,Sa(l.attrs,n-r.colCount(u)));else{var d=t.mapping.slice(s).map(i+u);t.delete(d,d+l.nodeSize)}a+=l.attrs.rowspan}}function ec(t,e){if(!va(t))return!1;if(e){var n=Ya(t),r=t.tr;if(0==n.left&&n.right==n.map.width)return!1;for(var o=n.right-1;tc(r,n,o),o!=n.left;o--)n.table=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc,n.map=ca.get(n.table);e(r)}return!0}function nc(t,e,n){for(var r=fa(e.type.schema).header_cell,o=0;o<t.width;o++)if(e.nodeAt(t.map[o+n*t.width]).type!=r)return!1;return!0}function rc(t,e,n){for(var r=e.map,o=e.tableStart,i=e.table,s=o,a=0;a<n;a++)s+=i.child(a).nodeSize;var c=[],u=n>0?-1:0;nc(r,i,n+u)&&(u=0==n||n==r.height?null:0);for(var l=0,d=r.width*n;l<r.width;l++,d++)if(n>0&&n<r.height&&r.map[d]==r.map[d-r.width]){var p=r.map[d],f=i.nodeAt(p).attrs;t.setNodeMarkup(o+p,null,Ca(f,"rowspan",f.rowspan+1)),l+=f.colspan-1}else{var h=null==u?fa(i.type.schema).cell:i.nodeAt(r.map[d+u*r.width]).type;c.push(h.createAndFill())}return t.insert(s,fa(i.type.schema).row.create(null,c)),t}function oc(t,e){if(!va(t))return!1;if(e){var n=Ya(t);e(rc(t.tr,n,n.top))}return!0}function ic(t,e){if(!va(t))return!1;if(e){var n=Ya(t);e(rc(t.tr,n,n.bottom))}return!0}function sc(t,e,n){for(var r=e.map,o=e.table,i=e.tableStart,s=0,a=0;a<n;a++)s+=o.child(a).nodeSize;var c=s+o.child(n).nodeSize,u=t.mapping.maps.length;t.delete(s+i,c+i);for(var l=0,d=n*r.width;l<r.width;l++,d++){var p=r.map[d];if(n>0&&p==r.map[d-r.width]){var f=o.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(u).map(p+i),null,Ca(f,"rowspan",f.rowspan-1)),l+=f.colspan-1}else if(n<r.width&&p==r.map[d+r.width]){var h=o.nodeAt(p),m=h.type.create(Ca(h.attrs,"rowspan",h.attrs.rowspan-1),h.content),v=r.positionAt(n+1,l,o);t.insert(t.mapping.slice(u).map(i+v),m),l+=h.attrs.colspan-1}}}function ac(t,e){if(!va(t))return!1;if(e){var n=Ya(t),r=t.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(var o=n.bottom-1;sc(r,n,o),o!=n.top;o--)n.table=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc,n.map=ca.get(n.table);e(r)}return!0}function cc(t){var e=t.content;return 1==e.childCount&&e.firstChild.isTextblock&&0==e.firstChild.childCount}function uc(t,e){var n=t.selection;if(!(n instanceof Ma)||n.$anchorCell.pos==n.$headCell.pos)return!1;var r=Ya(t),o=r.map;if(function(t,e){for(var n=t.width,r=t.height,o=t.map,i=e.top*n+e.left,s=i,a=(e.bottom-1)*n+e.left,c=i+(e.right-e.left-1),u=e.top;u<e.bottom;u++){if(e.left>0&&o[s]==o[s-1]||e.right<n&&o[c]==o[c+1])return!0;s+=n,c+=n}for(var l=e.left;l<e.right;l++){if(e.top>0&&o[i]==o[i-n]||e.bottom<r&&o[a]==o[a+n])return!0;i++,a++}return!1}(o,r))return!1;if(e){for(var s,a,c=t.tr,u={},l=i.empty,d=r.top;d<r.bottom;d++)for(var p=r.left;p<r.right;p++){var f=o.map[d*o.width+p],h=r.table.nodeAt(f);if(!u[f])if(u[f]=!0,null==s)s=f,a=h;else{cc(h)||(l=l.append(h.content));var m=c.mapping.map(f+r.tableStart);c.delete(m,m+h.nodeSize)}}if(c.setNodeMarkup(s+r.tableStart,null,Ca(Ta(a.attrs,a.attrs.colspan,r.right-r.left-a.attrs.colspan),"rowspan",r.bottom-r.top)),l.size){var v=s+1+a.content.size,g=cc(a)?s+1:v;c.replaceWith(g+r.tableStart,v+r.tableStart,l)}c.setSelection(new Ma(c.doc.resolve(s+r.tableStart))),e(c)}return!0}function lc(t,e){var n=fa(t.schema);return dc((function(t){var e=t.node;return n[e.type.spec.tableRole]}))(t,e)}function dc(t){return function(e,n){var r,o,i=e.selection;if(i instanceof Ma){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;r=i.$anchorCell.nodeAfter,o=i.$anchorCell.pos}else{if(!(r=function(t){for(var e=t.depth;e>0;e--){var n=t.node(e).type.spec.tableRole;if("cell"===n||"header_cell"===n)return t.node(e)}return null}(i.$from)))return!1;o=ma(i.$from).pos}if(1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(n){var s=r.attrs,a=[],c=s.colwidth;s.rowspan>1&&(s=Ca(s,"rowspan",1)),s.colspan>1&&(s=Ca(s,"colspan",1));for(var u,l=Ya(e),d=e.tr,p=0;p<l.right-l.left;p++)a.push(c?Ca(s,"colwidth",c&&c[p]?[c[p]]:null):s);for(var f=l.top;f<l.bottom;f++){var h=l.map.positionAt(f,l.left,l.table);f==l.top&&(h+=r.nodeSize);for(var m=l.left,v=0;m<l.right;m++,v++)m==l.left&&f==l.top||d.insert(u=d.mapping.map(h+l.tableStart,1),t({node:r,row:f,col:m}).createAndFill(a[v]))}d.setNodeMarkup(o,t({node:r,row:l.top,col:l.left}),a[0]),i instanceof Ma&&d.setSelection(new Ma(d.doc.resolve(i.$anchorCell.pos),u&&d.doc.resolve(u))),n(d)}return!0}}function pc(t,e){return function(n,r){if(!va(n))return!1;var o=ga(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){var i=n.tr;n.selection instanceof Ma?n.selection.forEachCell((function(n,r){n.attrs[t]!==e&&i.setNodeMarkup(r,null,Ca(n.attrs,t,e))})):i.setNodeMarkup(o.pos,null,Ca(o.nodeAfter.attrs,t,e)),r(i)}return!0}}function fc(t,e,n){for(var r=e.map.cellsInRect({left:0,top:0,right:"row"==t?e.map.width:1,bottom:"column"==t?e.map.height:1}),o=0;o<r.length;o++){var i=e.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function hc(t,e){return(e=e||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(t){return function(e,n){if(!va(e))return!1;if(n){for(var r=fa(e.schema),o=Ya(e),i=e.tr,s=o.map.cellsInRect("column"==t?new aa(o.left,0,o.right,o.map.height):"row"==t?new aa(0,o.top,o.map.width,o.bottom):o),a=s.map((function(t){return o.table.nodeAt(t)})),c=0;c<s.length;c++)a[c].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[c],r.cell,a[c].attrs);if(0==i.steps.length)for(var u=0;u<s.length;u++)i.setNodeMarkup(o.tableStart+s[u],r.header_cell,a[u].attrs);n(i)}return!0}}(t):function(e,n){if(!va(e))return!1;if(n){var r=fa(e.schema),o=Ya(e),i=e.tr,s=fc("row",o,r),a=fc("column",o,r),c=("column"===t?s:"row"===t&&a)?1:0,u="column"==t?new aa(0,c,1,o.map.height):"row"==t?new aa(c,0,o.map.width,1):o,l="column"==t?a?r.cell:r.header_cell:"row"==t?s?r.cell:r.header_cell:r.cell;o.map.cellsInRect(u).forEach((function(t){var e=t+o.tableStart,n=i.doc.nodeAt(e);n&&i.setNodeMarkup(e,l,n.attrs)})),n(i)}return!0}}var mc=hc("row",{useDeprecatedLogic:!0}),vc=hc("column",{useDeprecatedLogic:!0}),gc=hc("cell",{useDeprecatedLogic:!0});function yc(t){return function(e,n){if(!va(e))return!1;var r=function(t,e){if(e<0){var n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(var r=t.index(-1)-1,o=t.before();r>=0;r--){var i=t.node(-1).child(r);if(i.childCount)return o-1-i.lastChild.nodeSize;o-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;for(var s=t.node(-1),a=t.indexAfter(-1),c=t.after();a<s.childCount;a++){var u=s.child(a);if(u.childCount)return c+1;c+=u.nodeSize}}}(ga(e),t);if(null!=r){if(n){var o=e.doc.resolve(r);n(e.tr.setSelection(re.between(o,ba(o))).scrollIntoView())}return!0}}}function bc(t,e){for(var n=t.selection.$anchor,r=n.depth;r>0;r--){if("table"==n.node(r).type.spec.tableRole)return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0}return!1}var wc=function(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),_c(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))};function _c(t,e,n,r,o,i){for(var s=0,a=!0,c=e.firstChild,u=t.firstChild,l=0,d=0;l<u.childCount;l++)for(var p=u.child(l).attrs,f=p.colspan,h=p.colwidth,m=0;m<f;m++,d++){var v=o==d?i:h&&h[m],g=v?v+"px":"";s+=v||r,v||(a=!1),c?(c.style.width!=g&&(c.style.width=g),c=c.nextSibling):e.appendChild(document.createElement("col")).style.width=g}for(;c;){var y=c.nextSibling;c.parentNode.removeChild(c),c=y}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}wc.prototype.update=function(t){return t.type==this.node.type&&(this.node=t,_c(t,this.colgroup,this.table,this.cellMinWidth),!0)},wc.prototype.ignoreMutation=function(t){return"attributes"==t.type&&(t.target==this.table||this.colgroup.contains(t.target))};var xc=new xe("tableColumnResizing");function kc(t){void 0===t&&(t={});var e=t.handleWidth;void 0===e&&(e=5);var n=t.cellMinWidth;void 0===n&&(n=25);var r=t.View;void 0===r&&(r=wc);var o=t.lastColumnResizable;return void 0===o&&(o=!0),new be({key:xc,state:{init:function(t,e){return this.spec.props.nodeViews[fa(e.schema).table.name]=function(t,e){return new r(t,n,e)},new Cc(-1,!1)},apply:function(t,e){return e.apply(t)}},props:{attributes:function(t){return xc.getState(t).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove:function(t,n){!function(t,e,n,r,o){var i=xc.getState(t.state);if(!i.dragging){var s=function(t){for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.classList.contains("ProseMirror")?null:t.parentNode;return t}(e.target),a=-1;if(s){var c=s.getBoundingClientRect(),u=c.left,l=c.right;e.clientX-u<=n?a=Sc(t,e,"left"):l-e.clientX<=n&&(a=Sc(t,e,"right"))}if(a!=i.activeHandle){if(!o&&-1!==a){var d=t.state.doc.resolve(a),p=d.node(-1),f=ca.get(p),h=d.start(-1);if(f.colCount(d.pos-h)+d.nodeAfter.attrs.colspan-1==f.width-1)return}Ec(t,a)}}}(t,n,e,0,o)},mouseleave:function(t){!function(t){var e=xc.getState(t.state);e.activeHandle>-1&&!e.dragging&&Ec(t,-1)}(t)},mousedown:function(t,e){!function(t,e,n){var r=xc.getState(t.state);if(-1==r.activeHandle||r.dragging)return!1;var o=t.state.doc.nodeAt(r.activeHandle),i=function(t,e,n){var r=n.colspan,o=n.colwidth,i=o&&o[o.length-1];if(i)return i;var s=t.domAtPos(e),a=s.node.childNodes[s.offset].offsetWidth,c=r;if(o)for(var u=0;u<r;u++)o[u]&&(a-=o[u],c--);return a/c}(t,r.activeHandle,o.attrs);function s(e){window.removeEventListener("mouseup",s),window.removeEventListener("mousemove",a);var r=xc.getState(t.state);r.dragging&&(!function(t,e,n){for(var r=t.state.doc.resolve(e),o=r.node(-1),i=ca.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,c=t.state.tr,u=0;u<i.height;u++){var l=u*i.width+a;if(!u||i.map[l]!=i.map[l-i.width]){var d=i.map[l],p=o.nodeAt(d).attrs,f=1==p.colspan?0:a-i.colCount(d);if(!p.colwidth||p.colwidth[f]!=n){var h=p.colwidth?p.colwidth.slice():Mc(p.colspan);h[f]=n,c.setNodeMarkup(s+d,null,Ca(p,"colwidth",h))}}}c.docChanged&&t.dispatch(c)}(t,r.activeHandle,Tc(r.dragging,e,n)),t.dispatch(t.state.tr.setMeta(xc,{setDragging:null})))}function a(e){if(!e.which)return s(e);var r=xc.getState(t.state),o=Tc(r.dragging,e,n);!function(t,e,n,r){var o=t.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),a=ca.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,c=t.domAtPos(o.start(-1)).node;for(;"TABLE"!=c.nodeName;)c=c.parentNode;_c(i,c.firstChild,c,r,a,n)}(t,r.activeHandle,o,n)}t.dispatch(t.state.tr.setMeta(xc,{setDragging:{startX:e.clientX,startWidth:i}})),window.addEventListener("mouseup",s),window.addEventListener("mousemove",a),e.preventDefault()}(t,e,n)}},decorations:function(t){var e=xc.getState(t);if(e.activeHandle>-1)return function(t,e){for(var n=[],r=t.doc.resolve(e),o=r.node(-1),i=ca.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan,c=0;c<i.height;c++){var u=a+c*i.width-1;if(!(a!=i.width&&i.map[u]==i.map[u+1]||0!=c&&i.map[u-1]==i.map[u-1-i.width])){var l=i.map[u],d=s+l+o.nodeAt(l).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",n.push(Bs.widget(d,p))}}return Fs.create(t.doc,n)}(t,e.activeHandle)},nodeViews:{}}})}var Cc=function(t,e){this.activeHandle=t,this.dragging=e};function Sc(t,e,n){var r=t.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return-1;var o=r.pos,i=ma(t.state.doc.resolve(o));if(!i)return-1;if("right"==n)return i.pos;var s=ca.get(i.node(-1)),a=i.start(-1),c=s.map.indexOf(i.pos-a);return c%s.width==0?-1:a+s.map[c-1]}function Tc(t,e,n){var r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Ec(t,e){t.dispatch(t.state.tr.setMeta(xc,{setHandle:e}))}function Mc(t){for(var e=[],n=0;n<t;n++)e.push(0);return e}function Oc(t){void 0===t&&(t={});var e=t.allowTableNodeSelection;return void 0===e&&(e=!1),new be({key:ha,state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(ha);if(null!=n)return-1==n?null:n;if(null==e||!t.docChanged)return e;var r=t.mapping.mapResult(e),o=r.deleted,i=r.pos;return o?null:i}},props:{decorations:Da,handleDOMEvents:{mousedown:Ha},createSelectionBetween:function(t){if(null!=ha.getState(t.state))return t.state.selection},handleTripleClick:$a,handleKeyDown:Ra,handlePaste:Wa},appendTransaction:function(t,n,r){return function(t,e,n){var r,o,i=(e||t).selection,s=(e||t).doc;if(i instanceof ie&&(o=i.node.type.spec.tableRole)){if("cell"==o||"header_cell"==o)r=Ma.create(s,i.from);else if("row"==o){var a=s.resolve(i.from+1);r=Ma.rowSelection(a,a)}else if(!n){var c=ca.get(i.node),u=i.from+1,l=u+c.map[c.width*c.height-1];r=Ma.create(s,u+1,l)}}else i instanceof re&&function(t){var e=t.$from,n=t.$to;if(e.pos==n.pos||e.pos<e.pos-6)return!1;for(var r=e.pos,o=n.pos,i=e.depth;i>=0&&!(e.after(i+1)<e.end(i));i--,r++);for(var s=n.depth;s>=0&&!(n.before(s+1)>n.start(s));s--,o--);return r==o&&/row|table/.test(e.node(i).type.spec.tableRole)}(i)?r=re.create(s,i.from):i instanceof re&&function(t){for(var e,n,r=t.$from,o=t.$to,i=r.depth;i>0;i--){var s=r.node(i);if("cell"===s.type.spec.tableRole||"header_cell"===s.type.spec.tableRole){e=s;break}}for(var a=o.depth;a>0;a--){var c=o.node(a);if("cell"===c.type.spec.tableRole||"header_cell"===c.type.spec.tableRole){n=c;break}}return e!==n&&0===o.parentOffset}(i)&&(r=re.create(s,i.$from.start(),i.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}(r,Ga(r,n),e)}})}Cc.prototype.apply=function(t){var e=this,n=t.getMeta(xc);if(n&&null!=n.setHandle)return new Cc(n.setHandle,null);if(n&&void 0!==n.setDragging)return new Cc(e.activeHandle,n.setDragging);if(e.activeHandle>-1&&t.docChanged){var r=t.mapping.map(e.activeHandle,-1);ya(t.doc.resolve(r))||(r=null),e=new Cc(r,e.dragging)}return e};var Dc=["blockquote",0],Ic=["hr"],Ac=["pre",["code",0]],Nc=["ol",0],Bc=["ul",0],zc=["li",0],Pc=function(t){for(var e,n={},r=t.attributes,o=0;o<r.length;o++)n[(e=r[o]).name]=e.value;return n},Rc=function(t){var e={};return t.forEach((function(t){e[t]={default:null}})),e},Fc=function(){return Rc(["style","class","id"])},Lc=function(t,e){for(var n in t)if(n&&null!==t[n]&&n!==e)return!0;return!1},Vc=function(t,e){var n={};for(var r in t)r&&null!==t[r]&&r!==e&&(n[r]=t[r]);return n},jc=function(t){var e;return(e={})[t]={name:t,inclusive:!0,parseDOM:[{tag:t}],toDOM:function(){return[t,0]}},e},$c=Be.__assign({link:{attrs:Be.__assign({},Fc(),{href:{default:null},target:{default:null},title:{default:null}}),inclusive:!1,parseDOM:[{tag:"a",getAttrs:Pc}],toDOM:function(t){return["a",Vc(t.attrs),0]}}},jc("strong"),jc("b"),jc("em"),jc("i"),jc("u"),jc("del"),jc("sub"),jc("sup"),jc("code"),{style:{attrs:Be.__assign({},Fc()),parseDOM:[{tag:"span",getAttrs:Pc}],toDOM:function(t){return Lc(t.attrs)?["span",Vc(t.attrs),0]:["span",0]}}}),Wc=function(t){var e;return(e={})[t]={default:null,getFromDOM:function(e){return e.getAttribute(t)},setDOMAttr:function(e,n){n[t]=e}},e},Hc=Be.__assign({},Wc("style"),Wc("class"),Wc("id"),Wc("headers")),qc={doc:{content:"colgroup*"},col:{attrs:Rc(["id","class","style","span"]),parseDOM:[{getAttrs:Pc,tag:"col"}],toDOM:function(t){return["col",t.attrs]}},colgroup:{attrs:Rc(["id","class","style","span"]),content:"col*",parseDOM:[{getAttrs:Pc,tag:"colgroup"}],toDOM:function(t){return["colgroup",t.attrs,0]}},text:{inline:!0,group:"inline"}},Jc=new Z({nodes:qc,marks:{}}),Kc=pa({tableGroup:"block",cellContent:"block+",cellAttributes:Hc});Kc.table_row.attrs=Be.__assign({},Kc.table_row.attrs,Rc([ke,"style","class","id"])),Kc.table_row.toDOM=function(t){return["tr",Vc(t.attrs),0]},Kc.table_row.parseDOM=[{tag:"tr",getAttrs:Pc}],Kc.table.attrs=Be.__assign({},Kc.table.attrs,Rc(["style","class","id","k-colgroup-data"])),Kc.table.toDOM=function(t){var e=Lc(t.attrs)?Vc(t.attrs,"k-colgroup-data"):{},n=null;if(t.attrs["k-colgroup-data"]&&!function(t){for(var e=!1,n=t.child(0),r=0;r<n.childCount;r++){if(n.child(r).attrs.colwidth){e=!0;break}}return e}(t)){var r=De(Me(t.attrs["k-colgroup-data"]),Jc,{preserveWhitespace:!1}),o=Oe(r).firstChild;if(o){var i=Array.from(o.children).map((function(t){return["col",Pc(t)]}));n=["colgroup",Pc(o)].concat(i)}}return n?["table",e,n,["tbody",0]]:["table",e,["tbody",0]]},Kc.table.parseDOM=[{tag:"table",getAttrs:function(t){var e=Pc(t),n=Array.from(t.childNodes).find((function(t){return"COLGROUP"===t.nodeName}));return n&&(e["k-colgroup-data"]=n.outerHTML),e}}];var Uc=Be.__assign({doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:Be.__assign({},Fc()),parseDOM:[{tag:"p",getAttrs:Pc}],toDOM:function(t){return Lc(t.attrs)?["p",Vc(t.attrs),0]:["p",0]}},div:{content:"block*",group:"block",attrs:Be.__assign({},Fc()),parseDOM:[{tag:"div",getAttrs:Pc}],toDOM:function(t){return Lc(t.attrs)?["div",Vc(t.attrs),0]:["div",0]}},blockquote:{attrs:Be.__assign({},Fc()),content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote",getAttrs:Pc}],toDOM:function(t){return Lc(t.attrs)?["blockquote",Vc(t.attrs),0]:Dc}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return Ic}},heading:{attrs:Be.__assign({},Fc(),{level:{default:1}}),content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",getAttrs:function(t){return Be.__assign({},Pc(t),{level:1})}},{tag:"h2",getAttrs:function(t){return Be.__assign({},Pc(t),{level:2})}},{tag:"h3",getAttrs:function(t){return Be.__assign({},Pc(t),{level:3})}},{tag:"h4",getAttrs:function(t){return Be.__assign({},Pc(t),{level:4})}},{tag:"h5",getAttrs:function(t){return Be.__assign({},Pc(t),{level:5})}},{tag:"h6",getAttrs:function(t){return Be.__assign({},Pc(t),{level:6})}}],toDOM:function(t){return Lc(t.attrs,"level")?["h"+t.attrs.level,Vc(t.attrs,"level"),0]:["h"+t.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM:function(){return Ac}},text:{inline:!0,group:"inline"},image:{inline:!0,attrs:Be.__assign({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}},Fc()),group:"inline",draggable:!0,parseDOM:[{tag:"img",getAttrs:Pc}],toDOM:function(t){return Lc(t.attrs)?["img",Vc(t.attrs)]:["img"]}},hard_break:{inline:!0,attrs:Be.__assign({},Fc()),group:"inline",selectable:!1,parseDOM:[{tag:"br",getAttrs:Pc}],toDOM:function(t){return Lc(t.attrs)?["br",Vc(t.attrs)]:["br"]}},ordered_list:{content:"list_item+",group:"block",attrs:Be.__assign({},Fc(),{type:{default:null},order:{default:1}}),parseDOM:[{tag:"ol",getAttrs:function(t){return Be.__assign({},Pc(t),{order:t.hasAttribute("start")?parseInt(t.getAttribute("start")||"1",10):1})}}],toDOM:function(t){return 1===t.attrs.order?Lc(t.attrs,"order")?["ol",Vc(t.attrs,"order"),0]:Nc:["ol",Be.__assign({},Vc(t.attrs,"order"),{start:t.attrs.order}),0]}},bullet_list:{content:"list_item+",group:"block",attrs:Be.__assign({},Fc()),parseDOM:[{tag:"ul",getAttrs:Pc}],toDOM:function(t){return Lc(t.attrs)?["ul",Vc(t.attrs),0]:Bc}},list_item:{content:"(paragraph | heading) block*",attrs:Be.__assign({},Fc()),parseDOM:[{tag:"li",getAttrs:Pc}],toDOM:function(t){return Lc(t.attrs)?["li",Vc(t.attrs),0]:zc},defining:!0}},Kc),Gc=function(){};Gc.prototype.append=function(t){return t.length?(t=Gc.from(t),!this.length&&t||t.length<200&&this.leafAppend(t)||this.length<200&&t.leafPrepend(this)||this.appendInner(t)):this},Gc.prototype.prepend=function(t){return t.length?Gc.from(t).append(this):this},Gc.prototype.appendInner=function(t){return new Xc(this,t)},Gc.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Gc.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Gc.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Gc.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Gc.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Gc.from=function(t){return t instanceof Gc?t:t&&t.length?new Yc(t):Gc.empty};var Yc=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var o=e;o<n;o++)if(!1===t(this.values[o],r+o))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var o=e-1;o>=n;o--)if(!1===t(this.values[o],r+o))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=200)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=200)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Gc);Gc.empty=new Yc([]);var Xc=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var o=this.left.length;return!(e<o&&!1===this.left.forEachInner(t,e,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(t,Math.max(e-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var o=this.left.length;return!(e>o&&!1===this.right.forEachInvertedInner(t,e-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(t,Math.min(e,o),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Gc),Zc=Gc,Qc=function(t,e){this.items=t,this.eventCount=e};Qc.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var r,o,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(r=this.remapping(i,this.items.length),o=r.maps.length);var s,a,c=t.tr,u=[],l=[];return this.items.forEach((function(t,e){if(!t.step)return r||(r=n.remapping(i,e+1),o=r.maps.length),o--,void l.push(t);if(r){l.push(new tu(t.map));var d,p=t.step.map(r.slice(o));p&&c.maybeStep(p).doc&&(d=c.mapping.maps[c.mapping.maps.length-1],u.push(new tu(d,null,null,u.length+l.length))),o--,d&&r.appendMap(d,o)}else c.maybeStep(t.step);return t.selection?(s=r?t.selection.map(r.slice(o)):t.selection,a=new Qc(n.items.slice(0,i).append(l.reverse().concat(u)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:a,transform:c,selection:s}},Qc.prototype.addTransform=function(t,e,n,r){for(var o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null,c=0;c<t.steps.length;c++){var u,l=t.steps[c].invert(t.docs[c]),d=new tu(t.mapping.maps[c],l,e);(u=a&&a.merge(d))&&(d=u,c?o.pop():s=s.slice(0,s.length-1)),o.push(d),e&&(i++,e=null),r||(a=d)}var p,f,h,m=i-n.depth;return m>nu&&(f=m,(p=s).forEach((function(t,e){if(t.selection&&0==f--)return h=e,!1})),s=p.slice(h),i-=m),new Qc(s.append(o),i)},Qc.prototype.remapping=function(t,e){var n=new yt;return this.items.forEach((function(e,r){var o=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,o)}),t,e),n},Qc.prototype.addMaps=function(t){return 0==this.eventCount?this:new Qc(this.items.append(t.map((function(t){return new tu(t)}))),this.eventCount)},Qc.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],r=Math.max(0,this.items.length-e),o=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach((function(t){t.selection&&s--}),r);var a=e;this.items.forEach((function(e){var r=o.getMirror(--a);if(null!=r){i=Math.min(i,r);var c=o.maps[r];if(e.step){var u=t.steps[r].invert(t.docs[r]),l=e.selection&&e.selection.map(o.slice(a+1,r));l&&s++,n.push(new tu(c,u,l))}else n.push(new tu(c))}}),r);for(var c=[],u=e;u<i;u++)c.push(new tu(o.maps[u]));var l=this.items.slice(0,r).append(c).append(n),d=new Qc(l,s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d},Qc.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},Qc.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,r=[],o=0;return this.items.forEach((function(i,s){if(s>=t)r.push(i),i.selection&&o++;else if(i.step){var a=i.step.map(e.slice(n)),c=a&&a.getMap();if(n--,c&&e.appendMap(c,n),a){var u=i.selection&&i.selection.map(e.slice(n));u&&o++;var l,d=new tu(c.invert(),a,u),p=r.length-1;(l=r.length&&r[p].merge(d))?r[p]=l:r.push(d)}}else i.map&&n--}),this.items.length,0),new Qc(Zc.from(r.reverse()),o)},Qc.empty=new Qc(Zc.empty,0);var tu=function(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r};tu.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new tu(e.getMap().invert(),e,this.selection)}};var eu=function(t,e,n,r){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r},nu=20;function ru(t){var e=[];return t.forEach((function(t,n,r,o){return e.push(r,o)})),e}function ou(t,e){if(!t)return null;for(var n=[],r=0;r<t.length;r+=2){var o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function iu(t,e,n,r){var o=cu(e),i=lu.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,o);if(s){var a=s.selection.resolve(s.transform.doc),c=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,o),u=new eu(r?c:s.remaining,r?s.remaining:c,null,0);n(s.transform.setSelection(a).setMeta(lu,{redo:r,historyState:u}).scrollIntoView())}}var su=!1,au=null;function cu(t){var e=t.plugins;if(au!=e){su=!1,au=e;for(var n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){su=!0;break}}return su}function uu(t){return t.setMeta(du,!0)}var lu=new xe("history"),du=new xe("closeHistory");function pu(t){return t={depth:t&&t.depth||100,newGroupDelay:t&&t.newGroupDelay||500},new be({key:lu,state:{init:function(){return new eu(Qc.empty,Qc.empty,null,0)},apply:function(e,n,r){return function(t,e,n,r){var o,i=n.getMeta(lu);if(i)return i.historyState;n.getMeta(du)&&(t=new eu(t.done,t.undone,null,0));var s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(lu))return s.getMeta(lu).redo?new eu(t.done.addTransform(n,null,r,cu(e)),t.undone,ru(n.mapping.maps[n.steps.length-1]),t.prevTime):new eu(t.done,t.undone.addTransform(n,null,r,cu(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new eu(t.done.rebased(n,o),t.undone.rebased(n,o),ou(t.prevRanges,n.mapping),t.prevTime):new eu(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ou(t.prevRanges,n.mapping),t.prevTime);var a=0==t.prevTime||!s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;var n=!1;return t.mapping.maps[0].forEach((function(t,r){for(var o=0;o<e.length;o+=2)t<=e[o+1]&&r>=e[o]&&(n=!0)})),n}(n,t.prevRanges)),c=s?ou(t.prevRanges,n.mapping):ru(n.mapping.maps[n.steps.length-1]);return new eu(t.done.addTransform(n,a?e.selection.getBookmark():null,r,cu(e)),Qc.empty,c,n.time)}(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput:function(t,e){var n="historyUndo"==e.inputType?fu(t.state,t.dispatch):"historyRedo"==e.inputType&&hu(t.state,t.dispatch);return n&&e.preventDefault(),n}}}})}function fu(t,e){var n=lu.getState(t);return!(!n||0==n.done.eventCount)&&(e&&iu(n,t,e,!1),!0)}function hu(t,e){var n=lu.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&iu(n,t,e,!0),!0)}function mu(t){var e=lu.getState(t);return e?e.done.eventCount:0}function vu(t){var e=lu.getState(t);return e?e.undone.eventCount:0}var gu=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,r,o){var i=n;if(e[1]){var s=e[0].lastIndexOf(e[1]);i+=e[0].slice(s+e[1].length);var a=(r+=s)-o;a>0&&(i=e[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}):e};function yu(t){var e=t.rules,n=new be({state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,r,o,i){return bu(t,r,o,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var r=t.state.selection.$cursor;r&&bu(t,r.pos,r.pos,"",e,n)}))}}},isInputRules:!0});return n}function bu(t,e,n,r,o,i){if(t.composing)return!1;var s=t.state,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;for(var c=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,null,"")+r,u=0;u<o.length;u++){var l=o[u].match.exec(c),d=l&&o[u].handler(s,l,e-(l[0].length-r.length),n);if(d)return t.dispatch(d.setMeta(i,{transform:d,from:e,to:n,text:r})),!0}return!1}function wu(t,e){for(var n=t.plugins,r=0;r<n.length;r++){var o=n[r],i=void 0;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){for(var s=t.tr,a=i.transform,c=a.steps.length-1;c>=0;c--)s.step(a.steps[c].invert(a.docs[c]));if(i.text){var u=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,u))}else s.delete(i.from,i.to);e(s)}return!0}}return!1}var _u=new gu(/--$/,"—"),xu=new gu(/\.\.\.$/,"…"),ku=new gu(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),Cu=new gu(/"$/,"”"),Su=new gu(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),Tu=new gu(/'$/,"’"),Eu=[ku,Cu,Su,Tu];function Mu(t,e,n,r){return new gu(t,(function(t,o,i,s){var a=n instanceof Function?n(o):n,c=t.tr.delete(i,s),u=c.doc.resolve(i).blockRange(),l=u&&It(u,e,a);if(!l)return null;c.wrap(u,l);var d=c.doc.resolve(i-1).nodeBefore;return d&&d.type==e&&Bt(c.doc,i-1)&&(!r||r(o,d))&&c.join(i-1),c}))}function Ou(t,e,n){return new gu(t,(function(t,r,o,i){var s=t.doc.resolve(o),a=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e)?t.tr.delete(o,i).setBlockType(o,o,e,a):null}))}var Du={mark:"strong",altMarks:["b"],altStyle:{name:"font-weight",value:/^(bold(er)?|[5-9]\d{2,})$/}},Iu={mark:"em",altMarks:["i"],altStyle:{name:"font-style",value:/^italic$/i}},Au={mark:"u",altStyle:{name:"text-decoration",value:/^underline$/i}},Nu={mark:"del",altStyle:{name:"text-decoration",value:/^line-through$/i}},Bu={mark:"sub"},zu={mark:"sup"},Pu={mark:"link"},Ru="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Fu=function(t,e){var n={},r=e&&e.applyToWord||!1;if(n["Mod-z"]=fu,n["Shift-Mod-z"]=hu,n.Backspace=yr(wu,Hn,qn,Kn),n.Enter=yr(er,or,ir,ar),Ru||(n["Mod-y"]=hu),t.marks.strong&&(n["Mod-b"]=Ke(un,Be.__assign({},Du,{applyToWord:r}))),t.marks.em&&(n["Mod-i"]=Ke(un,Be.__assign({},Iu,{applyToWord:r}))),t.marks.u&&(n["Mod-u"]=Ke(un,Be.__assign({},Au,{applyToWord:r}))),t.nodes.hard_break){var o=t.nodes.hard_break,i=yr(rr,(function(t,e){return e(t.tr.replaceSelectionWith(o.create()).scrollIntoView()),!0}));n["Shift-Enter"]=i}return n},Lu=function(t){var e,n={};return t.nodes.list_item&&(n.Enter=(e=t.nodes.list_item,function(t,n){return Pn(e)(t,(function(e){var r=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();r&&e.ensureMarks(r),n(e)}))})),n},Vu=/style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi,ju=function(t){return/^MsoListParagraph/.test(t.className)},$u=function(t){var e=t.innerHTML;return e=(e=e.replace(/<!--(.|\s)*?-->/gi,"")).replace(/<\/?[^>]+?\/?>/gm,"")},Wu=function(t,e){var n=document.createElement(t);return n.style.listStyleType=e,n},Hu=function(t){var e=null;return/^\d/.test(t)||(e=(/^[a-z]/.test(t)?"lower-":"upper-")+(/^[ivxlcdm]/i.test(t)?"roman":"alpha")),e},qu=function(t,e){var n=[];Array.from(t).forEach((function(t){if(t.nodeType===Node.ELEMENT_NODE){var r=t;r.getAttribute("datalist")?(n.push(t),e.add(n)):ju(r)&&n.length?n.push(t):(n=[],"DIV"===r.nodeName?qu(r.children,e):"TABLE"===r.nodeName&&Array.from(r.querySelectorAll("td,th")).forEach((function(t){qu(t.children,e)})))}}))},Ju=function(t){var e,n=t.innerHTML,r=function(t){return t.replace(/^(?:&nbsp;|[\u00a0\n\r\s])+/,"")};return n=n.replace(/<\/?\w+[^>]*>/g,"").replace(/&nbsp;/g," "),/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(n)?{tag:"ul",style:(e=r($u(t)),/^[\u2022\u00b7\u00FC\u00D8\u002dv-]/.test(e)?null:/^o/.test(e)?"circle":"square")}:/^\s*\w+[\.\)][\u00a0 ]{2,}/.test(n)?{tag:"ol",style:Hu(r($u(t)))}:void 0},Ku=function(t){var e,n=t.nodeName.toLowerCase();t.firstChild&&t.firstChild.nodeType===Node.COMMENT_NODE&&t.removeChild(t.firstChild),1===t.childNodes.length?e=t.firstChild.nodeType===Node.TEXT_NODE?$u(t):t.firstChild.innerHTML.replace(/^\w+[\.\)](&nbsp;)+ /,""):(t.removeChild(t.firstChild),3===t.firstChild.nodeType&&/^[ivxlcdm]+\.$/i.test(t.firstChild.nodeValue)&&t.removeChild(t.firstChild),/^(&nbsp;|\s)+$/i.test(t.firstChild.innerHTML)&&t.removeChild(t.firstChild),e="p"!==n?"<"+n+">"+t.innerHTML+"</"+n+">":t.innerHTML),t.parentNode.removeChild(t);var r=document.createElement("li");return r.innerHTML=e,r},Uu=function(t){var e=document.createElement("div");e.innerHTML=function(t){return t=t.replace(Vu,(function(t,e,n){return'datalist="'+e+'" datalevel="'+n+'" '+t}))}(t);var n=new Set;return qu(e.children,n),n.forEach((function(t){return function(t){var e,n,r,o,i,s,a,c,u,l,d,p,f,h=-1,m={};for(c=0;c<t.length;c++){var v=(f={datalist:(u=t[c]).getAttribute("datalist"),datalevel:u.getAttribute("datalevel")}).datalist,g=Ju(u);if(l=g&&g.tag){if(d=f.datalevel||parseFloat(u.style.marginLeft||0),f.datalevel||u.style.marginLeft){var y=l+v;m[d]||(m[d]={}),(!n||n<0)&&(n=d,r=v,o=(a=t.filter((function(t){return t.getAttribute("datalist")===String(r)})))[a.length-1],s=Wu(l,g&&g.style),u.parentNode.insertBefore(s,u),h=d,m[d][y]=s),i=o===u,p=m[d][y],(d>h||!p)&&(p=Wu(l,g&&g.style),m[d][y]=p,e.appendChild(p)),e=Ku(u),p.appendChild(e),i?n=h=-1:h=d}}else!e||i&&!ju(u)||(u.style.marginLeft&&(u.style.marginLeft=""),u.style.marginLeft&&(u.style.margin=""),e.appendChild(u))}}(t)})),e.innerHTML},Gu=function(t){return t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/,"$1")).replace(/<\/?[ovw]:[^>]*?>/gi,"")).replace(/<\\?\??xml[^>]*>/gi,"")).replace(/<(?:link|meta) [^>]+?>/gi,"")).replace(/<style[^>]*?>\s*<\/style>/gi,"")).replace(/<\/?st1:.*?>/gi,"")).replace(/<a name="[a-zA-Z0-9_]+">/gim,"")).replace(/v:shapes?="[^"]+"/gi,"")).replace(/<!\[if !supportLists\]>/gi,"")).replace(/<!\[endif\]>/gi,"")},Yu=function(t){return t.replace(/<!--[\s\S]+?-->/g,"")},Xu=function(t,e){return t.replace(new RegExp("<\\/?("+e+")(?:\\s[^>]*?)?>","gi"),"")},Zu=function(t){t.ownerElement&&t.ownerElement.removeAttribute(t.name)},Qu=function(t){/^Mso/.test(t.value)&&Zu(t)},tl=/\s*;\s*/,el=/\s*:\s*/,nl=function(t){var e,n,r=t.value.split(tl).filter((function(t){return Boolean(t)})),o=t.ownerElement.style,i="";r.forEach((function(t){var r;r=t.split(el),e=r[0],n=r[1],void 0!==o[e]&&(i+=e+": "+n+"; ")})),(i=i.trim())?t.value=i:Zu(t)},rl=function(t,e){var n=t;if(e.convertMsLists&&(n=Uu(n)),e.stripTags&&(n=Xu(n,e.stripTags)),e.attributes){var r=document.createElement("div");r.innerHTML=n,Array.from(r.querySelectorAll("*")).forEach((function(t){return function(t,e){if(t.nodeType===Node.ELEMENT_NODE){for(var n=t.attributes.length-1;n>=0;n--){var r=t.attributes[n];e[r.name]?e[r.name](r):e["*"]&&e["*"](r)}"SPAN"===t.nodeName&&0===t.attributes.length&&function(t){var e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}(t)}}(t,e.attributes)})),n=r.innerHTML}return n};function ol(t){for(var e=t.length,n=new Array(e/2),r=0;r<e;r+=2)n[r]=String.fromCharCode(parseInt(t.substring(r,r+2),16));return btoa(n.join(""))}var il=/<img\s[^>]*?src=(?:'|")file:\/[^'"]+(?:'|")[^>]*>/gi,sl=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,al=new RegExp("(?:("+sl.source+"))([\\da-fA-F\\s]+)\\}","g"),cl=/[^\da-fA-F]/g,ul=/file:\/[^'"]+\.(jpg|png|gif)/i,ll=/\\(png|jpeg)blip\\/,dl=function(t,e){var n=t.match(il);if(!n||-1===e.types.indexOf("text/rtf"))return t;var r=e.getData("text/rtf"),o=[],i=r.match(al);if(!r||!i)return t;for(var s=0,a=i;s<a.length;s++){var c=a[s],u=ll.exec(c);if(u){var l=c.replace(sl,"").replace(cl,"");o.push("data:image/"+u[1]+";base64,"+ol(l))}}return n.length!==o.length?t:t.replace(il,(function(t){var e=o.shift()||"";return t.replace(ul,e)}))},pl=function(t,e,n,r,o){var i,s,a,c,u,l,d=[],p=[],f=e.matchCase,h=e.matchWord,m=e.useRegExp,v=e.text;if(m&&(/^\\$/.test(v)||/[^\\]\\$/.test(v))&&(v=v.substring(0,v.length-1)),!v)return d;var g=f?"g":"gi",y=m?new RegExp(v,g):bl(v,g);return t.nodesBetween(n,r,(function(e,f,m){if(o(d))return!1;e.inlineContent&&f+e.content.size>=n&&(p.length=0,e.nodesBetween(0,e.content.size,(function(e,m,v,g){if(o(d))return!1;var b=1+f+m;if(e.isText&&b+e.nodeSize>=n){if(u=e.text||"",l=v.childCount-1>=g+1&&v.child(g+1),p.push(n<=b?{text:u,start:b}:{text:u.slice(n-b),start:n}),l&&l.isText)return;for(s=p.map((function(t){return t.text})).join(""),i=y.exec(s);null!==i&&(a=p[0].start+i.index,c=a+i[0].length,n<=a&&r>=c&&yl(i,h)&&d.push(re.create(t,a,c)),!o(d));)i=y.exec(s)}else p.length=0})))})),d},fl=function(t,e){var n=e.backward,r=e.matchCyclic,o=Be.__rest(e,["backward","matchCyclic"]),i=n?function(){return!1}:function(t){return t.length>0},s=t.doc,a=t.selection,c=[];return n?!(c=pl(s,o,0,a.from,i)).length&&r&&(c=pl(s,o,a.from,s.content.size,i)):!(c=pl(s,o,a.to,s.content.size,i)).length&&r&&(c=pl(s,o,0,a.to,i)),c.length?c[c.length-1]:null},hl=function(t,e){return pl(t,e,0,t.content.size,(function(){return!1}))},ml=function(t,e,n){var r=t.from,o=t.to;return n.insertText(e,r,o).setSelection(re.create(n.doc,r,r+e.length)),n},vl=function(t,e,n){var r=hl(t.doc,n);if(0===r.length)return null;for(var o=t.tr,i=r.length-1;i>=0;i--)o.insertText(e,r[i].from,r[i].to);return o},gl=/^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/,yl=function(t,e){if(e){if(!0===e){var n=t.input,r=n.charAt(t.index-1),o=n.charAt(t.index+t[0].length);return gl.test(r)&&gl.test(o)}return e(t)}return!0},bl=function(t,e){var n=t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(/\s/g,"\\s");return new RegExp(n,e)};function wl(t){var e={class:"k-placeholder","data-placeholder":t};return new be({key:new xe("placeholder"),props:{decorations:function(t){var n=t.doc,r=n.content.firstChild;if(!(0===n.childCount||1===n.childCount&&r.inlineContent&&0===r.childCount))return Fs.empty;var o=[];return n.descendants((function(t,n){o.push(Bs.node(n,n+t.nodeSize,e))})),Fs.create(n,o)}}})}var _l=/\s+/g,xl=/text-align/,kl=function(){return new be({key:new xe("spaces-fix"),props:{decorations:function(t){var e,n,r,o,i=[],s=t.doc;return s.nodesBetween(0,s.content.size,(function(t,s,a){if(t.type.isText&&function(t){return xl.test(t&&t.attrs&&t.attrs.style||"")}(a))for(n=_l.exec(t.text||"");null!==n;){if(e=s+n.index,r=n[0].length,n.index+r<n.input.length)for(o=0;o<=r-1;o+=2)i.push(Bs.inline(e+o,e+o+1,{style:"white-space: normal"}));n=_l.exec(t.text||"")}})),Fs.create(s,i)}}})},Cl=new xe("highlight");function Sl(t){return void 0===t&&(t=Cl),new be({key:t,state:{init:function(){return null},apply:function(t){return t.getMeta(this.spec.key)}},props:{decorations:function(t){var e=(this.spec.key.getState(t)||[]).map((function(t){return Bs.inline(t.from,t.to,t.attrs)}));return Fs.create(t.doc,e)}}})}var Tl=new xe("image-resize"),El={southeast:{x:1,y:1},east:{x:1,y:0},south:{x:0,y:1},north:{x:0,y:-1},west:{x:-1,y:0},southwest:{x:-1,y:1},northwest:{x:-1,y:-1},northeast:{x:1,y:-1}},Ml=Object.keys(El),Ol=function(t,e,n){t.style[e]=n+"px"},Dl=/[^\-]width:|[^\-]height:/,Il=/^.+$/,Al=function(){function t(t,e,n,r){this.activeHandle=t,this.dragging=e,this.rect=n,this.nodePosition=r}return t.prototype.apply=function(e){var n=e.getMeta(Tl);return n?new t(n.activeHandle,n.setDragging,n.rect,n.nodePosition):this},t}(),Nl=function(t,e,n){var r=e.target.getAttribute("data-direction");if(!r)return!1;var o=Tl.getState(t.state);e.preventDefault();var i=t.state.tr;function s(e){!function(t,e,n){var r=Tl.getState(t.state),o=r.rect,i=r.dragging,s=r.nodePosition,a=r.activeHandle;if(i&&o){var c=t.nodeDOM(s),u=El[a],l=(e.clientX-i.startX)*u.x,d=(e.clientY-i.startY)*u.y,p=u.x?l+c.width:o.width,f=u.y?d+c.height:o.height;if(n.lockRatio&&u.x&&u.y){var h=Math.min(p/c.width,f/c.height),m=c.width*h,v=c.height*h;i.startX=e.clientX-(p-m)*u.x,i.startY=e.clientY-(f-v)*u.y,p=m,f=v}else i.startX=u.x?e.clientX:i.startX,i.startY=u.y?e.clientY:i.startY;Ol(c,"width",p),Ol(c,"height",f),o.top=c.offsetTop,o.left=c.offsetLeft,o.width=c.offsetWidth,o.height=c.offsetHeight;var g=c.nextElementSibling;g.style.width=o.width+"px",g.style.height=o.height+"px",g.style.top=o.top+"px",g.style.left=o.left+"px"}}(t,e,n)}return i.setMeta(Tl,{setDragging:{startX:e.clientX,startY:e.clientY},activeHandle:r,rect:o.rect,nodePosition:o.nodePosition}),i.setMeta("addToHistory",!1),t.dispatch(i),e.view.addEventListener("mouseup",(function e(n){n.view.removeEventListener("mouseup",e),n.view.removeEventListener("mousemove",s),function(t){var e=Tl.getState(t.state),n=e.rect,r=e.dragging,o=e.nodePosition;if(r&&n){var i=t.state.selection;if(i instanceof ie){var s=i.node.attrs,a=n.width,c=n.height,u=void 0;if(Dl.test(s.style||"")){var l=ze(s.style,{style:"width",value:Il,newValue:a+"px"}),d=ze(l.style||"",{style:"height",value:Il,newValue:c+"px"}).style;u=Be.__assign({},s,{style:d})}else u=Be.__assign({},s,{width:a,height:c});var p=i.node.type.createAndFill(u);if(p){var f=t.state.tr;f.replaceWith(o,o+1,p),f.setSelection(ie.create(f.doc,o)),f.setMeta("commandName","image-resize"),f.setMeta("args",u),f.setMeta(Tl,{setDragging:null,activeHandle:null,rect:n,nodePosition:o}),t.dispatch(f)}}}}(t)})),e.view.addEventListener("mousemove",s),!0},Bl=function(t){return void 0===t&&(t={node:"image",lockRatio:!0}),new be({key:Tl,view:function(e){return{resize:function(){Tl.getState(e.state).rect&&e.dispatch(e.state.tr.setMeta("resize",!0))},get window(){return e.dom.ownerDocument&&e.dom.ownerDocument.defaultView},attachResize:function(){var t=this.window;t&&(t.removeEventListener("resize",this.resize),t.addEventListener("resize",this.resize))},removeResize:function(){var t=this.window;t&&t.removeEventListener("resize",this.resize)},update:function(e,n){var r=e.state,o=r.selection,i=r.schema.nodes[t.node],s=Tl.getState(r),a=s.rect;if(o instanceof ie&&i===o.node.type){var c=e.nodeDOM(o.from),u={top:c.offsetTop,left:c.offsetLeft,width:c.offsetWidth,height:c.offsetHeight};if(!n.selection.eq(o)||a&&(a.width!==u.width||a.height!==u.height||a.top!==u.top||a.left!==u.left)){var l=r.tr;l.setMeta(Tl,{rect:u,nodePosition:o.from}),e.dispatch(l),this.attachResize()}}else a&&(s.rect=null,s.nodePosition=-1)},destroy:function(){this.removeResize()}}},state:{init:function(){return new Al("",null,null,-1)},apply:function(t,e){return e.apply(t)}},props:{handleDOMEvents:{mousedown:function(e,n){return Nl(e,n,t)}},decorations:function(e){var n=e.selection,r=e.schema.nodes[t.node],o=Tl.getState(e).rect;if(o&&n instanceof ie&&r===n.node.type){var i=document.createElement("div");i.className="k-editor-resize-handles-wrapper",i.style.width=o.width+"px",i.style.height=o.height+"px",i.style.top=o.top+"px",i.style.left=o.left+"px";for(var s=0;s<Ml.length;s++){var a=document.createElement("div");a.className="k-editor-resize-handle "+Ml[s],a.setAttribute("data-direction",Ml[s]),i.appendChild(a)}return Fs.create(e.doc,[Bs.widget(e.selection.from+1,i)])}return Fs.empty}}})},zl=new xe("caret-color");function Pl(){return new be({key:zl,props:{decorations:function(t){var e=t.doc,n=t.selection,r=t.storedMarks;if(!n.empty||!r)return Fs.empty;var o=tn((r||[]).find((function(t){return"style"===t.type.name})),{name:"color",value:/^.+$/});if(!o)return Fs.empty;var i=n.$anchor.parent,s=[];return e.descendants((function(t,e){t.eq(i)&&s.push(Bs.node(e,e+t.nodeSize,{style:"caret-color: "+o}))})),Fs.create(e,s)}}})}function Rl(t){return void 0===t&&(t={}),new be({view:function(e){return new Fl(e,t)}})}var Fl=function(t,e){var n=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var r=function(t){return n[e](t)};return t.dom.addEventListener(e,r),{name:e,handler:r}}))};Fl.prototype.destroy=function(){var t=this;this.handlers.forEach((function(e){var n=e.name,r=e.handler;return t.editorView.dom.removeEventListener(n,r)}))},Fl.prototype.update=function(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())},Fl.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},Fl.prototype.updateOverlay=function(){var t,e=this.editorView.state.doc.resolve(this.cursorPos);if(!e.parent.inlineContent){var n=e.nodeBefore,r=e.nodeAfter;if(n||r){var o=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:o.left,right:o.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!t){var s=this.editorView.coordsAtPos(this.cursorPos);t={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}var a,c,u=this.editorView.dom.offsetParent;if(this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color),!u||u==document.body&&"static"==getComputedStyle(u).position)a=-pageXOffset,c=-pageYOffset;else{var l=u.getBoundingClientRect();a=l.left-u.scrollLeft,c=l.top-u.scrollTop}this.element.style.left=t.left-a+"px",this.element.style.top=t.top-c+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"},Fl.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.setCursor(null)}),t)},Fl.prototype.dragover=function(t){if(this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),n=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,e):r;if(e&&!o){var i=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&null==(i=Ft(this.editorView.state.doc,i,this.editorView.dragging.slice)))return this.setCursor(null);this.setCursor(i),this.scheduleRemoval(5e3)}}},Fl.prototype.dragend=function(){this.scheduleRemoval(20)},Fl.prototype.drop=function(){this.scheduleRemoval(20)},Fl.prototype.dragleave=function(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)};var Ll=function(t){function e(e){t.call(this,e,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,r){var o=n.resolve(r.map(this.head));return e.valid(o)?new e(o):t.near(o)},e.prototype.content=function(){return p.empty},e.prototype.eq=function(t){return t instanceof e&&t.head==this.head},e.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new e(t.resolve(n.pos))},e.prototype.getBookmark=function(){return new Vl(this.anchor)},e.valid=function(t){var e=t.parent;if(e.isTextblock||!function(t){for(var e=t.depth;e>=0;e--){var n=t.index(e),r=t.node(e);if(0!=n)for(var o=r.child(n-1);;o=o.lastChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(t)||!function(t){for(var e=t.depth;e>=0;e--){var n=t.indexAfter(e),r=t.node(e);if(n!=r.childCount)for(var o=r.child(n);;o=o.firstChild){if(0==o.childCount&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(t))return!1;var n=e.type.spec.allowGapCursor;if(null!=n)return n;var r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock},e.findFrom=function(t,n,r){t:for(;;){if(!r&&e.valid(t))return t;for(var o=t.pos,i=null,s=t.depth;;s--){var a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.child(n>0?t.indexAfter(s):t.index(s)-1);break}if(0==s)return null;o+=n;var c=t.doc.resolve(o);if(e.valid(c))return c}for(;;){var u=n>0?i.firstChild:i.lastChild;if(!u){if(i.isAtom&&!i.isText&&!ie.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue t}break}i=u,o+=n;var l=t.doc.resolve(o);if(e.valid(l))return l}return null}},e}(te);Ll.prototype.visible=!1,te.jsonID("gapcursor",Ll);var Vl=function(t){this.pos=t};Vl.prototype.map=function(t){return new Vl(t.map(this.pos))},Vl.prototype.resolve=function(t){var e=t.resolve(this.pos);return Ll.valid(e)?new Ll(e):te.near(e)};var jl=function(){return new be({props:{decorations:ql,createSelectionBetween:function(t,e,n){if(e.pos==n.pos&&Ll.valid(n))return new Ll(n)},handleClick:Hl,handleKeyDown:$l}})},$l=uo({ArrowLeft:Wl("horiz",-1),ArrowRight:Wl("horiz",1),ArrowUp:Wl("vert",-1),ArrowDown:Wl("vert",1)});function Wl(t,e){var n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,r,o){var i=t.selection,s=e>0?i.$to:i.$from,a=i.empty;if(i instanceof re){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=t.doc.resolve(e>0?s.after():s.before())}var c=Ll.findFrom(s,e,a);return!!c&&(r&&r(t.tr.setSelection(new Ll(c))),!0)}}function Hl(t,e,n){if(!t.editable)return!1;var r=t.state.doc.resolve(e);if(!Ll.valid(r))return!1;var o=t.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(o>-1&&ie.isSelectable(t.state.doc.nodeAt(o)))&&(t.dispatch(t.state.tr.setSelection(new Ll(r))),!0)}function ql(t){if(!(t.selection instanceof Ll))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",Fs.create(t.doc,[Bs.widget(t.selection.head,e,{key:"gapcursor"})])}var Jl=function(t,e,n){for(var r,o=t.table,i=t.table_row,s=t.table_cell,a=[],c=0;c<e+1;c++){r=[];for(var u=0;u<n+1;u++)r.push(s.createAndFill());a.push(i.createAndFill(void 0,r))}return o.createAndFill(void 0,a)},Kl=function(t,e){for(var n=t.$head,r=n.depth;r>0;r--){var o=n.node(r);if(o.type.name===e)return{pos:n.before(r),node:o}}return null},Ul=function(t,e){return oc(t,e&&function(t){var n,r=Kl(t.selection,"table_row"),o=Kl(t.selection,"table");if(r&&o&&r.node.attrs[ke]){for(var i=0,s=0;s<o.node.nodeSize;s++)if(o.node.child(s).eq(r.node)){i=s;break}var a=o.node.child(i-1),c=r.pos-a.nodeSize;t.setNodeMarkup(c,void 0,((n={})[ke]=r.node.attrs[ke],n))}return e(t)})},Gl=function(t,e){return ic(t,e&&function(t){var n,r=Kl(t.selection,"table_row");if(r&&r.node.attrs[ke]){var o=r.pos+r.node.nodeSize;t.setNodeMarkup(o,void 0,((n={})[ke]=r.node.attrs[ke],n))}return e(t)})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(10);e.outerWidth=function(t){var e=t.offsetWidth,n=getComputedStyle(t);return e+=parseFloat(n.marginLeft)||0+parseFloat(n.marginRight)||0},e.removeEntries=function(t,e){return Object.keys(t).filter((function(t){return e(t)})).reduce((function(e,n){var r;return Object.assign(e,((r={})[n]=t[n],r))}),{})},e.removeEmptyEntries=function(t){return e.removeEntries(t,(function(e){return null!==t[e]&&void 0!==t[e]&&""!==t[e]}))},e.isEmpty=function(t){return 0===Object.keys(t).length},e.isNullOrUndefined=function(t){return null==t},e.isPresent=function(t){return!e.isNullOrUndefined(t)},e.detectIE=function(){if(!r.isDocumentAvailable())return!1;var t=window.navigator.userAgent,e=t.indexOf("MSIE "),n=t.indexOf("Trident/");return e>0||n>0},e.safeString=function(t){return e.isNullOrUndefined(t)?"":t.toString()},e.first=function(t){return t[0]},e.last=function(t){return t[t.length-1]},e.unique=function(t){return Array.from(new Set(t))},e.split=function(t){return function(e){return e.split(t)}},e.trim=function(t){return t.trim()},e.filter=function(t){return function(e){return e.filter(t)}},e.toArray=function(t){return t instanceof Array?t:[t]},e.getUniqueStyleValues=function(t,n){if(t.hasNodesWithoutMarks)return"";var r=t.marks.filter((function(t){return"style"===t.type.name})).map((function(t){return t.attrs.style})).map(e.safeString).map(e.split(";")).map(e.filter((function(t){return t.includes(n)}))).map((function(t){return 0!==t.length?t:[n+": INVALID"]})).map(e.first).map(e.split(":")).map(e.last).map(e.trim).reduce((function(t,e){return t.indexOf(e)>-1?t:t.concat([e])}),[]);return r.indexOf("INVALID")>-1||1!==r.length?"":r[0]},e.conditionallyExecute=function(t){return function(e){return function(n){return e?t(n):n}}},e.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return t.reduce((function(t,e){return e(t)}),e)}}},function(t,e){t.exports=r},function(t,e){t.exports=o},function(t,e){t.exports=i},function(t,e){t.exports=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=function(t){function e(e,n,r,o,i){var s=t.call(this,e,n,r,o,i)||this;return s.dialog=e,s.button=n,s.editor=r,s.localization=o,s.toolsService=i,s}return r.__extends(e,t),e.prototype.clickHandler=function(){this.editor.openDialog(this.dialog)},e.prototype.onStateChange=function(t){this.button.selected=t[this.command].selected,this.button.disabled=t[this.command].disabled},e}(n(34).EditorCommandBase);e.EditorCommandDialog=o},function(t,e){t.exports=a},function(t,e){t.exports=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(13),s=function(){function t(){this.valueChange=new o.EventEmitter}return t.prototype.onValueChange=function(t){this.valueChange.emit(t)},t.prototype.focus=function(){this.dropDownList.focus()},r.__decorate([o.Input(),r.__metadata("design:type",Array)],t.prototype,"data",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],t.prototype,"value",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Object)],t.prototype,"defaultItem",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Function)],t.prototype,"itemDisabled",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],t.prototype,"title",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Boolean)],t.prototype,"disabled",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Number)],t.prototype,"tabindex",void 0),r.__decorate([o.Output(),r.__metadata("design:type",o.EventEmitter)],t.prototype,"valueChange",void 0),r.__decorate([o.ViewChild("element",{static:!0}),r.__metadata("design:type",o.ElementRef)],t.prototype,"element",void 0),r.__decorate([o.ViewChild("element",{read:i.DropDownListComponent,static:!0}),r.__metadata("design:type",i.DropDownListComponent)],t.prototype,"dropDownList",void 0),t=r.__decorate([o.Component({selector:"kendo-editor-format-dropdownlist",template:'\n <kendo-dropdownlist\n #element\n kendoEditorDropDownTool\n [defaultItem]="defaultItem"\n [textField]="\'text\'"\n [valueField]="\'tag\'"\n [data]="data"\n [(value)]="value"\n [valuePrimitive]="true"\n [itemDisabled]="itemDisabled"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n <ng-template kendoDropDownListItemTemplate let-dataItem>\n <ng-container [ngSwitch]="dataItem.tag">\n <span *ngSwitchCase="\'h1\'" style="display: block; font-size: 2em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'h2\'" style="display: block; font-size: 1.5em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'h3\'" style="display: block; font-size: 1.17em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'h4\'" style="display: block; font-size: 1em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'h5\'" style="display: block; font-size: .83em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'h6\'" style="display: block; font-size: .67em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'p\'" style="display: block; margin-left: 0;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchDefault>{{ dataItem.text }}</span>\n </ng-container>\n </ng-template>\n </kendo-dropdownlist>\n ',styles:["\n .k-dropdownlist {\n width: 13em;\n }\n "]})],t)}();e.FormatDropDownListComponent=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(13),s=function(){function t(){this.valueChange=new o.EventEmitter}return t.prototype.onValueChange=function(t){this.valueChange.emit(t)},t.prototype.focus=function(){this.dropDownList.focus()},r.__decorate([o.Input(),r.__metadata("design:type",Array)],t.prototype,"data",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],t.prototype,"value",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Object)],t.prototype,"defaultItem",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Function)],t.prototype,"itemDisabled",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],t.prototype,"title",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Boolean)],t.prototype,"disabled",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Number)],t.prototype,"tabindex",void 0),r.__decorate([o.Output(),r.__metadata("design:type",o.EventEmitter)],t.prototype,"valueChange",void 0),r.__decorate([o.ViewChild("element",{static:!0}),r.__metadata("design:type",o.ElementRef)],t.prototype,"element",void 0),r.__decorate([o.ViewChild("element",{read:i.DropDownListComponent,static:!0}),r.__metadata("design:type",i.DropDownListComponent)],t.prototype,"dropDownList",void 0),t=r.__decorate([o.Component({selector:"kendo-editor-fontfamily-dropdownlist",template:'\n <kendo-dropdownlist\n #element\n kendoEditorDropDownTool\n [defaultItem]="defaultItem"\n [textField]="\'text\'"\n [valueField]="\'fontName\'"\n [data]="data"\n [(value)]="value"\n [valuePrimitive]="true"\n [itemDisabled]="itemDisabled"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n <ng-template kendoDropDownListItemTemplate let-dataItem>\n <span [ngStyle]="{ \'font-family\': dataItem.fontName }">\n {{ dataItem.text }}\n </span>\n </ng-template>\n </kendo-dropdownlist>\n ',styles:["\n .k-dropdownlist {\n width: 13em;\n }\n "]})],t)}();e.FontFamilyDropDownListComponent=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(13),s=function(){function t(){this.valueChange=new o.EventEmitter}return t.prototype.onValueChange=function(t){this.valueChange.emit(t)},t.prototype.focus=function(){this.dropDownList.focus()},r.__decorate([o.Input(),r.__metadata("design:type",Array)],t.prototype,"data",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],t.prototype,"value",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Object)],t.prototype,"defaultItem",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Function)],t.prototype,"itemDisabled",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],t.prototype,"title",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Boolean)],t.prototype,"disabled",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Number)],t.prototype,"tabindex",void 0),r.__decorate([o.Output(),r.__metadata("design:type",o.EventEmitter)],t.prototype,"valueChange",void 0),r.__decorate([o.ViewChild("element",{static:!0}),r.__metadata("design:type",o.ElementRef)],t.prototype,"element",void 0),r.__decorate([o.ViewChild("element",{read:i.DropDownListComponent,static:!0}),r.__metadata("design:type",i.DropDownListComponent)],t.prototype,"dropDownList",void 0),t=r.__decorate([o.Component({selector:"kendo-editor-fontsize-dropdownlist",template:'\n <kendo-dropdownlist\n #element\n kendoEditorDropDownTool\n [defaultItem]="defaultItem"\n [textField]="\'text\'"\n [valueField]="\'size\'"\n [data]="data"\n [(value)]="value"\n [valuePrimitive]="true"\n [itemDisabled]="itemDisabled"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n </kendo-dropdownlist>\n ',styles:["\n .k-dropdownlist {\n width: 13em;\n }\n "]})],t)}();e.FontSizeDropDownListComponent=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(16),a=n(2),c=n(9),u=n(3),l=n(7),d=n(30),p=n(22),f=function(t){function e(e,n,r,o){var i=t.call(this)||this;return i.editor=e,i.localization=n,i.dialogService=r,i.ngZone=o,i.tabindex=-1,i.disabled=!1,i.views=["palette"],i}var n;return r.__extends(e,t),n=e,Object.defineProperty(e.prototype,"view",{get:function(){return this.views&&this.views.length>0?this.views[0]:null},set:function(t){this.views=[t]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this.localization.get(this.editorCommand)},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var t=this;this.subs=this.editor.stateChange.subscribe((function(e){var n=e.style;t.disabled=n.disabled}))},e.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe()},e.prototype.handleValueChange=function(t){this.editor.exec(this.editorCommand,t),this.editor.view.focus()},e.prototype.handleActiveColorClick=function(t){t.preventOpen(),this.handleValueChange(t.color)},e.prototype.onOpen=function(t){this.valueCache=t.value,t.reset()},e.prototype.onClose=function(t){var e=this;t.value||(t.value=this.valueCache),this.editor.shouldEmitFocus=!0,this.ngZone.onStable.pipe(p.take(1)).subscribe((function(){return e.editor.view.focus()}))},Object.defineProperty(e.prototype,"outerWidth",{get:function(){if(this.element)return c.outerWidth(this.element.nativeElement)},enumerable:!0,configurable:!0}),e.prototype.openDialog=function(){var t={appendTo:this.editor.dialogContainer,content:d.ColorPickerDialogComponent};this.editor.toolbar.toggle(!1),this.dialogService.open(t).content.instance.setData({editor:this.editor,value:this.value,title:this.title,editorCommand:this.editorCommand,paletteSettings:this.paletteSettings,icon:this.icon,views:this.views})},e.prototype.canFocus=function(){return!this.disabled},e.prototype.focus=function(){this.tabindex=0,this.overflows?this.colorPickerButton.nativeElement.focus():this.colorPicker.focus()},e.prototype.handleKey=function(){return this.tabindex=-1,!1},r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"value",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"icon",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Object)],e.prototype,"paletteSettings",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"editorCommand",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Boolean)],e.prototype,"disabled",void 0),r.__decorate([o.Input(),r.__metadata("design:type",Array)],e.prototype,"views",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String),r.__metadata("design:paramtypes",[String])],e.prototype,"view",null),r.__decorate([o.ViewChild("toolbarTemplate",{static:!0}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"toolbarTemplate",void 0),r.__decorate([o.ViewChild("popupTemplate",{static:!0}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"popupTemplate",void 0),r.__decorate([o.ViewChild("colorpicker",{read:o.ElementRef,static:!1}),r.__metadata("design:type",o.ElementRef)],e.prototype,"element",void 0),r.__decorate([o.ViewChild("colorpicker",{read:s.ColorPickerComponent,static:!1}),r.__metadata("design:type",s.ColorPickerComponent)],e.prototype,"colorPicker",void 0),r.__decorate([o.ViewChild("colorPickerButton",{read:o.ElementRef,static:!1}),r.__metadata("design:type",o.ElementRef)],e.prototype,"colorPickerButton",void 0),e=n=r.__decorate([o.Component({providers:[{provide:i.ToolBarToolComponent,useExisting:o.forwardRef((function(){return n}))}],selector:"kendo-toolbar-colorpicker",template:'\n <ng-template #toolbarTemplate>\n <kendo-colorpicker\n #colorpicker\n [attr.title]="title"\n [icon]="icon"\n [views]="views"\n [format]="\'hex\'"\n [value]="value"\n [paletteSettings]="paletteSettings"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="handleValueChange($event)"\n (activeColorClick)="handleActiveColorClick($event)"\n (open)="onOpen(colorpicker)"\n (close)="onClose(colorpicker)"\n >\n </kendo-colorpicker>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n tabindex="-1"\n type="button"\n kendoButton\n #colorPickerButton\n class="k-overflow-button"\n [icon]="icon"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (click)="openDialog()"\n >\n {{ title }}\n </button>\n </ng-template>\n '}),r.__param(0,o.Host()),r.__metadata("design:paramtypes",[u.EditorComponent,a.EditorLocalizationService,l.DialogService,o.NgZone])],e)}(i.ToolBarToolComponent);e.EditorColorPickerComponent=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.commandIcons={alignCenter:"align-center",alignJustify:"align-justify",alignLeft:"align-left",alignRight:"align-right",backColor:"background",blockquote:"blockquote",bold:"bold",cleanFormatting:"clear-css",createLink:"link-horizontal",foreColor:"foreground-color",indent:"indent-increase",insertFile:"file-add",insertImage:"image",insertOrderedList:"list-ordered",insertUnorderedList:"list-unordered",italic:"italic",outdent:"indent-decrease",print:"print",redo:"redo",selectAll:"select-all",strikethrough:"strikethrough",subscript:"sub-script",superscript:"sup-script",underline:"underline",undo:"undo",unlink:"unlink-horizontal",viewSource:"html",insertTable:"table-insert",addColumnBefore:"table-column-insert-left",addColumnAfter:"table-column-insert-right",addRowBefore:"table-row-insert-above",addRowAfter:"table-row-insert-below",deleteRow:"table-row-delete",deleteColumn:"table-column-delete",mergeCells:"cells-merge",splitCell:"cell-split-horizontally",deleteTable:"table-delete"}},function(t,e,n){"use strict";n.r(e),n.d(e,"audit",(function(){return P})),n.d(e,"auditTime",(function(){return J})),n.d(e,"buffer",(function(){return K})),n.d(e,"bufferCount",(function(){return Y})),n.d(e,"bufferTime",(function(){return tt})),n.d(e,"bufferToggle",(function(){return at})),n.d(e,"bufferWhen",(function(){return lt})),n.d(e,"catchError",(function(){return ft})),n.d(e,"combineAll",(function(){return wt})),n.d(e,"combineLatest",(function(){return xt})),n.d(e,"concat",(function(){return Rt})),n.d(e,"concatAll",(function(){return zt})),n.d(e,"concatMap",(function(){return Ft})),n.d(e,"concatMapTo",(function(){return Lt})),n.d(e,"count",(function(){return Vt})),n.d(e,"debounce",(function(){return Wt})),n.d(e,"debounceTime",(function(){return Jt})),n.d(e,"defaultIfEmpty",(function(){return Yt})),n.d(e,"delay",(function(){return oe})),n.d(e,"delayWhen",(function(){return ce})),n.d(e,"dematerialize",(function(){return fe})),n.d(e,"distinct",(function(){return ve})),n.d(e,"distinctUntilChanged",(function(){return be})),n.d(e,"distinctUntilKeyChanged",(function(){return xe})),n.d(e,"elementAt",(function(){return Fe})),n.d(e,"endWith",(function(){return Le})),n.d(e,"every",(function(){return Ve})),n.d(e,"exhaust",(function(){return We})),n.d(e,"exhaustMap",(function(){return Je})),n.d(e,"expand",(function(){return Ge})),n.d(e,"filter",(function(){return Se})),n.d(e,"finalize",(function(){return Ze})),n.d(e,"find",(function(){return en})),n.d(e,"findIndex",(function(){return on})),n.d(e,"first",(function(){return sn})),n.d(e,"groupBy",(function(){return fn})),n.d(e,"ignoreElements",(function(){return bn})),n.d(e,"isEmpty",(function(){return xn})),n.d(e,"last",(function(){return Mn})),n.d(e,"map",(function(){return Et})),n.d(e,"mapTo",(function(){return On})),n.d(e,"materialize",(function(){return An})),n.d(e,"max",(function(){return Ln})),n.d(e,"merge",(function(){return jn})),n.d(e,"mergeAll",(function(){return Bt})),n.d(e,"mergeMap",(function(){return Dt})),n.d(e,"flatMap",(function(){return Dt})),n.d(e,"mergeMapTo",(function(){return $n})),n.d(e,"mergeScan",(function(){return Wn})),n.d(e,"min",(function(){return Jn})),n.d(e,"multicast",(function(){return Qn})),n.d(e,"observeOn",(function(){return er})),n.d(e,"onErrorResumeNext",(function(){return ir})),n.d(e,"pairwise",(function(){return cr})),n.d(e,"partition",(function(){return pr})),n.d(e,"pluck",(function(){return fr})),n.d(e,"publish",(function(){return mr})),n.d(e,"publishBehavior",(function(){return gr})),n.d(e,"publishLast",(function(){return br})),n.d(e,"publishReplay",(function(){return Cr})),n.d(e,"race",(function(){return Mr})),n.d(e,"reduce",(function(){return Fn})),n.d(e,"repeat",(function(){return Or})),n.d(e,"repeatWhen",(function(){return Ar})),n.d(e,"retry",(function(){return zr})),n.d(e,"retryWhen",(function(){return Fr})),n.d(e,"refCount",(function(){return Kn})),n.d(e,"sample",(function(){return jr})),n.d(e,"sampleTime",(function(){return Hr})),n.d(e,"scan",(function(){return zn})),n.d(e,"sequenceEqual",(function(){return Ur})),n.d(e,"share",(function(){return Qr})),n.d(e,"shareReplay",(function(){return to})),n.d(e,"single",(function(){return eo})),n.d(e,"skip",(function(){return oo})),n.d(e,"skipLast",(function(){return ao})),n.d(e,"skipUntil",(function(){return lo})),n.d(e,"skipWhile",(function(){return ho})),n.d(e,"startWith",(function(){return go})),n.d(e,"subscribeOn",(function(){return So})),n.d(e,"switchAll",(function(){return Do})),n.d(e,"switchMap",(function(){return Eo})),n.d(e,"switchMapTo",(function(){return Io})),n.d(e,"take",(function(){return ze})),n.d(e,"takeLast",(function(){return Sn})),n.d(e,"takeUntil",(function(){return Ao})),n.d(e,"takeWhile",(function(){return zo})),n.d(e,"tap",(function(){return Me})),n.d(e,"throttle",(function(){return Lo})),n.d(e,"throttleTime",(function(){return $o})),n.d(e,"throwIfEmpty",(function(){return Ne})),n.d(e,"timeInterval",(function(){return Jo})),n.d(e,"timeout",(function(){return Qo})),n.d(e,"timeoutWith",(function(){return Yo})),n.d(e,"timestamp",(function(){return ti})),n.d(e,"toArray",(function(){return ri})),n.d(e,"window",(function(){return oi})),n.d(e,"windowCount",(function(){return ai})),n.d(e,"windowTime",(function(){return li})),n.d(e,"windowToggle",(function(){return gi})),n.d(e,"windowWhen",(function(){return wi})),n.d(e,"withLatestFrom",(function(){return ki})),n.d(e,"zip",(function(){return Ai})),n.d(e,"zipAll",(function(){return Ni}));var r=n(0);function o(t){return"function"==typeof t}var i=!1,s={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;i=t},get useDeprecatedSynchronousErrorHandling(){return i}};function a(t){setTimeout((function(){throw t}))}var c={closed:!0,next:function(t){},error:function(t){if(s.useDeprecatedSynchronousErrorHandling)throw t;a(t)},complete:function(){}},u=Array.isArray||function(t){return t&&"number"==typeof t.length};function l(t){return null!==t&&"object"==typeof t}function d(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}d.prototype=Object.create(Error.prototype);var p=d,f=function(){function t(t){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){var n=this._parent,r=this._parents,i=this._unsubscribe,s=this._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var a=-1,c=r?r.length:0;n;)n.remove(this),n=++a<c&&r[a]||null;if(o(i))try{i.call(this)}catch(n){e=!0,t=n instanceof p?h(n.errors):[n]}if(u(s))for(a=-1,c=s.length;++a<c;){var d=s[a];if(l(d))try{d.unsubscribe()}catch(n){e=!0,t=t||[],n instanceof p?t=t.concat(h(n.errors)):t.push(n)}}if(e)throw new p(t)}},t.prototype.add=function(e){var n=e;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var r=n;(n=new t)._subscriptions=[r]}break;default:if(!e)return t.EMPTY;throw new Error("unrecognized teardown "+e+" added to Subscription.")}if(n._addParent(this)){var o=this._subscriptions;o?o.push(n):this._subscriptions=[n]}return n},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},t.prototype._addParent=function(t){var e=this._parent,n=this._parents;return e!==t&&(e?n?-1===n.indexOf(t)&&(n.push(t),!0):(this._parents=[t],!0):(this._parent=t,!0))},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function h(t){return t.reduce((function(t,e){return t.concat(e instanceof p?e.errors:e)}),[])}var m="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),v=function(t){function e(n,r,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=c;break;case 1:if(!n){i.destination=c;break}if("object"==typeof n){n instanceof e?(i.syncErrorThrowable=n.syncErrorThrowable,i.destination=n,n.add(i)):(i.syncErrorThrowable=!0,i.destination=new g(i,n));break}default:i.syncErrorThrowable=!0,i.destination=new g(i,n,r,o)}return i}return r.__extends(e,t),e.prototype[m]=function(){return this},e.create=function(t,n,r){var o=new e(t,n,r);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parent,e=this._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=t,this._parents=e,this},e}(f),g=function(t){function e(e,n,r,i){var s,a=t.call(this)||this;a._parentSubscriber=e;var u=a;return o(n)?s=n:n&&(s=n.next,r=n.error,i=n.complete,n!==c&&(o((u=Object.create(n)).unsubscribe)&&a.add(u.unsubscribe.bind(u)),u.unsubscribe=a.unsubscribe.bind(a))),a._context=u,a._next=s,a._error=r,a._complete=i,a}return r.__extends(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;s.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,n=s.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):a(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;a(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};s.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),s.useDeprecatedSynchronousErrorHandling)throw t;a(t)}},e.prototype.__tryOrSetError=function(t,e,n){if(!s.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return s.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(a(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(v),y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.__extends(e,t),e.prototype.notifyNext=function(t,e,n,r,o){this.destination.next(e)},e.prototype.notifyError=function(t,e){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.complete()},e}(v),b=function(t){function e(e,n,r){var o=t.call(this)||this;return o.parent=e,o.outerValue=n,o.outerIndex=r,o.index=0,o}return r.__extends(e,t),e.prototype._next=function(t){this.parent.notifyNext(this.outerValue,t,this.outerIndex,this.index++,this)},e.prototype._error=function(t){this.parent.notifyError(t,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(v);var w="function"==typeof Symbol&&Symbol.observable||"@@observable";function _(){}function x(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return k(t)}function k(t){return t?1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}:_}var C=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r=this.operator,o=function(t,e,n){if(t){if(t instanceof v)return t;if(t[m])return t[m]()}return t||e||n?new v(t,e,n):new v(c)}(t,e,n);if(r?o.add(r.call(o,this.source)):o.add(this.source||s.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),s.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){s.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),!function(t){for(;t;){var e=t,n=e.closed,r=e.destination,o=e.isStopped;if(n||o)return!1;t=r&&r instanceof v?r:null}return!0}(t)?console.warn(e):t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=S(e))((function(e,r){var o;o=n.subscribe((function(e){try{t(e)}catch(t){r(t),o&&o.unsubscribe()}}),r,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[w]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:k(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=S(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function S(t){if(t||(t=s.Promise||Promise),!t)throw new Error("no Promise impl found");return t}var T=function(t){return function(e){for(var n=0,r=t.length;n<r&&!e.closed;n++)e.next(t[n]);e.closed||e.complete()}},E=function(t){return function(e){return t.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,a),e}};function M(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var O=M(),D=function(t){return function(e){for(var n=t[O]();;){var r=n.next();if(r.done){e.complete();break}if(e.next(r.value),e.closed)break}return"function"==typeof n.return&&e.add((function(){n.return&&n.return()})),e}},I=function(t){return function(e){var n=t[w]();if("function"!=typeof n.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return n.subscribe(e)}},A=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function N(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}var B=function(t){if(t instanceof C)return function(e){return t._isScalar?(e.next(t.value),void e.complete()):t.subscribe(e)};if(t&&"function"==typeof t[w])return I(t);if(A(t))return T(t);if(N(t))return E(t);if(t&&"function"==typeof t[O])return D(t);var e=l(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+e+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")};function z(t,e,n,r,o){if(void 0===o&&(o=new b(t,n,r)),!o.closed)return B(e)(o)}function P(t){return function(e){return e.lift(new R(t))}}var R=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new F(t,this.durationSelector))},t}(),F=function(t){function e(e,n){var r=t.call(this,e)||this;return r.durationSelector=n,r.hasValue=!1,r}return r.__extends(e,t),e.prototype._next=function(t){if(this.value=t,this.hasValue=!0,!this.throttled){var e=void 0;try{e=(0,this.durationSelector)(t)}catch(t){return this.destination.error(t)}var n=z(this,e);!n||n.closed?this.clearThrottle():this.add(this.throttled=n)}},e.prototype.clearThrottle=function(){var t=this.value,e=this.hasValue,n=this.throttled;n&&(this.remove(n),this.throttled=null,n.unsubscribe()),e&&(this.value=null,this.hasValue=!1,this.destination.next(t))},e.prototype.notifyNext=function(t,e,n,r){this.clearThrottle()},e.prototype.notifyComplete=function(){this.clearThrottle()},e}(y),L=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return r.__extends(e,t),e.prototype.schedule=function(t,e){if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!==n&&this.delay===n&&!1===this.pending)return e;clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n=!1,r=void 0;try{this.work(t)}catch(t){n=!0,r=!!t&&t||new Error(t)}if(n)return this.unsubscribe(),r},e.prototype._unsubscribe=function(){var t=this.id,e=this.scheduler,n=e.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null},e}(function(t){function e(e,n){return t.call(this)||this}return r.__extends(e,t),e.prototype.schedule=function(t,e){return void 0===e&&(e=0),this},e}(f)),V=function(){function t(e,n){void 0===n&&(n=t.now),this.SchedulerAction=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.SchedulerAction(this,t).schedule(n,e)},t.now=function(){return Date.now()},t}(),j=function(t){function e(n,r){void 0===r&&(r=V.now);var o=t.call(this,n,(function(){return e.delegate&&e.delegate!==o?e.delegate.now():r()}))||this;return o.actions=[],o.active=!1,o.scheduled=void 0,o}return r.__extends(e,t),e.prototype.schedule=function(n,r,o){return void 0===r&&(r=0),e.delegate&&e.delegate!==this?e.delegate.schedule(n,r,o):t.prototype.schedule.call(this,n,r,o)},e.prototype.flush=function(t){var e=this.actions;if(this.active)e.push(t);else{var n;this.active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(V),$=new j(L);function W(t){return!u(t)&&t-parseFloat(t)+1>=0}function H(t){return t&&"function"==typeof t.schedule}function q(t){var e=t.index,n=t.period,r=t.subscriber;if(r.next(e),!r.closed){if(-1===n)return r.complete();t.index=e+1,this.schedule(t,n)}}function J(t,e){return void 0===e&&(e=$),P((function(){return function(t,e,n){void 0===t&&(t=0);var r=-1;return W(e)?r=Number(e)<1?1:Number(e):H(e)&&(n=e),H(n)||(n=$),new C((function(e){var o=W(t)?t:+t-n.now();return n.schedule(q,o,{index:0,period:r,subscriber:e})}))}(t,e)}))}function K(t){return function(e){return e.lift(new U(t))}}var U=function(){function t(t){this.closingNotifier=t}return t.prototype.call=function(t,e){return e.subscribe(new G(t,this.closingNotifier))},t}(),G=function(t){function e(e,n){var r=t.call(this,e)||this;return r.buffer=[],r.add(z(r,n)),r}return r.__extends(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype.notifyNext=function(t,e,n,r,o){var i=this.buffer;this.buffer=[],this.destination.next(i)},e}(y);function Y(t,e){return void 0===e&&(e=null),function(n){return n.lift(new X(t,e))}}var X=function(){function t(t,e){this.bufferSize=t,this.startBufferEvery=e,this.subscriberClass=e&&t!==e?Q:Z}return t.prototype.call=function(t,e){return e.subscribe(new this.subscriberClass(t,this.bufferSize,this.startBufferEvery))},t}(),Z=function(t){function e(e,n){var r=t.call(this,e)||this;return r.bufferSize=n,r.buffer=[],r}return r.__extends(e,t),e.prototype._next=function(t){var e=this.buffer;e.push(t),e.length==this.bufferSize&&(this.destination.next(e),this.buffer=[])},e.prototype._complete=function(){var e=this.buffer;e.length>0&&this.destination.next(e),t.prototype._complete.call(this)},e}(v),Q=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.bufferSize=n,o.startBufferEvery=r,o.buffers=[],o.count=0,o}return r.__extends(e,t),e.prototype._next=function(t){var e=this.bufferSize,n=this.startBufferEvery,r=this.buffers,o=this.count;this.count++,o%n==0&&r.push([]);for(var i=r.length;i--;){var s=r[i];s.push(t),s.length===e&&(r.splice(i,1),this.destination.next(s))}},e.prototype._complete=function(){for(var e=this.buffers,n=this.destination;e.length>0;){var r=e.shift();r.length>0&&n.next(r)}t.prototype._complete.call(this)},e}(v);function tt(t){var e=arguments.length,n=$;H(arguments[arguments.length-1])&&(n=arguments[arguments.length-1],e--);var r=null;e>=2&&(r=arguments[1]);var o=Number.POSITIVE_INFINITY;return e>=3&&(o=arguments[2]),function(e){return e.lift(new et(t,r,o,n))}}var et=function(){function t(t,e,n,r){this.bufferTimeSpan=t,this.bufferCreationInterval=e,this.maxBufferSize=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new rt(t,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},t}(),nt=function(){return function(){this.buffer=[]}}(),rt=function(t){function e(e,n,r,o,i){var s=t.call(this,e)||this;s.bufferTimeSpan=n,s.bufferCreationInterval=r,s.maxBufferSize=o,s.scheduler=i,s.contexts=[];var a=s.openContext();if(s.timespanOnly=null==r||r<0,s.timespanOnly){var c={subscriber:s,context:a,bufferTimeSpan:n};s.add(a.closeAction=i.schedule(ot,n,c))}else{var u={subscriber:s,context:a},l={bufferTimeSpan:n,bufferCreationInterval:r,subscriber:s,scheduler:i};s.add(a.closeAction=i.schedule(st,n,u)),s.add(i.schedule(it,r,l))}return s}return r.__extends(e,t),e.prototype._next=function(t){for(var e,n=this.contexts,r=n.length,o=0;o<r;o++){var i=n[o],s=i.buffer;s.push(t),s.length==this.maxBufferSize&&(e=i)}e&&this.onBufferFull(e)},e.prototype._error=function(e){this.contexts.length=0,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts,n=this.destination;e.length>0;){var r=e.shift();n.next(r.buffer)}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.contexts=null},e.prototype.onBufferFull=function(t){this.closeContext(t);var e=t.closeAction;if(e.unsubscribe(),this.remove(e),!this.closed&&this.timespanOnly){t=this.openContext();var n=this.bufferTimeSpan,r={subscriber:this,context:t,bufferTimeSpan:n};this.add(t.closeAction=this.scheduler.schedule(ot,n,r))}},e.prototype.openContext=function(){var t=new nt;return this.contexts.push(t),t},e.prototype.closeContext=function(t){this.destination.next(t.buffer);var e=this.contexts;(e?e.indexOf(t):-1)>=0&&e.splice(e.indexOf(t),1)},e}(v);function ot(t){var e=t.subscriber,n=t.context;n&&e.closeContext(n),e.closed||(t.context=e.openContext(),t.context.closeAction=this.schedule(t,t.bufferTimeSpan))}function it(t){var e=t.bufferCreationInterval,n=t.bufferTimeSpan,r=t.subscriber,o=t.scheduler,i=r.openContext();r.closed||(r.add(i.closeAction=o.schedule(st,n,{subscriber:r,context:i})),this.schedule(t,e))}function st(t){var e=t.subscriber,n=t.context;e.closeContext(n)}function at(t,e){return function(n){return n.lift(new ct(t,e))}}var ct=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new ut(t,this.openings,this.closingSelector))},t}(),ut=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.openings=n,o.closingSelector=r,o.contexts=[],o.add(z(o,n)),o}return r.__extends(e,t),e.prototype._next=function(t){for(var e=this.contexts,n=e.length,r=0;r<n;r++)e[r].buffer.push(t)},e.prototype._error=function(e){for(var n=this.contexts;n.length>0;){var r=n.shift();r.subscription.unsubscribe(),r.buffer=null,r.subscription=null}this.contexts=null,t.prototype._error.call(this,e)},e.prototype._complete=function(){for(var e=this.contexts;e.length>0;){var n=e.shift();this.destination.next(n.buffer),n.subscription.unsubscribe(),n.buffer=null,n.subscription=null}this.contexts=null,t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e,n,r,o){t?this.closeBuffer(t):this.openBuffer(e)},e.prototype.notifyComplete=function(t){this.closeBuffer(t.context)},e.prototype.openBuffer=function(t){try{var e=this.closingSelector.call(this,t);e&&this.trySubscribe(e)}catch(t){this._error(t)}},e.prototype.closeBuffer=function(t){var e=this.contexts;if(e&&t){var n=t.buffer,r=t.subscription;this.destination.next(n),e.splice(e.indexOf(t),1),this.remove(r),r.unsubscribe()}},e.prototype.trySubscribe=function(t){var e=this.contexts,n=new f,r={buffer:[],subscription:n};e.push(r);var o=z(this,t,r);!o||o.closed?this.closeBuffer(r):(o.context=r,this.add(o),n.add(o))},e}(y);function lt(t){return function(e){return e.lift(new dt(t))}}var dt=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new pt(t,this.closingSelector))},t}(),pt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.closingSelector=n,r.subscribing=!1,r.openBuffer(),r}return r.__extends(e,t),e.prototype._next=function(t){this.buffer.push(t)},e.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},e.prototype.notifyNext=function(t,e,n,r,o){this.openBuffer()},e.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},e.prototype.openBuffer=function(){var t=this.closingSubscription;t&&(this.remove(t),t.unsubscribe());var e,n=this.buffer;this.buffer&&this.destination.next(n),this.buffer=[];try{e=(0,this.closingSelector)()}catch(t){return this.error(t)}t=new f,this.closingSubscription=t,this.add(t),this.subscribing=!0,t.add(z(this,e)),this.subscribing=!1},e}(y);function ft(t){return function(e){var n=new ht(t),r=e.lift(n);return n.caught=r}}var ht=function(){function t(t){this.selector=t}return t.prototype.call=function(t,e){return e.subscribe(new mt(t,this.selector,this.caught))},t}(),mt=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.selector=n,o.caught=r,o}return r.__extends(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=void 0;try{n=this.selector(e,this.caught)}catch(e){return void t.prototype.error.call(this,e)}this._unsubscribeAndRecycle();var r=new b(this,void 0,void 0);this.add(r),z(this,n,void 0,void 0,r)}},e}(y);function vt(t,e){return new C(e?function(n){var r=new f,o=0;return r.add(e.schedule((function(){o!==t.length?(n.next(t[o++]),n.closed||r.add(this.schedule())):n.complete()}))),r}:T(t))}var gt={};var yt=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new bt(t,this.resultSelector))},t}(),bt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.resultSelector=n,r.active=0,r.values=[],r.observables=[],r}return r.__extends(e,t),e.prototype._next=function(t){this.values.push(gt),this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{this.active=e,this.toRespond=e;for(var n=0;n<e;n++){var r=t[n];this.add(z(this,r,r,n))}}},e.prototype.notifyComplete=function(t){0==(this.active-=1)&&this.destination.complete()},e.prototype.notifyNext=function(t,e,n,r,o){var i=this.values,s=i[n],a=this.toRespond?s===gt?--this.toRespond:this.toRespond:0;i[n]=e,0===a&&(this.resultSelector?this._tryResultSelector(i):this.destination.next(i.slice()))},e.prototype._tryResultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(y);function wt(t){return function(e){return e.lift(new yt(t))}}function _t(t,e){if(!e)return t instanceof C?t:new C(B(t));if(null!=t){if(function(t){return t&&"function"==typeof t[w]}(t))return function(t,e){return new C(e?function(n){var r=new f;return r.add(e.schedule((function(){var o=t[w]();r.add(o.subscribe({next:function(t){r.add(e.schedule((function(){return n.next(t)})))},error:function(t){r.add(e.schedule((function(){return n.error(t)})))},complete:function(){r.add(e.schedule((function(){return n.complete()})))}}))}))),r}:I(t))}(t,e);if(N(t))return function(t,e){return new C(e?function(n){var r=new f;return r.add(e.schedule((function(){return t.then((function(t){r.add(e.schedule((function(){n.next(t),r.add(e.schedule((function(){return n.complete()})))})))}),(function(t){r.add(e.schedule((function(){return n.error(t)})))}))}))),r}:E(t))}(t,e);if(A(t))return vt(t,e);if(function(t){return t&&"function"==typeof t[O]}(t)||"string"==typeof t)return function(t,e){if(!t)throw new Error("Iterable cannot be null");return new C(e?function(n){var r,o=new f;return o.add((function(){r&&"function"==typeof r.return&&r.return()})),o.add(e.schedule((function(){r=t[O](),o.add(e.schedule((function(){if(!n.closed){var t,e;try{var o=r.next();t=o.value,e=o.done}catch(t){return void n.error(t)}e?n.complete():(n.next(t),this.schedule())}})))}))),o}:D(t))}(t,e)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}function xt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=null;return"function"==typeof t[t.length-1]&&(n=t.pop()),1===t.length&&u(t[0])&&(t=t[0].slice()),function(e){return e.lift.call(_t([e].concat(t)),new yt(n))}}var kt=new C((function(t){return t.complete()}));function Ct(t){return t?function(t){return new C((function(e){return t.schedule((function(){return e.complete()}))}))}(t):kt}function St(t){var e=new C((function(e){e.next(t),e.complete()}));return e._isScalar=!0,e.value=t,e}function Tt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];switch(H(n)?t.pop():n=void 0,t.length){case 0:return Ct(n);case 1:return n?vt(t,n):St(t[0]);default:return vt(t,n)}}function Et(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new Mt(t,e))}}var Mt=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Ot(t,this.project,this.thisArg))},t}(),Ot=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.project=n,o.count=0,o.thisArg=r||o,o}return r.__extends(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(v);function Dt(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?function(r){return r.pipe(Dt((function(n,r){return _t(t(n,r)).pipe(Et((function(t,o){return e(n,t,r,o)})))}),n))}:("number"==typeof e&&(n=e),function(e){return e.lift(new It(t,n))})}var It=function(){function t(t,e){void 0===e&&(e=Number.POSITIVE_INFINITY),this.project=t,this.concurrent=e}return t.prototype.call=function(t,e){return e.subscribe(new At(t,this.project,this.concurrent))},t}(),At=function(t){function e(e,n,r){void 0===r&&(r=Number.POSITIVE_INFINITY);var o=t.call(this,e)||this;return o.project=n,o.concurrent=r,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return r.__extends(e,t),e.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},e.prototype._tryNext=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(e,t,n)},e.prototype._innerSub=function(t,e,n){var r=new b(this,void 0,void 0);this.destination.add(r),z(this,t,e,n,r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t,e,n,r,o){this.destination.next(e)},e.prototype.notifyComplete=function(t){var e=this.buffer;this.remove(t),this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(y);function Nt(t){return t}function Bt(t){return void 0===t&&(t=Number.POSITIVE_INFINITY),Dt(Nt,t)}function zt(){return Bt(1)}function Pt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return zt()(Tt.apply(void 0,t))}function Rt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(Pt.apply(void 0,[e].concat(t)))}}function Ft(t,e){return Dt(t,e,1)}function Lt(t,e){return Ft((function(){return t}),e)}function Vt(t){return function(e){return e.lift(new jt(t,e))}}var jt=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new $t(t,this.predicate,this.source))},t}(),$t=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.predicate=n,o.source=r,o.count=0,o.index=0,o}return r.__extends(e,t),e.prototype._next=function(t){this.predicate?this._tryPredicate(t):this.count++},e.prototype._tryPredicate=function(t){var e;try{e=this.predicate(t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e&&this.count++},e.prototype._complete=function(){this.destination.next(this.count),this.destination.complete()},e}(v);function Wt(t){return function(e){return e.lift(new Ht(t))}}var Ht=function(){function t(t){this.durationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new qt(t,this.durationSelector))},t}(),qt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.durationSelector=n,r.hasValue=!1,r.durationSubscription=null,r}return r.__extends(e,t),e.prototype._next=function(t){try{var e=this.durationSelector.call(this,t);e&&this._tryNext(t,e)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.emitValue(),this.destination.complete()},e.prototype._tryNext=function(t,e){var n=this.durationSubscription;this.value=t,this.hasValue=!0,n&&(n.unsubscribe(),this.remove(n)),(n=z(this,e))&&!n.closed&&this.add(this.durationSubscription=n)},e.prototype.notifyNext=function(t,e,n,r,o){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){if(this.hasValue){var e=this.value,n=this.durationSubscription;n&&(this.durationSubscription=null,n.unsubscribe(),this.remove(n)),this.value=null,this.hasValue=!1,t.prototype._next.call(this,e)}},e}(y);function Jt(t,e){return void 0===e&&(e=$),function(n){return n.lift(new Kt(t,e))}}var Kt=function(){function t(t,e){this.dueTime=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new Ut(t,this.dueTime,this.scheduler))},t}(),Ut=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.dueTime=n,o.scheduler=r,o.debouncedSubscription=null,o.lastValue=null,o.hasValue=!1,o}return r.__extends(e,t),e.prototype._next=function(t){this.clearDebounce(),this.lastValue=t,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(Gt,this.dueTime,this))},e.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},e.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var t=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(t)}},e.prototype.clearDebounce=function(){var t=this.debouncedSubscription;null!==t&&(this.remove(t),t.unsubscribe(),this.debouncedSubscription=null)},e}(v);function Gt(t){t.debouncedNext()}function Yt(t){return void 0===t&&(t=null),function(e){return e.lift(new Zt(t))}}var Xt,Zt=function(){function t(t){this.defaultValue=t}return t.prototype.call=function(t,e){return e.subscribe(new Qt(t,this.defaultValue))},t}(),Qt=function(t){function e(e,n){var r=t.call(this,e)||this;return r.defaultValue=n,r.isEmpty=!0,r}return r.__extends(e,t),e.prototype._next=function(t){this.isEmpty=!1,this.destination.next(t)},e.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},e}(v);function te(t){return t instanceof Date&&!isNaN(+t)}function ee(t,e){return new C(e?function(n){return e.schedule(ne,0,{error:t,subscriber:n})}:function(e){return e.error(t)})}function ne(t){var e=t.error;t.subscriber.error(e)}Xt||(Xt={});var re=function(){function t(t,e,n){this.kind=t,this.value=e,this.error=n,this.hasValue="N"===t}return t.prototype.observe=function(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}},t.prototype.do=function(t,e,n){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return n&&n()}},t.prototype.accept=function(t,e,n){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,n)},t.prototype.toObservable=function(){switch(this.kind){case"N":return Tt(this.value);case"E":return ee(this.error);case"C":return Ct()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();function oe(t,e){void 0===e&&(e=$);var n=te(t)?+t-e.now():Math.abs(t);return function(t){return t.lift(new ie(n,e))}}var ie=function(){function t(t,e){this.delay=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new se(t,this.delay,this.scheduler))},t}(),se=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.delay=n,o.scheduler=r,o.queue=[],o.active=!1,o.errored=!1,o}return r.__extends(e,t),e.dispatch=function(t){for(var e=t.source,n=e.queue,r=t.scheduler,o=t.destination;n.length>0&&n[0].time-r.now()<=0;)n.shift().notification.observe(o);if(n.length>0){var i=Math.max(0,n[0].time-r.now());this.schedule(t,i)}else this.unsubscribe(),e.active=!1},e.prototype._schedule=function(t){this.active=!0,this.destination.add(t.schedule(e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:t}))},e.prototype.scheduleNotification=function(t){if(!0!==this.errored){var e=this.scheduler,n=new ae(e.now()+this.delay,t);this.queue.push(n),!1===this.active&&this._schedule(e)}},e.prototype._next=function(t){this.scheduleNotification(re.createNext(t))},e.prototype._error=function(t){this.errored=!0,this.queue=[],this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.scheduleNotification(re.createComplete()),this.unsubscribe()},e}(v),ae=function(){return function(t,e){this.time=t,this.notification=e}}();function ce(t,e){return e?function(n){return new de(n,e).lift(new ue(t))}:function(e){return e.lift(new ue(t))}}var ue=function(){function t(t){this.delayDurationSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new le(t,this.delayDurationSelector))},t}(),le=function(t){function e(e,n){var r=t.call(this,e)||this;return r.delayDurationSelector=n,r.completed=!1,r.delayNotifierSubscriptions=[],r.index=0,r}return r.__extends(e,t),e.prototype.notifyNext=function(t,e,n,r,o){this.destination.next(t),this.removeSubscription(o),this.tryComplete()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype.notifyComplete=function(t){var e=this.removeSubscription(t);e&&this.destination.next(e),this.tryComplete()},e.prototype._next=function(t){var e=this.index++;try{var n=this.delayDurationSelector(t,e);n&&this.tryDelay(n,t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.completed=!0,this.tryComplete(),this.unsubscribe()},e.prototype.removeSubscription=function(t){t.unsubscribe();var e=this.delayNotifierSubscriptions.indexOf(t);return-1!==e&&this.delayNotifierSubscriptions.splice(e,1),t.outerValue},e.prototype.tryDelay=function(t,e){var n=z(this,t,e);n&&!n.closed&&(this.destination.add(n),this.delayNotifierSubscriptions.push(n))},e.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},e}(y),de=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subscriptionDelay=n,r}return r.__extends(e,t),e.prototype._subscribe=function(t){this.subscriptionDelay.subscribe(new pe(t,this.source))},e}(C),pe=function(t){function e(e,n){var r=t.call(this)||this;return r.parent=e,r.source=n,r.sourceSubscribed=!1,r}return r.__extends(e,t),e.prototype._next=function(t){this.subscribeToSource()},e.prototype._error=function(t){this.unsubscribe(),this.parent.error(t)},e.prototype._complete=function(){this.unsubscribe(),this.subscribeToSource()},e.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},e}(v);function fe(){return function(t){return t.lift(new he)}}var he=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new me(t))},t}(),me=function(t){function e(e){return t.call(this,e)||this}return r.__extends(e,t),e.prototype._next=function(t){t.observe(this.destination)},e}(v);function ve(t,e){return function(n){return n.lift(new ge(t,e))}}var ge=function(){function t(t,e){this.keySelector=t,this.flushes=e}return t.prototype.call=function(t,e){return e.subscribe(new ye(t,this.keySelector,this.flushes))},t}(),ye=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.keySelector=n,o.values=new Set,r&&o.add(z(o,r)),o}return r.__extends(e,t),e.prototype.notifyNext=function(t,e,n,r,o){this.values.clear()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype._next=function(t){this.keySelector?this._useKeySelector(t):this._finalizeNext(t,t)},e.prototype._useKeySelector=function(t){var e,n=this.destination;try{e=this.keySelector(t)}catch(t){return void n.error(t)}this._finalizeNext(e,t)},e.prototype._finalizeNext=function(t,e){var n=this.values;n.has(t)||(n.add(t),this.destination.next(e))},e}(y);function be(t,e){return function(n){return n.lift(new we(t,e))}}var we=function(){function t(t,e){this.compare=t,this.keySelector=e}return t.prototype.call=function(t,e){return e.subscribe(new _e(t,this.compare,this.keySelector))},t}(),_e=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.keySelector=r,o.hasKey=!1,"function"==typeof n&&(o.compare=n),o}return r.__extends(e,t),e.prototype.compare=function(t,e){return t===e},e.prototype._next=function(t){var e;try{var n=this.keySelector;e=n?n(t):t}catch(t){return this.destination.error(t)}var r=!1;if(this.hasKey)try{r=(0,this.compare)(this.key,e)}catch(t){return this.destination.error(t)}else this.hasKey=!0;r||(this.key=e,this.destination.next(t))},e}(v);function xe(t,e){return be((function(n,r){return e?e(n[t],r[t]):n[t]===r[t]}))}function ke(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}ke.prototype=Object.create(Error.prototype);var Ce=ke;function Se(t,e){return function(n){return n.lift(new Te(t,e))}}var Te=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new Ee(t,this.predicate,this.thisArg))},t}(),Ee=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.predicate=n,o.thisArg=r,o.count=0,o}return r.__extends(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(v);function Me(t,e,n){return function(r){return r.lift(new Oe(t,e,n))}}var Oe=function(){function t(t,e,n){this.nextOrObserver=t,this.error=e,this.complete=n}return t.prototype.call=function(t,e){return e.subscribe(new De(t,this.nextOrObserver,this.error,this.complete))},t}(),De=function(t){function e(e,n,r,i){var s=t.call(this,e)||this;return s._tapNext=_,s._tapError=_,s._tapComplete=_,s._tapError=r||_,s._tapComplete=i||_,o(n)?(s._context=s,s._tapNext=n):n&&(s._context=n,s._tapNext=n.next||_,s._tapError=n.error||_,s._tapComplete=n.complete||_),s}return r.__extends(e,t),e.prototype._next=function(t){try{this._tapNext.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.next(t)},e.prototype._error=function(t){try{this._tapError.call(this._context,t)}catch(t){return void this.destination.error(t)}this.destination.error(t)},e.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(t){return void this.destination.error(t)}return this.destination.complete()},e}(v);function Ie(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}Ie.prototype=Object.create(Error.prototype);var Ae=Ie,Ne=function(t){return void 0===t&&(t=Be),Me({hasValue:!1,next:function(){this.hasValue=!0},complete:function(){if(!this.hasValue)throw t()}})};function Be(){return new Ae}function ze(t){return function(e){return 0===t?Ct():e.lift(new Pe(t))}}var Pe=function(){function t(t){if(this.total=t,this.total<0)throw new Ce}return t.prototype.call=function(t,e){return e.subscribe(new Re(t,this.total))},t}(),Re=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return r.__extends(e,t),e.prototype._next=function(t){var e=this.total,n=++this.count;n<=e&&(this.destination.next(t),n===e&&(this.destination.complete(),this.unsubscribe()))},e}(v);function Fe(t,e){if(t<0)throw new Ce;var n=arguments.length>=2;return function(r){return r.pipe(Se((function(e,n){return n===t})),ze(1),n?Yt(e):Ne((function(){return new Ce})))}}function Le(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){var n=t[t.length-1];H(n)?t.pop():n=null;var r=t.length;return Pt(e,1!==r||n?r>0?vt(t,n):Ct(n):St(t[0]))}}function Ve(t,e){return function(n){return n.lift(new je(t,e,n))}}var je=function(){function t(t,e,n){this.predicate=t,this.thisArg=e,this.source=n}return t.prototype.call=function(t,e){return e.subscribe(new $e(t,this.predicate,this.thisArg,this.source))},t}(),$e=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.predicate=n,i.thisArg=r,i.source=o,i.index=0,i.thisArg=r||i,i}return r.__extends(e,t),e.prototype.notifyComplete=function(t){this.destination.next(t),this.destination.complete()},e.prototype._next=function(t){var e=!1;try{e=this.predicate.call(this.thisArg,t,this.index++,this.source)}catch(t){return void this.destination.error(t)}e||this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(v);function We(){return function(t){return t.lift(new He)}}var He=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new qe(t))},t}(),qe=function(t){function e(e){var n=t.call(this,e)||this;return n.hasCompleted=!1,n.hasSubscription=!1,n}return r.__extends(e,t),e.prototype._next=function(t){this.hasSubscription||(this.hasSubscription=!0,this.add(z(this,t)))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},e.prototype.notifyComplete=function(t){this.remove(t),this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(y);function Je(t,e){return e?function(n){return n.pipe(Je((function(n,r){return _t(t(n,r)).pipe(Et((function(t,o){return e(n,t,r,o)})))})))}:function(e){return e.lift(new Ke(t))}}var Ke=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new Ue(t,this.project))},t}(),Ue=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.hasSubscription=!1,r.hasCompleted=!1,r.index=0,r}return r.__extends(e,t),e.prototype._next=function(t){this.hasSubscription||this.tryNext(t)},e.prototype.tryNext=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this.hasSubscription=!0,this._innerSub(e,t,n)},e.prototype._innerSub=function(t,e,n){var r=new b(this,void 0,void 0);this.destination.add(r),z(this,t,e,n,r)},e.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t,e,n,r,o){this.destination.next(e)},e.prototype.notifyError=function(t){this.destination.error(t)},e.prototype.notifyComplete=function(t){this.destination.remove(t),this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},e}(y);function Ge(t,e,n){return void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===n&&(n=void 0),e=(e||0)<1?Number.POSITIVE_INFINITY:e,function(r){return r.lift(new Ye(t,e,n))}}var Ye=function(){function t(t,e,n){this.project=t,this.concurrent=e,this.scheduler=n}return t.prototype.call=function(t,e){return e.subscribe(new Xe(t,this.project,this.concurrent,this.scheduler))},t}(),Xe=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.project=n,i.concurrent=r,i.scheduler=o,i.index=0,i.active=0,i.hasCompleted=!1,r<Number.POSITIVE_INFINITY&&(i.buffer=[]),i}return r.__extends(e,t),e.dispatch=function(t){var e=t.subscriber,n=t.result,r=t.value,o=t.index;e.subscribeToProjection(n,r,o)},e.prototype._next=function(t){var n=this.destination;if(n.closed)this._complete();else{var r=this.index++;if(this.active<this.concurrent){n.next(t);try{var o=(0,this.project)(t,r);if(this.scheduler){var i={subscriber:this,result:o,value:t,index:r};this.destination.add(this.scheduler.schedule(e.dispatch,0,i))}else this.subscribeToProjection(o,t,r)}catch(t){n.error(t)}}else this.buffer.push(t)}},e.prototype.subscribeToProjection=function(t,e,n){this.active++,this.destination.add(z(this,t,e,n))},e.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},e.prototype.notifyNext=function(t,e,n,r,o){this._next(e)},e.prototype.notifyComplete=function(t){var e=this.buffer;this.destination.remove(t),this.active--,e&&e.length>0&&this._next(e.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},e}(y);function Ze(t){return function(e){return e.lift(new Qe(t))}}var Qe=function(){function t(t){this.callback=t}return t.prototype.call=function(t,e){return e.subscribe(new tn(t,this.callback))},t}(),tn=function(t){function e(e,n){var r=t.call(this,e)||this;return r.add(new f(n)),r}return r.__extends(e,t),e}(v);function en(t,e){if("function"!=typeof t)throw new TypeError("predicate is not a function");return function(n){return n.lift(new nn(t,n,!1,e))}}var nn=function(){function t(t,e,n,r){this.predicate=t,this.source=e,this.yieldIndex=n,this.thisArg=r}return t.prototype.call=function(t,e){return e.subscribe(new rn(t,this.predicate,this.source,this.yieldIndex,this.thisArg))},t}(),rn=function(t){function e(e,n,r,o,i){var s=t.call(this,e)||this;return s.predicate=n,s.source=r,s.yieldIndex=o,s.thisArg=i,s.index=0,s}return r.__extends(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete(),this.unsubscribe()},e.prototype._next=function(t){var e=this.predicate,n=this.thisArg,r=this.index++;try{e.call(n||this,t,r,this.source)&&this.notifyComplete(this.yieldIndex?r:t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},e}(v);function on(t,e){return function(n){return n.lift(new nn(t,n,!0,e))}}function sn(t,e){var n=arguments.length>=2;return function(r){return r.pipe(t?Se((function(e,n){return t(e,n,r)})):Nt,ze(1),n?Yt(e):Ne((function(){return new Ae})))}}function an(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}an.prototype=Object.create(Error.prototype);var cn=an,un=function(t){function e(e,n){var r=t.call(this)||this;return r.subject=e,r.subscriber=n,r.closed=!1,r}return r.__extends(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}},e}(f),ln=function(t){function e(e){var n=t.call(this,e)||this;return n.destination=e,n}return r.__extends(e,t),e}(v),dn=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return r.__extends(e,t),e.prototype[m]=function(){return new ln(this)},e.prototype.lift=function(t){var e=new pn(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new cn;if(!this.isStopped)for(var e=this.observers,n=e.length,r=e.slice(),o=0;o<n;o++)r[o].next(t)},e.prototype.error=function(t){if(this.closed)throw new cn;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,r=e.slice(),o=0;o<n;o++)r[o].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new cn;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),r=0;r<e;r++)n[r].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new cn;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new cn;return this.hasError?(t.error(this.thrownError),f.EMPTY):this.isStopped?(t.complete(),f.EMPTY):(this.observers.push(t),new un(this,t))},e.prototype.asObservable=function(){var t=new C;return t.source=this,t},e.create=function(t,e){return new pn(t,e)},e}(C),pn=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return r.__extends(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):f.EMPTY},e}(dn);function fn(t,e,n,r){return function(o){return o.lift(new hn(t,e,n,r))}}var hn=function(){function t(t,e,n,r){this.keySelector=t,this.elementSelector=e,this.durationSelector=n,this.subjectSelector=r}return t.prototype.call=function(t,e){return e.subscribe(new mn(t,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},t}(),mn=function(t){function e(e,n,r,o,i){var s=t.call(this,e)||this;return s.keySelector=n,s.elementSelector=r,s.durationSelector=o,s.subjectSelector=i,s.groups=null,s.attemptedToUnsubscribe=!1,s.count=0,s}return r.__extends(e,t),e.prototype._next=function(t){var e;try{e=this.keySelector(t)}catch(t){return void this.error(t)}this._group(t,e)},e.prototype._group=function(t,e){var n=this.groups;n||(n=this.groups=new Map);var r,o=n.get(e);if(this.elementSelector)try{r=this.elementSelector(t)}catch(t){this.error(t)}else r=t;if(!o){o=this.subjectSelector?this.subjectSelector():new dn,n.set(e,o);var i=new gn(e,o,this);if(this.destination.next(i),this.durationSelector){var s=void 0;try{s=this.durationSelector(new gn(e,o))}catch(t){return void this.error(t)}this.add(s.subscribe(new vn(e,o,this)))}}o.closed||o.next(r)},e.prototype._error=function(t){var e=this.groups;e&&(e.forEach((function(e,n){e.error(t)})),e.clear()),this.destination.error(t)},e.prototype._complete=function(){var t=this.groups;t&&(t.forEach((function(t,e){t.complete()})),t.clear()),this.destination.complete()},e.prototype.removeGroup=function(t){this.groups.delete(t)},e.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&t.prototype.unsubscribe.call(this))},e}(v),vn=function(t){function e(e,n,r){var o=t.call(this,n)||this;return o.key=e,o.group=n,o.parent=r,o}return r.__extends(e,t),e.prototype._next=function(t){this.complete()},e.prototype._unsubscribe=function(){var t=this.parent,e=this.key;this.key=this.parent=null,t&&t.removeGroup(e)},e}(v),gn=function(t){function e(e,n,r){var o=t.call(this)||this;return o.key=e,o.groupSubject=n,o.refCountSubscription=r,o}return r.__extends(e,t),e.prototype._subscribe=function(t){var e=new f,n=this.refCountSubscription,r=this.groupSubject;return n&&!n.closed&&e.add(new yn(n)),e.add(r.subscribe(t)),e},e}(C),yn=function(t){function e(e){var n=t.call(this)||this;return n.parent=e,e.count++,n}return r.__extends(e,t),e.prototype.unsubscribe=function(){var e=this.parent;e.closed||this.closed||(t.prototype.unsubscribe.call(this),e.count-=1,0===e.count&&e.attemptedToUnsubscribe&&e.unsubscribe())},e}(f);function bn(){return function(t){return t.lift(new wn)}}var wn=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new _n(t))},t}(),_n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.__extends(e,t),e.prototype._next=function(t){},e}(v);function xn(){return function(t){return t.lift(new kn)}}var kn=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Cn(t))},t}(),Cn=function(t){function e(e){return t.call(this,e)||this}return r.__extends(e,t),e.prototype.notifyComplete=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype._next=function(t){this.notifyComplete(!1)},e.prototype._complete=function(){this.notifyComplete(!0)},e}(v);function Sn(t){return function(e){return 0===t?Ct():e.lift(new Tn(t))}}var Tn=function(){function t(t){if(this.total=t,this.total<0)throw new Ce}return t.prototype.call=function(t,e){return e.subscribe(new En(t,this.total))},t}(),En=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.ring=new Array,r.count=0,r}return r.__extends(e,t),e.prototype._next=function(t){var e=this.ring,n=this.total,r=this.count++;e.length<n?e.push(t):e[r%n]=t},e.prototype._complete=function(){var t=this.destination,e=this.count;if(e>0)for(var n=this.count>=this.total?this.total:this.count,r=this.ring,o=0;o<n;o++){var i=e++%n;t.next(r[i])}t.complete()},e}(v);function Mn(t,e){var n=arguments.length>=2;return function(r){return r.pipe(t?Se((function(e,n){return t(e,n,r)})):Nt,Sn(1),n?Yt(e):Ne((function(){return new Ae})))}}function On(t){return function(e){return e.lift(new Dn(t))}}var Dn=function(){function t(t){this.value=t}return t.prototype.call=function(t,e){return e.subscribe(new In(t,this.value))},t}(),In=function(t){function e(e,n){var r=t.call(this,e)||this;return r.value=n,r}return r.__extends(e,t),e.prototype._next=function(t){this.destination.next(this.value)},e}(v);function An(){return function(t){return t.lift(new Nn)}}var Nn=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Bn(t))},t}(),Bn=function(t){function e(e){return t.call(this,e)||this}return r.__extends(e,t),e.prototype._next=function(t){this.destination.next(re.createNext(t))},e.prototype._error=function(t){var e=this.destination;e.next(re.createError(t)),e.complete()},e.prototype._complete=function(){var t=this.destination;t.next(re.createComplete()),t.complete()},e}(v);function zn(t,e){var n=!1;return arguments.length>=2&&(n=!0),function(r){return r.lift(new Pn(t,e,n))}}var Pn=function(){function t(t,e,n){void 0===n&&(n=!1),this.accumulator=t,this.seed=e,this.hasSeed=n}return t.prototype.call=function(t,e){return e.subscribe(new Rn(t,this.accumulator,this.seed,this.hasSeed))},t}(),Rn=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.accumulator=n,i._seed=r,i.hasSeed=o,i.index=0,i}return r.__extends(e,t),Object.defineProperty(e.prototype,"seed",{get:function(){return this._seed},set:function(t){this.hasSeed=!0,this._seed=t},enumerable:!0,configurable:!0}),e.prototype._next=function(t){if(this.hasSeed)return this._tryNext(t);this.seed=t,this.destination.next(t)},e.prototype._tryNext=function(t){var e,n=this.index++;try{e=this.accumulator(this.seed,t,n)}catch(t){this.destination.error(t)}this.seed=e,this.destination.next(e)},e}(v);function Fn(t,e){return arguments.length>=2?function(n){return x(zn(t,e),Sn(1),Yt(e))(n)}:function(e){return x(zn((function(e,n,r){return t(e,n,r+1)})),Sn(1))(e)}}function Ln(t){return Fn("function"==typeof t?function(e,n){return t(e,n)>0?e:n}:function(t,e){return t>e?t:e})}function Vn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Number.POSITIVE_INFINITY,r=null,o=t[t.length-1];return H(o)?(r=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(n=t.pop())):"number"==typeof o&&(n=t.pop()),null===r&&1===t.length&&t[0]instanceof C?t[0]:Bt(n)(vt(t,r))}function jn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(Vn.apply(void 0,[e].concat(t)))}}function $n(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?Dt((function(){return t}),e,n):("number"==typeof e&&(n=e),Dt((function(){return t}),n))}function Wn(t,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),function(r){return r.lift(new Hn(t,e,n))}}var Hn=function(){function t(t,e,n){this.accumulator=t,this.seed=e,this.concurrent=n}return t.prototype.call=function(t,e){return e.subscribe(new qn(t,this.accumulator,this.seed,this.concurrent))},t}(),qn=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.accumulator=n,i.acc=r,i.concurrent=o,i.hasValue=!1,i.hasCompleted=!1,i.buffer=[],i.active=0,i.index=0,i}return r.__extends(e,t),e.prototype._next=function(t){if(this.active<this.concurrent){var e=this.index++,n=this.destination,r=void 0;try{r=(0,this.accumulator)(this.acc,t,e)}catch(t){return n.error(t)}this.active++,this._innerSub(r,t,e)}else this.buffer.push(t)},e.prototype._innerSub=function(t,e,n){var r=new b(this,void 0,void 0);this.destination.add(r),z(this,t,e,n,r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete()),this.unsubscribe()},e.prototype.notifyNext=function(t,e,n,r,o){var i=this.destination;this.acc=e,this.hasValue=!0,i.next(e)},e.prototype.notifyComplete=function(t){var e=this.buffer;this.destination.remove(t),this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},e}(y);function Jn(t){return Fn("function"==typeof t?function(e,n){return t(e,n)<0?e:n}:function(t,e){return t<e?t:e})}function Kn(){return function(t){return t.lift(new Un(t))}}var Un=function(){function t(t){this.connectable=t}return t.prototype.call=function(t,e){var n=this.connectable;n._refCount++;var r=new Gn(t,n),o=e.subscribe(r);return r.closed||(r.connection=n.connect()),o},t}(),Gn=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return r.__extends(e,t),e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._refCount;if(e<=0)this.connection=null;else if(t._refCount=e-1,e>1)this.connection=null;else{var n=this.connection,r=t._connection;this.connection=null,!r||n&&r!==n||r.unsubscribe()}}else this.connection=null},e}(v),Yn=function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._refCount=0,r._isComplete=!1,r}return r.__extends(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var t=this._connection;return t||(this._isComplete=!1,(t=this._connection=new f).add(this.source.subscribe(new Zn(this.getSubject(),this))),t.closed?(this._connection=null,t=f.EMPTY):this._connection=t),t},e.prototype.refCount=function(){return Kn()(this)},e}(C).prototype,Xn={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:Yn._subscribe},_isComplete:{value:Yn._isComplete,writable:!0},getSubject:{value:Yn.getSubject},connect:{value:Yn.connect},refCount:{value:Yn.refCount}},Zn=function(t){function e(e,n){var r=t.call(this,e)||this;return r.connectable=n,r}return r.__extends(e,t),e.prototype._error=function(e){this._unsubscribe(),t.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.connectable;if(t){this.connectable=null;var e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}},e}(ln);function Qn(t,e){return function(n){var r;if(r="function"==typeof t?t:function(){return t},"function"==typeof e)return n.lift(new tr(r,e));var o=Object.create(n,Xn);return o.source=n,o.subjectFactory=r,o}}var tr=function(){function t(t,e){this.subjectFactory=t,this.selector=e}return t.prototype.call=function(t,e){var n=this.selector,r=this.subjectFactory(),o=n(r).subscribe(t);return o.add(e.subscribe(r)),o},t}();function er(t,e){return void 0===e&&(e=0),function(n){return n.lift(new nr(t,e))}}var nr=function(){function t(t,e){void 0===e&&(e=0),this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return e.subscribe(new rr(t,this.scheduler,this.delay))},t}(),rr=function(t){function e(e,n,r){void 0===r&&(r=0);var o=t.call(this,e)||this;return o.scheduler=n,o.delay=r,o}return r.__extends(e,t),e.dispatch=function(t){var e=t.notification,n=t.destination;e.observe(n),this.unsubscribe()},e.prototype.scheduleMessage=function(t){this.destination.add(this.scheduler.schedule(e.dispatch,this.delay,new or(t,this.destination)))},e.prototype._next=function(t){this.scheduleMessage(re.createNext(t))},e.prototype._error=function(t){this.scheduleMessage(re.createError(t)),this.unsubscribe()},e.prototype._complete=function(){this.scheduleMessage(re.createComplete()),this.unsubscribe()},e}(v),or=function(){return function(t,e){this.notification=t,this.destination=e}}();function ir(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&u(t[0])&&(t=t[0]),function(e){return e.lift(new sr(t))}}var sr=function(){function t(t){this.nextSources=t}return t.prototype.call=function(t,e){return e.subscribe(new ar(t,this.nextSources))},t}(),ar=function(t){function e(e,n){var r=t.call(this,e)||this;return r.destination=e,r.nextSources=n,r}return r.__extends(e,t),e.prototype.notifyError=function(t,e){this.subscribeToNextSource()},e.prototype.notifyComplete=function(t){this.subscribeToNextSource()},e.prototype._error=function(t){this.subscribeToNextSource(),this.unsubscribe()},e.prototype._complete=function(){this.subscribeToNextSource(),this.unsubscribe()},e.prototype.subscribeToNextSource=function(){var t=this.nextSources.shift();if(t){var e=new b(this,void 0,void 0);this.destination.add(e),z(this,t,void 0,void 0,e)}else this.destination.complete()},e}(y);function cr(){return function(t){return t.lift(new ur)}}var ur=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new lr(t))},t}(),lr=function(t){function e(e){var n=t.call(this,e)||this;return n.hasPrev=!1,n}return r.__extends(e,t),e.prototype._next=function(t){this.hasPrev?this.destination.next([this.prev,t]):this.hasPrev=!0,this.prev=t},e}(v);function dr(t,e){function n(){return!n.pred.apply(n.thisArg,arguments)}return n.pred=t,n.thisArg=e,n}function pr(t,e){return function(n){return[Se(t,e)(n),Se(dr(t,e))(n)]}}function fr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.length;if(0===n)throw new Error("list of properties cannot be empty.");return function(e){return Et(hr(t,n))(e)}}function hr(t,e){return function(n){for(var r=n,o=0;o<e;o++){var i=r[t[o]];if(void 0===i)return;r=i}return r}}function mr(t){return t?Qn((function(){return new dn}),t):Qn(new dn)}var vr=function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}return r.__extends(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return n&&!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new cn;return this._value},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(dn);function gr(t){return function(e){return Qn(new vr(t))(e)}}var yr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.value=null,e.hasNext=!1,e.hasCompleted=!1,e}return r.__extends(e,t),e.prototype._subscribe=function(e){return this.hasError?(e.error(this.thrownError),f.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),f.EMPTY):t.prototype._subscribe.call(this,e)},e.prototype.next=function(t){this.hasCompleted||(this.value=t,this.hasNext=!0)},e.prototype.error=function(e){this.hasCompleted||t.prototype.error.call(this,e)},e.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&t.prototype.next.call(this,this.value),t.prototype.complete.call(this)},e}(dn);function br(){return function(t){return Qn(new yr)(t)}}var wr=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.__extends(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):e.flush(this)},e}(L),_r=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.__extends(e,t),e}(j))(wr),xr=function(t){function e(e,n,r){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===n&&(n=Number.POSITIVE_INFINITY);var o=t.call(this)||this;return o.scheduler=r,o._events=[],o._infiniteTimeWindow=!1,o._bufferSize=e<1?1:e,o._windowTime=n<1?1:n,n===Number.POSITIVE_INFINITY?(o._infiniteTimeWindow=!0,o.next=o.nextInfiniteTimeWindow):o.next=o.nextTimeWindow,o}return r.__extends(e,t),e.prototype.nextInfiniteTimeWindow=function(e){var n=this._events;n.push(e),n.length>this._bufferSize&&n.shift(),t.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this._events.push(new kr(this._getNow(),e)),this._trimBufferThenGetEvents(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){var e,n=this._infiniteTimeWindow,r=n?this._events:this._trimBufferThenGetEvents(),o=this.scheduler,i=r.length;if(this.closed)throw new cn;if(this.isStopped||this.hasError?e=f.EMPTY:(this.observers.push(t),e=new un(this,t)),o&&t.add(t=new rr(t,o)),n)for(var s=0;s<i&&!t.closed;s++)t.next(r[s]);else for(s=0;s<i&&!t.closed;s++)t.next(r[s].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),e},e.prototype._getNow=function(){return(this.scheduler||_r).now()},e.prototype._trimBufferThenGetEvents=function(){for(var t=this._getNow(),e=this._bufferSize,n=this._windowTime,r=this._events,o=r.length,i=0;i<o&&!(t-r[i].time<n);)i++;return o>e&&(i=Math.max(i,o-e)),i>0&&r.splice(0,i),r},e}(dn),kr=function(){return function(t,e){this.time=t,this.value=e}}();function Cr(t,e,n,r){n&&"function"!=typeof n&&(r=n);var o="function"==typeof n?n:void 0,i=new xr(t,e,r);return function(t){return Qn((function(){return i}),o)(t)}}function Sr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(1===t.length){if(!u(t[0]))return t[0];t=t[0]}return vt(t,void 0).lift(new Tr)}var Tr=function(){function t(){}return t.prototype.call=function(t,e){return e.subscribe(new Er(t))},t}(),Er=function(t){function e(e){var n=t.call(this,e)||this;return n.hasFirst=!1,n.observables=[],n.subscriptions=[],n}return r.__extends(e,t),e.prototype._next=function(t){this.observables.push(t)},e.prototype._complete=function(){var t=this.observables,e=t.length;if(0===e)this.destination.complete();else{for(var n=0;n<e&&!this.hasFirst;n++){var r=t[n],o=z(this,r,r,n);this.subscriptions&&this.subscriptions.push(o),this.add(o)}this.observables=null}},e.prototype.notifyNext=function(t,e,n,r,o){if(!this.hasFirst){this.hasFirst=!0;for(var i=0;i<this.subscriptions.length;i++)if(i!==n){var s=this.subscriptions[i];s.unsubscribe(),this.remove(s)}this.subscriptions=null}this.destination.next(e)},e}(y);function Mr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return 1===t.length&&u(t[0])&&(t=t[0]),e.lift.call(Sr.apply(void 0,[e].concat(t)))}}function Or(t){return void 0===t&&(t=-1),function(e){return 0===t?Ct():t<0?e.lift(new Dr(-1,e)):e.lift(new Dr(t-1,e))}}var Dr=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Ir(t,this.count,this.source))},t}(),Ir=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.count=n,o.source=r,o}return r.__extends(e,t),e.prototype.complete=function(){if(!this.isStopped){var e=this.source,n=this.count;if(0===n)return t.prototype.complete.call(this);n>-1&&(this.count=n-1),e.subscribe(this._unsubscribeAndRecycle())}},e}(v);function Ar(t){return function(e){return e.lift(new Nr(t))}}var Nr=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new Br(t,this.notifier,e))},t}(),Br=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.notifier=n,o.source=r,o.sourceIsBeingSubscribedTo=!0,o}return r.__extends(e,t),e.prototype.notifyNext=function(t,e,n,r,o){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},e.prototype.notifyComplete=function(e){if(!1===this.sourceIsBeingSubscribedTo)return t.prototype.complete.call(this)},e.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries||this.subscribeToRetries(),!this.retriesSubscription||this.retriesSubscription.closed)return t.prototype.complete.call(this);this._unsubscribeAndRecycle(),this.notifications.next()}},e.prototype._unsubscribe=function(){var t=this.notifications,e=this.retriesSubscription;t&&(t.unsubscribe(),this.notifications=null),e&&(e.unsubscribe(),this.retriesSubscription=null),this.retries=null},e.prototype._unsubscribeAndRecycle=function(){var e=this._unsubscribe;return this._unsubscribe=null,t.prototype._unsubscribeAndRecycle.call(this),this._unsubscribe=e,this},e.prototype.subscribeToRetries=function(){var e;this.notifications=new dn;try{e=(0,this.notifier)(this.notifications)}catch(e){return t.prototype.complete.call(this)}this.retries=e,this.retriesSubscription=z(this,e)},e}(y);function zr(t){return void 0===t&&(t=-1),function(e){return e.lift(new Pr(t,e))}}var Pr=function(){function t(t,e){this.count=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Rr(t,this.count,this.source))},t}(),Rr=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.count=n,o.source=r,o}return r.__extends(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=this.source,r=this.count;if(0===r)return t.prototype.error.call(this,e);r>-1&&(this.count=r-1),n.subscribe(this._unsubscribeAndRecycle())}},e}(v);function Fr(t){return function(e){return e.lift(new Lr(t,e))}}var Lr=function(){function t(t,e){this.notifier=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new Vr(t,this.notifier,this.source))},t}(),Vr=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.notifier=n,o.source=r,o}return r.__extends(e,t),e.prototype.error=function(e){if(!this.isStopped){var n=this.errors,r=this.retries,o=this.retriesSubscription;if(r)this.errors=null,this.retriesSubscription=null;else{n=new dn;try{r=(0,this.notifier)(n)}catch(e){return t.prototype.error.call(this,e)}o=z(this,r)}this._unsubscribeAndRecycle(),this.errors=n,this.retries=r,this.retriesSubscription=o,n.next(e)}},e.prototype._unsubscribe=function(){var t=this.errors,e=this.retriesSubscription;t&&(t.unsubscribe(),this.errors=null),e&&(e.unsubscribe(),this.retriesSubscription=null),this.retries=null},e.prototype.notifyNext=function(t,e,n,r,o){var i=this._unsubscribe;this._unsubscribe=null,this._unsubscribeAndRecycle(),this._unsubscribe=i,this.source.subscribe(this)},e}(y);function jr(t){return function(e){return e.lift(new $r(t))}}var $r=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new Wr(t),r=e.subscribe(n);return r.add(z(n,this.notifier)),r},t}(),Wr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasValue=!1,e}return r.__extends(e,t),e.prototype._next=function(t){this.value=t,this.hasValue=!0},e.prototype.notifyNext=function(t,e,n,r,o){this.emitValue()},e.prototype.notifyComplete=function(){this.emitValue()},e.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},e}(y);function Hr(t,e){return void 0===e&&(e=$),function(n){return n.lift(new qr(t,e))}}var qr=function(){function t(t,e){this.period=t,this.scheduler=e}return t.prototype.call=function(t,e){return e.subscribe(new Jr(t,this.period,this.scheduler))},t}(),Jr=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.period=n,o.scheduler=r,o.hasValue=!1,o.add(r.schedule(Kr,n,{subscriber:o,period:n})),o}return r.__extends(e,t),e.prototype._next=function(t){this.lastValue=t,this.hasValue=!0},e.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},e}(v);function Kr(t){var e=t.subscriber,n=t.period;e.notifyNext(),this.schedule(t,n)}function Ur(t,e){return function(n){return n.lift(new Gr(t,e))}}var Gr=function(){function t(t,e){this.compareTo=t,this.comparator=e}return t.prototype.call=function(t,e){return e.subscribe(new Yr(t,this.compareTo,this.comparator))},t}(),Yr=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.compareTo=n,o.comparator=r,o._a=[],o._b=[],o._oneComplete=!1,o.destination.add(n.subscribe(new Xr(e,o))),o}return r.__extends(e,t),e.prototype._next=function(t){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(t),this.checkValues())},e.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0,this.unsubscribe()},e.prototype.checkValues=function(){for(var t=this._a,e=this._b,n=this.comparator;t.length>0&&e.length>0;){var r=t.shift(),o=e.shift(),i=!1;try{i=n?n(r,o):r===o}catch(t){this.destination.error(t)}i||this.emit(!1)}},e.prototype.emit=function(t){var e=this.destination;e.next(t),e.complete()},e.prototype.nextB=function(t){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(t),this.checkValues())},e.prototype.completeB=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},e}(v),Xr=function(t){function e(e,n){var r=t.call(this,e)||this;return r.parent=n,r}return r.__extends(e,t),e.prototype._next=function(t){this.parent.nextB(t)},e.prototype._error=function(t){this.parent.error(t),this.unsubscribe()},e.prototype._complete=function(){this.parent.completeB(),this.unsubscribe()},e}(v);function Zr(){return new dn}function Qr(){return function(t){return Kn()(Qn(Zr)(t))}}function to(t,e,n){var r;return r=t&&"object"==typeof t?t:{bufferSize:t,windowTime:e,refCount:!1,scheduler:n},function(t){return t.lift(function(t){var e,n,r=t.bufferSize,o=void 0===r?Number.POSITIVE_INFINITY:r,i=t.windowTime,s=void 0===i?Number.POSITIVE_INFINITY:i,a=t.refCount,c=t.scheduler,u=0,l=!1,d=!1;return function(t){u++,e&&!l||(l=!1,e=new xr(o,s,c),n=t.subscribe({next:function(t){e.next(t)},error:function(t){l=!0,e.error(t)},complete:function(){d=!0,e.complete()}}));var r=e.subscribe(this);this.add((function(){u--,r.unsubscribe(),n&&!d&&a&&0===u&&(n.unsubscribe(),n=void 0,e=void 0)}))}}(r))}}function eo(t){return function(e){return e.lift(new no(t,e))}}var no=function(){function t(t,e){this.predicate=t,this.source=e}return t.prototype.call=function(t,e){return e.subscribe(new ro(t,this.predicate,this.source))},t}(),ro=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.predicate=n,o.source=r,o.seenValue=!1,o.index=0,o}return r.__extends(e,t),e.prototype.applySingleValue=function(t){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=t)},e.prototype._next=function(t){var e=this.index++;this.predicate?this.tryNext(t,e):this.applySingleValue(t)},e.prototype.tryNext=function(t,e){try{this.predicate(t,e,this.source)&&this.applySingleValue(t)}catch(t){this.destination.error(t)}},e.prototype._complete=function(){var t=this.destination;this.index>0?(t.next(this.seenValue?this.singleValue:void 0),t.complete()):t.error(new Ae)},e}(v);function oo(t){return function(e){return e.lift(new io(t))}}var io=function(){function t(t){this.total=t}return t.prototype.call=function(t,e){return e.subscribe(new so(t,this.total))},t}(),so=function(t){function e(e,n){var r=t.call(this,e)||this;return r.total=n,r.count=0,r}return r.__extends(e,t),e.prototype._next=function(t){++this.count>this.total&&this.destination.next(t)},e}(v);function ao(t){return function(e){return e.lift(new co(t))}}var co=function(){function t(t){if(this._skipCount=t,this._skipCount<0)throw new Ce}return t.prototype.call=function(t,e){return 0===this._skipCount?e.subscribe(new v(t)):e.subscribe(new uo(t,this._skipCount))},t}(),uo=function(t){function e(e,n){var r=t.call(this,e)||this;return r._skipCount=n,r._count=0,r._ring=new Array(n),r}return r.__extends(e,t),e.prototype._next=function(t){var e=this._skipCount,n=this._count++;if(n<e)this._ring[n]=t;else{var r=n%e,o=this._ring,i=o[r];o[r]=t,this.destination.next(i)}},e}(v);function lo(t){return function(e){return e.lift(new po(t))}}var po=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){return e.subscribe(new fo(t,this.notifier))},t}(),fo=function(t){function e(e,n){var r=t.call(this,e)||this;r.hasValue=!1;var o=new b(r,void 0,void 0);return r.add(o),r.innerSubscription=o,z(r,n,void 0,void 0,o),r}return r.__extends(e,t),e.prototype._next=function(e){this.hasValue&&t.prototype._next.call(this,e)},e.prototype.notifyNext=function(t,e,n,r,o){this.hasValue=!0,this.innerSubscription&&this.innerSubscription.unsubscribe()},e.prototype.notifyComplete=function(){},e}(y);function ho(t){return function(e){return e.lift(new mo(t))}}var mo=function(){function t(t){this.predicate=t}return t.prototype.call=function(t,e){return e.subscribe(new vo(t,this.predicate))},t}(),vo=function(t){function e(e,n){var r=t.call(this,e)||this;return r.predicate=n,r.skipping=!0,r.index=0,r}return r.__extends(e,t),e.prototype._next=function(t){var e=this.destination;this.skipping&&this.tryCallPredicate(t),this.skipping||e.next(t)},e.prototype.tryCallPredicate=function(t){try{var e=this.predicate(t,this.index++);this.skipping=Boolean(e)}catch(t){this.destination.error(t)}},e}(v);function go(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){var n=t[t.length-1];H(n)?t.pop():n=null;var r=t.length;return Pt(1!==r||n?r>0?vt(t,n):Ct(n):St(t[0]),e)}}var yo=1,bo={};var wo=function(t){var e=yo++;return bo[e]=t,Promise.resolve().then((function(){return function(t){var e=bo[t];e&&e()}(e)})),e},_o=function(t){delete bo[t]},xo=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return r.__extends(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e.scheduled||(e.scheduled=wo(e.flush.bind(e,null))))},e.prototype.recycleAsyncId=function(e,n,r){if(void 0===r&&(r=0),null!==r&&r>0||null===r&&this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);0===e.actions.length&&(_o(n),e.scheduled=void 0)},e}(L),ko=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.__extends(e,t),e.prototype.flush=function(t){this.active=!0,this.scheduled=void 0;var e,n=this.actions,r=-1,o=n.length;t=t||n.shift();do{if(e=t.execute(t.state,t.delay))break}while(++r<o&&(t=n.shift()));if(this.active=!1,e){for(;++r<o&&(t=n.shift());)t.unsubscribe();throw e}},e}(j))(xo),Co=function(t){function e(e,n,r){void 0===n&&(n=0),void 0===r&&(r=ko);var o=t.call(this)||this;return o.source=e,o.delayTime=n,o.scheduler=r,(!W(n)||n<0)&&(o.delayTime=0),r&&"function"==typeof r.schedule||(o.scheduler=ko),o}return r.__extends(e,t),e.create=function(t,n,r){return void 0===n&&(n=0),void 0===r&&(r=ko),new e(t,n,r)},e.dispatch=function(t){var e=t.source,n=t.subscriber;return this.add(e.subscribe(n))},e.prototype._subscribe=function(t){var n=this.delayTime,r=this.source;return this.scheduler.schedule(e.dispatch,n,{source:r,subscriber:t})},e}(C);function So(t,e){return void 0===e&&(e=0),function(n){return n.lift(new To(t,e))}}var To=function(){function t(t,e){this.scheduler=t,this.delay=e}return t.prototype.call=function(t,e){return new Co(e,this.delay,this.scheduler).subscribe(t)},t}();function Eo(t,e){return"function"==typeof e?function(n){return n.pipe(Eo((function(n,r){return _t(t(n,r)).pipe(Et((function(t,o){return e(n,t,r,o)})))})))}:function(e){return e.lift(new Mo(t))}}var Mo=function(){function t(t){this.project=t}return t.prototype.call=function(t,e){return e.subscribe(new Oo(t,this.project))},t}(),Oo=function(t){function e(e,n){var r=t.call(this,e)||this;return r.project=n,r.index=0,r}return r.__extends(e,t),e.prototype._next=function(t){var e,n=this.index++;try{e=this.project(t,n)}catch(t){return void this.destination.error(t)}this._innerSub(e,t,n)},e.prototype._innerSub=function(t,e,n){var r=this.innerSubscription;r&&r.unsubscribe();var o=new b(this,void 0,void 0);this.destination.add(o),this.innerSubscription=z(this,t,e,n,o)},e.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||t.prototype._complete.call(this),this.unsubscribe()},e.prototype._unsubscribe=function(){this.innerSubscription=null},e.prototype.notifyComplete=function(e){this.destination.remove(e),this.innerSubscription=null,this.isStopped&&t.prototype._complete.call(this)},e.prototype.notifyNext=function(t,e,n,r,o){this.destination.next(e)},e}(y);function Do(){return Eo(Nt)}function Io(t,e){return e?Eo((function(){return t}),e):Eo((function(){return t}))}function Ao(t){return function(e){return e.lift(new No(t))}}var No=function(){function t(t){this.notifier=t}return t.prototype.call=function(t,e){var n=new Bo(t),r=z(n,this.notifier);return r&&!n.seenValue?(n.add(r),e.subscribe(n)):n},t}(),Bo=function(t){function e(e){var n=t.call(this,e)||this;return n.seenValue=!1,n}return r.__extends(e,t),e.prototype.notifyNext=function(t,e,n,r,o){this.seenValue=!0,this.complete()},e.prototype.notifyComplete=function(){},e}(y);function zo(t,e){return void 0===e&&(e=!1),function(n){return n.lift(new Po(t,e))}}var Po=function(){function t(t,e){this.predicate=t,this.inclusive=e}return t.prototype.call=function(t,e){return e.subscribe(new Ro(t,this.predicate,this.inclusive))},t}(),Ro=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.predicate=n,o.inclusive=r,o.index=0,o}return r.__extends(e,t),e.prototype._next=function(t){var e,n=this.destination;try{e=this.predicate(t,this.index++)}catch(t){return void n.error(t)}this.nextOrComplete(t,e)},e.prototype.nextOrComplete=function(t,e){var n=this.destination;Boolean(e)?n.next(t):(this.inclusive&&n.next(t),n.complete())},e}(v),Fo={leading:!0,trailing:!1};function Lo(t,e){return void 0===e&&(e=Fo),function(n){return n.lift(new Vo(t,e.leading,e.trailing))}}var Vo=function(){function t(t,e,n){this.durationSelector=t,this.leading=e,this.trailing=n}return t.prototype.call=function(t,e){return e.subscribe(new jo(t,this.durationSelector,this.leading,this.trailing))},t}(),jo=function(t){function e(e,n,r,o){var i=t.call(this,e)||this;return i.destination=e,i.durationSelector=n,i._leading=r,i._trailing=o,i._hasValue=!1,i}return r.__extends(e,t),e.prototype._next=function(t){this._hasValue=!0,this._sendValue=t,this._throttled||(this._leading?this.send():this.throttle(t))},e.prototype.send=function(){var t=this._hasValue,e=this._sendValue;t&&(this.destination.next(e),this.throttle(e)),this._hasValue=!1,this._sendValue=null},e.prototype.throttle=function(t){var e=this.tryDurationSelector(t);e&&this.add(this._throttled=z(this,e))},e.prototype.tryDurationSelector=function(t){try{return this.durationSelector(t)}catch(t){return this.destination.error(t),null}},e.prototype.throttlingDone=function(){var t=this._throttled,e=this._trailing;t&&t.unsubscribe(),this._throttled=null,e&&this.send()},e.prototype.notifyNext=function(t,e,n,r,o){this.throttlingDone()},e.prototype.notifyComplete=function(){this.throttlingDone()},e}(y);function $o(t,e,n){return void 0===e&&(e=$),void 0===n&&(n=Fo),function(r){return r.lift(new Wo(t,e,n.leading,n.trailing))}}var Wo=function(){function t(t,e,n,r){this.duration=t,this.scheduler=e,this.leading=n,this.trailing=r}return t.prototype.call=function(t,e){return e.subscribe(new Ho(t,this.duration,this.scheduler,this.leading,this.trailing))},t}(),Ho=function(t){function e(e,n,r,o,i){var s=t.call(this,e)||this;return s.duration=n,s.scheduler=r,s.leading=o,s.trailing=i,s._hasTrailingValue=!1,s._trailingValue=null,s}return r.__extends(e,t),e.prototype._next=function(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(qo,this.duration,{subscriber:this})),this.leading&&this.destination.next(t))},e.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},e.prototype.clearThrottle=function(){var t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)},e}(v);function qo(t){t.subscriber.clearThrottle()}function Jo(t){return void 0===t&&(t=$),function(e){return n=function(){return e.pipe(zn((function(e,n){var r=e.current;return{value:n,current:t.now(),last:r}}),{current:t.now(),value:void 0,last:void 0}),Et((function(t){var e=t.current,n=t.last,r=t.value;return new Ko(r,e-n)})))},new C((function(t){var e;try{e=n()}catch(e){return void t.error(e)}return(e?_t(e):Ct()).subscribe(t)}));var n}}var Ko=function(){return function(t,e){this.value=t,this.interval=e}}();function Uo(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}Uo.prototype=Object.create(Error.prototype);var Go=Uo;function Yo(t,e,n){return void 0===n&&(n=$),function(r){var o=te(t),i=o?+t-n.now():Math.abs(t);return r.lift(new Xo(i,o,e,n))}}var Xo=function(){function t(t,e,n,r){this.waitFor=t,this.absoluteTimeout=e,this.withObservable=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new Zo(t,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},t}(),Zo=function(t){function e(e,n,r,o,i){var s=t.call(this,e)||this;return s.absoluteTimeout=n,s.waitFor=r,s.withObservable=o,s.scheduler=i,s.action=null,s.scheduleTimeout(),s}return r.__extends(e,t),e.dispatchTimeout=function(t){var e=t.withObservable;t._unsubscribeAndRecycle(),t.add(z(t,e))},e.prototype.scheduleTimeout=function(){var t=this.action;t?this.action=t.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(e.dispatchTimeout,this.waitFor,this))},e.prototype._next=function(e){this.absoluteTimeout||this.scheduleTimeout(),t.prototype._next.call(this,e)},e.prototype._unsubscribe=function(){this.action=null,this.scheduler=null,this.withObservable=null},e}(y);function Qo(t,e){return void 0===e&&(e=$),Yo(t,ee(new Go),e)}function ti(t){return void 0===t&&(t=$),Et((function(e){return new ei(e,t.now())}))}var ei=function(){return function(t,e){this.value=t,this.timestamp=e}}();function ni(t,e,n){return 0===n?[e]:(t.push(e),t)}function ri(){return Fn(ni,[])}function oi(t){return function(e){return e.lift(new ii(t))}}var ii=function(){function t(t){this.windowBoundaries=t}return t.prototype.call=function(t,e){var n=new si(t),r=e.subscribe(n);return r.closed||n.add(z(n,this.windowBoundaries)),r},t}(),si=function(t){function e(e){var n=t.call(this,e)||this;return n.window=new dn,e.next(n.window),n}return r.__extends(e,t),e.prototype.notifyNext=function(t,e,n,r,o){this.openWindow()},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype.notifyComplete=function(t){this._complete()},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t)},e.prototype._complete=function(){this.window.complete(),this.destination.complete()},e.prototype._unsubscribe=function(){this.window=null},e.prototype.openWindow=function(){var t=this.window;t&&t.complete();var e=this.destination,n=this.window=new dn;e.next(n)},e}(y);function ai(t,e){return void 0===e&&(e=0),function(n){return n.lift(new ci(t,e))}}var ci=function(){function t(t,e){this.windowSize=t,this.startWindowEvery=e}return t.prototype.call=function(t,e){return e.subscribe(new ui(t,this.windowSize,this.startWindowEvery))},t}(),ui=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.destination=e,o.windowSize=n,o.startWindowEvery=r,o.windows=[new dn],o.count=0,e.next(o.windows[0]),o}return r.__extends(e,t),e.prototype._next=function(t){for(var e=this.startWindowEvery>0?this.startWindowEvery:this.windowSize,n=this.destination,r=this.windowSize,o=this.windows,i=o.length,s=0;s<i&&!this.closed;s++)o[s].next(t);var a=this.count-r+1;if(a>=0&&a%e==0&&!this.closed&&o.shift().complete(),++this.count%e==0&&!this.closed){var c=new dn;o.push(c),n.next(c)}},e.prototype._error=function(t){var e=this.windows;if(e)for(;e.length>0&&!this.closed;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){var t=this.windows;if(t)for(;t.length>0&&!this.closed;)t.shift().complete();this.destination.complete()},e.prototype._unsubscribe=function(){this.count=0,this.windows=null},e}(v);function li(t){var e=$,n=null,r=Number.POSITIVE_INFINITY;return H(arguments[3])&&(e=arguments[3]),H(arguments[2])?e=arguments[2]:W(arguments[2])&&(r=arguments[2]),H(arguments[1])?e=arguments[1]:W(arguments[1])&&(n=arguments[1]),function(o){return o.lift(new di(t,n,r,e))}}var di=function(){function t(t,e,n,r){this.windowTimeSpan=t,this.windowCreationInterval=e,this.maxWindowSize=n,this.scheduler=r}return t.prototype.call=function(t,e){return e.subscribe(new fi(t,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},t}(),pi=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._numberOfNextedValues=0,e}return r.__extends(e,t),e.prototype.next=function(e){this._numberOfNextedValues++,t.prototype.next.call(this,e)},Object.defineProperty(e.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),e}(dn),fi=function(t){function e(e,n,r,o,i){var s=t.call(this,e)||this;s.destination=e,s.windowTimeSpan=n,s.windowCreationInterval=r,s.maxWindowSize=o,s.scheduler=i,s.windows=[];var a=s.openWindow();if(null!==r&&r>=0){var c={subscriber:s,window:a,context:null},u={windowTimeSpan:n,windowCreationInterval:r,subscriber:s,scheduler:i};s.add(i.schedule(vi,n,c)),s.add(i.schedule(mi,r,u))}else{var l={subscriber:s,window:a,windowTimeSpan:n};s.add(i.schedule(hi,n,l))}return s}return r.__extends(e,t),e.prototype._next=function(t){for(var e=this.windows,n=e.length,r=0;r<n;r++){var o=e[r];o.closed||(o.next(t),o.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(o))}},e.prototype._error=function(t){for(var e=this.windows;e.length>0;)e.shift().error(t);this.destination.error(t)},e.prototype._complete=function(){for(var t=this.windows;t.length>0;){var e=t.shift();e.closed||e.complete()}this.destination.complete()},e.prototype.openWindow=function(){var t=new pi;return this.windows.push(t),this.destination.next(t),t},e.prototype.closeWindow=function(t){t.complete();var e=this.windows;e.splice(e.indexOf(t),1)},e}(v);function hi(t){var e=t.subscriber,n=t.windowTimeSpan,r=t.window;r&&e.closeWindow(r),t.window=e.openWindow(),this.schedule(t,n)}function mi(t){var e=t.windowTimeSpan,n=t.subscriber,r=t.scheduler,o=t.windowCreationInterval,i=n.openWindow(),s={action:this,subscription:null},a={subscriber:n,window:i,context:s};s.subscription=r.schedule(vi,e,a),this.add(s.subscription),this.schedule(t,o)}function vi(t){var e=t.subscriber,n=t.window,r=t.context;r&&r.action&&r.subscription&&r.action.remove(r.subscription),e.closeWindow(n)}function gi(t,e){return function(n){return n.lift(new yi(t,e))}}var yi=function(){function t(t,e){this.openings=t,this.closingSelector=e}return t.prototype.call=function(t,e){return e.subscribe(new bi(t,this.openings,this.closingSelector))},t}(),bi=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.openings=n,o.closingSelector=r,o.contexts=[],o.add(o.openSubscription=z(o,n,n)),o}return r.__extends(e,t),e.prototype._next=function(t){var e=this.contexts;if(e)for(var n=e.length,r=0;r<n;r++)e[r].window.next(t)},e.prototype._error=function(e){var n=this.contexts;if(this.contexts=null,n)for(var r=n.length,o=-1;++o<r;){var i=n[o];i.window.error(e),i.subscription.unsubscribe()}t.prototype._error.call(this,e)},e.prototype._complete=function(){var e=this.contexts;if(this.contexts=null,e)for(var n=e.length,r=-1;++r<n;){var o=e[r];o.window.complete(),o.subscription.unsubscribe()}t.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var t=this.contexts;if(this.contexts=null,t)for(var e=t.length,n=-1;++n<e;){var r=t[n];r.window.unsubscribe(),r.subscription.unsubscribe()}},e.prototype.notifyNext=function(t,e,n,r,o){if(t===this.openings){var i=void 0;try{i=(0,this.closingSelector)(e)}catch(t){return this.error(t)}var s=new dn,a=new f,c={window:s,subscription:a};this.contexts.push(c);var u=z(this,i,c);u.closed?this.closeWindow(this.contexts.length-1):(u.context=c,a.add(u)),this.destination.next(s)}else this.closeWindow(this.contexts.indexOf(t))},e.prototype.notifyError=function(t){this.error(t)},e.prototype.notifyComplete=function(t){t!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(t.context))},e.prototype.closeWindow=function(t){if(-1!==t){var e=this.contexts,n=e[t],r=n.window,o=n.subscription;e.splice(t,1),r.complete(),o.unsubscribe()}},e}(y);function wi(t){return function(e){return e.lift(new _i(t))}}var _i=function(){function t(t){this.closingSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new xi(t,this.closingSelector))},t}(),xi=function(t){function e(e,n){var r=t.call(this,e)||this;return r.destination=e,r.closingSelector=n,r.openWindow(),r}return r.__extends(e,t),e.prototype.notifyNext=function(t,e,n,r,o){this.openWindow(o)},e.prototype.notifyError=function(t,e){this._error(t)},e.prototype.notifyComplete=function(t){this.openWindow(t)},e.prototype._next=function(t){this.window.next(t)},e.prototype._error=function(t){this.window.error(t),this.destination.error(t),this.unsubscribeClosingNotification()},e.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},e.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},e.prototype.openWindow=function(t){void 0===t&&(t=null),t&&(this.remove(t),t.unsubscribe());var e=this.window;e&&e.complete();var n,r=this.window=new dn;this.destination.next(r);try{n=(0,this.closingSelector)()}catch(t){return this.destination.error(t),void this.window.error(t)}this.add(this.closingNotification=z(this,n))},e}(y);function ki(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){var n;"function"==typeof t[t.length-1]&&(n=t.pop());var r=t;return e.lift(new Ci(r,n))}}var Ci=function(){function t(t,e){this.observables=t,this.project=e}return t.prototype.call=function(t,e){return e.subscribe(new Si(t,this.observables,this.project))},t}(),Si=function(t){function e(e,n,r){var o=t.call(this,e)||this;o.observables=n,o.project=r,o.toRespond=[];var i=n.length;o.values=new Array(i);for(var s=0;s<i;s++)o.toRespond.push(s);for(s=0;s<i;s++){var a=n[s];o.add(z(o,a,a,s))}return o}return r.__extends(e,t),e.prototype.notifyNext=function(t,e,n,r,o){this.values[n]=e;var i=this.toRespond;if(i.length>0){var s=i.indexOf(n);-1!==s&&i.splice(s,1)}},e.prototype.notifyComplete=function(){},e.prototype._next=function(t){if(0===this.toRespond.length){var e=[t].concat(this.values);this.project?this._tryProject(e):this.destination.next(e)}},e.prototype._tryProject=function(t){var e;try{e=this.project.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(y);function Ti(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return"function"==typeof n&&t.pop(),vt(t,void 0).lift(new Ei(n))}var Ei=function(){function t(t){this.resultSelector=t}return t.prototype.call=function(t,e){return e.subscribe(new Mi(t,this.resultSelector))},t}(),Mi=function(t){function e(e,n,r){void 0===r&&(r=Object.create(null));var o=t.call(this,e)||this;return o.iterators=[],o.active=0,o.resultSelector="function"==typeof n?n:null,o.values=r,o}return r.__extends(e,t),e.prototype._next=function(t){var e=this.iterators;u(t)?e.push(new Di(t)):"function"==typeof t[O]?e.push(new Oi(t[O]())):e.push(new Ii(this.destination,this,t))},e.prototype._complete=function(){var t=this.iterators,e=t.length;if(this.unsubscribe(),0!==e){this.active=e;for(var n=0;n<e;n++){var r=t[n];if(r.stillUnsubscribed)this.destination.add(r.subscribe(r,n));else this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var t=this.iterators,e=t.length,n=this.destination,r=0;r<e;r++){if("function"==typeof(s=t[r]).hasValue&&!s.hasValue())return}var o=!1,i=[];for(r=0;r<e;r++){var s,a=(s=t[r]).next();if(s.hasCompleted()&&(o=!0),a.done)return void n.complete();i.push(a.value)}this.resultSelector?this._tryresultSelector(i):n.next(i),o&&n.complete()},e.prototype._tryresultSelector=function(t){var e;try{e=this.resultSelector.apply(this,t)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(v),Oi=function(){function t(t){this.iterator=t,this.nextResult=t.next()}return t.prototype.hasValue=function(){return!0},t.prototype.next=function(){var t=this.nextResult;return this.nextResult=this.iterator.next(),t},t.prototype.hasCompleted=function(){var t=this.nextResult;return t&&t.done},t}(),Di=function(){function t(t){this.array=t,this.index=0,this.length=0,this.length=t.length}return t.prototype[O]=function(){return this},t.prototype.next=function(t){var e=this.index++,n=this.array;return e<this.length?{value:n[e],done:!1}:{value:null,done:!0}},t.prototype.hasValue=function(){return this.array.length>this.index},t.prototype.hasCompleted=function(){return this.array.length===this.index},t}(),Ii=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.parent=n,o.observable=r,o.stillUnsubscribed=!0,o.buffer=[],o.isComplete=!1,o}return r.__extends(e,t),e.prototype[O]=function(){return this},e.prototype.next=function(){var t=this.buffer;return 0===t.length&&this.isComplete?{value:null,done:!0}:{value:t.shift(),done:!1}},e.prototype.hasValue=function(){return this.buffer.length>0},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(t,e,n,r,o){this.buffer.push(e),this.parent.checkIterators()},e.prototype.subscribe=function(t,e){return z(this,this.observable,this,e)},e}(y);function Ai(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return e.lift.call(Ti.apply(void 0,[e].concat(t)))}}function Ni(t){return function(e){return e.lift(new Ei(t))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(39),o=n(8);e.Schema=o.Schema;var i=o.marks,s=Object.assign(o.nodes,r.semanticNodes);e.schema=new o.Schema({marks:i,nodes:s})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(7),s=n(2),a=function(t){function e(e,n){var r=t.call(this,e)||this;return r.dialog=e,r.localization=n,r.data="",r}return r.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.textarea.nativeElement.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.editor.exec("setHTML",this.getData()),this.dialog.close(),this.editor.view.focus()},e.prototype.getData=function(){return this.textarea.nativeElement.value},e.prototype.setData=function(){this.data=this.indent(this.editor.getSource())},e.prototype.textFor=function(t){return this.localization.get(t)},e.prototype.indent=function(t){return t.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/gi,"</$1>\n").replace(/<(ul|ol)([^>]*)><li/gi,"<$1$2>\n<li").replace(/<br \/>/gi,"<br />\n").replace(/\n$/,"")},r.__decorate([o.Input(),r.__metadata("design:type",Object)],e.prototype,"editor",void 0),r.__decorate([o.ViewChild("textarea",{static:!0}),r.__metadata("design:type",o.ElementRef)],e.prototype,"textarea",void 0),e=r.__decorate([o.Component({styles:["\n >>> .k-editor-textarea {\n height: 100%;\n }\n "],template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'viewSource\') }}\n </kendo-dialog-titlebar>\n <textarea [value]="data" #textarea class="k-textarea k-editor-textarea"></textarea>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogUpdate\') }}</button>\n </kendo-dialog-actions>\n '}),r.__metadata("design:paramtypes",[i.DialogRef,s.EditorLocalizationService])],e)}(i.DialogContentBase);e.SourceDialogComponent=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(12),s=n(7),a=n(8),c=n(9),u=n(2),l=n(10),d=function(t){function e(e,n){var r=t.call(this,e)||this;return r.dialog=e,r.localization=n,r.src=new i.FormControl("",i.Validators.required),r.alt=new i.FormControl(""),r.width=new i.FormControl("",i.Validators.min(1)),r.height=new i.FormControl("",i.Validators.min(1)),r.data={alt:"",height:"",src:"",width:""},r.imageData=new i.FormGroup({alt:r.alt,height:r.height,src:r.src,width:r.width}),r}return r.__extends(e,t),e.prototype.ngOnInit=function(){this.srcInputId="k-"+l.guid(),this.altTextInputId="k-"+l.guid(),this.widthInputId="k-"+l.guid(),this.heightInputId="k-"+l.guid()},e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.srcInput.nativeElement.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.src.value&&(this.editor.exec("insertImage",this.getData()),this.dialog.close(),this.editor.view.focus())},e.prototype.setData=function(t){var e=a.getNodeFromSelection(t);e&&(this.src.patchValue(e.attrs.src),this.alt.patchValue(e.attrs.alt),this.width.patchValue(e.attrs.width),this.height.patchValue(e.attrs.height))},e.prototype.textFor=function(t){return this.localization.get(t)},e.prototype.getData=function(){return{alt:this.alt.value,height:this.normalizeDimension(this.height.value),src:this.src.value,width:this.normalizeDimension(this.width.value)}},e.prototype.normalizeDimension=function(t){return Number.isNaN(parseInt(t,10))||parseInt(t,10)<=0?"":c.safeString(parseInt(t,10))},r.__decorate([o.Input(),r.__metadata("design:type",Object)],e.prototype,"editor",void 0),r.__decorate([o.ViewChild("srcInput",{read:o.ElementRef,static:!0}),r.__metadata("design:type",o.ElementRef)],e.prototype,"srcInput",void 0),e=r.__decorate([o.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'insertImage\') }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content">\n <div class="k-edit-label">\n <label [for]="srcInputId">{{ textFor(\'imageWebAddress\') }}</label>\n </div>\n <div class="k-edit-field">\n <input [id]="srcInputId" #srcInput [formControl]="src" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n <div class="k-edit-label">\n <label [for]="altTextInputId">{{ textFor(\'imageAltText\') }}</label>\n </div>\n <div class="k-edit-field">\n <input [id]="altTextInputId" [formControl]="alt" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n <div class="k-edit-label">\n <label [for]="widthInputId">{{ textFor(\'imageWidth\') }}</label>\n </div>\n <div class="k-edit-field">\n <input [id]="widthInputId" [formControl]="width" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n <div class="k-edit-label">\n <label [for]="heightInputId">{{ textFor(\'imageHeight\') }}</label>\n </div>\n <div class="k-edit-field">\n <input [id]="heightInputId" [formControl]="height" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton [disabled]="imageData.invalid"\n (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogInsert\') }}</button>\n </kendo-dialog-actions>\n '}),r.__metadata("design:paramtypes",[s.DialogRef,u.EditorLocalizationService])],e)}(s.DialogContentBase);e.ImageDialogComponent=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(12),s=n(7),a=n(8),c=n(9),u=n(2),l=function(t){function e(e,n){var r=t.call(this,e)||this;return r.dialog=e,r.localization=n,r.linkForm=new i.FormGroup({href:new i.FormControl("",i.Validators.required),text:new i.FormControl({value:"",disabled:!0},i.Validators.required),title:new i.FormControl("")}),r}return r.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.hrefInput.nativeElement.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){var t=this.getData();this.editor.exec(this.command,t),this.dialog.close(),this.editor.view.focus()},Object.defineProperty(e.prototype,"titleText",{get:function(){return this.localization.get(this.command)},enumerable:!0,configurable:!0}),e.prototype.setData=function(t,e){"createLink"===this.command&&this.linkForm.addControl("target",new i.FormControl);var n=a.getMark(t,t.schema.marks.link);if(n)this.linkForm.reset({href:n.attrs.href,title:n.attrs.title,target:c.isPresent(n.attrs.target),text:this.setLinkText(t)});else if(t.selection.empty){var r=e.applyToWord?a.expandSelection(t,(function(){}),e).state:t;r.selection.empty||this.linkForm.patchValue({text:a.getSelectionText(r)})}else this.linkForm.patchValue({text:a.getSelectionText(t)})},e.prototype.textForWithPrefix=function(t){var e="createLink"===this.command?"link":"file";return this.textFor(e+t)},e.prototype.textFor=function(t){return this.localization.get(t)},e.prototype.setLinkText=function(t){var e=t.selection;if(e.empty&&e.$cursor){var n=e.$cursor,r=n.index();return n.parent.child(r).text}return a.getSelectionText(t)},e.prototype.getData=function(){var t=this.linkForm.value;return c.isPresent(this.linkForm.controls.target)&&(t.target=t.target?"_blank":null),t},r.__decorate([o.Input(),r.__metadata("design:type",Object)],e.prototype,"editor",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"command",void 0),r.__decorate([o.ViewChild("hrefInput",{read:o.ElementRef,static:!0}),r.__metadata("design:type",o.ElementRef)],e.prototype,"hrefInput",void 0),e=r.__decorate([o.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ titleText }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content">\n <form novalidate [formGroup]="linkForm">\n <div class="k-edit-label">\n <label (click)="hrefInput.focus()">{{ textForWithPrefix(\'WebAddress\') }}</label>\n </div>\n <div class="k-edit-field">\n <input #hrefInput formControlName="href" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n\n <div class="k-edit-label">\n <label (click)="textInput.focus()">{{ textForWithPrefix(\'Text\') }}</label>\n </div>\n <div class="k-edit-field">\n <input #textInput formControlName="text" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n\n <div class="k-edit-label">\n <label (click)="titleInput.focus()">{{ textForWithPrefix(\'Title\') }}</label>\n </div>\n <div class="k-edit-field">\n <input #titleInput formControlName="title" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n <ng-container *ngIf="command === \'createLink\'">\n <div class="k-edit-label"></div>\n <div class="k-edit-field">\n <input type="checkbox" id="k-target-blank" kendoCheckBox formControlName="target" />\n <label class="k-checkbox-label" for="k-target-blank">{{ textForWithPrefix(\'OpenInNewWindow\') }}</label>\n </div>\n </ng-container>\n </form>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton [disabled]="linkForm.invalid" (click)="onConfirmAction()" [primary]="true">\n {{ textFor(\'dialogInsert\') }}\n </button>\n </kendo-dialog-actions>\n '}),r.__metadata("design:paramtypes",[s.DialogRef,u.EditorLocalizationService])],e)}(s.DialogContentBase);e.FileLinkDialogComponent=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EditorErrorMessages={schemaType:"Expected value of type Schema. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/",setSchemaOnce:"The Schema cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/",pluginsCallbackType:function(t){return"plugins must be a function, but received "+JSON.stringify(t)+"."},pastedContentCallbackType:function(t){return"pastedContent must be a function, but received "+JSON.stringify(t)+"."},setPluginsOnce:"The plugins cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/plugins/",setPlaceHolderOnce:"The placeholder cannot be changed dynamically. See https://www.telerik.com/kendo-angular-ui/components/editor/plugins/#toc-custom-plugins/",printTool:"The Print tool and functionality are supported only in iframe mode. See https://www.telerik.com/kendo-angular-ui-develop/components/editor/api/EditorPrintButtonDirective/"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=function(t){function e(e,n,r){var o=t.call(this)||this;return o.cleanedHtml=e,o.originalHtml=n,o.originalEvent=r,o}return r.__extends(e,t),e}(n(10).PreventableEvent);e.EditorPasteEvent=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(7),s=n(2),a=n(3),c=n(17),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.dialog=e,r.localization=n,r.data=[],r}return r.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.formatDropDownList.dropDownList.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.value&&this.editor.exec("format",{tag:this.value}),this.dialog.close()},e.prototype.setData=function(t){this.editor=t.editor,this.data=t.data,this.defaultItem=t.defaultItem,this.value=t.value,this.itemDisabled=t.itemDisabled},e.prototype.textFor=function(t){return this.localization.get(t)},r.__decorate([o.Input(),r.__metadata("design:type",a.EditorComponent)],e.prototype,"editor",void 0),r.__decorate([o.ViewChild("formatDropDownList",{read:c.FormatDropDownListComponent,static:!0}),r.__metadata("design:type",c.FormatDropDownListComponent)],e.prototype,"formatDropDownList",void 0),e=r.__decorate([o.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'format\') }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content" style="text-align: center;">\n <kendo-editor-format-dropdownlist\n #formatDropDownList\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n >\n </kendo-editor-format-dropdownlist>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton\n (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogApply\') }}</button>\n </kendo-dialog-actions>\n '}),r.__metadata("design:paramtypes",[i.DialogRef,s.EditorLocalizationService])],e)}(i.DialogContentBase);e.FormatDialogComponent=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(7),s=n(2),a=n(3),c=n(16),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.dialog=e,r.localization=n,r}return r.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.colorPicker.focus()}))},e.prototype.handleActiveColorClick=function(t){t.preventOpen(),this.value=t.color},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.value&&this.editor.exec(this.editorCommand,this.value),this.dialog.close(),this.editor.view.focus()},e.prototype.setData=function(t){this.editor=t.editor,this.value=t.value,this.editorCommand=t.editorCommand,this.paletteSettings=t.paletteSettings,this.icon=t.icon,this.views=t.view?[t.view]:t.views},e.prototype.textFor=function(t){return this.localization.get(t)},r.__decorate([o.Input(),r.__metadata("design:type",a.EditorComponent)],e.prototype,"editor",void 0),r.__decorate([o.ViewChild("colorpicker",{read:c.ColorPickerComponent,static:!0}),r.__metadata("design:type",c.ColorPickerComponent)],e.prototype,"colorPicker",void 0),e=r.__decorate([o.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(editorCommand) }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content" style="text-align: center;">\n <kendo-colorpicker\n #colorpicker\n [views]="views"\n [format]="\'hex\'"\n [attr.title]="title"\n [icon]="icon"\n [(value)]="value"\n [paletteSettings]="paletteSettings"\n (activeColorClick)="handleActiveColorClick($event)"\n >\n </kendo-colorpicker>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton\n (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogApply\') }}</button>\n </kendo-dialog-actions>\n '}),r.__metadata("design:paramtypes",[i.DialogRef,s.EditorLocalizationService])],e)}(i.DialogContentBase);e.ColorPickerDialogComponent=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(7),s=n(2),a=n(3),c=n(18),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.dialog=e,r.localization=n,r.data=[],r}return r.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.fontFamilyDropDownList.dropDownList.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.value&&this.editor.exec("fontFamily",this.value),this.dialog.close()},e.prototype.setData=function(t){this.editor=t.editor,this.data=t.data,this.defaultItem=t.defaultItem,this.value=t.value,this.itemDisabled=t.itemDisabled},e.prototype.textFor=function(t){return this.localization.get(t)},r.__decorate([o.Input(),r.__metadata("design:type",a.EditorComponent)],e.prototype,"editor",void 0),r.__decorate([o.ViewChild("fontFamilyDropDownList",{read:c.FontFamilyDropDownListComponent,static:!0}),r.__metadata("design:type",c.FontFamilyDropDownListComponent)],e.prototype,"fontFamilyDropDownList",void 0),e=r.__decorate([o.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'fontFamily\') }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content" style="text-align: center;">\n <kendo-editor-fontfamily-dropdownlist\n #fontFamilyDropDownList\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n >\n </kendo-editor-fontfamily-dropdownlist>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton\n (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogApply\') }}</button>\n </kendo-dialog-actions>\n '}),r.__metadata("design:paramtypes",[i.DialogRef,s.EditorLocalizationService])],e)}(i.DialogContentBase);e.FontFamilyDialogComponent=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(7),s=n(2),a=n(3),c=function(t){function e(e,n){var r=t.call(this,e)||this;return r.dialog=e,r.localization=n,r}return r.__extends(e,t),e.prototype.onCancelAction=function(){this.dialog.close(),this.editor.view.focus()},e.prototype.onCellClick=function(t){this.dialog.close(),this.editor.exec("insertTable",t),this.editor.view.focus()},e.prototype.setData=function(t){this.editor=t.editor},e.prototype.textFor=function(t){return this.localization.get(t)},r.__decorate([o.Input(),r.__metadata("design:type",a.EditorComponent)],e.prototype,"editor",void 0),e=r.__decorate([o.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'insertTable\') }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-ct-popup k-window-content" style="text-align: center;">\n <kendo-popup-table-grid (cellClick)="onCellClick($event)"></kendo-popup-table-grid>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n </kendo-dialog-actions>\n '}),r.__metadata("design:paramtypes",[i.DialogRef,s.EditorLocalizationService])],e)}(i.DialogContentBase);e.InsertTableDialogComponent=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(7),s=n(2),a=n(3),c=n(19),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.dialog=e,r.localization=n,r.data=[],r}return r.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.fontSizeDropDownList.dropDownList.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.value&&this.editor.exec("fontSize",this.value),this.dialog.close()},e.prototype.setData=function(t){this.editor=t.editor,this.data=t.data,this.defaultItem=t.defaultItem,this.value=t.value,this.itemDisabled=t.itemDisabled},e.prototype.textFor=function(t){return this.localization.get(t)},r.__decorate([o.Input(),r.__metadata("design:type",a.EditorComponent)],e.prototype,"editor",void 0),r.__decorate([o.ViewChild("fontSizeDropDownList",{read:c.FontSizeDropDownListComponent,static:!0}),r.__metadata("design:type",c.FontSizeDropDownListComponent)],e.prototype,"fontSizeDropDownList",void 0),e=r.__decorate([o.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'fontSize\') }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content" style="text-align: center;">\n <kendo-editor-fontsize-dropdownlist\n #fontSizeDropDownList\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n >\n </kendo-editor-fontsize-dropdownlist>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton\n (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogApply\') }}</button>\n </kendo-dialog-actions>\n '}),r.__metadata("design:paramtypes",[i.DialogRef,s.EditorLocalizationService])],e)}(i.DialogContentBase);e.FontSizeDialogComponent=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(21),o=function(){function t(t,e,n,o,i){var s=this;this.command=t,this.button=e,this.editor=n,this.localization=o,this.toolsService=i,setTimeout((function(){var t=s.localization.get(s.command);t&&(s.button.showText="overflow",s.button.showIcon="both",s.button.text=t),s.button.toolbarOptions.icon||(s.button.icon=r.commandIcons[s.command]),s.button.title=t,s.toolsService.needsCheck.next()}))}return t.prototype.ngOnInit=function(){this.subs=this.editor.stateChange.subscribe(this.onStateChange.bind(this)),this.subs.add(this.button.click.subscribe(this.clickHandler.bind(this))),this.subs.add(this.button.pointerdown.subscribe(this.pointerdownHandler.bind(this)))},t.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe()},t.prototype.clickHandler=function(){},t.prototype.pointerdownHandler=function(t){},t.prototype.onStateChange=function(t){},t}();e.EditorCommandBase=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r.__extends(e,t),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"alignCenter",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"alignJustify",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"alignLeft",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"alignRight",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"backColor",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"blockquote",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"bold",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"cleanFormatting",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"createLink",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"fontFamily",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"fontSize",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"foreColor",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"format",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"indent",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"insertFile",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"insertImage",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"insertOrderedList",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"insertUnorderedList",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"italic",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"outdent",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"print",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"redo",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"selectAll",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"strikethrough",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"subscript",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"superscript",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"underline",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"undo",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"unlink",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"viewSource",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"insertTable",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"addColumnBefore",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"addColumnAfter",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"addRowBefore",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"addRowAfter",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"deleteColumn",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"deleteRow",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"deleteTable",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"dialogApply",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"dialogCancel",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"dialogInsert",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"dialogUpdate",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"fileText",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"fileTitle",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"fileWebAddress",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"imageAltText",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"imageHeight",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"imageWebAddress",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"imageWidth",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"linkOpenInNewWindow",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"linkText",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"linkTitle",void 0),r.__decorate([o.Input(),r.__metadata("design:type",String)],e.prototype,"linkWebAddress",void 0),e}(n(11).ComponentMessages);e.Messages=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3);e.EditorComponent=r.EditorComponent;var o=n(45);e.EditorModule=o.EditorModule;var i=n(23);e.schema=i.schema,e.Schema=i.Schema;var s=n(8);e.EditorState=s.EditorState,e.Plugin=s.Plugin,e.PluginKey=s.PluginKey,e.Transaction=s.Transaction,e.EditorView=s.EditorView,e.Decoration=s.Decoration,e.DecorationSet=s.DecorationSet,e.NodeType=s.NodeType,e.Node=s.Node,e.MarkType=s.MarkType,e.Mark=s.Mark,e.InputRule=s.InputRule,e.inputRules=s.inputRules,e.wrappingInputRule=s.wrappingInputRule,e.textblockTypeInputRule=s.textblockTypeInputRule,e.keymap=s.keymap,e.baseKeymap=s.baseKeymap,e.history=s.history,e.dropCursor=s.dropCursor,e.gapCursor=s.gapCursor,e.tableNodes=s.tableNodes,e.getSelectionText=s.getSelectionText;var a=n(28);e.EditorPasteEvent=a.EditorPasteEvent},function(t,e){t.exports=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.packageMetadata={name:"@progress/kendo-angular-editor",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1645798286,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(40);e.semanticTagNames=["article","main","nav","header","footer","aside","section"],e.semanticNodes=e.semanticTagNames.reduce((function(t,e){var n,i;return Object.assign(t,((n={})[e]=(i=e,{content:"block*",group:"block",attrs:r.__assign({},o.commonAttributes()),parseDOM:[{tag:i,getAttrs:o.getAttributes}],toDOM:function(t){return o.hasAttrs(t.attrs)?[i,o.getAttrs(t.attrs),o.hole]:[i,o.hole]}}),n))}),{})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0);e.hasAttrs=function(t,e){for(var n in t)if(n&&null!==t[n]&&n!==e)return!0;return!1},e.getAttrs=function(t,e){var n={};for(var r in t)r&&null!==t[r]&&r!==e&&(n[r]=t[r]);return n},e.getAttributes=function(t){for(var e,n={},r=t.attributes,o=0;o<r.length;o++)n[(e=r[o]).name]=e.value;return n},e.serializeDOMAttrs=function(t){return Array.from(t.attributes).reduce((function(t,e){var n;return Object.assign({},t,((n={})[e.name]=e.value,n))}),{})},e.commonAttributes=function(){return r.__assign({},e.createDefaultAttributes(["class","id","style"]))},e.createDefaultAttributes=function(t){return void 0===t&&(t=[]),r.__assign({},t.reduce((function(t,e){var n;return r.__assign({},t,((n={})[e]={default:null},n))}),{}))},e.hole=0,e.isSchemaNode=function(t){return function(e){return e.type.name===t}},e.isTable=e.isSchemaNode("table"),e.isTableBody=e.isSchemaNode("table_body"),e.isTableHead=e.isSchemaNode("table_head"),e.isTableFoot=e.isSchemaNode("table_foot"),e.isTableRow=e.isSchemaNode("table_row"),e.isTableCell=e.isSchemaNode("table_cell"),e.isTableHeaderCell=e.isSchemaNode("table_header")},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(8),i=n(42),s=function(t,e){return o.alignBlocks(o.alignRemoveRules)(t,e)},a={bold:function(t){return o.expandToWordWrap(o.toggleInlineFormat,r.__assign({},o.bold,{applyToWord:t}))},cleanFormatting:function(t){return o.cleanFormatting(t)},createLink:function(t){return o.expandToWordWrap(o.applyLink,{mark:"link",attrs:t.value,applyToWord:t.applyToWord})},fontFamily:function(t){return o.expandToWordWrap(o.applyInlineStyle,{style:"font-family",value:t.value,applyToWord:t.applyToWord})},fontSize:function(t){return o.expandToWordWrap(o.applyInlineStyle,{style:"font-size",value:t.value+"px",applyToWord:t.applyToWord})},insertFile:function(t){return o.expandToWordWrap(o.applyLink,{mark:"link",attrs:t,applyToWord:t.applyToWord})},insertText:function(t){return o.insertText(t)},italic:function(t){return o.expandToWordWrap(o.toggleInlineFormat,r.__assign({},o.italic,{applyToWord:t}))},strikethrough:function(t){return o.expandToWordWrap(o.toggleInlineFormat,r.__assign({},o.strikethrough,{applyToWord:t}))},subscript:function(t){return o.expandToWordWrap(o.toggleInlineFormat,r.__assign({},o.subscript,{applyToWord:t}))},superscript:function(t){return o.expandToWordWrap(o.toggleInlineFormat,r.__assign({},o.superscript,{applyToWord:t}))},underline:function(t){return o.expandToWordWrap(o.toggleInlineFormat,r.__assign({},o.underline,{applyToWord:t}))},unlink:function(){return o.removeLink(o.link)},foreColor:function(t){return o.expandToWordWrap(o.applyInlineStyle,{style:"color",value:t.value,applyToWord:t.applyToWord})},backColor:function(t){return o.expandToWordWrap(o.applyInlineStyle,{style:"background-color",value:t.value,applyToWord:t.applyToWord})},selectAll:function(){return function(t,e){return o.selectAll(t,e)}}},c={alignCenter:function(){return function(t,e){return o.isAligned(t,o.alignCenterRules)?s(t,e):o.alignBlocks(o.alignCenterRules)(t,e)}},alignJustify:function(){return function(t,e){return o.isAligned(t,o.alignJustifyRules)?s(t,e):o.alignBlocks(o.alignJustifyRules)(t,e)}},alignLeft:function(){return function(t,e){return o.isAligned(t,o.alignLeftRules)?s(t,e):o.alignBlocks(o.alignLeftRules)(t,e)}},alignRight:function(){return function(t,e){return o.isAligned(t,o.alignRightRules)?s(t,e):o.alignBlocks(o.alignRightRules)(t,e)}},format:function(t){return o.formatBlockElements(t.tag)},getHTML:function(){return o.getHtml},indent:function(){return o.indent},insertImage:function(t){return o.insertImage(t)},insertOrderedList:function(){return o.toggleOrderedList},insertUnorderedList:function(){return o.toggleUnorderedList},outdent:function(){return o.outdent},redo:function(){return o.redo},setHTML:function(t){var e=t.content,n=t.parseOptions;return o.setHtml(e,"setHTML",n)},undo:function(){return o.undo},blockquote:function(){return o.blockquote}},u={insertTable:function(t){return i.insertTable(t)},addColumnBefore:function(){return o.addColumnBefore},addColumnAfter:function(){return o.addColumnAfter},addRowBefore:function(){return o.addRowBefore},addRowAfter:function(){return o.addRowAfter},deleteRow:function(){return o.deleteRow},deleteColumn:function(){return o.deleteColumn},mergeCells:function(){return o.mergeCells},splitCell:function(){return o.splitCell},deleteTable:function(){return o.deleteTable}};e.editorCommands=Object.assign({},a,c,u)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8);e.insertTable=function(t){return function(e,n){var o=r.createTable(e.schema.nodes,t.rows,t.cols);o&&r.insertNode(o,!0)(e,n)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(8),o=n(8);e.getToolbarState=function(t,e){return{alignCenter:{selected:o.isAligned(t,o.alignCenterRules),disabled:!1},alignJustify:{selected:o.isAligned(t,o.alignJustifyRules),disabled:!1},alignLeft:{selected:o.isAligned(t,o.alignLeftRules),disabled:!1},alignRight:{selected:o.isAligned(t,o.alignRightRules),disabled:!1},bold:{selected:o.hasMark(t,o.bold),disabled:!1},cleanFormatting:{selected:!1,disabled:!r.cleanFormatting()(t)},format:{selected:o.activeNode(t),disabled:!1},blockquote:{selected:!1,disabled:!r.blockquote(t)},indent:{selected:!1,disabled:!(o.canIndentAsListItem(t,t.schema.nodes.list_item)||o.canBeIndented(t,o.indentRules))},insertOrderedList:{selected:o.hasNode(t,t.schema.nodes.ordered_list),disabled:!1},insertUnorderedList:{selected:o.hasNode(t,t.schema.nodes.bullet_list),disabled:!1},italic:{selected:o.hasMark(t,o.italic),disabled:!1},unlink:{selected:!1,disabled:!o.hasMark(t,o.link)},outdent:{selected:!1,get disabled(){return!(o.hasNode(t,t.schema.nodes.blockquote)||o.canOutdentAsListItem(t,o.outdentRules)||r.isIndented(t,o.outdentRules.nodes))}},redo:{selected:!1,disabled:!o.redo(t)},selectAll:{selected:!1,disabled:!1},strikethrough:{selected:o.hasMark(t,o.strikethrough),disabled:!1},style:{selected:o.getActiveMarks(t,t.schema.marks.style),disabled:!1},subscript:{selected:o.hasMark(t,o.subscript),disabled:!1},superscript:{selected:o.hasMark(t,o.superscript),disabled:!1},underline:{selected:o.hasMark(t,o.underline),disabled:!1},undo:{selected:!1,disabled:!o.undo(t)},createLink:{selected:!1,get disabled(){var n=t.selection.empty;return e&&e.applyToWord&&n?o.expandSelection(t,(function(){}),e).state.selection.empty:n}},insertFile:{selected:!1,disabled:t.selection.empty},insertImage:{selected:!1,disabled:!1},viewSource:{selected:!1,disabled:!1},print:{selected:!1,disabled:!1},insertTable:{selected:!1,disabled:!1},addColumnBefore:{selected:!1,disabled:!o.addColumnBefore(t)},addColumnAfter:{selected:!1,disabled:!o.addColumnAfter(t)},addRowBefore:{selected:!1,disabled:!o.addRowBefore(t)},addRowAfter:{selected:!1,disabled:!o.addRowAfter(t)},deleteRow:{selected:!1,disabled:!o.deleteRow(t)},deleteColumn:{selected:!1,disabled:!o.deleteColumn(t)},mergeCells:{selected:!1,disabled:!o.mergeCells(t)},splitCell:{selected:!1,disabled:!o.splitCell(t)},deleteTable:{selected:!1,disabled:!o.deleteTable(t)}}},e.initialToolBarState={alignCenter:{selected:!1,disabled:!1},alignJustify:{selected:!1,disabled:!1},alignLeft:{selected:!1,disabled:!1},alignRight:{selected:!1,disabled:!1},bold:{selected:!1,disabled:!1},italic:{selected:!1,disabled:!1},underline:{selected:!1,disabled:!1},strikethrough:{selected:!1,disabled:!1},subscript:{selected:!1,disabled:!1},superscript:{selected:!1,disabled:!1},format:{selected:{text:"Format",tag:null},disabled:!1},style:{selected:{marks:[],hasNodesWithoutMarks:!1},disabled:!1},cleanFormatting:{selected:!1,disabled:!0},blockquote:{selected:!1,disabled:!1},indent:{selected:!1,disabled:!1},outdent:{selected:!1,disabled:!1},insertOrderedList:{selected:!1,disabled:!1},insertUnorderedList:{selected:!1,disabled:!1},unlink:{selected:!1,disabled:!0},redo:{selected:!1,disabled:!0},undo:{selected:!1,disabled:!0},print:{selected:!1,disabled:!1},createLink:{selected:!1,disabled:!0},insertFile:{selected:!1,disabled:!0},insertImage:{selected:!1,disabled:!1},viewSource:{selected:!1,disabled:!1},insertTable:{selected:!1,disabled:!1},addColumnBefore:{selected:!1,disabled:!0},addColumnAfter:{selected:!1,disabled:!0},addRowBefore:{selected:!1,disabled:!0},addRowAfter:{selected:!1,disabled:!0},deleteRow:{selected:!1,disabled:!0},deleteColumn:{selected:!1,disabled:!0},mergeCells:{selected:!1,disabled:!0},splitCell:{selected:!1,disabled:!0},deleteTable:{selected:!1,disabled:!0},selectAll:{selected:!1,disabled:!1}},e.disabledToolBarState={alignCenter:{selected:!1,disabled:!0},alignJustify:{selected:!1,disabled:!0},alignLeft:{selected:!1,disabled:!0},alignRight:{selected:!1,disabled:!0},bold:{selected:!1,disabled:!0},italic:{selected:!1,disabled:!0},underline:{selected:!1,disabled:!0},strikethrough:{selected:!1,disabled:!0},subscript:{selected:!1,disabled:!0},superscript:{selected:!1,disabled:!0},format:{selected:{text:"Format",tag:null},disabled:!0},style:{selected:{marks:[],hasNodesWithoutMarks:!1},disabled:!0},cleanFormatting:{selected:!1,disabled:!0},blockquote:{selected:!1,disabled:!0},indent:{selected:!1,disabled:!0},outdent:{selected:!1,disabled:!0},insertOrderedList:{selected:!1,disabled:!0},insertUnorderedList:{selected:!1,disabled:!0},unlink:{selected:!1,disabled:!0},redo:{selected:!1,disabled:!0},undo:{selected:!1,disabled:!0},print:{selected:!1,disabled:!0},createLink:{selected:!1,disabled:!0},insertFile:{selected:!1,disabled:!0},insertImage:{selected:!1,disabled:!0},viewSource:{selected:!1,disabled:!0},insertTable:{selected:!1,disabled:!0},addColumnBefore:{selected:!1,disabled:!0},addColumnAfter:{selected:!1,disabled:!0},addRowBefore:{selected:!1,disabled:!0},addRowAfter:{selected:!1,disabled:!0},deleteRow:{selected:!1,disabled:!0},deleteColumn:{selected:!1,disabled:!0},mergeCells:{selected:!1,disabled:!0},splitCell:{selected:!1,disabled:!0},deleteTable:{selected:!1,disabled:!0},selectAll:{selected:!1,disabled:!0}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.defaultStyle='\n html, body {\n margin: 0;\n height: 100%;\n padding: 0;\n }\n\n html {\n min-height: 100%;\n }\n\n body {\n box-sizing: border-box;\n position: relative;\n word-wrap: break-word;\n padding: 8px;\n }\n\n body > .k-content {\n outline: 0;\n height: 100%;\n white-space: pre-wrap;\n }\n\n div.ProseMirror {\n position: relative;\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n }\n\n .ProseMirror pre {\n white-space: pre-wrap;\n }\n\n .k-content > p {\n margin: 0 0 1em;\n }\n\n .k-content table {\n white-space: pre-wrap;\n }\n\n .k-content .k-text-selected, .k-content::selection {\n color: HighlightText;\n background-color: Highlight;\n }\n\n .k-content .k-text-highlighted {\n background-color: #bbdefb;\n }\n\n .k-content .ProseMirror-selectednode {\n outline: 2px solid #8cf;\n }\n\n .ProseMirror-hideselection *::selection { background: transparent; }\n .ProseMirror-hideselection *::-moz-selection { background: transparent; }\n .ProseMirror-hideselection { caret-color: transparent; }\n\n .ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n }\n\n .ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n }\n\n @keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n }\n\n .ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n }\n\n .k-editor-resize-handles-wrapper {\n position: absolute;\n visibility: hidden;\n }\n\n .k-editor-resize-handle {\n position: absolute;\n visibility: visible;\n background-color: #fff;\n border: 1px solid #000;\n z-index: 100;\n width: 5px;\n height: 5px;\n }\n\n .k-editor-resize-handle.northwest {\n top: 0;\n left: 0;\n transform: translate(-50%, -50%);\n cursor: nw-resize;\n }\n\n .k-editor-resize-handle.north {\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n cursor: n-resize;\n }\n\n .k-editor-resize-handle.northeast {\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n cursor: ne-resize;\n }\n\n .k-editor-resize-handle.southwest {\n left: 0;\n bottom: 0;\n transform: translate(-50%, 50%);\n cursor: sw-resize;\n }\n\n .k-editor-resize-handle.south {\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 50%);\n cursor: s-resize;\n }\n\n .k-editor-resize-handle.southeast {\n right: 0;\n bottom: 0;\n transform: translate(50%, 50%);\n cursor: se-resize;\n }\n\n .k-editor-resize-handle.west {\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n cursor: w-resize;\n }\n\n .k-editor-resize-handle.east {\n top: 50%;\n right: 0;\n transform: translate(50%, -50%);\n cursor: e-resize;\n }\n\n .ProseMirror .k-placeholder::before {\n content: attr(data-placeholder);\n height: 0;\n color: #8a8a8a;\n float: left;\n opacity: 1;\n cursor: text;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n\n .ProseMirror li {\n position: relative;\n }\n\n li.ProseMirror-selectednode {\n outline: none;\n }\n\n li.ProseMirror-selectednode:after {\n content: "";\n position: absolute;\n left: -32px;\n right: -2px;\n top: -2px;\n bottom: -2px;\n border: 2px solid #8cf;\n pointer-events: none;\n }\n',e.tablesStyles='\n.ProseMirror .tableWrapper {\n overflow-x: auto;\n margin: 1em 0;\n}\n\n.ProseMirror table {\n margin: 0;\n border-collapse: collapse;\n table-layout: fixed;\n width: 100%;\n overflow: hidden;\n}\n\n.ProseMirror td, .ProseMirror th {\n min-width: 1em;\n border: 1px solid #ddd;\n padding: 3px 5px;\n vertical-align: top;\n box-sizing: border-box;\n position: relative;\n}\n\n.ProseMirror th {\n font-weight: bold;\n text-align: left;\n}\n\n.ProseMirror .column-resize-handle {\n position: absolute;\n right: -2px; top: 0; bottom: 0;\n width: 4px;\n z-index: 20;\n background-color: #adf;\n pointer-events: none;\n}\n\n.ProseMirror.resize-cursor {\n cursor: ew-resize;\n cursor: col-resize;\n}\n\n/* Give selected cells a blue overlay */\n.ProseMirror .selectedCell:after {\n z-index: 2;\n position: absolute;\n content: "";\n left: 0; right: 0; top: 0; bottom: 0;\n background: rgba(200, 200, 255, 0.4);\n pointer-events: none;\n}\n',e.rtlStyles="body { direction: rtl }"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(46),s=n(12),a=n(4),c=n(13),u=n(7),l=n(47),d=n(16),p=n(3),f=n(25),h=n(24),m=n(26),v=n(29),g=n(30),y=n(31),b=n(32),w=n(48),_=n(49),x=n(50),k=n(20),C=n(51),S=n(53),T=n(54),E=n(55),M=n(56),O=n(57),D=n(58),I=n(59),A=n(60),N=n(61),B=n(62),z=n(63),P=n(64),R=n(65),F=n(66),L=n(67),V=n(68),j=n(69),$=n(70),W=n(71),H=n(72),q=n(73),J=n(74),K=n(75),U=n(76),G=n(77),Y=n(78),X=n(79),Z=n(80),Q=n(81),tt=n(82),et=n(83),nt=n(84),rt=n(85),ot=n(86),it=n(87),st=n(88),at=n(89),ct=n(17),ut=n(18),lt=n(19),dt=n(33),pt=n(90),ft=n(91),ht=n(92),mt=[T.EditorAlignLeftButtonDirective,E.EditorAlignCenterButtonDirective,M.EditorAlignRightButtonDirective,O.EditorAlignJustifyButtonDirective,K.EditorInsertFileButtonDirective,I.EditorRedoButtonDirective,A.EditorUndoButtonDirective,N.EditorInsertImageButtonDirective,B.EditorIndentButtonDirective,z.EditorOutdentButtonDirective,P.EditorCreateLinkButtonDirective,R.EditorUnlinkButtonDirective,F.EditorInsertOrderedListButtonDirective,L.EditorInsertUnorderedListButtonDirective,V.EditorViewSourceButtonDirective,j.EditorBoldButtonDirective,$.EditorItalicButtonDirective,W.EditorUnderlineButtonDirective,H.EditorStrikethroughButtonDirective,q.EditorSubscriptButtonDirective,J.EditorSuperscriptButtonDirective,U.EditorForeColorDirective,G.EditorBackColorDirective,Y.EditorCleanFormattingButtonDirective,X.EditorAddColumnBeforeButtonDirective,Z.EditorAddColumnAfterButtonDirective,Q.EditorAddRowBeforeButtonDirective,tt.EditorAddRowAfterButtonDirective,et.EditorDeleteColumnButtonDirective,nt.EditorDeleteRowButtonDirective,rt.EditorDeleteTableButtonDirective,ot.EditorMergeCellsButtonDirective,it.EditorSplitCellButtonDirective,at.CustomMessagesComponent,st.LocalizedMessagesDirective,pt.DropDownToolDirective,ft.EditorPrintDirective,ht.EditorSelectAllButtonDirective,D.EditorBlockquoteDirective],vt=[_.EditorFontSizeComponent,x.EditorFontFamilyComponent,w.EditorFormatComponent,k.EditorColorPickerComponent,C.EditorInsertTableButtonComponent],gt=[m.FileLinkDialogComponent,f.ImageDialogComponent,h.SourceDialogComponent,v.FormatDialogComponent,g.ColorPickerDialogComponent,y.FontFamilyDialogComponent,dt.FontSizeDialogComponent,b.InsertTableDialogComponent],yt=[S.PopupTableGridComponent,ct.FormatDropDownListComponent,ut.FontFamilyDropDownListComponent,lt.FontSizeDropDownListComponent],bt=function(){function t(){}return t=r.__decorate([o.NgModule({declarations:[p.EditorComponent,mt,vt,gt,yt],entryComponents:[gt],exports:[p.EditorComponent,mt,vt,a.ToolBarModule,l.ButtonModule,s.FormsModule,s.ReactiveFormsModule,yt],imports:[i.CommonModule,s.FormsModule,s.ReactiveFormsModule,l.ButtonModule,d.ColorPickerModule,u.DialogModule,c.DropDownsModule,d.NumericTextBoxModule,d.CheckBoxModule,a.ToolBarModule,d.TextBoxModule]})],t)}();e.EditorModule=bt},function(t,e){t.exports=l},function(t,e){t.exports=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(7),a=n(9),c=n(3),u=n(2),l=n(29),d=n(17),p=n(5),f=function(t){function e(e,n,r,i){var s=t.call(this)||this;return s.editor=e,s.dialogService=n,s.localization=r,s.toolsService=i,s.disabled=!1,s.tabindex=-1,s.valueChange=new o.EventEmitter,s._data=[{text:"Paragraph",tag:"p"},{text:"Heading 1",tag:"h1"},{text:"Heading 2",tag:"h2"},{text:"Heading 3",tag:"h3"},{text:"Heading 4",tag:"h4"},{text:"Heading 5",tag:"h5"},{text:"Heading 6",tag:"h6"}],s}var n;return r.__extends(e,t),n=e,Object.defineProperty(e.prototype,"data",{get:function(){return this._data},set:function(t){this._data=t||this._data},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var t=this;this.itemDisabled=function(e){return!(t.overflows||!t.formatDropDownList||t.formatDropDownList.dropDownList.isOpen)||null===e.dataItem.tag},setTimeout((function(){t.defaultItem={text:t.title,tag:null},t.toolsService.needsCheck.next()})),this.subs=this.editor.stateChange.subscribe((function(e){var n=e.format,r=t.data.findIndex((function(t){return t.tag===n.selected.tag}));t.value=-1!==r?n.selected.tag:null,t.disabled=n.disabled}))},e.prototype.onValueChange=function(t){a.isPresent(t)&&(this.editor.exec("format",{tag:t}),this.editor.view.focus(),this.valueChange.emit(this.data.find((function(e){return e.tag===t}))))},e.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe()},Object.defineProperty(e.prototype,"outerWidth",{get:function(){var t=this.formatDropDownList.element;if(t)return a.outerWidth(t.nativeElement)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this.localization.get("format")},enumerable:!0,configurable:!0}),e.prototype.openDialog=function(){var t={appendTo:this.editor.dialogContainer,content:l.FormatDialogComponent};this.editor.toolbar.toggle(!1),this.dialogService.open(t).content.instance.setData({editor:this.editor,data:this.data,defaultItem:this.defaultItem,value:this.value,itemDisabled:this.itemDisabled})},e.prototype.canFocus=function(){return!this.disabled},e.prototype.focus=function(){this.tabindex=0,this.overflows?this.formatButton.nativeElement.focus():this.formatDropDownList.focus()},e.prototype.handleKey=function(){return this.tabindex=-1,!1},r.__decorate([o.Input(),r.__metadata("design:type",Array),r.__metadata("design:paramtypes",[Array])],e.prototype,"data",null),r.__decorate([o.Output(),r.__metadata("design:type",o.EventEmitter)],e.prototype,"valueChange",void 0),r.__decorate([o.ViewChild("toolbarTemplate",{static:!0}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"toolbarTemplate",void 0),r.__decorate([o.ViewChild("popupTemplate",{static:!0}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"popupTemplate",void 0),r.__decorate([o.ViewChild("formatDropDownList",{static:!1}),r.__metadata("design:type",d.FormatDropDownListComponent)],e.prototype,"formatDropDownList",void 0),r.__decorate([o.ViewChild("formatButton",{static:!1}),r.__metadata("design:type",o.ElementRef)],e.prototype,"formatButton",void 0),e=n=r.__decorate([o.Component({providers:[{provide:i.ToolBarToolComponent,useExisting:o.forwardRef((function(){return n}))}],selector:"kendo-toolbar-dropdownlist[kendoEditorFormat]",template:'\n <ng-template #toolbarTemplate>\n <kendo-editor-format-dropdownlist\n #formatDropDownList\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n [title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n </kendo-editor-format-dropdownlist>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n #formatButton\n [tabindex]="tabindex"\n type="button"\n kendoButton\n class="k-overflow-button"\n [icon]="\'apply-format\'"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (click)="openDialog()"\n >\n {{ title }}\n </button>\n </ng-template>\n '}),r.__param(0,o.Host()),r.__metadata("design:paramtypes",[c.EditorComponent,s.DialogService,u.EditorLocalizationService,p.EditorToolsService])],e)}(i.ToolBarToolComponent);e.EditorFormatComponent=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(9),a=n(3),c=n(2),u=n(7),l=n(33),d=n(19),p=n(5),f=function(t){function e(e,n,r,i){var s=t.call(this)||this;return s.editor=e,s.dialogService=n,s.localization=r,s.toolsService=i,s.disabled=!1,s.tabindex=-1,s.valueChange=new o.EventEmitter,s._data=[{text:"8px",size:8},{text:"10px",size:10},{text:"12px",size:12},{text:"14px",size:14},{text:"18px",size:18},{text:"24px",size:24},{text:"36px",size:36}],s}var n;return r.__extends(e,t),n=e,Object.defineProperty(e.prototype,"data",{get:function(){return this._data},set:function(t){this._data=t||this._data},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var t=this;this.itemDisabled=function(e){return!(t.overflows||!t.fontSizeDropDownList||t.fontSizeDropDownList.dropDownList.isOpen)||null===e.dataItem.size},setTimeout((function(){t.defaultItem={text:t.title,size:null},t.toolsService.needsCheck.next()})),this.subs=this.editor.stateChange.subscribe((function(e){var n=e.style;t.value=(s.getUniqueStyleValues(n.selected,"font-size").match(/\d+/g)||[null])[0],t.disabled=n.disabled}))},e.prototype.onValueChange=function(t){s.isPresent(t)&&(this.editor.exec("fontSize",t),this.editor.view.focus(),this.valueChange.emit(this.data.find((function(e){return e.size===parseInt(t,10)}))))},e.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe()},Object.defineProperty(e.prototype,"outerWidth",{get:function(){if(this.element)return s.outerWidth(this.element.nativeElement)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this.localization.get("fontSize")},enumerable:!0,configurable:!0}),e.prototype.openDialog=function(){var t={appendTo:this.editor.dialogContainer,content:l.FontSizeDialogComponent};this.editor.toolbar.toggle(!1),this.dialogService.open(t).content.instance.setData({editor:this.editor,data:this.data,defaultItem:this.defaultItem,value:this.value,itemDisabled:this.itemDisabled})},e.prototype.canFocus=function(){return!this.disabled},e.prototype.focus=function(){this.tabindex=0,this.overflows?this.fontSizeButton.nativeElement.focus():this.fontSizeDropDownList.focus()},e.prototype.handleKey=function(){return this.tabindex=-1,!1},r.__decorate([o.Input(),r.__metadata("design:type",Array),r.__metadata("design:paramtypes",[Array])],e.prototype,"data",null),r.__decorate([o.Output(),r.__metadata("design:type",o.EventEmitter)],e.prototype,"valueChange",void 0),r.__decorate([o.ViewChild("toolbarTemplate",{static:!0}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"toolbarTemplate",void 0),r.__decorate([o.ViewChild("popupTemplate",{static:!0}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"popupTemplate",void 0),r.__decorate([o.ViewChild("element",{static:!1}),r.__metadata("design:type",o.ElementRef)],e.prototype,"element",void 0),r.__decorate([o.ViewChild("element",{read:d.FontSizeDropDownListComponent,static:!1}),r.__metadata("design:type",d.FontSizeDropDownListComponent)],e.prototype,"fontSizeDropDownList",void 0),r.__decorate([o.ViewChild("fontSizeButton",{static:!1}),r.__metadata("design:type",o.ElementRef)],e.prototype,"fontSizeButton",void 0),e=n=r.__decorate([o.Component({providers:[{provide:i.ToolBarToolComponent,useExisting:o.forwardRef((function(){return n}))}],selector:"kendo-toolbar-dropdownlist[kendoEditorFontSize]",template:'\n <ng-template #toolbarTemplate>\n <kendo-editor-fontsize-dropdownlist\n #element\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n [title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n </kendo-editor-fontsize-dropdownlist>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n tabindex="-1"\n type="button"\n kendoButton\n #fontSizeButton\n class="k-overflow-button"\n [icon]="\'font-size\'"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (click)="openDialog()"\n >\n {{ title }}\n </button>\n </ng-template>\n '}),r.__param(0,o.Host()),r.__metadata("design:paramtypes",[a.EditorComponent,u.DialogService,c.EditorLocalizationService,p.EditorToolsService])],e)}(i.ToolBarToolComponent);e.EditorFontSizeComponent=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(9),a=n(3),c=n(2),u=n(7),l=n(31),d=n(18),p=n(5),f=function(t){function e(e,n,r,i){var s=t.call(this)||this;return s.editor=e,s.dialogService=n,s.localization=r,s.toolsService=i,s.disabled=!1,s.tabindex=-1,s.valueChange=new o.EventEmitter,s._data=[{text:"Arial",fontName:'Arial,"Helvetica Neue",Helvetica,sans-serif'},{text:"Courier New",fontName:'"Courier New",Courier,"Lucida Sans Typewriter","Lucida Typewriter",monospace'},{text:"Georgia",fontName:'Georgia,Times,"Times New Roman",serif'},{fontName:'Impact,Haettenschweiler,"Franklin Gothic Bold",Charcoal,"Helvetica Inserat","Bitstream Vera Sans Bold","Arial Black","sans serif"',text:"Impact"},{text:"Lucida Console",fontName:'"Lucida Console","Lucida Sans Typewriter",monaco,"Bitstream Vera Sans Mono",monospace'},{text:"Tahoma",fontName:"Tahoma,Verdana,Segoe,sans-serif"},{text:"Times New Roman",fontName:'TimesNewRoman,"Times New Roman",Times,Baskerville,Georgia,serif'},{text:"Trebuchet MS",fontName:'"Trebuchet MS","Lucida Grande","Lucida Sans Unicode","Lucida Sans",Tahoma,sans-serif'},{text:"Verdana",fontName:"Verdana,Geneva,sans-serif"}],s}var n;return r.__extends(e,t),n=e,Object.defineProperty(e.prototype,"data",{get:function(){return this._data},set:function(t){this._data=t||this._data},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var t=this;this.itemDisabled=function(e){return!(t.overflows||!t.fontFamilyDropDownList||t.fontFamilyDropDownList.dropDownList.isOpen)||null===e.dataItem.fontName},setTimeout((function(){t.defaultItem={text:t.title,fontName:null},t.toolsService.needsCheck.next()})),this.subs=this.editor.stateChange.subscribe((function(e){var n=e.style;t.value=s.getUniqueStyleValues(n.selected,"font-family")||null,t.disabled=n.disabled}))},e.prototype.onValueChange=function(t){s.isPresent(t)&&(this.editor.exec("fontFamily",t),this.editor.view.focus(),this.valueChange.emit(this.data.find((function(e){return e.fontName===t}))))},e.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe()},Object.defineProperty(e.prototype,"outerWidth",{get:function(){if(this.element)return s.outerWidth(this.element.nativeElement)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this.localization.get("fontFamily")},enumerable:!0,configurable:!0}),e.prototype.openDialog=function(){var t={appendTo:this.editor.dialogContainer,content:l.FontFamilyDialogComponent};this.editor.toolbar.toggle(!1),this.dialogService.open(t).content.instance.setData({editor:this.editor,data:this.data,defaultItem:this.defaultItem,value:this.value,itemDisabled:this.itemDisabled})},e.prototype.canFocus=function(){return!this.disabled},e.prototype.focus=function(){this.tabindex=0,this.overflows?this.fontFamilyButton.nativeElement.focus():this.fontFamilyDropDownList.focus()},e.prototype.handleKey=function(){return this.tabindex=-1,!1},r.__decorate([o.Input(),r.__metadata("design:type",Array),r.__metadata("design:paramtypes",[Array])],e.prototype,"data",null),r.__decorate([o.Output(),r.__metadata("design:type",o.EventEmitter)],e.prototype,"valueChange",void 0),r.__decorate([o.ViewChild("toolbarTemplate",{static:!0}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"toolbarTemplate",void 0),r.__decorate([o.ViewChild("popupTemplate",{static:!0}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"popupTemplate",void 0),r.__decorate([o.ViewChild("element",{static:!1}),r.__metadata("design:type",o.ElementRef)],e.prototype,"element",void 0),r.__decorate([o.ViewChild("element",{read:d.FontFamilyDropDownListComponent,static:!1}),r.__metadata("design:type",d.FontFamilyDropDownListComponent)],e.prototype,"fontFamilyDropDownList",void 0),r.__decorate([o.ViewChild("fontFamilyButton",{static:!1}),r.__metadata("design:type",o.ElementRef)],e.prototype,"fontFamilyButton",void 0),e=n=r.__decorate([o.Component({providers:[{provide:i.ToolBarToolComponent,useExisting:o.forwardRef((function(){return n}))}],selector:"kendo-toolbar-dropdownlist[kendoEditorFontFamily]",template:'\n <ng-template #toolbarTemplate>\n <kendo-editor-fontfamily-dropdownlist\n #element\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n [title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n </kendo-editor-fontfamily-dropdownlist>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n tabindex="-1"\n type="button"\n kendoButton\n #fontFamilyButton\n class="k-overflow-button"\n [icon]="\'font-family\'"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (click)="openDialog()"\n >\n {{ title }}\n </button>\n </ng-template>\n '}),r.__param(0,o.Host()),r.__metadata("design:paramtypes",[a.EditorComponent,u.DialogService,c.EditorLocalizationService,p.EditorToolsService])],e)}(i.ToolBarToolComponent);e.EditorFontFamilyComponent=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(15),s=n(22),a=n(4),c=n(52),u=n(9),l=n(3),d=n(2),p=n(7),f=n(32),h=n(10),m=function(t){function e(e,n,r,a){var c=t.call(this)||this;return c.editor=e,c.localization=n,c.popupService=r,c.dialogService=a,c.open=!1,c.buttonBlurred=new o.EventEmitter,c.cellClicked=new o.EventEmitter,c.subs=c.editor.stateChange.subscribe((function(t){var e=t.insertTable;c.disabled=e.disabled})),c.subs.add(c.buttonBlurred.pipe(s.concatMap((function(){return i.interval(200).pipe(s.take(1),s.takeUntil(c.cellClicked))}))).subscribe((function(){c.toggle(!1)}))),c}var n;return r.__extends(e,t),n=e,e.prototype.ngOnDestroy=function(){this.destroyPopup(),this.subs&&this.subs.unsubscribe()},Object.defineProperty(e.prototype,"outerWidth",{get:function(){if(this.element)return u.outerWidth(this.element.nativeElement)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this.localization.get("insertTable")},enumerable:!0,configurable:!0}),e.prototype.toggle=function(t){this.open=void 0===t?!this.open:t,this.destroyPopup(),this.open&&this.createPopup()},e.prototype.openDialog=function(){var t={appendTo:this.editor.dialogContainer,content:f.InsertTableDialogComponent};this.editor.toolbar.toggle(!1),this.dialogService.open(t).content.instance.setData({editor:this.editor})},e.prototype.onBlur=function(){this.tabIndex=-1,this.buttonBlurred.emit()},e.prototype.onCellClick=function(t){this.cellClicked.emit(),this.toggle(!1),this.editor.exec("insertTable",t)},e.prototype.canFocus=function(){return!this.disabled},e.prototype.focus=function(){this.tabIndex=0,this.getButton().focus()},e.prototype.handleKey=function(t){return t.keyCode===h.Keys.Space||t.keyCode===h.Keys.Enter||(this.tabIndex=-1,!1)},e.prototype.onTableWizardClick=function(){},e.prototype.createPopup=function(){var t="rtl"===this.editor.direction?"right":"left",e={horizontal:t,vertical:"bottom"},n={horizontal:t,vertical:"top"};this.popupRef=this.popupService.open({anchor:this.element,anchorAlign:e,animate:!0,content:this.popupGridTemplate,popupAlign:n,popupClass:"k-ct-popup k-group k-reset k-state-border-up",positionMode:"absolute"});var r=this.popupRef.popupElement;r.style.width="190px",r.style.height="164px",r.setAttribute("dir",this.editor.direction)},e.prototype.destroyPopup=function(){this.popupRef&&(this.popupRef.close(),this.popupRef=null)},e.prototype.getButton=function(){return(this.overflows?this.overflowElement:this.element).nativeElement},r.__decorate([o.ViewChild("toolbarTemplate",{static:!0}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"toolbarTemplate",void 0),r.__decorate([o.ViewChild("popupTemplate",{static:!1}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"popupTemplate",void 0),r.__decorate([o.ViewChild("element",{static:!1}),r.__metadata("design:type",o.ElementRef)],e.prototype,"element",void 0),r.__decorate([o.ViewChild("overflowElement",{static:!1}),r.__metadata("design:type",o.ElementRef)],e.prototype,"overflowElement",void 0),r.__decorate([o.ViewChild("popupGridTemplate",{static:!0}),r.__metadata("design:type",o.TemplateRef)],e.prototype,"popupGridTemplate",void 0),e=n=r.__decorate([o.Component({providers:[{provide:a.ToolBarToolComponent,useExisting:o.forwardRef((function(){return n}))}],selector:"kendo-editor-insert-table-button",template:'\n <ng-template #toolbarTemplate>\n <button\n type="button"\n kendoButton\n #element\n [attr.title]="title"\n [attr.tabindex]="tabIndex"\n [icon]="\'table-insert\'"\n [disabled]="disabled"\n (click)="toggle()"\n (blur)="onBlur()"\n ></button>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n kendoButton\n #overflowElement\n [attr.title]="title"\n [attr.tabindex]="tabIndex"\n [icon]="\'table-insert\'"\n [disabled]="disabled"\n (click)="openDialog()">\n {{ title }}\n </button>\n </ng-template>\n <ng-template #popupGridTemplate>\n <kendo-popup-table-grid (cellClick)="onCellClick($event)" (tableWizardClick)="onTableWizardClick()"></kendo-popup-table-grid>\n </ng-template>\n '}),r.__param(0,o.Host()),r.__metadata("design:paramtypes",[l.EditorComponent,d.EditorLocalizationService,c.PopupService,p.DialogService])],e)}(a.ToolBarToolComponent);e.EditorInsertTableButtonComponent=m},function(t,e){t.exports=p},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=function(){function t(){this.cellClick=new o.EventEmitter,this.tableWizardClick=new o.EventEmitter,this.state={rows:-1,cols:-1},this.rows=6,this.cols=8}return Object.defineProperty(t.prototype,"message",{get:function(){var t=this.state,e=t.rows,n=t.cols;return"Create a "+(e>-1?e+1:"")+" "+(n>-1?"x":"")+" "+(n>-1?n+1:"")+" table"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cells",{get:function(){return Array.from(Array(this.rows*this.cols).keys())},enumerable:!0,configurable:!0}),t.prototype.selected=function(t){var e=this.state,n=e.rows,r=e.cols,o=Math.floor(t/this.cols),i=t%this.cols;return o<=n&&i<=r},t.prototype.setState=function(t){var e=Math.floor(t/this.cols),n=t%this.cols;this.state={rows:e,cols:n}},t.prototype.resetState=function(){this.state={rows:-1,cols:-1}},t.prototype.insertTable=function(){this.cellClick.emit(this.state)},t.prototype.openTableWizard=function(){this.tableWizardClick.emit()},r.__decorate([o.Output(),r.__metadata("design:type",o.EventEmitter)],t.prototype,"cellClick",void 0),r.__decorate([o.Output(),r.__metadata("design:type",o.EventEmitter)],t.prototype,"tableWizardClick",void 0),t=r.__decorate([o.Component({selector:"kendo-popup-table-grid",template:'\n <div style="border-color: inherit;" (mouseleave)="resetState()" (click)="insertTable()">\n <span *ngFor="let i of cells"\n class="k-ct-cell"\n [class.k-state-selected]="selected(i)"\n [class.k-state-disabled]="!selected(i)"\n (mouseenter)="setState(i)">\n </span>\n </div>\n <div class="k-status" unselectable="on">{{ message }}</div>\n \x3c!-- uncomment when TableWizard is completed\n <div class="k-editor-toolbar" unselectable="on">\n <button type="button" kendoButton class="k-tool" [icon]="\'table-wizard\'" (click)="openTableWizard()" title="Table Wizard">Table Wizard</button>\n </div>\n --\x3e\n '})],t)}();e.PopupTableGridComponent=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"alignLeft",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorAlignLeftButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorAlignLeftButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"alignCenter",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorAlignCenterButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorAlignCenterButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"alignRight",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorAlignRightButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorAlignRightButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"alignJustify",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorAlignJustifyButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorAlignJustifyButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){var i=t.call(this,"blockquote",e,n,r,o)||this;return i.editor=n,i}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorBlockquoteButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorBlockquoteDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"redo",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorRedoButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorRedoButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"undo",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorUndoButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorUndoButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(14),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"insertImage",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorInsertImageButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandDialog);e.EditorInsertImageButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"indent",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorIndentButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorIndentButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"outdent",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorOutdentButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorOutdentButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(14),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"createLink",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorCreateLinkButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandDialog);e.EditorCreateLinkButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"unlink",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorUnlinkButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorUnlinkButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"insertOrderedList",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorInsertOrderedListButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorInsertOrderedListButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"insertUnorderedList",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorInsertUnorderedListButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorInsertUnorderedListButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(14),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"viewSource",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorViewSourceButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandDialog);e.EditorViewSourceButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"bold",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorBoldButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorBoldButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"italic",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorItalicButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorItalicButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"underline",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorUnderlineButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorUnderlineButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"strikethrough",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorStrikethroughButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorStrikethroughButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"subscript",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorSubscriptButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorSubscriptButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"superscript",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorSuperscriptButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorSuperscriptButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(3),s=n(14),a=n(4),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"insertFile",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorInsertFileButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[a.ToolBarButtonComponent,i.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(s.EditorCommandDialog);e.EditorInsertFileButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(20),s=n(21),a=function(){function t(t){this.colorPicker=t,this.colorPicker.icon=s.commandIcons.foreColor,this.colorPicker.editorCommand="foreColor"}return t=r.__decorate([o.Directive({selector:"[kendoEditorForeColor]"}),r.__metadata("design:paramtypes",[i.EditorColorPickerComponent])],t)}();e.EditorForeColorDirective=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(20),s=n(21),a=function(){function t(t){this.colorPicker=t,this.colorPicker.icon=s.commandIcons.backColor,this.colorPicker.editorCommand="backColor"}return t=r.__decorate([o.Directive({selector:"[kendoEditorBackColor]"}),r.__metadata("design:paramtypes",[i.EditorColorPickerComponent])],t)}();e.EditorBackColorDirective=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"cleanFormatting",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorCleanFormattingButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorCleanFormattingButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"addColumnBefore",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorAddColumnBeforeButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorAddColumnBeforeButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"addColumnAfter",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorAddColumnAfterButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorAddColumnAfterButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"addRowBefore",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorAddRowBeforeButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorAddRowBeforeButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"addRowAfter",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorAddRowAfterButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorAddRowAfterButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"deleteColumn",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorDeleteColumnButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorDeleteColumnButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"deleteRow",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorDeleteRowButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorDeleteRowButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"deleteTable",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorDeleteTableButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorDeleteTableButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"mergeCells",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorMergeCellsButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorMergeCellsButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"splitCell",e,n,r,o)||this}return r.__extends(e,t),e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorSplitCellButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorSplitCellButtonDirective=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(11),s=n(35),a=function(t){function e(e){var n=t.call(this)||this;return n.service=e,n}var n;return r.__extends(e,t),n=e,e=n=r.__decorate([o.Directive({providers:[{provide:s.Messages,useExisting:o.forwardRef((function(){return n}))}],selector:"[kendoEditorLocalizedMessages]"}),r.__metadata("design:paramtypes",[i.LocalizationService])],e)}(s.Messages);e.LocalizedMessagesDirective=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(11),s=n(35),a=function(t){function e(e){var n=t.call(this)||this;return n.service=e,n}var n;return r.__extends(e,t),n=e,Object.defineProperty(e.prototype,"override",{get:function(){return!0},enumerable:!0,configurable:!0}),e=n=r.__decorate([o.Component({providers:[{provide:s.Messages,useExisting:o.forwardRef((function(){return n}))}],selector:"kendo-editor-messages",template:""}),r.__metadata("design:paramtypes",[i.LocalizationService])],e)}(s.Messages);e.CustomMessagesComponent=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=function(){function t(t,e){this.hostEl=t,this.zone=e,this.preventDefault=function(t){t.preventDefault()}}return Object.defineProperty(t.prototype,"hostElement",{get:function(){return this.hostEl.nativeElement},enumerable:!0,configurable:!0}),t.prototype.ngAfterViewInit=function(){var t=this;this.zone.runOutsideAngular((function(){t.hostElement.addEventListener("pointerdown",t.preventDefault)}))},t.prototype.ngOnDestroy=function(){this.hostElement.removeEventListener("pointerdown",this.preventDefault)},t=r.__decorate([o.Directive({selector:"[kendoEditorDropDownTool]"}),r.__metadata("design:paramtypes",[o.ElementRef,o.NgZone])],t)}();e.DropDownToolDirective=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(27),l=n(5),d=function(t){function e(e,n,r,o){var i=t.call(this,"print",e,n,r,o)||this;return i.editor=n,i}return r.__extends(e,t),e.prototype.ngAfterViewInit=function(){if(o.isDevMode&&!this.editor.iframe)throw new Error(u.EditorErrorMessages.printTool)},e.prototype.clickHandler=function(){if(this.editor.iframe){var t=this.editor.view,e=t&&t.dom,n=e&&e.ownerDocument,r=n&&n.defaultView;r&&r.print()}},e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorPrintButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,l.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorPrintDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(4),s=n(3),a=n(6),c=n(2),u=n(5),l=function(t){function e(e,n,r,o){return t.call(this,"selectAll",e,n,r,o)||this}return r.__extends(e,t),e.prototype.clickHandler=function(){this.editor.shouldEmitFocus=!0,t.prototype.clickHandler.call(this)},e=r.__decorate([o.Directive({selector:"kendo-toolbar-button[kendoEditorSelectAllButton]"}),r.__param(1,o.Host()),r.__metadata("design:paramtypes",[i.ToolBarButtonComponent,s.EditorComponent,c.EditorLocalizationService,u.EditorToolsService])],e)}(a.EditorCommandButton);e.EditorSelectAllButtonDirective=l}])}));
20
+ var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function r(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function a(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}function s(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}function l(t,e){return function(n,o){e(n,o,t)}}function c(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function d(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{l(o.next(t))}catch(t){i(t)}}function s(t){try{l(o.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}l((o=o.apply(t,e||[])).next())}))}function u(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function p(t,e,n,o){void 0===o&&(o=n),t[o]=e[n]}function f(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||(e[n]=t[n])}function h(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function v(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(m(arguments[e]));return t}function g(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var o=Array(t),r=0;for(e=0;e<n;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o}function y(t){return this instanceof y?(this.v=t,this):new y(t)}function b(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(t,e||[]),i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(t){r[t]&&(o[t]=function(e){return new Promise((function(n,o){i.push([t,e,n,o])>1||s(t,e)}))})}function s(t,e){try{(n=r[t](e)).value instanceof y?Promise.resolve(n.value.v).then(l,c):d(i[0][2],n)}catch(t){d(i[0][3],t)}var n}function l(t){s("next",t)}function c(t){s("throw",t)}function d(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}}function w(t){var e,n;return e={},o("next"),o("throw",(function(t){throw t})),o("return"),e[Symbol.iterator]=function(){return this},e;function o(o,r){e[o]=t[o]?function(e){return(n=!n)?{value:y(t[o](e)),done:"return"===o}:r?r(e):e}:r}}function k(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=h(t),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(n){e[n]=t[n]&&function(e){return new Promise((function(o,r){(function(t,e,n,o){Promise.resolve(o).then((function(e){t({value:e,done:n})}),e)})(o,r,(e=t[n](e)).done,e.value)}))}}}function _(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function C(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function x(t){return t&&t.__esModule?t:{default:t}}function S(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function E(t,e,n){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,n),n}},function(e,n){e.exports=t},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(11),a=function(t){function e(e,n,o){return t.call(this,e,n,o)||this}return o.__extends(e,t),e=o.__decorate([o.__param(0,r.Inject(i.L10N_PREFIX)),o.__param(1,r.Optional()),o.__param(2,r.Optional()),o.__param(2,r.Inject(i.RTL)),o.__metadata("design:paramtypes",[String,i.MessageService,Boolean])],e)}(i.LocalizationService);e.EditorLocalizationService=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(12),a=n(15),s=n(16),l=n(4),c=n(7),d=n(10),u=n(8),p=n(37),f=n(38),h=n(23),m=n(41),v=n(43),g=n(9),y=n(24),b=n(25),w=n(26),k=n(11),_=n(2),C=n(44),x=n(27),S=n(5),E=n(28),T={convertMsLists:!1,removeAttributes:[],removeHtmlComments:!1,removeInvalidHTML:!0,removeMsClasses:!1,removeMsStyles:!1,stripTags:[]},M=g.conditionallyExecute(u.removeComments),D=g.conditionallyExecute(u.sanitize),O=function(t){if("all"===t.removeAttributes)return{"*":u.removeAttribute};var e=g.removeEmptyEntries({style:t.removeMsStyles?u.sanitizeStyleAttr:void 0,class:t.removeMsClasses?u.sanitizeClassAttr:void 0});return t.removeAttributes.reduce((function(t,e){var n;return o.__assign({},t,((n={})[e]=u.removeAttribute,n))}),e)},A=function(){function t(t,e,n,i,s,l){var c=this;this.dialogService=t,this.localization=e,this.cdr=n,this.ngZone=i,this.element=s,this.toolsService=l,this.iframe=!0,this.applyToWord=!1,this.preserveWhitespace=!1,this.resizable=!1,this.valueChange=new r.EventEmitter,this.onFocus=new r.EventEmitter,this.paste=new r.EventEmitter,this.onBlur=new r.EventEmitter,this.hostClass=!0,this.stateChange=new a.BehaviorSubject(v.initialToolBarState),this.valueModified=new a.Subject,this._readonly=!1,this._placeholder="",this.inForm=!1,this.afterViewInit=new a.Subject,this.contentAreaLoaded=new a.Subject,this.dispatchTransaction=function(t){var e=t.docChanged;if(!(c.disabled||c.readonly&&e)){if(e){var n=t.doc,o=u.getHtml({doc:n});c.trOnChange=t,c.htmlOnChange=o,c.ngZone.run((function(){c.valueModified.next(o)}))}e&&!c.inForm||c.view.updateState(c.view.state.apply(t))}},this.transformPastedHTML=function(t){var e=o.__assign({},T,c.pasteCleanupSettings),n=g.pipe(D(e.removeInvalidHTML),M(e.removeHtmlComments))(t),r=u.pasteCleanup(n,{convertMsLists:e.convertMsLists,stripTags:e.stripTags.join("|"),attributes:O(e)});if(d.hasObservers(c.paste)){var i=new E.EditorPasteEvent(r,t,c._pasteEvent);return c.ngZone.run((function(){return c.paste.emit(i)})),i.isDefaultPrevented()?"":i.cleanedHtml}return r},this.changeValue=function(t){var e=c._value;if(c._value=t,c._view){if(c.htmlOnChange===t&&c.trOnChange)c.view.updateState(c.view.state.apply(c.trOnChange));else if((e||"")!==(t||"")){if(c.iframe&&!c.container.element.nativeElement.contentWindow)return;var n=c.view.state,o=u.parseContent(t||"",n.schema,{preserveWhitespace:c.preserveWhitespace}),r=n.tr.setSelection(new u.AllSelection(n.doc)).replaceSelectionWith(o);c.view.updateState(n.apply(r))}c.trOnChange=null,c.htmlOnChange=null}},this.onChangeCallback=function(t){c.changeValue(t)},this.onTouchedCallback=function(t){},this.onPaste=function(t,e){return c._pasteEvent=e,!1},p.validatePackage(f.packageMetadata),this.direction=e.rtl?"rtl":"ltr",this.subs=a.zip(this.afterViewInit.asObservable(),this.contentAreaLoaded.asObservable()).subscribe((function(){return c.initialize()}))}var e;return e=t,Object.defineProperty(t.prototype,"value",{get:function(){if(this.trOnChange)return this.htmlOnChange;var t=this._view?this.getSource():this._value;return"<p></p>"===t?this._value?"":this._value:t},set:function(t){this.changeValue(t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{get:function(){return this._disabled},set:function(t){this._disabled=t||!1,this._view&&this._view.updateState(this._view.state),this._disabled&&(this.readonly=!1),this._disabled||this._readonly?this.stateChange.next(v.disabledToolBarState):this.stateChange.next(v.initialToolBarState)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"readonly",{get:function(){return this._readonly},set:function(t){if(this._readonly=t||!1,this._view){var e=void 0,n=(e=this.iframe?this.container.element.nativeElement.contentWindow:window).getSelection().focusNode;this._view.dom.contains(n)&&e.getSelection().removeAllRanges();var o=this._view.state.doc,r=this._view.state.tr.setSelection(u.TextSelection.create(o,1));this._view.dispatch(r)}this._readonly?(this.toolbar&&(this.toolbar.tabindex=-1),this.stateChange.next(v.disabledToolBarState)):(this.toolbar&&(this.toolbar.tabindex=0),this.stateChange.next(v.initialToolBarState))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"schema",{get:function(){return this._schema},set:function(t){if(r.isDevMode){if(!(t instanceof u.Schema))throw new Error(x.EditorErrorMessages.schemaType);if(this._view)throw new Error(x.EditorErrorMessages.setSchemaOnce)}this._schema=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"plugins",{get:function(){return this._plugins},set:function(t){if(r.isDevMode){if("function"!=typeof t)throw new Error(x.EditorErrorMessages.pluginsCallbackType(t));if(this._view)throw new Error(x.EditorErrorMessages.setPluginsOnce)}this._plugins=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"placeholder",{get:function(){return this._placeholder},set:function(t){if(r.isDevMode&&this._view)throw new Error(x.EditorErrorMessages.setPlaceHolderOnce);this._placeholder=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"resizableClass",{get:function(){return!!this.resizable},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisabled",{get:function(){return this.disabled},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isReadonly",{get:function(){return this.readonly},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isIE",{get:function(){return this.iframe&&g.detectIE()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dir",{get:function(){return this.direction},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ariaDisabled",{get:function(){return this.disabled},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minWidth",{get:function(){var t=this.resizable;return t.minWidth?t.minWidth+"px":void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxWidth",{get:function(){var t=this.resizable;return t.maxWidth?t.maxWidth+"px":void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minHeight",{get:function(){var t=this.resizable;return t.minHeight?t.minHeight+"px":void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxHeight",{get:function(){var t=this.resizable;return t.maxHeight?t.maxHeight+"px":void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"toolbar",{get:function(){return this.defaultToolbarComponent||this.userToolBarComponent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"view",{get:function(){return this._view},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selectionText",{get:function(){return this._view&&this._view.state?u.getSelectionText(this._view.state):""},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this.subs.add(this.localization.changes.subscribe((function(e){var n=e.rtl;t.direction=n?"rtl":"ltr"}))),this.subs.add(this.toolsService.needsCheck.subscribe((function(){return t.cdr.markForCheck()})))},t.prototype.ngAfterViewInit=function(){this.afterViewInit.next(),this.iframe||this.contentAreaLoaded.next(),this.resizable&&this.normalizeSize()},t.prototype.ngOnChanges=function(t){var e=this;t.value&&this.view&&this.changeValue(t.value.currentValue),t.iframe&&!t.iframe.isFirstChange()&&this.ngZone.onStable.pipe(s.take(1)).subscribe((function(){return e.initialize()})),t.resizable&&!t.resizable.isFirstChange()&&this.normalizeSize()},t.prototype.setDisabledState=function(t){this.disabled=t},t.prototype.iframeOnLoad=function(){this.contentAreaLoaded.next()},t.prototype.exec=function(t,e){"setHTML"===t&&"string"==typeof e?e={content:e,parseOptions:{preserveWhitespace:this.preserveWhitespace}}:["fontFamily","fontSize","foreColor","backColor","createLink"].some((function(e){return e===t}))&&(e={value:e,applyToWord:this.applyToWord}),m.editorCommands[t](e)(this._view.state,this._view.dispatch,this._view)},t.prototype.openDialog=function(t){var e={createLink:{content:w.FileLinkDialogComponent},insertFile:{content:w.FileLinkDialogComponent},insertImage:{content:b.ImageDialogComponent},viewSource:{content:y.SourceDialogComponent,height:400,width:500}},n=Object.assign({appendTo:this.dialogContainer},e[t]);this.toolbar.toggle(!1);var o=this.dialogService.open(n).content.instance;"createLink"!==t&&"insertFile"!==t||(o.command=t),o.editor=this,o.setData(this._view.state,{applyToWord:this.applyToWord})},t.prototype.focus=function(){this.focusChangedProgrammatically=!0,this._view.focus(),this.focusChangedProgrammatically=!1},t.prototype.blur=function(){this.focusChangedProgrammatically=!0,this._view.dom.blur(),this.focusChangedProgrammatically=!1},t.prototype.getSource=function(){return u.getHtml(this._view.state)},t.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe(),this._styleObserver&&this._styleObserver.disconnect()},t.prototype.writeValue=function(t){this.inForm=!0,this.value=null===t?void 0:t},t.prototype.registerOnChange=function(t){this.onChangeCallback=t},t.prototype.registerOnTouched=function(t){this.onTouchedCallback=t},t.prototype.isEmpty=function(){return!1},t.prototype.initialize=function(){var t=this;if(d.isDocumentAvailable()){var e=this.schema||h.schema,n=this.container.element.nativeElement,o=u.parseContent((this.value||"").trim(),e,{preserveWhitespace:this.preserveWhitespace});if(this.iframe){var r=n.contentDocument,i=r.createElement("meta");i.setAttribute("charset","utf-8"),r.head.appendChild(i),[C.defaultStyle,C.tablesStyles,"rtl"===this.dir?C.rtlStyles:void 0].forEach((function(t){if(t){var e=r.createElement("style");e.appendChild(r.createTextNode(t)),r.head.appendChild(e)}})),(l=r.createElement("div")).classList.add("k-content"),r.body.appendChild(l)}else{var l=document.createElement("div");n.appendChild(l)}var c=[new u.Plugin({key:new u.PluginKey("editor-tabindex"),props:{attributes:function(){return{tabIndex:t.readonly?"0":""}}}}),new u.Plugin({key:new u.PluginKey("toolbar-tools-update"),view:function(){return{update:function(e){t.disabled||t.stateChange.next(t.readonly?v.disabledToolBarState:v.getToolbarState(e.state,{applyToWord:t.applyToWord}))}}}}),u.history(),u.keymap(u.buildListKeymap(e)),u.keymap(u.buildKeymap(e,{applyToWord:this.applyToWord})),u.keymap(u.baseKeymap),u.gapCursor(),u.imageResizing(),u.tableEditing(),u.caretColor()];this.placeholder&&c.push(u.placeholder(this.placeholder));var p=u.EditorState.create({schema:e,doc:o,plugins:g.isPresent(this.plugins)?this.plugins(c):c});if(this.iframe?this.viewMountElement=n.contentDocument.querySelector("div"):this.viewMountElement=n.querySelector("div"),this.ngZone.runOutsideAngular((function(){t._view=new u.EditorView({mount:t.viewMountElement},{state:p,editable:function(){return!t.readonly},dispatchTransaction:t.dispatchTransaction,transformPastedHTML:t.transformPastedHTML,handleDOMEvents:{paste:t.onPaste}})})),this._view){var f=void 0,m=this.element.nativeElement.querySelector(".k-editor-content").classList;f=this.iframe?this.container.element.nativeElement.contentDocument:this.container.element.nativeElement,this.subs.add(a.fromEvent(f,"focusin").subscribe((function(e){if(t.readonly&&m.add("k-focus"),!t.focusChangedProgrammatically||t.shouldEmitFocus){var n=e.relatedTarget;n&&n.classList.contains("k-colorpicker")&&!t.shouldEmitFocus||t.ngZone.run((function(){return t.onFocus.emit()})),t.shouldEmitFocus=!1}}))),this.subs.add(a.fromEvent(f,"focusout").subscribe((function(e){if(t.readonly&&m.remove("k-focus"),!t.focusChangedProgrammatically){var n=e.relatedTarget;n&&n.classList.contains("k-colorpicker")||t.ngZone.run((function(){return t.onBlur.emit()}))}})))}this.subs.add(this.stateChange.subscribe((function(){t.userToolBarComponent?t.userToolBarComponent.cdr.detectChanges():t.cdr.detectChanges()}))),this.subs.add(this.valueModified.subscribe((function(e){t.onChangeCallback(e),t.valueChange.emit(e),t.cdr.markForCheck()}))),this.subs.add(a.fromEvent(this.viewMountElement,"keyup").pipe(s.map((function(t){return t.keyCode})),s.filter((function(t){return 121===t})),s.map((function(){return t.userToolBarElement||t.defaultToolbar}))).subscribe((function(t){return t.nativeElement.focus()}))),this.subs.add(a.fromEvent(this.viewMountElement,"blur").pipe(s.filter((function(e){return!t.viewMountElement.contains(e.relatedTarget)}))).subscribe((function(){return t.onTouchedCallback()})))}},t.prototype.normalizeSize=function(){var t=this;if("object"==typeof this.resizable&&!this._styleObserver){var e=this.element.nativeElement;this._styleObserver=new MutationObserver((function(){t.ngZone.runOutsideAngular((function(){return t.normalizeProperties(e)}))})),this._styleObserver.observe(e,{attributeFilter:["style"]})}},t.prototype.normalizeProperties=function(t){var e=Object.keys(this.resizable),n=parseInt(t.style.width,10),o=parseInt(t.style.height,10),r=this.resizable;e.forEach((function(e){var i=e.startsWith("min"),a=!i,s=e.endsWith("Width"),l=!s;i&&s?n<r.minWidth&&(t.style.width=r.minWidth+"px"):i&&l?o<r.minHeight&&(t.style.height=r.minHeight+"px"):a&&s?n>r.maxWidth&&(t.style.width=r.maxWidth+"px"):o>r.maxHeight&&(t.style.height=r.maxHeight+"px")}))},o.__decorate([r.Input(),o.__metadata("design:type",String),o.__metadata("design:paramtypes",[String])],t.prototype,"value",null),o.__decorate([r.Input(),o.__metadata("design:type",Boolean),o.__metadata("design:paramtypes",[Boolean])],t.prototype,"disabled",null),o.__decorate([r.Input(),o.__metadata("design:type",Boolean),o.__metadata("design:paramtypes",[Boolean])],t.prototype,"readonly",null),o.__decorate([r.Input(),o.__metadata("design:type",Boolean)],t.prototype,"iframe",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Object)],t.prototype,"applyToWord",void 0),o.__decorate([r.Input(),o.__metadata("design:type",u.Schema),o.__metadata("design:paramtypes",[u.Schema])],t.prototype,"schema",null),o.__decorate([r.Input(),o.__metadata("design:type",Function),o.__metadata("design:paramtypes",[Function])],t.prototype,"plugins",null),o.__decorate([r.Input(),o.__metadata("design:type",String),o.__metadata("design:paramtypes",[String])],t.prototype,"placeholder",null),o.__decorate([r.Input(),o.__metadata("design:type",Object)],t.prototype,"preserveWhitespace",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Object)],t.prototype,"pasteCleanupSettings",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Object)],t.prototype,"resizable",void 0),o.__decorate([r.Output(),o.__metadata("design:type",r.EventEmitter)],t.prototype,"valueChange",void 0),o.__decorate([r.Output("focus"),o.__metadata("design:type",r.EventEmitter)],t.prototype,"onFocus",void 0),o.__decorate([r.Output(),o.__metadata("design:type",r.EventEmitter)],t.prototype,"paste",void 0),o.__decorate([r.Output("blur"),o.__metadata("design:type",r.EventEmitter)],t.prototype,"onBlur",void 0),o.__decorate([r.HostBinding("class.k-editor"),o.__metadata("design:type",Boolean)],t.prototype,"hostClass",void 0),o.__decorate([r.HostBinding("class.k-editor-resizable"),o.__metadata("design:type",Boolean),o.__metadata("design:paramtypes",[])],t.prototype,"resizableClass",null),o.__decorate([r.HostBinding("class.k-disabled"),o.__metadata("design:type",Boolean),o.__metadata("design:paramtypes",[])],t.prototype,"isDisabled",null),o.__decorate([r.HostBinding("class.k-readonly"),o.__metadata("design:type",Boolean),o.__metadata("design:paramtypes",[])],t.prototype,"isReadonly",null),o.__decorate([r.HostBinding("class.k-ie"),o.__metadata("design:type",Boolean),o.__metadata("design:paramtypes",[])],t.prototype,"isIE",null),o.__decorate([r.HostBinding("attr.dir"),o.__metadata("design:type",String),o.__metadata("design:paramtypes",[])],t.prototype,"dir",null),o.__decorate([r.HostBinding("attr.ariaDisabled"),o.__metadata("design:type",Boolean),o.__metadata("design:paramtypes",[])],t.prototype,"ariaDisabled",null),o.__decorate([r.HostBinding("style.minWidth"),o.__metadata("design:type",String),o.__metadata("design:paramtypes",[])],t.prototype,"minWidth",null),o.__decorate([r.HostBinding("style.maxWidth"),o.__metadata("design:type",String),o.__metadata("design:paramtypes",[])],t.prototype,"maxWidth",null),o.__decorate([r.HostBinding("style.minHeight"),o.__metadata("design:type",String),o.__metadata("design:paramtypes",[])],t.prototype,"minHeight",null),o.__decorate([r.HostBinding("style.maxHeight"),o.__metadata("design:type",String),o.__metadata("design:paramtypes",[])],t.prototype,"maxHeight",null),o.__decorate([r.ContentChild(l.ToolBarComponent,{static:!1}),o.__metadata("design:type",l.ToolBarComponent)],t.prototype,"userToolBarComponent",void 0),o.__decorate([r.ContentChild(l.ToolBarComponent,{read:r.ElementRef,static:!1}),o.__metadata("design:type",r.ElementRef)],t.prototype,"userToolBarElement",void 0),o.__decorate([r.ViewChild("dialogsContainer",{read:r.ViewContainerRef,static:!0}),o.__metadata("design:type",r.ViewContainerRef)],t.prototype,"dialogContainer",void 0),o.__decorate([r.ViewChild("content",{read:r.ViewContainerRef,static:!1}),o.__metadata("design:type",r.ViewContainerRef)],t.prototype,"container",void 0),o.__decorate([r.ViewChild("defaultToolbar",{read:r.ElementRef,static:!1}),o.__metadata("design:type",r.ElementRef)],t.prototype,"defaultToolbar",void 0),o.__decorate([r.ViewChild("defaultToolbar",{read:l.ToolBarComponent,static:!1}),o.__metadata("design:type",l.ToolBarComponent)],t.prototype,"defaultToolbarComponent",void 0),t=e=o.__decorate([r.Component({selector:"kendo-editor",providers:[_.EditorLocalizationService,S.EditorToolsService,{provide:k.LocalizationService,useExisting:_.EditorLocalizationService},{provide:k.L10N_PREFIX,useValue:"kendo.editor"},{provide:i.NG_VALUE_ACCESSOR,useExisting:r.forwardRef((function(){return e})),multi:!0},{provide:d.KendoInput,useExisting:r.forwardRef((function(){return e}))}],template:'\n <ng-container\n kendoEditorLocalizedMessages\n i18n-alignCenter="kendo.editor.alignCenter|The title of the tool that aligns text in the center."\n alignCenter="Center text"\n i18n-alignJustify="kendo.editor.alignJustify|The title of the tool that justifies text both left and right."\n alignJustify="Justify"\n i18n-alignLeft="kendo.editor.alignLeft|The title of the tool that aligns text on the left."\n alignLeft="Align text left"\n i18n-alignRight="kendo.editor.alignRight|The title of the tool that aligns text on the right."\n alignRight="Align text right"\n i18n-backColor="kendo.editor.backColor|The title of the tool that changes the text background color."\n backColor="Background color"\n i18n-blockquote="kendo.editor.blockquote|The title of the tool that wraps an element in a blockquote"\n blockquote="Quotation"\n i18n-bold="kendo.editor.bold|The title of the tool that makes text bold."\n bold="Bold"\n i18n-cleanFormatting="kendo.editor.cleanFormatting|The title of the Clean Formatting tool."\n cleanFormatting="Clean formatting"\n i18n-createLink="kendo.editor.createLink|The title of the tool that creates hyperlinks."\n createLink="Insert link"\n i18n-dialogApply="kendo.editor.dialogApply|The label of the **Apply** button in all editor dialogs."\n dialogApply="Apply"\n i18n-dialogCancel="kendo.editor.dialogCancel|The label of the **Cancel** button in all editor dialogs."\n dialogCancel="Cancel"\n i18n-dialogInsert="kendo.editor.dialogInsert|The label of the **Insert** button in all editor dialogs."\n dialogInsert="Insert"\n i18n-dialogUpdate="kendo.editor.dialogUpdate|The label of the **Update** button in all editor dialogs."\n dialogUpdate="Update"\n i18n-fileText="kendo.editor.fileText|The caption for the file text in the insertFile dialog."\n fileText="Text"\n i18n-fileTitle="kendo.editor.fileTitle|The caption for the file Title in the insertFile dialog."\n fileTitle="Title"\n i18n-fileWebAddress="kendo.editor.fileWebAddress|The caption for the file URL in the insertFile dialog."\n fileWebAddress="Web address"\n i18n-fontFamily="kendo.editor.fontFamily|The title of the tool that changes the text font."\n fontFamily="Select font family"\n i18n-fontSize="kendo.editor.fontSize|The title of the tool that changes the text size."\n fontSize="Select font size"\n i18n-foreColor="kendo.editor.foreColor|The title of the tool that changes the text color."\n foreColor="Color"\n i18n-format="kendo.editor.format|The title of the tool that lets users choose block formats."\n format="Format"\n i18n-imageAltText="kendo.editor.imageAltText|The caption for the image alternate text in the insertImage dialog."\n imageAltText="Alternate text"\n i18n-imageHeight="kendo.editor.imageHeight|The caption for the image height in the insertImage dialog."\n imageHeight="Height (px)"\n i18n-imageWebAddress="kendo.editor.imageWebAddress|The caption for the image URL in the insertImage dialog."\n imageWebAddress="Web address"\n i18n-imageWidth="kendo.editor.imageWidth|The caption for the image width in the insertImage dialog."\n imageWidth="Width (px)"\n i18n-indent="kendo.editor.indent|The title of the tool that indents the content."\n indent="Indent"\n i18n-insertFile="kendo.editor.insertFile|The title of the tool that inserts links to files."\n insertFile="Insert file"\n i18n-insertImage="kendo.editor.insertImage|The title of the tool that inserts images."\n insertImage="Insert image"\n i18n-insertOrderedList="kendo.editor.insertOrderedList|The title of the tool that inserts an ordered list."\n insertOrderedList="Insert ordered list"\n i18n-insertUnorderedList="kendo.editor.insertUnorderedList|The title of the tool that inserts an unordered list."\n insertUnorderedList="Insert unordered list"\n i18n-italic="kendo.editor.italic|The title of the tool that makes text italicized."\n italic="Italic"\n i18n-linkOpenInNewWindow="kendo.editor.linkOpenInNewWindow|The caption for the checkbox for opening the link in a new window in the createLink dialog."\n linkOpenInNewWindow="Open link in new window"\n i18n-linkText="kendo.editor.linkText|The caption for the link text in the createLink dialog."\n linkText="Text"\n i18n-linkTitle="kendo.editor.linkTitle|The caption for the link title in the createLink dialog."\n linkTitle="Title"\n i18n-linkWebAddress="kendo.editor.linkWebAddress|The caption for the URL in the createLink dialog."\n linkWebAddress="Web address"\n i18n-outdent="kendo.editor.outdent|The title of the tool that outdents the content."\n outdent="Outdent"\n i18n-print="kendo.editor.print|The title of the print tool."\n print="Print"\n i18n-redo="kendo.editor.redo|The title of the tool that undos the last action."\n redo="Redo"\n i18n-selectAll="kendo.editor.selectAll|The title of the tool that selects all content."\n selectAll="Select All"\n i18n-strikethrough="kendo.editor.strikethrough|The title of the tool that strikes through text."\n strikethrough="Strikethrough"\n i18n-subscript="kendo.editor.subscript|The title of the tool that makes text subscript."\n subscript="Subscript"\n i18n-superscript="kendo.editor.superscript|The title of the tool that makes text superscript."\n superscript="Superscript"\n i18n-underline="kendo.editor.underline|The title of the tool that underlines text."\n underline="Underline"\n i18n-unlink="kendo.editor.unlink|The title of the tool that removes hyperlinks."\n unlink="Remove Link"\n i18n-undo="kendo.editor.undo|The title of the tool that undos the last action."\n undo="Undo"\n i18n-viewSource="kendo.editor.viewSource|The title of the tool that shows the editor value as HTML."\n viewSource="View source"\n i18n-insertTable="kendo.editor.insertTable|The title of the tool that inserts table."\n insertTable="Insert Table"\n i18n-addColumnBefore="kendo.editor.addColumnBefore|The title of the tool that adds new column before currently selected column."\n addColumnBefore="Add column before"\n i18n-addColumnAfter="kendo.editor.addColumnAfter|The title of the tool that adds new column after currently selected column."\n addColumnAfter="Add column after"\n i18n-addRowBefore="kendo.editor.addRowBefore|The title of the tool that adds new row before currently selected row."\n addRowBefore="Add row before"\n i18n-addRowAfter="kendo.editor.addRowAfter|The title of the tool that adds new row after currently selected row."\n addRowAfter="Add row after"\n i18n-deleteColumn="kendo.editor.deleteColumn|The title of the tool that deletes a table column."\n deleteColumn="Delete column"\n i18n-deleteRow="kendo.editor.deleteRow|The title of the tool that deletes a table row."\n deleteRow="Delete row"\n i18n-deleteTable="kendo.editor.deleteTable|The title of the tool that deletes a table."\n deleteTable="Delete table"\n >\n </ng-container>\n\n <ng-content select="kendo-toolbar"></ng-content>\n <kendo-toolbar [overflow]="true" [tabindex]="readonly ? -1 : 0" *ngIf="!userToolBarElement" #defaultToolbar>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorBoldButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorItalicButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnderlineButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-dropdownlist kendoEditorFormat></kendo-toolbar-dropdownlist>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorAlignLeftButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignCenterButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignRightButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignJustifyButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertUnorderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorInsertOrderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorIndentButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorOutdentButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorCreateLinkButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnlinkButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertImageButton></kendo-toolbar-button>\n </kendo-toolbar>\n\n <div *ngIf="!iframe" #content [attr.dir]="direction" class="k-editor-content"></div>\n\n <div class="k-editor-content" *ngIf="iframe">\n <iframe #content srcdoc="<!DOCTYPE html>" frameborder="0" class="k-iframe" (load)="iframeOnLoad()"></iframe>\n </div>\n\n <ng-container #dialogsContainer></ng-container>\n ',styles:["\n >>> .k-editor-content > .ProseMirror {\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n outline: none;\n overflow: auto;\n }\n\n .k-iframe {\n width: 100%;\n height: 100%;\n display: block;\n }\n "]}),o.__metadata("design:paramtypes",[c.DialogService,k.LocalizationService,r.ChangeDetectorRef,r.NgZone,r.ElementRef,S.EditorToolsService])],t)}();e.EditorComponent=A},function(t,n){t.exports=e},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(15),a=function(){function t(){this.needsCheck=new i.Subject}return t=o.__decorate([r.Injectable()],t)}();e.EditorToolsService=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=function(t){function e(e,n,o,r,i){var a=t.call(this,e,n,o,r,i)||this;return a.command=e,a.button=n,a.editor=o,a.localization=r,a.toolsService=i,a}return o.__extends(e,t),e.prototype.clickHandler=function(){this.editor.exec(this.command,this.editor.applyToWord),this.editor.focus()},e.prototype.pointerdownHandler=function(t){t.preventDefault()},e.prototype.onStateChange=function(t){this.button.selected=t[this.command].selected,this.button.disabled=t[this.command].disabled},e}(n(34).EditorCommandBase);e.EditorCommandButton=r},function(t,e){t.exports=n},function(t,e,n){"use strict";function o(t){this.content=t}n.r(e),n.d(e,"getHtml",(function(){return Ie})),n.d(e,"setHtml",(function(){return Be})),n.d(e,"parseContent",(function(){return Ae})),n.d(e,"trimWhitespace",(function(){return Te})),n.d(e,"htmlToFragment",(function(){return Me})),n.d(e,"domToPmDoc",(function(){return Oe})),n.d(e,"pmDocToFragment",(function(){return De})),n.d(e,"applyInlineStyle",(function(){return dn})),n.d(e,"getInlineStyles",(function(){return sn})),n.d(e,"toggleInlineFormat",(function(){return cn})),n.d(e,"applyLink",(function(){return pn})),n.d(e,"removeLink",(function(){return un})),n.d(e,"insertText",(function(){return fn})),n.d(e,"insertImage",(function(){return hn})),n.d(e,"alignBlocks",(function(){return xn})),n.d(e,"isAligned",(function(){return Sn})),n.d(e,"cleanFormatting",(function(){return En})),n.d(e,"hasNode",(function(){return kn})),n.d(e,"activeNode",(function(){return Cn})),n.d(e,"formatBlockElements",(function(){return gn})),n.d(e,"getBlockFormats",(function(){return bn})),n.d(e,"parentBlockFormat",(function(){return _n})),n.d(e,"changeTextBlock",(function(){return mn})),n.d(e,"blockNodes",(function(){return vn})),n.d(e,"cleanTextBlockFormatting",(function(){return yn})),n.d(e,"hasMark",(function(){return Qe})),n.d(e,"getMark",(function(){return nn})),n.d(e,"getActiveMarks",(function(){return on})),n.d(e,"removeAllMarks",(function(){return Ye})),n.d(e,"cleanMarks",(function(){return Ze})),n.d(e,"selectionMarks",(function(){return en})),n.d(e,"indent",(function(){return Bo})),n.d(e,"canIndentAsListItem",(function(){return Oo})),n.d(e,"outdent",(function(){return No})),n.d(e,"canOutdentAsListItem",(function(){return Ao})),n.d(e,"isIndented",(function(){return Do})),n.d(e,"canBeIndented",(function(){return Io})),n.d(e,"indentBlocks",(function(){return Mo})),n.d(e,"toggleOrderedList",(function(){return Wo})),n.d(e,"toggleUnorderedList",(function(){return jo})),n.d(e,"toggleList",(function(){return Vo})),n.d(e,"listStyle",(function(){return $o})),n.d(e,"blockquote",(function(){return Eo})),n.d(e,"liftBlockquote",(function(){return To})),n.d(e,"hasSameMarkup",(function(){return $e})),n.d(e,"getSelectionText",(function(){return Ve})),n.d(e,"getNodeFromSelection",(function(){return je})),n.d(e,"selectedLineTextOnly",(function(){return We})),n.d(e,"expandSelection",(function(){return Je})),n.d(e,"expandToWordWrap",(function(){return Ke})),n.d(e,"canInsert",(function(){return Re})),n.d(e,"insertNode",(function(){return Fe})),n.d(e,"indentHtml",(function(){return He})),n.d(e,"alignLeftRules",(function(){return qo})),n.d(e,"alignCenterRules",(function(){return Ko})),n.d(e,"alignRightRules",(function(){return Jo})),n.d(e,"alignJustifyRules",(function(){return Uo})),n.d(e,"alignRemoveRules",(function(){return Go})),n.d(e,"indentRules",(function(){return jn})),n.d(e,"outdentRules",(function(){return Wn})),n.d(e,"nodes",(function(){return Ul})),n.d(e,"marks",(function(){return jl})),n.d(e,"buildKeymap",(function(){return Lc})),n.d(e,"buildListKeymap",(function(){return Fc})),n.d(e,"bold",(function(){return Oc})),n.d(e,"italic",(function(){return Ac})),n.d(e,"underline",(function(){return Ic})),n.d(e,"strikethrough",(function(){return Bc})),n.d(e,"subscript",(function(){return Nc})),n.d(e,"superscript",(function(){return zc})),n.d(e,"link",(function(){return Rc})),n.d(e,"sanitize",(function(){return Gc})),n.d(e,"removeComments",(function(){return Xc})),n.d(e,"removeTag",(function(){return Yc})),n.d(e,"pasteCleanup",(function(){return od})),n.d(e,"sanitizeClassAttr",(function(){return Qc})),n.d(e,"sanitizeStyleAttr",(function(){return nd})),n.d(e,"removeAttribute",(function(){return Zc})),n.d(e,"replaceImageSourcesFromRtf",(function(){return ud})),n.d(e,"convertMsLists",(function(){return Uc})),n.d(e,"find",(function(){return fd})),n.d(e,"findAt",(function(){return pd})),n.d(e,"findAll",(function(){return hd})),n.d(e,"replace",(function(){return md})),n.d(e,"replaceAll",(function(){return vd})),n.d(e,"placeholder",(function(){return wd})),n.d(e,"spacesFix",(function(){return Cd})),n.d(e,"textHighlight",(function(){return Sd})),n.d(e,"textHighlightKey",(function(){return xd})),n.d(e,"imageResizing",(function(){return Nd})),n.d(e,"imageResizeKey",(function(){return Ed})),n.d(e,"caretColor",(function(){return Rd})),n.d(e,"caretColorKey",(function(){return zd})),n.d(e,"autoJoin",(function(){return yo})),n.d(e,"baseKeymap",(function(){return So})),n.d(e,"chainCommands",(function(){return bo})),n.d(e,"createParagraphNear",(function(){return ro})),n.d(e,"deleteSelection",(function(){return Hn})),n.d(e,"exitCode",(function(){return oo})),n.d(e,"joinBackward",(function(){return qn})),n.d(e,"joinDown",(function(){return Qn})),n.d(e,"joinForward",(function(){return Gn})),n.d(e,"joinUp",(function(){return Zn})),n.d(e,"lift",(function(){return to})),n.d(e,"liftEmptyBlock",(function(){return io})),n.d(e,"macBaseKeymap",(function(){return Co})),n.d(e,"newlineInCode",(function(){return eo})),n.d(e,"pcBaseKeymap",(function(){return _o})),n.d(e,"selectAll",(function(){return co})),n.d(e,"selectNodeBackward",(function(){return Kn})),n.d(e,"selectNodeForward",(function(){return Xn})),n.d(e,"selectParentNode",(function(){return lo})),n.d(e,"selectTextblockEnd",(function(){return ho})),n.d(e,"selectTextblockStart",(function(){return fo})),n.d(e,"setBlockType",(function(){return vo})),n.d(e,"splitBlock",(function(){return ao})),n.d(e,"splitBlockKeepMarks",(function(){return so})),n.d(e,"toggleMark",(function(){return go})),n.d(e,"wrapIn",(function(){return mo})),n.d(e,"dropCursor",(function(){return Pd})),n.d(e,"GapCursor",(function(){return Fd})),n.d(e,"gapCursor",(function(){return Vd})),n.d(e,"HistoryState",(function(){return ec})),n.d(e,"closeHistory",(function(){return cc})),n.d(e,"history",(function(){return pc})),n.d(e,"redo",(function(){return hc})),n.d(e,"redoDepth",(function(){return vc})),n.d(e,"undo",(function(){return fc})),n.d(e,"undoDepth",(function(){return mc})),n.d(e,"InputRule",(function(){return gc})),n.d(e,"closeDoubleQuote",(function(){return xc})),n.d(e,"closeSingleQuote",(function(){return Ec})),n.d(e,"ellipsis",(function(){return _c})),n.d(e,"emDash",(function(){return kc})),n.d(e,"inputRules",(function(){return yc})),n.d(e,"openDoubleQuote",(function(){return Cc})),n.d(e,"openSingleQuote",(function(){return Sc})),n.d(e,"smartQuotes",(function(){return Tc})),n.d(e,"textblockTypeInputRule",(function(){return Dc})),n.d(e,"undoInputRule",(function(){return wc})),n.d(e,"wrappingInputRule",(function(){return Mc})),n.d(e,"keydownHandler",(function(){return dr})),n.d(e,"keymap",(function(){return cr})),n.d(e,"ContentMatch",(function(){return B})),n.d(e,"DOMParser",(function(){return tt})),n.d(e,"DOMSerializer",(function(){return ut})),n.d(e,"Fragment",(function(){return i})),n.d(e,"Mark",(function(){return d})),n.d(e,"MarkType",(function(){return Y})),n.d(e,"Node",(function(){return D})),n.d(e,"NodeRange",(function(){return E})),n.d(e,"NodeType",(function(){return K})),n.d(e,"ReplaceError",(function(){return u})),n.d(e,"ResolvedPos",(function(){return k})),n.d(e,"Schema",(function(){return Z})),n.d(e,"Slice",(function(){return p})),n.d(e,"addListNodes",(function(){return Nn})),n.d(e,"bulletList",(function(){return An})),n.d(e,"liftListItem",(function(){return Pn})),n.d(e,"listItem",(function(){return In})),n.d(e,"orderedList",(function(){return On})),n.d(e,"sinkListItem",(function(){return Ln})),n.d(e,"splitListItem",(function(){return Rn})),n.d(e,"wrapInList",(function(){return zn})),n.d(e,"AllSelection",(function(){return se})),n.d(e,"EditorState",(function(){return ve})),n.d(e,"NodeSelection",(function(){return ie})),n.d(e,"Plugin",(function(){return be})),n.d(e,"PluginKey",(function(){return _e})),n.d(e,"Selection",(function(){return te})),n.d(e,"SelectionRange",(function(){return ne})),n.d(e,"TextSelection",(function(){return oe})),n.d(e,"Transaction",(function(){return ue})),n.d(e,"CellSelection",(function(){return Ms})),n.d(e,"TableMap",(function(){return ls})),n.d(e,"TableView",(function(){return wl})),n.d(e,"__clipCells",(function(){return Bs})),n.d(e,"__insertCells",(function(){return Rs})),n.d(e,"__pastedCells",(function(){return As})),n.d(e,"addColSpan",(function(){return Es})),n.d(e,"addColumn",(function(){return Ys})),n.d(e,"addColumnAfter",(function(){return Qs})),n.d(e,"addColumnBefore",(function(){return Zs})),n.d(e,"addRow",(function(){return ol})),n.d(e,"cellAround",(function(){return ms})),n.d(e,"colCount",(function(){return _s})),n.d(e,"columnIsHeader",(function(){return Ts})),n.d(e,"columnResizing",(function(){return Cl})),n.d(e,"columnResizingPluginKey",(function(){return _l})),n.d(e,"deleteColumn",(function(){return el})),n.d(e,"deleteRow",(function(){return sl})),n.d(e,"deleteTable",(function(){return bl})),n.d(e,"findCell",(function(){return ks})),n.d(e,"fixTables",(function(){return Gs})),n.d(e,"fixTablesKey",(function(){return Us})),n.d(e,"goToNextCell",(function(){return yl})),n.d(e,"handlePaste",(function(){return Ws})),n.d(e,"inSameTable",(function(){return ws})),n.d(e,"isInTable",(function(){return vs})),n.d(e,"mergeCells",(function(){return cl})),n.d(e,"moveCellForward",(function(){return bs})),n.d(e,"nextCell",(function(){return Cs})),n.d(e,"pointsAtCell",(function(){return ys})),n.d(e,"removeColSpan",(function(){return Ss})),n.d(e,"removeColumn",(function(){return tl})),n.d(e,"removeRow",(function(){return al})),n.d(e,"rowIsHeader",(function(){return nl})),n.d(e,"selectedRect",(function(){return Xs})),n.d(e,"selectionCell",(function(){return gs})),n.d(e,"setAttr",(function(){return xs})),n.d(e,"setCellAttr",(function(){return pl})),n.d(e,"splitCell",(function(){return dl})),n.d(e,"splitCellWithType",(function(){return ul})),n.d(e,"tableEditing",(function(){return Dl})),n.d(e,"tableEditingKey",(function(){return hs})),n.d(e,"tableNodeTypes",(function(){return fs})),n.d(e,"tableNodes",(function(){return ps})),n.d(e,"toggleHeader",(function(){return hl})),n.d(e,"toggleHeaderCell",(function(){return gl})),n.d(e,"toggleHeaderColumn",(function(){return vl})),n.d(e,"toggleHeaderRow",(function(){return ml})),n.d(e,"updateColumnsOnResize",(function(){return kl})),n.d(e,"AddMarkStep",(function(){return $t})),n.d(e,"MapResult",(function(){return vt})),n.d(e,"Mapping",(function(){return yt})),n.d(e,"RemoveMarkStep",(function(){return Vt})),n.d(e,"ReplaceAroundStep",(function(){return Tt})),n.d(e,"ReplaceStep",(function(){return Et})),n.d(e,"Step",(function(){return xt})),n.d(e,"StepMap",(function(){return gt})),n.d(e,"StepResult",(function(){return St})),n.d(e,"Transform",(function(){return wt})),n.d(e,"TransformError",(function(){return bt})),n.d(e,"canJoin",(function(){return Nt})),n.d(e,"canSplit",(function(){return Bt})),n.d(e,"dropPoint",(function(){return Lt})),n.d(e,"findWrapping",(function(){return At})),n.d(e,"insertPoint",(function(){return Pt})),n.d(e,"joinPoint",(function(){return Rt})),n.d(e,"liftTarget",(function(){return Ot})),n.d(e,"replaceStep",(function(){return jt})),n.d(e,"Decoration",(function(){return Ba})),n.d(e,"DecorationSet",(function(){return Pa})),n.d(e,"EditorView",(function(){return Xa})),n.d(e,"__endComposition",(function(){return Ca})),n.d(e,"__parseFromClipboard",(function(){return Ji})),n.d(e,"__serializeForClipboard",(function(){return qi})),n.d(e,"createTable",(function(){return Kd})),n.d(e,"addRowAfter",(function(){return Xd})),n.d(e,"addRowBefore",(function(){return Gd})),n.d(e,"pmAddRowAfter",(function(){return il})),n.d(e,"pmAddRowBefore",(function(){return rl})),o.prototype={constructor:o,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),a=r.content.slice();return-1==i?a.push(n||t,e):(a[i+1]=e,n&&(a[i]=n)),new o(a)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new o(n)},addToStart:function(t,e){return new o([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new o(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(-1==a?i.length:a,0,e,n),new o(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=o.from(t)).size?new o(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=o.from(t)).size?new o(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=o.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},get size(){return this.content.length>>1}},o.from=function(t){if(t instanceof o)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new o(e)};var r=o;var i=function(t,e){if(this.content=t,this.size=e||0,null==e)for(var n=0;n<t.length;n++)this.size+=t[n].nodeSize},a={firstChild:{configurable:!0},lastChild:{configurable:!0},childCount:{configurable:!0}};i.prototype.nodesBetween=function(t,e,n,o,r){void 0===o&&(o=0);for(var i=0,a=0;a<e;i++){var s=this.content[i],l=a+s.nodeSize;if(l>t&&!1!==n(s,o+a,r,i)&&s.content.size){var c=a+1;s.nodesBetween(Math.max(0,t-c),Math.min(s.content.size,e-c),n,o+c)}a=l}},i.prototype.descendants=function(t){this.nodesBetween(0,this.size,t)},i.prototype.textBetween=function(t,e,n,o){var r="",i=!0;return this.nodesBetween(t,e,(function(a,s){a.isText?(r+=a.text.slice(Math.max(t,s)-s,e-s),i=!n):a.isLeaf&&o?(r+="function"==typeof o?o(a):o,i=!n):!i&&a.isBlock&&(r+=n,i=!0)}),0),r},i.prototype.append=function(t){if(!t.size)return this;if(!this.size)return t;var e=this.lastChild,n=t.firstChild,o=this.content.slice(),r=0;for(e.isText&&e.sameMarkup(n)&&(o[o.length-1]=e.withText(e.text+n.text),r=1);r<t.content.length;r++)o.push(t.content[r]);return new i(o,this.size+t.size)},i.prototype.cut=function(t,e){if(null==e&&(e=this.size),0==t&&e==this.size)return this;var n=[],o=0;if(e>t)for(var r=0,a=0;a<e;r++){var s=this.content[r],l=a+s.nodeSize;l>t&&((a<t||l>e)&&(s=s.isText?s.cut(Math.max(0,t-a),Math.min(s.text.length,e-a)):s.cut(Math.max(0,t-a-1),Math.min(s.content.size,e-a-1))),n.push(s),o+=s.nodeSize),a=l}return new i(n,o)},i.prototype.cutByIndex=function(t,e){return t==e?i.empty:0==t&&e==this.content.length?this:new i(this.content.slice(t,e))},i.prototype.replaceChild=function(t,e){var n=this.content[t];if(n==e)return this;var o=this.content.slice(),r=this.size+e.nodeSize-n.nodeSize;return o[t]=e,new i(o,r)},i.prototype.addToStart=function(t){return new i([t].concat(this.content),this.size+t.nodeSize)},i.prototype.addToEnd=function(t){return new i(this.content.concat(t),this.size+t.nodeSize)},i.prototype.eq=function(t){if(this.content.length!=t.content.length)return!1;for(var e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0},a.firstChild.get=function(){return this.content.length?this.content[0]:null},a.lastChild.get=function(){return this.content.length?this.content[this.content.length-1]:null},a.childCount.get=function(){return this.content.length},i.prototype.child=function(t){var e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e},i.prototype.maybeChild=function(t){return this.content[t]},i.prototype.forEach=function(t){for(var e=0,n=0;e<this.content.length;e++){var o=this.content[e];t(o,n,e),n+=o.nodeSize}},i.prototype.findDiffStart=function(t,e){return void 0===e&&(e=0),function t(e,n,o){for(var r=0;;r++){if(r==e.childCount||r==n.childCount)return e.childCount==n.childCount?null:o;var i=e.child(r),a=n.child(r);if(i!=a){if(!i.sameMarkup(a))return o;if(i.isText&&i.text!=a.text){for(var s=0;i.text[s]==a.text[s];s++)o++;return o}if(i.content.size||a.content.size){var l=t(i.content,a.content,o+1);if(null!=l)return l}o+=i.nodeSize}else o+=i.nodeSize}}(this,t,e)},i.prototype.findDiffEnd=function(t,e,n){return void 0===e&&(e=this.size),void 0===n&&(n=t.size),function t(e,n,o,r){for(var i=e.childCount,a=n.childCount;;){if(0==i||0==a)return i==a?null:{a:o,b:r};var s=e.child(--i),l=n.child(--a),c=s.nodeSize;if(s!=l){if(!s.sameMarkup(l))return{a:o,b:r};if(s.isText&&s.text!=l.text){for(var d=0,u=Math.min(s.text.length,l.text.length);d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,o--,r--;return{a:o,b:r}}if(s.content.size||l.content.size){var p=t(s.content,l.content,o-1,r-1);if(p)return p}o-=c,r-=c}else o-=c,r-=c}}(this,t,e,n)},i.prototype.findIndex=function(t,e){if(void 0===e&&(e=-1),0==t)return l(0,t);if(t==this.size)return l(this.content.length,t);if(t>this.size||t<0)throw new RangeError("Position "+t+" outside of fragment ("+this+")");for(var n=0,o=0;;n++){var r=o+this.child(n).nodeSize;if(r>=t)return r==t||e>0?l(n+1,r):l(n,o);o=r}},i.prototype.toString=function(){return"<"+this.toStringInner()+">"},i.prototype.toStringInner=function(){return this.content.join(", ")},i.prototype.toJSON=function(){return this.content.length?this.content.map((function(t){return t.toJSON()})):null},i.fromJSON=function(t,e){if(!e)return i.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new i(e.map(t.nodeFromJSON))},i.fromArray=function(t){if(!t.length)return i.empty;for(var e,n=0,o=0;o<t.length;o++){var r=t[o];n+=r.nodeSize,o&&r.isText&&t[o-1].sameMarkup(r)?(e||(e=t.slice(0,o)),e[e.length-1]=r.withText(e[e.length-1].text+r.text)):e&&e.push(r)}return new i(e||t,n)},i.from=function(t){if(!t)return i.empty;if(t instanceof i)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new i([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))},Object.defineProperties(i.prototype,a);var s={index:0,offset:0};function l(t,e){return s.index=t,s.offset=e,s}function c(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;var n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(var o=0;o<t.length;o++)if(!c(t[o],e[o]))return!1}else{for(var r in t)if(!(r in e)||!c(t[r],e[r]))return!1;for(var i in e)if(!(i in t))return!1}return!0}i.empty=new i([],0);var d=function(t,e){this.type=t,this.attrs=e};function u(t){var e=Error.call(this,t);return e.__proto__=u.prototype,e}d.prototype.addToSet=function(t){for(var e,n=!1,o=0;o<t.length;o++){var r=t[o];if(this.eq(r))return t;if(this.type.excludes(r.type))e||(e=t.slice(0,o));else{if(r.type.excludes(this.type))return t;!n&&r.type.rank>this.type.rank&&(e||(e=t.slice(0,o)),e.push(this),n=!0),e&&e.push(r)}}return e||(e=t.slice()),n||e.push(this),e},d.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t},d.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1},d.prototype.eq=function(t){return this==t||this.type==t.type&&c(this.attrs,t.attrs)},d.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return t},d.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");var n=t.marks[e.type];if(!n)throw new RangeError("There is no mark type "+e.type+" in this schema");return n.create(e.attrs)},d.sameSet=function(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0},d.setFrom=function(t){if(!t||0==t.length)return d.none;if(t instanceof d)return[t];var e=t.slice();return e.sort((function(t,e){return t.type.rank-e.type.rank})),e},d.none=[],u.prototype=Object.create(Error.prototype),u.prototype.constructor=u,u.prototype.name="ReplaceError";var p=function(t,e,n){this.content=t,this.openStart=e,this.openEnd=n},f={size:{configurable:!0}};function h(t,e,n){if(n.openStart>t.depth)throw new u("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new u("Inconsistent open depths");return function t(e,n,o,r){var a=e.index(r),s=e.node(r);if(a==n.index(r)&&r<e.depth-o.openStart){var l=t(e,n,o,r+1);return s.copy(s.content.replaceChild(a,l))}if(o.content.size){if(o.openStart||o.openEnd||e.depth!=r||n.depth!=r){var c=function(t,e){for(var n=e.depth-t.openStart,o=e.node(n).copy(t.content),r=n-1;r>=0;r--)o=e.node(r).copy(i.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}(o,e),d=c.start,u=c.end;return b(s,function t(e,n,o,r,a){var s=e.depth>a&&v(e,n,a+1),l=r.depth>a&&v(o,r,a+1),c=[];y(null,e,a,c),s&&l&&n.index(a)==o.index(a)?(m(s,l),g(b(s,t(e,n,o,r,a+1)),c)):(s&&g(b(s,w(e,n,a+1)),c),y(n,o,a,c),l&&g(b(l,w(o,r,a+1)),c));return y(r,null,a,c),new i(c)}(e,d,u,n,r))}var p=e.parent,f=p.content;return b(p,f.cut(0,e.parentOffset).append(o.content).append(f.cut(n.parentOffset)))}return b(s,w(e,n,r))}(t,e,n,0)}function m(t,e){if(!e.type.compatibleContent(t.type))throw new u("Cannot join "+e.type.name+" onto "+t.type.name)}function v(t,e,n){var o=t.node(n);return m(o,e.node(n)),o}function g(t,e){var n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function y(t,e,n,o){var r=(e||t).node(n),i=0,a=e?e.index(n):r.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(g(t.nodeAfter,o),i++));for(var s=i;s<a;s++)g(r.child(s),o);e&&e.depth==n&&e.textOffset&&g(e.nodeBefore,o)}function b(t,e){if(!t.type.validContent(e))throw new u("Invalid content for node "+t.type.name);return t.copy(e)}function w(t,e,n){var o=[];(y(null,t,n,o),t.depth>n)&&g(b(v(t,e,n+1),w(t,e,n+1)),o);return y(e,null,n,o),new i(o)}f.size.get=function(){return this.content.size-this.openStart-this.openEnd},p.prototype.insertAt=function(t,e){var n=function t(e,n,o,r){var i=e.findIndex(n),a=i.index,s=i.offset,l=e.maybeChild(a);if(s==n||l.isText)return r&&!r.canReplace(a,a,o)?null:e.cut(0,n).append(o).append(e.cut(n));var c=t(l.content,n-s-1,o);return c&&e.replaceChild(a,l.copy(c))}(this.content,t+this.openStart,e,null);return n&&new p(n,this.openStart,this.openEnd)},p.prototype.removeBetween=function(t,e){return new p(function t(e,n,o){var r=e.findIndex(n),i=r.index,a=r.offset,s=e.maybeChild(i),l=e.findIndex(o),c=l.index,d=l.offset;if(a==n||s.isText){if(d!=o&&!e.child(c).isText)throw new RangeError("Removing non-flat range");return e.cut(0,n).append(e.cut(o))}if(i!=c)throw new RangeError("Removing non-flat range");return e.replaceChild(i,s.copy(t(s.content,n-a-1,o-a-1)))}(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)},p.prototype.eq=function(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd},p.prototype.toString=function(){return this.content+"("+this.openStart+","+this.openEnd+")"},p.prototype.toJSON=function(){if(!this.content.size)return null;var t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t},p.fromJSON=function(t,e){if(!e)return p.empty;var n=e.openStart||0,o=e.openEnd||0;if("number"!=typeof n||"number"!=typeof o)throw new RangeError("Invalid input for Slice.fromJSON");return new p(i.fromJSON(t,e.content),n,o)},p.maxOpen=function(t,e){void 0===e&&(e=!0);for(var n=0,o=0,r=t.firstChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.firstChild)n++;for(var i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)o++;return new p(t,n,o)},Object.defineProperties(p.prototype,f),p.empty=new p(i.empty,0,0);var k=function(t,e,n){this.pos=t,this.path=e,this.depth=e.length/3-1,this.parentOffset=n},_={parent:{configurable:!0},doc:{configurable:!0},textOffset:{configurable:!0},nodeAfter:{configurable:!0},nodeBefore:{configurable:!0}};k.prototype.resolveDepth=function(t){return null==t?this.depth:t<0?this.depth+t:t},_.parent.get=function(){return this.node(this.depth)},_.doc.get=function(){return this.node(0)},k.prototype.node=function(t){return this.path[3*this.resolveDepth(t)]},k.prototype.index=function(t){return this.path[3*this.resolveDepth(t)+1]},k.prototype.indexAfter=function(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)},k.prototype.start=function(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1},k.prototype.end=function(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size},k.prototype.before=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]},k.prototype.after=function(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize},_.textOffset.get=function(){return this.pos-this.path[this.path.length-1]},_.nodeAfter.get=function(){var t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;var n=this.pos-this.path[this.path.length-1],o=t.child(e);return n?t.child(e).cut(n):o},_.nodeBefore.get=function(){var t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)},k.prototype.posAtIndex=function(t,e){e=this.resolveDepth(e);for(var n=this.path[3*e],o=0==e?0:this.path[3*e-1]+1,r=0;r<t;r++)o+=n.child(r).nodeSize;return o},k.prototype.marks=function(){var t=this.parent,e=this.index();if(0==t.content.size)return d.none;if(this.textOffset)return t.child(e).marks;var n=t.maybeChild(e-1),o=t.maybeChild(e);if(!n){var r=n;n=o,o=r}for(var i=n.marks,a=0;a<i.length;a++)!1!==i[a].type.spec.inclusive||o&&i[a].isInSet(o.marks)||(i=i[a--].removeFromSet(i));return i},k.prototype.marksAcross=function(t){var e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;for(var n=e.marks,o=t.parent.maybeChild(t.index()),r=0;r<n.length;r++)!1!==n[r].type.spec.inclusive||o&&n[r].isInSet(o.marks)||(n=n[r--].removeFromSet(n));return n},k.prototype.sharedDepth=function(t){for(var e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0},k.prototype.blockRange=function(t,e){if(void 0===t&&(t=this),t.pos<this.pos)return t.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new E(this,t,n)},k.prototype.sameParent=function(t){return this.pos-this.parentOffset==t.pos-t.parentOffset},k.prototype.max=function(t){return t.pos>this.pos?t:this},k.prototype.min=function(t){return t.pos<this.pos?t:this},k.prototype.toString=function(){for(var t="",e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset},k.resolve=function(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");for(var n=[],o=0,r=e,i=t;;){var a=i.content.findIndex(r),s=a.index,l=a.offset,c=r-l;if(n.push(i,s,o+l),!c)break;if((i=i.child(s)).isText)break;r=c-1,o+=l+1}return new k(e,n,r)},k.resolveCached=function(t,e){for(var n=0;n<C.length;n++){var o=C[n];if(o.pos==e&&o.doc==t)return o}var r=C[x]=k.resolve(t,e);return x=(x+1)%S,r},Object.defineProperties(k.prototype,_);var C=[],x=0,S=12,E=function(t,e,n){this.$from=t,this.$to=e,this.depth=n},T={start:{configurable:!0},end:{configurable:!0},parent:{configurable:!0},startIndex:{configurable:!0},endIndex:{configurable:!0}};T.start.get=function(){return this.$from.before(this.depth+1)},T.end.get=function(){return this.$to.after(this.depth+1)},T.parent.get=function(){return this.$from.node(this.depth)},T.startIndex.get=function(){return this.$from.index(this.depth)},T.endIndex.get=function(){return this.$to.indexAfter(this.depth)},Object.defineProperties(E.prototype,T);var M=Object.create(null),D=function(t,e,n,o){this.type=t,this.attrs=e,this.content=n||i.empty,this.marks=o||d.none},O={nodeSize:{configurable:!0},childCount:{configurable:!0},textContent:{configurable:!0},firstChild:{configurable:!0},lastChild:{configurable:!0},isBlock:{configurable:!0},isTextblock:{configurable:!0},inlineContent:{configurable:!0},isInline:{configurable:!0},isText:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0}};O.nodeSize.get=function(){return this.isLeaf?1:2+this.content.size},O.childCount.get=function(){return this.content.childCount},D.prototype.child=function(t){return this.content.child(t)},D.prototype.maybeChild=function(t){return this.content.maybeChild(t)},D.prototype.forEach=function(t){this.content.forEach(t)},D.prototype.nodesBetween=function(t,e,n,o){void 0===o&&(o=0),this.content.nodesBetween(t,e,n,o,this)},D.prototype.descendants=function(t){this.nodesBetween(0,this.content.size,t)},O.textContent.get=function(){return this.textBetween(0,this.content.size,"")},D.prototype.textBetween=function(t,e,n,o){return this.content.textBetween(t,e,n,o)},O.firstChild.get=function(){return this.content.firstChild},O.lastChild.get=function(){return this.content.lastChild},D.prototype.eq=function(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)},D.prototype.sameMarkup=function(t){return this.hasMarkup(t.type,t.attrs,t.marks)},D.prototype.hasMarkup=function(t,e,n){return this.type==t&&c(this.attrs,e||t.defaultAttrs||M)&&d.sameSet(this.marks,n||d.none)},D.prototype.copy=function(t){return void 0===t&&(t=null),t==this.content?this:new this.constructor(this.type,this.attrs,t,this.marks)},D.prototype.mark=function(t){return t==this.marks?this:new this.constructor(this.type,this.attrs,this.content,t)},D.prototype.cut=function(t,e){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))},D.prototype.slice=function(t,e,n){if(void 0===e&&(e=this.content.size),void 0===n&&(n=!1),t==e)return p.empty;var o=this.resolve(t),r=this.resolve(e),i=n?0:o.sharedDepth(e),a=o.start(i),s=o.node(i).content.cut(o.pos-a,r.pos-a);return new p(s,o.depth-i,r.depth-i)},D.prototype.replace=function(t,e,n){return h(this.resolve(t),this.resolve(e),n)},D.prototype.nodeAt=function(t){for(var e=this;;){var n=e.content.findIndex(t),o=n.index,r=n.offset;if(!(e=e.maybeChild(o)))return null;if(r==t||e.isText)return e;t-=r+1}},D.prototype.childAfter=function(t){var e=this.content.findIndex(t),n=e.index,o=e.offset;return{node:this.content.maybeChild(n),index:n,offset:o}},D.prototype.childBefore=function(t){if(0==t)return{node:null,index:0,offset:0};var e=this.content.findIndex(t),n=e.index,o=e.offset;if(o<t)return{node:this.content.child(n),index:n,offset:o};var r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}},D.prototype.resolve=function(t){return k.resolveCached(this,t)},D.prototype.resolveNoCache=function(t){return k.resolve(this,t)},D.prototype.rangeHasMark=function(t,e,n){var o=!1;return e>t&&this.nodesBetween(t,e,(function(t){return n.isInSet(t.marks)&&(o=!0),!o})),o},O.isBlock.get=function(){return this.type.isBlock},O.isTextblock.get=function(){return this.type.isTextblock},O.inlineContent.get=function(){return this.type.inlineContent},O.isInline.get=function(){return this.type.isInline},O.isText.get=function(){return this.type.isText},O.isLeaf.get=function(){return this.type.isLeaf},O.isAtom.get=function(){return this.type.isAtom},D.prototype.toString=function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),I(this.marks,t)},D.prototype.contentMatchAt=function(t){var e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e},D.prototype.canReplace=function(t,e,n,o,r){void 0===n&&(n=i.empty),void 0===o&&(o=0),void 0===r&&(r=n.childCount);var a=this.contentMatchAt(t).matchFragment(n,o,r),s=a&&a.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(var l=o;l<r;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0},D.prototype.canReplaceWith=function(t,e,n,o){if(o&&!this.type.allowsMarks(o))return!1;var r=this.contentMatchAt(t).matchType(n),i=r&&r.matchFragment(this.content,e);return!!i&&i.validEnd},D.prototype.canAppend=function(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)},D.prototype.check=function(){if(!this.type.validContent(this.content))throw new RangeError("Invalid content for node "+this.type.name+": "+this.content.toString().slice(0,50));for(var t=d.none,e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!d.sameSet(t,this.marks))throw new RangeError("Invalid collection of marks for node "+this.type.name+": "+this.marks.map((function(t){return t.type.name})));this.content.forEach((function(t){return t.check()}))},D.prototype.toJSON=function(){var t={type:this.type.name};for(var e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((function(t){return t.toJSON()}))),t},D.fromJSON=function(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");var n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}var o=i.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,o,n)},Object.defineProperties(D.prototype,O);var A=function(t){function e(e,n,o,r){if(t.call(this,e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={textContent:{configurable:!0},nodeSize:{configurable:!0}};return e.prototype.toString=function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):I(this.marks,JSON.stringify(this.text))},n.textContent.get=function(){return this.text},e.prototype.textBetween=function(t,e){return this.text.slice(t,e)},n.nodeSize.get=function(){return this.text.length},e.prototype.mark=function(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)},e.prototype.withText=function(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)},e.prototype.cut=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.text.length),0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))},e.prototype.eq=function(t){return this.sameMarkup(t)&&this.text==t.text},e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.text=this.text,e},Object.defineProperties(e.prototype,n),e}(D);function I(t,e){for(var n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var B=function(t){this.validEnd=t,this.next=[],this.wrapCache=[]},N={inlineContent:{configurable:!0},defaultType:{configurable:!0},edgeCount:{configurable:!0}};B.parse=function(t,e){var n=new z(t,e);if(null==n.next)return B.empty;var o=P(n);n.next&&n.err("Unexpected trailing text");var r=function(t){var e=Object.create(null);return function n(o){var r=[];o.forEach((function(e){t[e].forEach((function(e){var n=e.term,o=e.to;if(n){var i=r.indexOf(n),a=i>-1&&r[i+1];W(t,o).forEach((function(t){a||r.push(n,a=[]),-1==a.indexOf(t)&&a.push(t)}))}}))}));for(var i=e[o.join(",")]=new B(o.indexOf(t.length-1)>-1),a=0;a<r.length;a+=2){var s=r[a+1].sort(j);i.next.push(r[a],e[s.join(",")]||n(s))}return i}(W(t,0))}(function(t){var e=[[]];return r(function t(e,i){if("choice"==e.type)return e.exprs.reduce((function(e,n){return e.concat(t(n,i))}),[]);if("seq"==e.type)for(var a=0;;a++){var s=t(e.exprs[a],i);if(a==e.exprs.length-1)return s;r(s,i=n())}else{if("star"==e.type){var l=n();return o(i,l),r(t(e.expr,l),l),[o(l)]}if("plus"==e.type){var c=n();return r(t(e.expr,i),c),r(t(e.expr,c),c),[o(c)]}if("opt"==e.type)return[o(i)].concat(t(e.expr,i));if("range"==e.type){for(var d=i,u=0;u<e.min;u++){var p=n();r(t(e.expr,d),p),d=p}if(-1==e.max)r(t(e.expr,d),d);else for(var f=e.min;f<e.max;f++){var h=n();o(d,h),r(t(e.expr,d),h),d=h}return[o(d)]}if("name"==e.type)return[o(i,null,e.value)]}}(t,0),n()),e;function n(){return e.push([])-1}function o(t,n,o){var r={term:o,to:n};return e[t].push(r),r}function r(t,e){t.forEach((function(t){return t.to=e}))}}(o));return function(t,e){for(var n=0,o=[t];n<o.length;n++){for(var r=o[n],i=!r.validEnd,a=[],s=0;s<r.next.length;s+=2){var l=r.next[s],c=r.next[s+1];a.push(l.name),!i||l.isText||l.hasRequiredAttrs()||(i=!1),-1==o.indexOf(c)&&o.push(c)}i&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(r,n),r},B.prototype.matchType=function(t){for(var e=0;e<this.next.length;e+=2)if(this.next[e]==t)return this.next[e+1];return null},B.prototype.matchFragment=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.childCount);for(var o=this,r=e;o&&r<n;r++)o=o.matchType(t.child(r).type);return o},N.inlineContent.get=function(){var t=this.next[0];return!!t&&t.isInline},N.defaultType.get=function(){for(var t=0;t<this.next.length;t+=2){var e=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}},B.prototype.compatible=function(t){for(var e=0;e<this.next.length;e+=2)for(var n=0;n<t.next.length;n+=2)if(this.next[e]==t.next[n])return!0;return!1},B.prototype.fillBefore=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=0);var o=[this];return function r(a,s){var l=a.matchFragment(t,n);if(l&&(!e||l.validEnd))return i.from(s.map((function(t){return t.createAndFill()})));for(var c=0;c<a.next.length;c+=2){var d=a.next[c],u=a.next[c+1];if(!d.isText&&!d.hasRequiredAttrs()&&-1==o.indexOf(u)){o.push(u);var p=r(u,s.concat(d));if(p)return p}}}(this,[])},B.prototype.findWrapping=function(t){for(var e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];var n=this.computeWrapping(t);return this.wrapCache.push(t,n),n},B.prototype.computeWrapping=function(t){for(var e=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var o=n.shift(),r=o.match;if(r.matchType(t)){for(var i=[],a=o;a.type;a=a.via)i.push(a.type);return i.reverse()}for(var s=0;s<r.next.length;s+=2){var l=r.next[s];l.isLeaf||l.hasRequiredAttrs()||l.name in e||o.type&&!r.next[s+1].validEnd||(n.push({match:l.contentMatch,type:l,via:o}),e[l.name]=!0)}}},N.edgeCount.get=function(){return this.next.length>>1},B.prototype.edge=function(t){var e=t<<1;if(e>=this.next.length)throw new RangeError("There's no "+t+"th edge in this content match");return{type:this.next[e],next:this.next[e+1]}},B.prototype.toString=function(){var t=[];return function e(n){t.push(n);for(var o=1;o<n.next.length;o+=2)-1==t.indexOf(n.next[o])&&e(n.next[o])}(this),t.map((function(e,n){for(var o=n+(e.validEnd?"*":" ")+" ",r=0;r<e.next.length;r+=2)o+=(r?", ":"")+e.next[r].name+"->"+t.indexOf(e.next[r+1]);return o})).join("\n")},Object.defineProperties(B.prototype,N),B.empty=new B(!0);var z=function(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},R={next:{configurable:!0}};function P(t){var e=[];do{e.push(L(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function L(t){var e=[];do{e.push(F(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function F(t){for(var e=function(t){if(t.eat("(")){var e=P(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){var n=function(t,e){var n=t.nodeTypes,o=n[e];if(o)return[o];var r=[];for(var i in n){var a=n[i];a.groups.indexOf(e)>-1&&r.push(a)}0==r.length&&t.err("No node type or group '"+e+"' found");return r}(t,t.next).map((function(e){return null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}}));return t.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}t.err("Unexpected token '"+t.next+"'")}(t);;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=V(t,e)}return e}function $(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");var e=Number(t.next);return t.pos++,e}function V(t,e){var n=$(t),o=n;return t.eat(",")&&(o="}"!=t.next?$(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function j(t,e){return e-t}function W(t,e){var n=[];return function e(o){var r=t[o];if(1==r.length&&!r[0].term)return e(r[0].to);n.push(o);for(var i=0;i<r.length;i++){var a=r[i],s=a.term,l=a.to;s||-1!=n.indexOf(l)||e(l)}}(e),n.sort(j)}function H(t){var e=Object.create(null);for(var n in t){var o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function q(t,e){var n=Object.create(null);for(var o in t){var r=e&&e[o];if(void 0===r){var i=t[o];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+o);r=i.default}n[o]=r}return n}function J(t){var e=Object.create(null);if(t)for(var n in t)e[n]=new G(t[n]);return e}R.next.get=function(){return this.tokens[this.pos]},z.prototype.eat=function(t){return this.next==t&&(this.pos++||!0)},z.prototype.err=function(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")},Object.defineProperties(z.prototype,R);var K=function(t,e,n){this.name=t,this.schema=e,this.spec=n,this.groups=n.group?n.group.split(" "):[],this.attrs=J(n.attrs),this.defaultAttrs=H(this.attrs),this.contentMatch=null,this.markSet=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t},U={isInline:{configurable:!0},isTextblock:{configurable:!0},isLeaf:{configurable:!0},isAtom:{configurable:!0},whitespace:{configurable:!0}};U.isInline.get=function(){return!this.isBlock},U.isTextblock.get=function(){return this.isBlock&&this.inlineContent},U.isLeaf.get=function(){return this.contentMatch==B.empty},U.isAtom.get=function(){return this.isLeaf||this.spec.atom},U.whitespace.get=function(){return this.spec.whitespace||(this.spec.code?"pre":"normal")},K.prototype.hasRequiredAttrs=function(){for(var t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1},K.prototype.compatibleContent=function(t){return this==t||this.contentMatch.compatible(t.contentMatch)},K.prototype.computeAttrs=function(t){return!t&&this.defaultAttrs?this.defaultAttrs:q(this.attrs,t)},K.prototype.create=function(t,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new D(this,this.computeAttrs(t),i.from(e),d.setFrom(n))},K.prototype.createChecked=function(t,e,n){if(e=i.from(e),!this.validContent(e))throw new RangeError("Invalid content for node "+this.name);return new D(this,this.computeAttrs(t),e,d.setFrom(n))},K.prototype.createAndFill=function(t,e,n){if(t=this.computeAttrs(t),(e=i.from(e)).size){var o=this.contentMatch.fillBefore(e);if(!o)return null;e=o.append(e)}var r=this.contentMatch.matchFragment(e).fillBefore(i.empty,!0);return r?new D(this,t,e.append(r),d.setFrom(n)):null},K.prototype.validContent=function(t){var e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(var n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0},K.prototype.allowsMarkType=function(t){return null==this.markSet||this.markSet.indexOf(t)>-1},K.prototype.allowsMarks=function(t){if(null==this.markSet)return!0;for(var e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0},K.prototype.allowedMarks=function(t){if(null==this.markSet)return t;for(var e,n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:d.empty:t},K.compile=function(t,e){var n=Object.create(null);t.forEach((function(t,o){return n[t]=new K(t,e,o)}));var o=e.spec.topNode||"doc";if(!n[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(var r in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n},Object.defineProperties(K.prototype,U);var G=function(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default},X={isRequired:{configurable:!0}};X.isRequired.get=function(){return!this.hasDefault},Object.defineProperties(G.prototype,X);var Y=function(t,e,n,o){this.name=t,this.schema=n,this.spec=o,this.attrs=J(o.attrs),this.rank=e,this.excluded=null;var r=H(this.attrs);this.instance=r&&new d(this,r)};Y.prototype.create=function(t){return!t&&this.instance?this.instance:new d(this,q(this.attrs,t))},Y.compile=function(t,e){var n=Object.create(null),o=0;return t.forEach((function(t,r){return n[t]=new Y(t,o++,e,r)})),n},Y.prototype.removeFromSet=function(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t},Y.prototype.isInSet=function(t){for(var e=0;e<t.length;e++)if(t[e].type==this)return t[e]},Y.prototype.excludes=function(t){return this.excluded.indexOf(t)>-1};var Z=function(t){for(var e in this.spec={},t)this.spec[e]=t[e];this.spec.nodes=r.from(t.nodes),this.spec.marks=r.from(t.marks),this.nodes=K.compile(this.spec.nodes,this),this.marks=Y.compile(this.spec.marks,this);var n=Object.create(null);for(var o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");var i=this.nodes[o],a=i.spec.content||"",s=i.spec.marks;i.contentMatch=n[a]||(n[a]=B.parse(a,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet="_"==s?null:s?Q(this,s.split(" ")):""!=s&&i.inlineContent?null:[]}for(var l in this.marks){var c=this.marks[l],d=c.spec.excludes;c.excluded=null==d?[c]:""==d?[]:Q(this,d.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached=Object.create(null),this.cached.wrappings=Object.create(null)};function Q(t,e){for(var n=[],o=0;o<e.length;o++){var r=e[o],i=t.marks[r],a=i;if(i)n.push(i);else for(var s in t.marks){var l=t.marks[s];("_"==r||l.spec.group&&l.spec.group.split(" ").indexOf(r)>-1)&&n.push(a=l)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}Z.prototype.node=function(t,e,n,o){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof K))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,o)},Z.prototype.text=function(t,e){var n=this.nodes.text;return new A(n,n.defaultAttrs,t,d.setFrom(e))},Z.prototype.mark=function(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)},Z.prototype.nodeFromJSON=function(t){return D.fromJSON(this,t)},Z.prototype.markFromJSON=function(t){return d.fromJSON(this,t)},Z.prototype.nodeType=function(t){var e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e};var tt=function(t,e){var n=this;this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((function(t){t.tag?n.tags.push(t):t.style&&n.styles.push(t)})),this.normalizeLists=!this.tags.some((function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)}))};tt.prototype.parse=function(t,e){void 0===e&&(e={});var n=new at(this,e,!1);return n.addAll(t,null,e.from,e.to),n.finish()},tt.prototype.parseSlice=function(t,e){void 0===e&&(e={});var n=new at(this,e,!0);return n.addAll(t,null,e.from,e.to),p.maxOpen(n.finish())},tt.prototype.matchTag=function(t,e,n){for(var o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r=this.tags[o];if(lt(t,r.tag)&&(void 0===r.namespace||t.namespaceURI==r.namespace)&&(!r.context||e.matchesContext(r.context))){if(r.getAttrs){var i=r.getAttrs(t);if(!1===i)continue;r.attrs=i}return r}}},tt.prototype.matchStyle=function(t,e,n,o){for(var r=o?this.styles.indexOf(o)+1:0;r<this.styles.length;r++){var i=this.styles[r];if(!(0!=i.style.indexOf(t)||i.context&&!n.matchesContext(i.context)||i.style.length>t.length&&(61!=i.style.charCodeAt(t.length)||i.style.slice(t.length+1)!=e))){if(i.getAttrs){var a=i.getAttrs(e);if(!1===a)continue;i.attrs=a}return i}}},tt.schemaRules=function(t){var e=[];function n(t){for(var n=null==t.priority?50:t.priority,o=0;o<e.length;o++){var r=e[o];if((null==r.priority?50:r.priority)<n)break}e.splice(o,0,t)}var o=function(e){var o=t.marks[e].spec.parseDOM;o&&o.forEach((function(t){n(t=ct(t)),t.mark=e}))};for(var r in t.marks)o(r);var i;for(var a in t.nodes)i=void 0,(i=t.nodes[a].spec.parseDOM)&&i.forEach((function(t){n(t=ct(t)),t.node=a}));return e},tt.fromSchema=function(t){return t.cached.domParser||(t.cached.domParser=new tt(t,tt.schemaRules(t)))};var et={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},nt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ot={ol:!0,ul:!0};function rt(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}var it=function(t,e,n,o,r,i,a){this.type=t,this.attrs=e,this.solid=r,this.match=i||(4&a?null:t.contentMatch),this.options=a,this.content=[],this.marks=n,this.activeMarks=d.none,this.pendingMarks=o,this.stashMarks=[]};it.prototype.findWrapping=function(t){if(!this.match){if(!this.type)return[];var e=this.type.contentMatch.fillBefore(i.from(t));if(!e){var n,o=this.type.contentMatch;return(n=o.findWrapping(t.type))?(this.match=o,n):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)},it.prototype.finish=function(t){if(!(1&this.options)){var e,n=this.content[this.content.length-1];n&&n.isText&&(e=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length)))}var o=i.from(this.content);return!t&&this.match&&(o=o.append(this.match.fillBefore(i.empty,!0))),this.type?this.type.create(this.attrs,o,this.marks):o},it.prototype.popFromStashMark=function(t){for(var e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]},it.prototype.applyPending=function(t){for(var e=0,n=this.pendingMarks;e<n.length;e++){var o=n[e];(this.type?this.type.allowsMarkType(o.type):dt(o.type,t))&&!o.isInSet(this.activeMarks)&&(this.activeMarks=o.addToSet(this.activeMarks),this.pendingMarks=o.removeFromSet(this.pendingMarks))}},it.prototype.inlineContext=function(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!et.hasOwnProperty(t.parentNode.nodeName.toLowerCase())};var at=function(t,e,n){this.parser=t,this.options=e,this.isOpen=n;var o,r=e.topNode,i=rt(null,e.preserveWhitespace,0)|(n?4:0);o=r?new it(r.type,r.attrs,d.none,d.none,!0,e.topMatch||r.type.contentMatch,i):new it(n?null:t.schema.topNodeType,null,d.none,d.none,!0,null,i),this.nodes=[o],this.open=0,this.find=e.findPositions,this.needsBlock=!1},st={top:{configurable:!0},currentPos:{configurable:!0}};function lt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ct(t){var e={};for(var n in t)e[n]=t[n];return e}function dt(t,e){var n=e.schema.nodes,o=function(o){var r=n[o];if(r.allowsMarkType(t)){var i=[],a=function(t){i.push(t);for(var n=0;n<t.edgeCount;n++){var o=t.edge(n),r=o.type,s=o.next;if(r==e)return!0;if(i.indexOf(s)<0&&a(s))return!0}};return a(r.contentMatch)?{v:!0}:void 0}};for(var r in n){var i=o(r);if(i)return i.v}}st.top.get=function(){return this.nodes[this.open]},at.prototype.addDOM=function(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){var e=t.getAttribute("style"),n=e?this.readStyles(function(t){var e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,o=[];for(;e=n.exec(t);)o.push(e[1],e[2].trim());return o}(e)):null,o=this.top;if(null!=n)for(var r=0;r<n.length;r++)this.addPendingMark(n[r]);if(this.addElement(t),null!=n)for(var i=0;i<n.length;i++)this.removePendingMark(n[i],o)}},at.prototype.addTextNode=function(t){var e=t.nodeValue,n=this.top;if(2&n.options||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)e=2&n.options?e.replace(/\r\n?/g,"\n"):e.replace(/\r?\n|\r/g," ");else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){var o=n.content[n.content.length-1],r=t.previousSibling;(!o||r&&"BR"==r.nodeName||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)},at.prototype.addElement=function(t,e){var n,o=t.nodeName.toLowerCase();ot.hasOwnProperty(o)&&this.parser.normalizeLists&&function(t){for(var e=t.firstChild,n=null;e;e=e.nextSibling){var o=1==e.nodeType?e.nodeName.toLowerCase():null;o&&ot.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):"li"==o?n=e:o&&(n=null)}}(t);var r=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(r?r.ignore:nt.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t);else if(!r||r.skip||r.closeParent){r&&r.closeParent?this.open=Math.max(0,this.open-1):r&&r.skip.nodeType&&(t=r.skip);var i,a=this.top,s=this.needsBlock;if(et.hasOwnProperty(o))i=!0,a.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);this.addAll(t),i&&this.sync(a),this.needsBlock=s}else this.addElementByRule(t,r,!1===r.consuming?n:null)},at.prototype.leafFallback=function(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))},at.prototype.ignoreFallback=function(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))},at.prototype.readStyles=function(t){var e=d.none;t:for(var n=0;n<t.length;n+=2)for(var o=null;;){var r=this.parser.matchStyle(t[n],t[n+1],this,o);if(!r)continue t;if(r.ignore)return null;if(e=this.parser.schema.marks[r.mark].create(r.attrs).addToSet(e),!1!==r.consuming)break;o=r}return e},at.prototype.addElementByRule=function(t,e,n){var o,r,i,a=this;e.node?(r=this.parser.schema.nodes[e.node]).isLeaf?this.insertNode(r.create(e.attrs))||this.leafFallback(t):o=this.enter(r,e.attrs,e.preserveWhitespace):(i=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(i));var s=this.top;if(r&&r.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((function(t){return a.insertNode(t)}));else{var l=e.contentElement;"string"==typeof l?l=t.querySelector(l):"function"==typeof l&&(l=l(t)),l||(l=t),this.findAround(t,l,!0),this.addAll(l,o)}o&&(this.sync(s),this.open--),i&&this.removePendingMark(i,s)},at.prototype.addAll=function(t,e,n,o){for(var r=n||0,i=n?t.childNodes[n]:t.firstChild,a=null==o?null:t.childNodes[o];i!=a;i=i.nextSibling,++r)this.findAtPoint(t,r),this.addDOM(i),e&&et.hasOwnProperty(i.nodeName.toLowerCase())&&this.sync(e);this.findAtPoint(t,r)},at.prototype.findPlace=function(t){for(var e,n,o=this.open;o>=0;o--){var r=this.nodes[o],i=r.findWrapping(t);if(i&&(!e||e.length>i.length)&&(e=i,n=r,!i.length))break;if(r.solid)break}if(!e)return!1;this.sync(n);for(var a=0;a<e.length;a++)this.enterInner(e[a],null,!1);return!0},at.prototype.insertNode=function(t){if(t.isInline&&this.needsBlock&&!this.top.type){var e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();var n=this.top;n.applyPending(t.type),n.match&&(n.match=n.match.matchType(t.type));for(var o=n.activeMarks,r=0;r<t.marks.length;r++)n.type&&!n.type.allowsMarkType(t.marks[r].type)||(o=t.marks[r].addToSet(o));return n.content.push(t.mark(o)),!0}return!1},at.prototype.enter=function(t,e,n){var o=this.findPlace(t.create(e));return o&&this.enterInner(t,e,!0,n),o},at.prototype.enterInner=function(t,e,n,o){this.closeExtra();var r=this.top;r.applyPending(t),r.match=r.match&&r.match.matchType(t,e);var i=rt(t,o,r.options);4&r.options&&0==r.content.length&&(i|=4),this.nodes.push(new it(t,e,r.activeMarks,r.pendingMarks,n,null,i)),this.open++},at.prototype.closeExtra=function(t){var e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}},at.prototype.finish=function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)},at.prototype.sync=function(t){for(var e=this.open;e>=0;e--)if(this.nodes[e]==t)return void(this.open=e)},st.currentPos.get=function(){this.closeExtra();for(var t=0,e=this.open;e>=0;e--){for(var n=this.nodes[e].content,o=n.length-1;o>=0;o--)t+=n[o].nodeSize;e&&t++}return t},at.prototype.findAtPoint=function(t,e){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)},at.prototype.findInside=function(t){if(this.find)for(var e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)},at.prototype.findAround=function(t,e,n){if(t!=e&&this.find)for(var o=0;o<this.find.length;o++){if(null==this.find[o].pos&&1==t.nodeType&&t.contains(this.find[o].node))e.compareDocumentPosition(this.find[o].node)&(n?2:4)&&(this.find[o].pos=this.currentPos)}},at.prototype.findInText=function(t){if(this.find)for(var e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))},at.prototype.matchesContext=function(t){var e=this;if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);var n=t.split("/"),o=this.options.context,r=!(this.isOpen||o&&o.parent.type!=this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),a=function(t,s){for(;t>=0;t--){var l=n[t];if(""==l){if(t==n.length-1||0==t)continue;for(;s>=i;s--)if(a(t-1,s))return!0;return!1}var c=s>0||0==s&&r?e.nodes[s].type:o&&s>=i?o.node(s-i).type:null;if(!c||c.name!=l&&-1==c.groups.indexOf(l))return!1;s--}return!0};return a(n.length-1,this.open)},at.prototype.textblockFromContext=function(){var t=this.options.context;if(t)for(var e=t.depth;e>=0;e--){var n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var o in this.parser.schema.nodes){var r=this.parser.schema.nodes[o];if(r.isTextblock&&r.defaultAttrs)return r}},at.prototype.addPendingMark=function(t){var e=function(t,e){for(var n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)},at.prototype.removePendingMark=function(t,e){for(var n=this.open;n>=0;n--){var o=this.nodes[n];if(o.pendingMarks.lastIndexOf(t)>-1)o.pendingMarks=t.removeFromSet(o.pendingMarks);else{o.activeMarks=t.removeFromSet(o.activeMarks);var r=o.popFromStashMark(t);r&&o.type&&o.type.allowsMarkType(r.type)&&(o.activeMarks=r.addToSet(o.activeMarks))}if(o==e)break}},Object.defineProperties(at.prototype,st);var ut=function(t,e){this.nodes=t||{},this.marks=e||{}};function pt(t){var e={};for(var n in t){var o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function ft(t){return t.document||window.document}ut.prototype.serializeFragment=function(t,e,n){var o=this;void 0===e&&(e={}),n||(n=ft(e).createDocumentFragment());var r=n,i=null;return t.forEach((function(t){if(i||t.marks.length){i||(i=[]);for(var n=0,a=0;n<i.length&&a<t.marks.length;){var s=t.marks[a];if(o.marks[s.type.name]){if(!s.eq(i[n])||!1===s.type.spec.spanning)break;n+=2,a++}else a++}for(;n<i.length;)r=i.pop(),i.pop();for(;a<t.marks.length;){var l=t.marks[a++],c=o.serializeMark(l,t.isInline,e);c&&(i.push(l,r),r.appendChild(c.dom),r=c.contentDOM||c.dom)}}r.appendChild(o.serializeNodeInner(t,e))})),n},ut.prototype.serializeNodeInner=function(t,e){void 0===e&&(e={});var n=ut.renderSpec(ft(e),this.nodes[t.type.name](t)),o=n.dom,r=n.contentDOM;if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");e.onContent?e.onContent(t,r,e):this.serializeFragment(t.content,e,r)}return o},ut.prototype.serializeNode=function(t,e){void 0===e&&(e={});for(var n=this.serializeNodeInner(t,e),o=t.marks.length-1;o>=0;o--){var r=this.serializeMark(t.marks[o],t.isInline,e);r&&((r.contentDOM||r.dom).appendChild(n),n=r.dom)}return n},ut.prototype.serializeMark=function(t,e,n){void 0===n&&(n={});var o=this.marks[t.type.name];return o&&ut.renderSpec(ft(n),o(t,e))},ut.renderSpec=function(t,e,n){if(void 0===n&&(n=null),"string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;var o=e[0],r=o.indexOf(" ");r>0&&(n=o.slice(0,r),o=o.slice(r+1));var i=null,a=n?t.createElementNS(n,o):t.createElement(o),s=e[1],l=1;if(s&&"object"==typeof s&&null==s.nodeType&&!Array.isArray(s))for(var c in l=2,s)if(null!=s[c]){var d=c.indexOf(" ");d>0?a.setAttributeNS(c.slice(0,d),c.slice(d+1),s[c]):a.setAttribute(c,s[c])}for(var u=l;u<e.length;u++){var p=e[u];if(0===p){if(u<e.length-1||u>l)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}var f=ut.renderSpec(t,p,n),h=f.dom,m=f.contentDOM;if(a.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}return{dom:a,contentDOM:i}},ut.fromSchema=function(t){return t.cached.domSerializer||(t.cached.domSerializer=new ut(this.nodesFromSchema(t),this.marksFromSchema(t)))},ut.nodesFromSchema=function(t){var e=pt(t.nodes);return e.text||(e.text=function(t){return t.text}),e},ut.marksFromSchema=function(t){return pt(t.marks)};var ht=Math.pow(2,16);function mt(t){return 65535&t}var vt=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=null),this.pos=t,this.deleted=e,this.recover=n},gt=function t(e,n){if(void 0===n&&(n=!1),!e.length&&t.empty)return t.empty;this.ranges=e,this.inverted=n};gt.prototype.recover=function(t){var e=0,n=mt(t);if(!this.inverted)for(var o=0;o<n;o++)e+=this.ranges[3*o+2]-this.ranges[3*o+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/ht}(t)},gt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},gt.prototype.map=function(t,e){return void 0===e&&(e=1),this._map(t,e,!0)},gt.prototype._map=function(t,e,n){for(var o=0,r=this.inverted?2:1,i=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?o:0);if(s>t)break;var l=this.ranges[a+r],c=this.ranges[a+i],d=s+l;if(t<=d){var u=s+o+((l?t==s?-1:t==d?1:e:e)<0?0:c);if(n)return u;var p=t==(e<0?s:d)?null:a/3+(t-s)*ht;return new vt(u,e<0?t!=s:t!=d,p)}o+=c-l}return n?t+o:new vt(t+o)},gt.prototype.touches=function(t,e){for(var n=0,o=mt(e),r=this.inverted?2:1,i=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?n:0);if(s>t)break;var l=this.ranges[a+r];if(t<=s+l&&a==3*o)return!0;n+=this.ranges[a+i]-l}return!1},gt.prototype.forEach=function(t){for(var e=this.inverted?2:1,n=this.inverted?1:2,o=0,r=0;o<this.ranges.length;o+=3){var i=this.ranges[o],a=i-(this.inverted?r:0),s=i+(this.inverted?0:r),l=this.ranges[o+e],c=this.ranges[o+n];t(a,a+l,s,s+c),r+=c-l}},gt.prototype.invert=function(){return new gt(this.ranges,!this.inverted)},gt.prototype.toString=function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)},gt.offset=function(t){return 0==t?gt.empty:new gt(t<0?[0,-t,0]:[0,0,t])},gt.empty=new gt([]);var yt=function(t,e,n,o){this.maps=t||[],this.from=n||0,this.to=null==o?this.maps.length:o,this.mirror=e};function bt(t){var e=Error.call(this,t);return e.__proto__=bt.prototype,e}yt.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.maps.length),new yt(this.maps,this.mirror,t,e)},yt.prototype.copy=function(){return new yt(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)},yt.prototype.appendMap=function(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)},yt.prototype.appendMapping=function(t){for(var e=0,n=this.maps.length;e<t.maps.length;e++){var o=t.getMirror(e);this.appendMap(t.maps[e],null!=o&&o<e?n+o:null)}},yt.prototype.getMirror=function(t){if(this.mirror)for(var e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]},yt.prototype.setMirror=function(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)},yt.prototype.appendMappingInverted=function(t){for(var e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){var o=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=o&&o>e?n-o-1:null)}},yt.prototype.invert=function(){var t=new yt;return t.appendMappingInverted(this),t},yt.prototype.map=function(t,e){if(void 0===e&&(e=1),this.mirror)return this._map(t,e,!0);for(var n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t},yt.prototype.mapResult=function(t,e){return void 0===e&&(e=1),this._map(t,e,!1)},yt.prototype._map=function(t,e,n){for(var o=!1,r=this.from;r<this.to;r++){var i=this.maps[r].mapResult(t,e);if(null!=i.recover){var a=this.getMirror(r);if(null!=a&&a>r&&a<this.to){r=a,t=this.maps[a].recover(i.recover);continue}}i.deleted&&(o=!0),t=i.pos}return n?t:new vt(t,o)},bt.prototype=Object.create(Error.prototype),bt.prototype.constructor=bt,bt.prototype.name="TransformError";var wt=function(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new yt},kt={before:{configurable:!0},docChanged:{configurable:!0}};function _t(){throw new Error("Override me")}kt.before.get=function(){return this.docs.length?this.docs[0]:this.doc},wt.prototype.step=function(t){var e=this.maybeStep(t);if(e.failed)throw new bt(e.failed);return this},wt.prototype.maybeStep=function(t){var e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e},kt.docChanged.get=function(){return this.steps.length>0},wt.prototype.addStep=function(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e},Object.defineProperties(wt.prototype,kt);var Ct=Object.create(null),xt=function(){};xt.prototype.apply=function(t){return _t()},xt.prototype.getMap=function(){return gt.empty},xt.prototype.invert=function(t){return _t()},xt.prototype.map=function(t){return _t()},xt.prototype.merge=function(t){return null},xt.prototype.toJSON=function(){return _t()},xt.fromJSON=function(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=Ct[e.stepType];if(!n)throw new RangeError("No step type "+e.stepType+" defined");return n.fromJSON(t,e)},xt.jsonID=function(t,e){if(t in Ct)throw new RangeError("Duplicate use of step JSON ID "+t);return Ct[t]=e,e.prototype.jsonID=t,e};var St=function(t,e){this.doc=t,this.failed=e};St.ok=function(t){return new St(t,null)},St.fail=function(t){return new St(null,t)},St.fromReplace=function(t,e,n,o){try{return St.ok(t.replace(e,n,o))}catch(t){if(t instanceof u)return St.fail(t.message);throw t}};var Et=function(t){function e(e,n,o,r){t.call(this),this.from=e,this.to=n,this.slice=o,this.structure=!!r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){return this.structure&&Mt(t,this.from,this.to)?St.fail("Structure replace would overwrite content"):St.fromReplace(t,this.from,this.to,this.slice)},e.prototype.getMap=function(){return new gt([this.from,this.to-this.from,this.slice.size])},e.prototype.invert=function(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))},e.prototype.map=function(t){var n=t.mapResult(this.from,1),o=t.mapResult(this.to,-1);return n.deleted&&o.deleted?null:new e(n.pos,Math.max(n.pos,o.pos),this.slice)},e.prototype.merge=function(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;var n=this.slice.size+t.slice.size==0?p.empty:new p(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}var o=this.slice.size+t.slice.size==0?p.empty:new p(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),o,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,p.fromJSON(t,n.slice),!!n.structure)},e}(xt);xt.jsonID("replace",Et);var Tt=function(t){function e(e,n,o,r,i,a,s){t.call(this),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=a,this.structure=!!s}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){if(this.structure&&(Mt(t,this.from,this.gapFrom)||Mt(t,this.gapTo,this.to)))return St.fail("Structure gap-replace would overwrite content");var e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return St.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,e.content);return n?St.fromReplace(t,this.from,this.to,n):St.fail("Content does not fit in gap")},e.prototype.getMap=function(){return new gt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])},e.prototype.invert=function(t){var n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),o=t.mapResult(this.to,-1),r=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return n.deleted&&o.deleted||r<n.pos||i>o.pos?null:new e(n.pos,o.pos,r,i,this.slice,this.insert,this.structure)},e.prototype.toJSON=function(){var t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,p.fromJSON(t,n.slice),n.insert,!!n.structure)},e}(xt);function Mt(t,e,n){for(var o=t.resolve(e),r=n-e,i=o.depth;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0)for(var a=o.node(i).maybeChild(o.indexAfter(i));r>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,r--}return!1}function Dt(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ot(t){for(var e=t.parent.content.cutByIndex(t.startIndex,t.endIndex),n=t.depth;;--n){var o=t.$from.node(n),r=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&o.canReplace(r,i,e))return n;if(0==n||o.type.spec.isolating||!Dt(o,r,i))break}}function At(t,e,n,o){void 0===o&&(o=t);var r=function(t,e){var n=t.parent,o=t.startIndex,r=t.endIndex,i=n.contentMatchAt(o).findWrapping(e);if(!i)return null;var a=i.length?i[0]:e;return n.canReplaceWith(o,r,a)?i:null}(t,e),i=r&&function(t,e){var n=t.parent,o=t.startIndex,r=t.endIndex,i=n.child(o),a=e.contentMatch.findWrapping(i.type);if(!a)return null;for(var s=(a.length?a[a.length-1]:e).contentMatch,l=o;s&&l<r;l++)s=s.matchType(n.child(l).type);if(!s||!s.validEnd)return null;return a}(o,e);return i?r.map(It).concat({type:e,attrs:n}).concat(i.map(It)):null}function It(t){return{type:t,attrs:null}}function Bt(t,e,n,o){void 0===n&&(n=1);var r=t.resolve(e),i=r.depth-n,a=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!a.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(var s=r.depth-1,l=n-2;s>i;s--,l--){var c=r.node(s),d=r.index(s);if(c.type.spec.isolating)return!1;var u=c.content.cutByIndex(d,c.childCount),p=o&&o[l]||c;if(p!=c&&(u=u.replaceChild(0,p.type.create(p.attrs))),!c.canReplace(d+1,c.childCount)||!p.type.validContent(u))return!1}var f=r.indexAfter(i),h=o&&o[0];return r.node(i).canReplaceWith(f,f,h?h.type:r.node(i+1).type)}function Nt(t,e){var n=t.resolve(e),o=n.index();return zt(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function zt(t,e){return t&&e&&!t.isLeaf&&t.canAppend(e)}function Rt(t,e,n){void 0===n&&(n=-1);for(var o=t.resolve(e),r=o.depth;;r--){var i=void 0,a=void 0,s=o.index(r);if(r==o.depth?(i=o.nodeBefore,a=o.nodeAfter):n>0?(i=o.node(r+1),s++,a=o.node(r).maybeChild(s)):(i=o.node(r).maybeChild(s-1),a=o.node(r+1)),i&&!i.isTextblock&&zt(i,a)&&o.node(r).canReplace(s,s+1))return e;if(0==r)break;e=n<0?o.before(r):o.after(r)}}function Pt(t,e,n){var o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(0==o.parentOffset)for(var r=o.depth-1;r>=0;r--){var i=o.index(r);if(o.node(r).canReplaceWith(i,i,n))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(var a=o.depth-1;a>=0;a--){var s=o.indexAfter(a);if(o.node(a).canReplaceWith(s,s,n))return o.after(a+1);if(s<o.node(a).childCount)return null}}function Lt(t,e,n){var o=t.resolve(e);if(!n.content.size)return e;for(var r=n.content,i=0;i<n.openStart;i++)r=r.firstChild.content;for(var a=1;a<=(0==n.openStart&&n.size?2:1);a++)for(var s=o.depth;s>=0;s--){var l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,c=o.index(s)+(l>0?1:0),d=o.node(s),u=!1;if(1==a)u=d.canReplace(c,c,r);else{var p=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=p&&d.canReplaceWith(c,c,p[0])}if(u)return 0==l?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function Ft(t,e,n){for(var o=[],r=0;r<t.childCount;r++){var a=t.child(r);a.content.size&&(a=a.copy(Ft(a.content,e,a))),a.isInline&&(a=e(a,n,r)),o.push(a)}return i.fromArray(o)}xt.jsonID("replaceAround",Tt),wt.prototype.lift=function(t,e){for(var n=t.$from,o=t.$to,r=t.depth,a=n.before(r+1),s=o.after(r+1),l=a,c=s,d=i.empty,u=0,f=r,h=!1;f>e;f--)h||n.index(f)>0?(h=!0,d=i.from(n.node(f).copy(d)),u++):l--;for(var m=i.empty,v=0,g=r,y=!1;g>e;g--)y||o.after(g+1)<o.end(g)?(y=!0,m=i.from(o.node(g).copy(m)),v++):c++;return this.step(new Tt(l,c,a,s,new p(d.append(m),u,v),d.size-u,!0))},wt.prototype.wrap=function(t,e){for(var n=i.empty,o=e.length-1;o>=0;o--){if(n.size){var r=e[o].type.contentMatch.matchFragment(n);if(!r||!r.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=i.from(e[o].type.create(e[o].attrs,n))}var a=t.start,s=t.end;return this.step(new Tt(a,s,a,s,new p(n,0,0),e.length,!0))},wt.prototype.setBlockType=function(t,e,n,o){var r=this;if(void 0===e&&(e=t),!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var a=this.steps.length;return this.doc.nodesBetween(t,e,(function(t,e){if(t.isTextblock&&!t.hasMarkup(n,o)&&function(t,e,n){var o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}(r.doc,r.mapping.slice(a).map(e),n)){r.clearIncompatible(r.mapping.slice(a).map(e,1),n);var s=r.mapping.slice(a),l=s.map(e,1),c=s.map(e+t.nodeSize,1);return r.step(new Tt(l,c,l+1,c-1,new p(i.from(n.create(o,null,t.marks)),0,0),1,!0)),!1}})),this},wt.prototype.setNodeMarkup=function(t,e,n,o){var r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at given position");e||(e=r.type);var a=e.create(n,null,o||r.marks);if(r.isLeaf)return this.replaceWith(t,t+r.nodeSize,a);if(!e.validContent(r.content))throw new RangeError("Invalid content for node type "+e.name);return this.step(new Tt(t,t+r.nodeSize,t+1,t+r.nodeSize-1,new p(i.from(a),0,0),1,!0))},wt.prototype.split=function(t,e,n){void 0===e&&(e=1);for(var o=this.doc.resolve(t),r=i.empty,a=i.empty,s=o.depth,l=o.depth-e,c=e-1;s>l;s--,c--){r=i.from(o.node(s).copy(r));var d=n&&n[c];a=i.from(d?d.type.create(d.attrs,a):o.node(s).copy(a))}return this.step(new Et(t,t,new p(r.append(a),e,e),!0))},wt.prototype.join=function(t,e){void 0===e&&(e=1);var n=new Et(t-e,t+e,p.empty,!0);return this.step(n)};var $t=function(t){function e(e,n,o){t.call(this),this.from=e,this.to=n,this.mark=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),o=t.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new p(Ft(n.content,(function(t,n){return t.isAtom&&n.type.allowsMarkType(e.mark.type)?t.mark(e.mark.addToSet(t.marks)):t}),r),n.openStart,n.openEnd);return St.fromReplace(t,this.from,this.to,i)},e.prototype.invert=function(){return new Vt(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),o=t.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new e(n.pos,o.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(xt);xt.jsonID("addMark",$t);var Vt=function(t){function e(e,n,o){t.call(this),this.from=e,this.to=n,this.mark=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.apply=function(t){var e=this,n=t.slice(this.from,this.to),o=new p(Ft(n.content,(function(t){return t.mark(e.mark.removeFromSet(t.marks))})),n.openStart,n.openEnd);return St.fromReplace(t,this.from,this.to,o)},e.prototype.invert=function(){return new $t(this.from,this.to,this.mark)},e.prototype.map=function(t){var n=t.mapResult(this.from,1),o=t.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new e(n.pos,o.pos,this.mark)},e.prototype.merge=function(t){if(t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark)},e.prototype.toJSON=function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}},e.fromJSON=function(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))},e}(xt);function jt(t,e,n,o){if(void 0===n&&(n=e),void 0===o&&(o=p.empty),e==n&&!o.size)return null;var r=t.resolve(e),i=t.resolve(n);return Wt(r,i,o)?new Et(e,n,o):new Ht(r,i,o).fit()}function Wt(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}xt.jsonID("removeMark",Vt),wt.prototype.addMark=function(t,e,n){var o=this,r=[],i=[],a=null,s=null;return this.doc.nodesBetween(t,e,(function(o,l,c){if(o.isInline){var d=o.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){for(var u=Math.max(l,t),p=Math.min(l+o.nodeSize,e),f=n.addToSet(d),h=0;h<d.length;h++)d[h].isInSet(f)||(a&&a.to==u&&a.mark.eq(d[h])?a.to=p:r.push(a=new Vt(u,p,d[h])));s&&s.to==u?s.to=p:i.push(s=new $t(u,p,n))}}})),r.forEach((function(t){return o.step(t)})),i.forEach((function(t){return o.step(t)})),this},wt.prototype.removeMark=function(t,e,n){var o=this;void 0===n&&(n=null);var r=[],i=0;return this.doc.nodesBetween(t,e,(function(o,a){if(o.isInline){i++;var s=null;if(n instanceof Y)for(var l,c=o.marks;l=n.isInSet(c);)(s||(s=[])).push(l),c=l.removeFromSet(c);else n?n.isInSet(o.marks)&&(s=[n]):s=o.marks;if(s&&s.length)for(var d=Math.min(a+o.nodeSize,e),u=0;u<s.length;u++){for(var p=s[u],f=void 0,h=0;h<r.length;h++){var m=r[h];m.step==i-1&&p.eq(r[h].style)&&(f=m)}f?(f.to=d,f.step=i):r.push({style:p,from:Math.max(a,t),to:d,step:i})}}})),r.forEach((function(t){return o.step(new Vt(t.from,t.to,t.style))})),this},wt.prototype.clearIncompatible=function(t,e,n){void 0===n&&(n=e.contentMatch);for(var o=this.doc.nodeAt(t),r=[],a=t+1,s=0;s<o.childCount;s++){var l=o.child(s),c=a+l.nodeSize,d=n.matchType(l.type,l.attrs);if(d){n=d;for(var u=0;u<l.marks.length;u++)e.allowsMarkType(l.marks[u].type)||this.step(new Vt(a,c,l.marks[u]))}else r.push(new Et(a,c,p.empty));a=c}if(!n.validEnd){var f=n.fillBefore(i.empty,!0);this.replace(a,a,new p(f,0,0))}for(var h=r.length-1;h>=0;h--)this.step(r[h]);return this},wt.prototype.replace=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=p.empty);var o=jt(this.doc,t,e,n);return o&&this.step(o),this},wt.prototype.replaceWith=function(t,e,n){return this.replace(t,e,new p(i.from(n),0,0))},wt.prototype.delete=function(t,e){return this.replace(t,e,p.empty)},wt.prototype.insert=function(t,e){return this.replaceWith(t,t,e)};var Ht=function(t,e,n){this.$to=e,this.$from=t,this.unplaced=n,this.frontier=[];for(var o=0;o<=t.depth;o++){var r=t.node(o);this.frontier.push({type:r.type,match:r.contentMatchAt(t.indexAfter(o))})}this.placed=i.empty;for(var a=t.depth;a>0;a--)this.placed=i.from(t.node(a).copy(this.placed))},qt={depth:{configurable:!0}};function Jt(t,e,n){return 0==e?t.cutByIndex(n):t.replaceChild(0,t.firstChild.copy(Jt(t.firstChild.content,e-1,n)))}function Kt(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Kt(t.lastChild.content,e-1,n)))}function Ut(t,e){for(var n=0;n<e;n++)t=t.firstChild.content;return t}function Gt(t,e,n){if(e<=0)return t;var o=t.content;return e>1&&(o=o.replaceChild(0,Gt(o.firstChild,e-1,1==o.childCount?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(i.empty,!0)))),t.copy(o)}function Xt(t,e,n,o,r){var i=t.node(e),a=r?t.indexAfter(e):t.index(e);if(a==i.childCount&&!n.compatibleContent(i.type))return null;var s=o.fillBefore(i.content,!0,a);return s&&!function(t,e,n){for(var o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}(n,i.content,a)?s:null}function Yt(t,e,n,o,r){if(e<n){var a=t.firstChild;t=t.replaceChild(0,a.copy(Yt(a.content,e+1,n,o,a)))}if(e>o){var s=r.contentMatchAt(0),l=s.fillBefore(t).append(t);t=l.append(s.matchFragment(l).fillBefore(i.empty,!0))}return t}function Zt(t,e){for(var n=[],o=Math.min(t.depth,e.depth);o>=0;o--){var r=t.start(o);if(r<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(r==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==r-1)&&n.push(o)}return n}qt.depth.get=function(){return this.frontier.length-1},Ht.prototype.fit=function(){for(;this.unplaced.size;){var t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}var e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;for(var i=this.placed,a=o.depth,s=r.depth;a&&s&&1==i.childCount;)i=i.firstChild.content,a--,s--;var l=new p(i,a,s);return e>-1?new Tt(o.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||o.pos!=this.$to.pos?new Et(o.pos,r.pos,l):void 0},Ht.prototype.findFittable=function(){for(var t=1;t<=2;t++)for(var e=this.unplaced.openStart;e>=0;e--)for(var n=void 0,o=(e?(n=Ut(this.unplaced.content,e-1).firstChild).content:this.unplaced.content).firstChild,r=this.depth;r>=0;r--){var a=this.frontier[r],s=a.type,l=a.match,c=void 0,d=void 0;if(1==t&&(o?l.matchType(o.type)||(d=l.fillBefore(i.from(o),!1)):s.compatibleContent(n.type)))return{sliceDepth:e,frontierDepth:r,parent:n,inject:d};if(2==t&&o&&(c=l.findWrapping(o.type)))return{sliceDepth:e,frontierDepth:r,parent:n,wrap:c};if(n&&l.matchType(n.type))break}},Ht.prototype.openMore=function(){var t=this.unplaced,e=t.content,n=t.openStart,o=t.openEnd,r=Ut(e,n);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new p(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)},Ht.prototype.dropNode=function(){var t=this.unplaced,e=t.content,n=t.openStart,o=t.openEnd,r=Ut(e,n);if(r.childCount<=1&&n>0){var i=e.size-n<=n+r.size;this.unplaced=new p(Jt(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new p(Jt(e,n,1),n,o)},Ht.prototype.placeNodes=function(t){for(var e=t.sliceDepth,n=t.frontierDepth,o=t.parent,r=t.inject,a=t.wrap;this.depth>n;)this.closeFrontierNode();if(a)for(var s=0;s<a.length;s++)this.openFrontierNode(a[s]);var l=this.unplaced,c=o?o.content:l.content,d=l.openStart-e,u=0,f=[],h=this.frontier[n],m=h.match,v=h.type;if(r){for(var g=0;g<r.childCount;g++)f.push(r.child(g));m=m.matchFragment(r)}for(var y=c.size+e-(l.content.size-l.openEnd);u<c.childCount;){var b=c.child(u),w=m.matchType(b.type);if(!w)break;(++u>1||0==d||b.content.size)&&(m=w,f.push(Gt(b.mark(v.allowedMarks(b.marks)),1==u?d:0,u==c.childCount?y:-1)))}var k=u==c.childCount;k||(y=-1),this.placed=Kt(this.placed,n,i.from(f)),this.frontier[n].match=m,k&&y<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var _=0,C=c;_<y;_++){var x=C.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),C=x.content}this.unplaced=k?0==e?p.empty:new p(Jt(l.content,e-1,1),e-1,y<0?l.openEnd:e-1):new p(Jt(l.content,e,u),l.openStart,l.openEnd)},Ht.prototype.mustMoveInline=function(){if(!this.$to.parent.isTextblock||this.$to.end()==this.$to.pos)return-1;var t,e=this.frontier[this.depth];if(!e.type.isTextblock||!Xt(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;for(var n=this.$to.depth,o=this.$to.after(n);n>1&&o==this.$to.end(--n);)++o;return o},Ht.prototype.findCloseLevel=function(t){t:for(var e=Math.min(this.depth,t.depth);e>=0;e--){var n=this.frontier[e],o=n.match,r=n.type,i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),a=Xt(t,e,r,o,i);if(a){for(var s=e-1;s>=0;s--){var l=this.frontier[s],c=l.match,d=Xt(t,s,l.type,c,!0);if(!d||d.childCount)continue t}return{depth:e,fit:a,move:i?t.doc.resolve(t.after(e+1)):t}}}},Ht.prototype.close=function(t){var e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Kt(this.placed,e.depth,e.fit)),t=e.move;for(var n=e.depth+1;n<=t.depth;n++){var o=t.node(n),r=o.type.contentMatch.fillBefore(o.content,!0,t.index(n));this.openFrontierNode(o.type,o.attrs,r)}return t},Ht.prototype.openFrontierNode=function(t,e,n){var o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=Kt(this.placed,this.depth,i.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})},Ht.prototype.closeFrontierNode=function(){var t=this.frontier.pop().match.fillBefore(i.empty,!0);t.childCount&&(this.placed=Kt(this.placed,this.frontier.length,t))},Object.defineProperties(Ht.prototype,qt),wt.prototype.replaceRange=function(t,e,n){if(!n.size)return this.deleteRange(t,e);var o=this.doc.resolve(t),r=this.doc.resolve(e);if(Wt(o,r,n))return this.step(new Et(t,e,n));var i=Zt(o,this.doc.resolve(e));0==i[i.length-1]&&i.pop();var a=-(o.depth+1);i.unshift(a);for(var s=o.depth,l=o.pos-1;s>0;s--,l--){var c=o.node(s).type.spec;if(c.defining||c.isolating)break;i.indexOf(s)>-1?a=s:o.before(s)==l&&i.splice(1,0,-s)}for(var d=i.indexOf(a),u=[],f=n.openStart,h=n.content,m=0;;m++){var v=h.firstChild;if(u.push(v),m==n.openStart)break;h=v.content}f>0&&u[f-1].type.spec.defining&&o.node(d).type!=u[f-1].type?f-=1:f>=2&&u[f-1].isTextblock&&u[f-2].type.spec.defining&&o.node(d).type!=u[f-2].type&&(f-=2);for(var g=n.openStart;g>=0;g--){var y=(g+f+1)%(n.openStart+1),b=u[y];if(b)for(var w=0;w<i.length;w++){var k=i[(w+d)%i.length],_=!0;k<0&&(_=!1,k=-k);var C=o.node(k-1),x=o.index(k-1);if(C.canReplaceWith(x,x,b.type,b.marks))return this.replace(o.before(k),_?r.after(k):e,new p(Yt(n.content,0,n.openStart,y),y,n.openEnd))}}for(var S=this.steps.length,E=i.length-1;E>=0&&(this.replace(t,e,n),!(this.steps.length>S));E--){var T=i[E];T<0||(t=o.before(T),e=r.after(T))}return this},wt.prototype.replaceRangeWith=function(t,e,n){if(!n.isInline&&t==e&&this.doc.resolve(t).parent.content.size){var o=Pt(this.doc,t,n.type);null!=o&&(t=e=o)}return this.replaceRange(t,e,new p(i.from(n),0,0))},wt.prototype.deleteRange=function(t,e){for(var n=this.doc.resolve(t),o=this.doc.resolve(e),r=Zt(n,o),i=0;i<r.length;i++){var a=r[i],s=i==r.length-1;if(s&&0==a||n.node(a).type.contentMatch.validEnd)return this.delete(n.start(a),o.end(a));if(a>0&&(s||n.node(a-1).canReplace(n.index(a-1),o.indexAfter(a-1))))return this.delete(n.before(a),o.after(a))}for(var l=1;l<=n.depth&&l<=o.depth;l++)if(t-n.start(l)==n.depth-l&&e>n.end(l)&&o.end(l)-e!=o.depth-l)return this.delete(n.before(l),e);return this.delete(t,e)};var Qt=Object.create(null),te=function(t,e,n){this.ranges=n||[new ne(t.min(e),t.max(e))],this.$anchor=t,this.$head=e},ee={anchor:{configurable:!0},head:{configurable:!0},from:{configurable:!0},to:{configurable:!0},$from:{configurable:!0},$to:{configurable:!0},empty:{configurable:!0}};ee.anchor.get=function(){return this.$anchor.pos},ee.head.get=function(){return this.$head.pos},ee.from.get=function(){return this.$from.pos},ee.to.get=function(){return this.$to.pos},ee.$from.get=function(){return this.ranges[0].$from},ee.$to.get=function(){return this.ranges[0].$to},ee.empty.get=function(){for(var t=this.ranges,e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0},te.prototype.content=function(){return this.$from.node(0).slice(this.from,this.to,!0)},te.prototype.replace=function(t,e){void 0===e&&(e=p.empty);for(var n=e.content.lastChild,o=null,r=0;r<e.openEnd;r++)o=n,n=n.lastChild;for(var i=t.steps.length,a=this.ranges,s=0;s<a.length;s++){var l=a[s],c=l.$from,d=l.$to,u=t.mapping.slice(i);t.replaceRange(u.map(c.pos),u.map(d.pos),s?p.empty:e),0==s&&de(t,i,(n?n.isInline:o&&o.isTextblock)?-1:1)}},te.prototype.replaceWith=function(t,e){for(var n=t.steps.length,o=this.ranges,r=0;r<o.length;r++){var i=o[r],a=i.$from,s=i.$to,l=t.mapping.slice(n),c=l.map(a.pos),d=l.map(s.pos);r?t.deleteRange(c,d):(t.replaceRangeWith(c,d,e),de(t,n,e.isInline?-1:1))}},te.findFrom=function(t,e,n){var o=t.parent.inlineContent?new oe(t):ce(t.node(0),t.parent,t.pos,t.index(),e,n);if(o)return o;for(var r=t.depth-1;r>=0;r--){var i=e<0?ce(t.node(0),t.node(r),t.before(r+1),t.index(r),e,n):ce(t.node(0),t.node(r),t.after(r+1),t.index(r)+1,e,n);if(i)return i}},te.near=function(t,e){return void 0===e&&(e=1),this.findFrom(t,e)||this.findFrom(t,-e)||new se(t.node(0))},te.atStart=function(t){return ce(t,t,0,0,1)||new se(t)},te.atEnd=function(t){return ce(t,t,t.content.size,t.childCount,-1)||new se(t)},te.fromJSON=function(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Qt[e.type];if(!n)throw new RangeError("No selection type "+e.type+" defined");return n.fromJSON(t,e)},te.jsonID=function(t,e){if(t in Qt)throw new RangeError("Duplicate use of selection JSON ID "+t);return Qt[t]=e,e.prototype.jsonID=t,e},te.prototype.getBookmark=function(){return oe.between(this.$anchor,this.$head).getBookmark()},Object.defineProperties(te.prototype,ee),te.prototype.visible=!0;var ne=function(t,e){this.$from=t,this.$to=e},oe=function(t){function e(e,n){void 0===n&&(n=e),t.call(this,e,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={$cursor:{configurable:!0}};return n.$cursor.get=function(){return this.$anchor.pos==this.$head.pos?this.$head:null},e.prototype.map=function(n,o){var r=n.resolve(o.map(this.head));if(!r.parent.inlineContent)return t.near(r);var i=n.resolve(o.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)},e.prototype.replace=function(e,n){if(void 0===n&&(n=p.empty),t.prototype.replace.call(this,e,n),n==p.empty){var o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head},e.prototype.getBookmark=function(){return new re(this.anchor,this.head)},e.prototype.toJSON=function(){return{type:"text",anchor:this.anchor,head:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,e,n){void 0===n&&(n=e);var o=t.resolve(e);return new this(o,n==e?o:t.resolve(n))},e.between=function(n,o,r){var i=n.pos-o.pos;if(r&&!i||(r=i>=0?1:-1),!o.parent.inlineContent){var a=t.findFrom(o,r,!0)||t.findFrom(o,-r,!0);if(!a)return t.near(o,r);o=a.$head}return n.parent.inlineContent||(0==i||(n=(t.findFrom(n,-r,!0)||t.findFrom(n,r,!0)).$anchor).pos<o.pos!=i<0)&&(n=o),new e(n,o)},Object.defineProperties(e.prototype,n),e}(te);te.jsonID("text",oe);var re=function(t,e){this.anchor=t,this.head=e};re.prototype.map=function(t){return new re(t.map(this.anchor),t.map(this.head))},re.prototype.resolve=function(t){return oe.between(t.resolve(this.anchor),t.resolve(this.head))};var ie=function(t){function e(e){var n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);t.call(this,e,o),this.node=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,o){var r=o.mapResult(this.anchor),i=r.deleted,a=r.pos,s=n.resolve(a);return i?t.near(s):new e(s)},e.prototype.content=function(){return new p(i.from(this.node),0,0)},e.prototype.eq=function(t){return t instanceof e&&t.anchor==this.anchor},e.prototype.toJSON=function(){return{type:"node",anchor:this.anchor}},e.prototype.getBookmark=function(){return new ae(this.anchor)},e.fromJSON=function(t,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new e(t.resolve(n.anchor))},e.create=function(t,e){return new this(t.resolve(e))},e.isSelectable=function(t){return!t.isText&&!1!==t.type.spec.selectable},e}(te);ie.prototype.visible=!1,te.jsonID("node",ie);var ae=function(t){this.anchor=t};ae.prototype.map=function(t){var e=t.mapResult(this.anchor),n=e.deleted,o=e.pos;return n?new re(o,o):new ae(o)},ae.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=e.nodeAfter;return n&&ie.isSelectable(n)?new ie(e):te.near(e)};var se=function(t){function e(e){t.call(this,e.resolve(0),e.resolve(e.content.size))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.replace=function(e,n){if(void 0===n&&(n=p.empty),n==p.empty){e.delete(0,e.doc.content.size);var o=t.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else t.prototype.replace.call(this,e,n)},e.prototype.toJSON=function(){return{type:"all"}},e.fromJSON=function(t){return new e(t)},e.prototype.map=function(t){return new e(t)},e.prototype.eq=function(t){return t instanceof e},e.prototype.getBookmark=function(){return le},e}(te);te.jsonID("all",se);var le={map:function(){return this},resolve:function(t){return new se(t)}};function ce(t,e,n,o,r,i){if(e.inlineContent)return oe.create(t,n);for(var a=o-(r>0?0:1);r>0?a<e.childCount:a>=0;a+=r){var s=e.child(a);if(s.isAtom){if(!i&&ie.isSelectable(s))return ie.create(t,n-(r<0?s.nodeSize:0))}else{var l=ce(t,s,n+r,r<0?s.childCount:0,r,i);if(l)return l}n+=s.nodeSize*r}}function de(t,e,n){var o=t.steps.length-1;if(!(o<e)){var r,i=t.steps[o];if(i instanceof Et||i instanceof Tt)t.mapping.maps[o].forEach((function(t,e,n,o){null==r&&(r=o)})),t.setSelection(te.near(t.doc.resolve(r),n))}}var ue=function(t){function e(e){t.call(this,e.doc),this.time=Date.now(),this.curSelection=e.selection,this.curSelectionFor=0,this.storedMarks=e.storedMarks,this.updated=0,this.meta=Object.create(null)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={selection:{configurable:!0},selectionSet:{configurable:!0},storedMarksSet:{configurable:!0},isGeneric:{configurable:!0},scrolledIntoView:{configurable:!0}};return n.selection.get=function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection},e.prototype.setSelection=function(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this},n.selectionSet.get=function(){return(1&this.updated)>0},e.prototype.setStoredMarks=function(t){return this.storedMarks=t,this.updated|=2,this},e.prototype.ensureMarks=function(t){return d.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this},e.prototype.addStoredMark=function(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))},e.prototype.removeStoredMark=function(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))},n.storedMarksSet.get=function(){return(2&this.updated)>0},e.prototype.addStep=function(e,n){t.prototype.addStep.call(this,e,n),this.updated=-3&this.updated,this.storedMarks=null},e.prototype.setTime=function(t){return this.time=t,this},e.prototype.replaceSelection=function(t){return this.selection.replace(this,t),this},e.prototype.replaceSelectionWith=function(t,e){var n=this.selection;return!1!==e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||d.none))),n.replaceWith(this,t),this},e.prototype.deleteSelection=function(){return this.selection.replace(this),this},e.prototype.insertText=function(t,e,n){void 0===n&&(n=e);var o=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(o.text(t),!0):this.deleteSelection();if(!t)return this.deleteRange(e,n);var r=this.storedMarks;if(!r){var i=this.doc.resolve(e);r=n==e?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,o.text(t,r)),this.selection.empty||this.setSelection(te.near(this.selection.$to)),this},e.prototype.setMeta=function(t,e){return this.meta["string"==typeof t?t:t.key]=e,this},e.prototype.getMeta=function(t){return this.meta["string"==typeof t?t:t.key]},n.isGeneric.get=function(){for(var t in this.meta)return!1;return!0},e.prototype.scrollIntoView=function(){return this.updated|=4,this},n.scrolledIntoView.get=function(){return(4&this.updated)>0},Object.defineProperties(e.prototype,n),e}(wt);function pe(t,e){return e&&t?t.bind(e):t}var fe=function(t,e,n){this.name=t,this.init=pe(e.init,n),this.apply=pe(e.apply,n)},he=[new fe("doc",{init:function(t){return t.doc||t.schema.topNodeType.createAndFill()},apply:function(t){return t.doc}}),new fe("selection",{init:function(t,e){return t.selection||te.atStart(e.doc)},apply:function(t){return t.selection}}),new fe("storedMarks",{init:function(t){return t.storedMarks||null},apply:function(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new fe("scrollToSelection",{init:function(){return 0},apply:function(t,e){return t.scrolledIntoView?e+1:e}})],me=function(t,e){var n=this;this.schema=t,this.fields=he.concat(),this.plugins=[],this.pluginsByKey=Object.create(null),e&&e.forEach((function(t){if(n.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");n.plugins.push(t),n.pluginsByKey[t.key]=t,t.spec.state&&n.fields.push(new fe(t.key,t.spec.state,t))}))},ve=function(t){this.config=t},ge={schema:{configurable:!0},plugins:{configurable:!0},tr:{configurable:!0}};ge.schema.get=function(){return this.config.schema},ge.plugins.get=function(){return this.config.plugins},ve.prototype.apply=function(t){return this.applyTransaction(t).state},ve.prototype.filterTransaction=function(t,e){void 0===e&&(e=-1);for(var n=0;n<this.config.plugins.length;n++)if(n!=e){var o=this.config.plugins[n];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,t,this))return!1}return!0},ve.prototype.applyTransaction=function(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};for(var e=[t],n=this.applyInner(t),o=null;;){for(var r=!1,i=0;i<this.config.plugins.length;i++){var a=this.config.plugins[i];if(a.spec.appendTransaction){var s=o?o[i].n:0,l=o?o[i].state:this,c=s<e.length&&a.spec.appendTransaction.call(a,s?e.slice(s):e,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",t),!o){o=[];for(var d=0;d<this.config.plugins.length;d++)o.push(d<i?{state:n,n:e.length}:{state:this,n:0})}e.push(c),n=n.applyInner(c),r=!0}o&&(o[i]={state:n,n:e.length})}}if(!r)return{state:n,transactions:e}}},ve.prototype.applyInner=function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var e=new ve(this.config),n=this.config.fields,o=0;o<n.length;o++){var r=n[o];e[r.name]=r.apply(t,this[r.name],this,e)}for(var i=0;i<ye.length;i++)ye[i](this,t,e);return e},ge.tr.get=function(){return new ue(this)},ve.create=function(t){for(var e=new me(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new ve(e),o=0;o<e.fields.length;o++)n[e.fields[o].name]=e.fields[o].init(t,n);return n},ve.prototype.reconfigure=function(t){for(var e=new me(this.schema,t.plugins),n=e.fields,o=new ve(e),r=0;r<n.length;r++){var i=n[r].name;o[i]=this.hasOwnProperty(i)?this[i]:n[r].init(t,o)}return o},ve.prototype.toJSON=function(t){var e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((function(t){return t.toJSON()}))),t&&"object"==typeof t)for(var n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var o=t[n],r=o.spec.state;r&&r.toJSON&&(e[n]=r.toJSON.call(o,this[o.key]))}return e},ve.fromJSON=function(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var o=new me(t.schema,t.plugins),r=new ve(o);return o.fields.forEach((function(o){if("doc"==o.name)r.doc=D.fromJSON(t.schema,e.doc);else if("selection"==o.name)r.selection=te.fromJSON(r.doc,e.selection);else if("storedMarks"==o.name)e.storedMarks&&(r.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(var i in n){var a=n[i],s=a.spec.state;if(a.key==o.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(e,i))return void(r[o.name]=s.fromJSON.call(a,t,e[i],r))}r[o.name]=o.init(t,r)}})),r},ve.addApplyListener=function(t){ye.push(t)},ve.removeApplyListener=function(t){var e=ye.indexOf(t);e>-1&&ye.splice(e,1)},Object.defineProperties(ve.prototype,ge);var ye=[];var be=function(t){this.props={},t.props&&function t(e,n,o){for(var r in e){var i=e[r];i instanceof Function?i=i.bind(n):"handleDOMEvents"==r&&(i=t(i,n,{})),o[r]=i}return o}(t.props,this,this.props),this.spec=t,this.key=t.key?t.key.key:ke("plugin")};be.prototype.getState=function(t){return t[this.key]};var we=Object.create(null);function ke(t){return t in we?t+"$"+ ++we[t]:(we[t]=0,t+"$")}var _e=function(t){void 0===t&&(t="key"),this.key=ke(t)};_e.prototype.get=function(t){return t.config.pluginsByKey[this.key]},_e.prototype.getState=function(t){return t[this.key]};var Ce="k-parent-node",xe=["div","ol","ul","li","table","tbody","thead","tfoot","td","th","p","tr","col","colgroup","article","main","nav","header","footer","aside","section"],Se=function(t,e){var n=(t.ownerDocument||document).createElement(e);Array.from(t.rows).filter((function(t){return t.getAttribute(Ce)===e})).forEach((function(t){t.removeAttribute(Ce),n.appendChild(t)})),n.children.length&&t.appendChild(n)},Ee=function(t,e){var n=e.toUpperCase();t.filter((function(t){return t.nodeName===n})).forEach((function(t){Array.from(t.children).forEach((function(n){n.setAttribute(Ce,e),t.parentNode&&t.parentNode.insertBefore(n,t)})),t.remove()}))},Te=function(t,e){void 0===e&&(e=xe);var n=e.join("|");return t.replace(new RegExp("\\s*(<(?:"+n+")(?:\\s[^>]*?)?>)","g"),"$1").replace(new RegExp("(<\\/(?:"+n+")(?:\\s[^>]*?)?>)\\s*","g"),"$1")},Me=function(t){var e,n=document.createElement("template");if("content"in n)n.innerHTML=t,e=n.content;else{var o=(new DOMParser).parseFromString(t,"text/html");e=document.createDocumentFragment();for(var r=o.body;r&&r.firstChild;)e.appendChild(r.firstChild)}return e},De=function(t){var e=ut.fromSchema(t.type.schema).serializeFragment(t.content);return function(t){Array.from(t.querySelectorAll("table")).forEach((function(t){Se(t,"thead"),Se(t,"tbody"),Se(t,"tfoot");var e=Array.from(t.children).find((function(t){return 0===t.children.length}));e&&e.remove()}))}(e),e},Oe=function(t,e,n){return tt.fromSchema(e).parse(t,n)},Ae=function(t,e,n){var o,r=Me(t);return o=r,Array.from(o.querySelectorAll("table")).forEach((function(t){var e=Array.from(t.children);e.some((function(t){return"THEAD"===t.nodeName||"TFOOT"===t.nodeName}))&&(Ee(e,"thead"),Ee(e,"tbody"),Ee(e,"tfoot"));var n=e.find((function(t){return"COLGROUP"===t.nodeName}));n&&(t.setAttribute("k-colgroup-data",n.outerHTML),n.remove())})),Oe(r,e,n)},Ie=function(t){var e=De(t.doc),n=document.createElement("div");return n.appendChild(e),n.innerHTML},Be=function(t,e,n){return void 0===e&&(e="setHTML"),void 0===n&&(n={preserveWhitespace:"full"}),function(o,r){return r(o.tr.setSelection(new se(o.doc)).replaceSelectionWith(Ae(t,o.schema,n)).setMeta("commandName",e))}},Ne=n(0),ze=function(t,e){var n=e.style,o=e.value,r=e.newValue;if(!t)return{changed:!1,style:null};var i=t.split(/\s*;\s*/).filter((function(t){return Boolean(t)})),a=i.filter((function(t){var e=t.split(/\s*:\s*/);return!(e[0].toLowerCase()===n&&o.test(e[1]))}));return r&&a.push(n+": "+r),{style:a.join("; ")+(a.length?";":""),changed:Boolean(r)||a.length!==i.length}},Re=function(t,e){for(var n=t.selection.$from,o=n.depth;o>=0;o--){var r=n.index(o);if(n.node(o).canReplaceWith(r,r,e))return!0}return!1},Pe=function(t){return t instanceof D?t.type.name:t.name},Le=function(t,e){return void 0===e&&(e=1),function(n){return function(t,e){return void 0===e&&(e=1),function(n){for(var o=n.$from,r=o.depth;r>0;r--){var i=o.node(r);if(t(i)&&0===(e-=1))return{depth:r,node:i}}}}((function(e){return Pe(e)===Pe(t)}),e)(n)}},Fe=function(t,e){return function(n,o){var r=n.tr.replaceSelectionWith(t);e&&r.scrollIntoView(),o(r)}},$e=function(t,e,n,o){var r=i.from(Ae(t,n,o)),a=i.from(Ae(e,n,o));return r.eq(a)},Ve=function(t){var e=t.selection;if(e instanceof oe||e instanceof se){var n=e.content().content;return n.textBetween(0,n.size)}return""},je=function(t){if(t.selection instanceof ie)return t.selection.node},We=function(t){var e="",n=!1,o=t.selection,r=t.doc,i=o.$from,a=o.$to,s=o.from,l=o.to;return i.sameParent(a)&&(r.nodesBetween(s,l,(function(t){n=n||t.isLeaf&&!t.isText})),n||(e=Ve(t))),e},He=function(t){return t.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/gi,"</$1>\n").replace(/<(ul|ol)([^>]*)><li/gi,"<$1$2>\n<li").replace(/<br \/>/gi,"<br />\n").replace(/\n$/,"")},qe={before:/[^ !,?.\[\]{}()]+$/i,after:/^[^ !,?.\[\]{}()]+/i},Je=function(t,e,n){if(!n.applyToWord||!t.selection.empty)return{state:t,dispatch:e};var o=!0===n.applyToWord?qe:n.applyToWord,r=null,i=t.tr,a=t.selection,s=a.$head.nodeBefore,l=a.$head.nodeAfter;if(s&&"text"===s.type.name&&s.text&&l&&"text"===l.type.name&&l.text){var c=[];a.$head.parent.descendants((function(t,e){return c.push({node:t,pos:e}),!1}));for(var d=a.$head.parentOffset,u=c.findIndex((function(t){var e=t.node,n=t.pos;return n<=d&&n+e.nodeSize>=d})),p=c[u].node.text,f=!1,h=u-1;h>=0;h--){var m=c[h];!f&&m&&"text"===m.node.type.name?p=m.node.text+p:(f=!0,d-=m.node.nodeSize)}for(h=u+1;h<c.length;h++){if(!(m=c[h])||"text"!==m.node.type.name)break;p+=m.node.text}var v=p.substring(0,d),g=p.substring(d),y=o.before.exec(v),b=o.after.exec(g);if(y&&b){var w=y[0].length,k=b[0].length,_=r=a.from;i.setSelection(oe.create(t.doc,_-w,_+k));return{state:{tr:i,selection:i.selection,doc:i.doc,storedMarks:null,schema:i.doc.type.schema},dispatch:function(t){t.setSelection(oe.create(t.doc,r)),e(t)}}}}return{state:t,dispatch:e}},Ke=function(t,e){return function(n,o,r){var i=Je(n,o,e),a=i.state,s=i.dispatch;return t(e)(a,s)}},Ue=function(t,e,n){for(var o=function(o){var r=e[o],i=r.$from,a=r.$to,s=0===i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,a.pos,(function(t){if(s)return!1;s=t.inlineContent&&t.type.allowsMarkType(n)})),s)return{v:!0}},r=0;r<e.length;r++){var i=o(r);if(i)return i.v}return!1},Ge=function(t,e,n){return function(o,r){var i=o.selection,a=i.empty,s=i.$cursor,l=i.ranges;if(a&&!s||!Ue(o.doc,l,t))return!1;if(r)if(s)t.isInSet(o.storedMarks||s.marks())?r(n.removeStoredMark(t)):r(n.addStoredMark(t.create(e)));else{for(var c=!1,d=0;!c&&d<l.length;d++){var u=l[d],p=u.$from,f=u.$to;c=o.doc.rangeHasMark(p.pos,f.pos,t)}for(d=0;d<l.length;d++){var h=l[d];p=h.$from,f=h.$to;c?n.removeMark(p.pos,f.pos,t):n.addMark(p.pos,f.pos,t.create(e))}r(n.scrollIntoView())}return!0}},Xe=function(t,e,n,o){void 0===o&&(o=null);var r=[],i=0;return t.doc.nodesBetween(e,n,(function(t,a){if(t.isInline){i++;var s=null;if(o instanceof Y){var l=o.isInSet(t.marks);l&&(s=[l])}else o?o.isInSet(t.marks)&&(s=[o]):s=t.marks;if(s&&s.length)for(var c=Math.min(a+t.nodeSize,n),d=0;d<s.length;d++){for(var u=s[d],p=void 0,f=0;f<r.length;f++){var h=r[f];h.step===i-1&&u.eq(h.style)&&(p=h)}p?(p.to=c,p.step=i):r.push({style:u,from:Math.max(a,e),to:c,step:i})}}})),r.forEach((function(e){return t.step(new Vt(e.from,e.to,e.style))})),t},Ye=function(t){var e=(void 0===t?{}:t).except,n=void 0===e?[]:e;return function(t,e){var o,r=t.tr;Ze(r,{except:(o=n,o instanceof Array?o:[o])}),r.docChanged&&e(r)}},Ze=function(t,e){var n=e.except,o=t.doc,r=t.selection,i=o.type.schema,a=r.empty,s=r.ranges,l=(n||[]).map((function(t){return t.name}));if(!a){var c=Object.keys(i.marks).map((function(t){return i.marks[t]})).filter((function(t){return-1===l.indexOf(t.name)}));s.forEach((function(e){var n=e.$from,o=e.$to;c.forEach((function(e){return t.removeMark(n.pos,o.pos,e)}))}))}},Qe=function(t,e){var n,o=t.schema.marks,r=(e.altMarks||[]).filter((function(t){return o[t]})),i=e.altStyle,a=t.selection,s=a.from,l=a.$from,c=a.to,d=a.empty,u=o[e.mark],p=t.doc,f=!1;return d?(n=t.storedMarks||l.marks(),f=u&&u.isInSet(n)||r.some((function(t){return o[t].isInSet(n)}))):f=u&&p.rangeHasMark(s,c,u)||r.some((function(t){return p.rangeHasMark(s,c,o[t])})),!f&&i&&o.style?en(t,o.style).some((function(t){return null!==tn(t,i)})):Boolean(f)},tn=function(t,e){for(var n=(t&&t.attrs.style||"").split(/\s*;\s*/).filter((function(t){return Boolean(t)})),o=0;o<n.length;o++){var r=n[o].split(/\s*:\s*/);if(r[0].toLowerCase()===e.name&&e.value.test(r[1]))return r[1]}return null},en=function(t,e){var n=t.selection,o=n.from,r=n.$from,i=n.to,a=n.empty,s=[];return a?s.push(e.isInSet(t.storedMarks||r.marks())):t.doc.nodesBetween(o,i,(function(t){t.isInline&&s.push(e.isInSet(t.marks))})),s},nn=function(t,e){var n=en(t,e),o=n.filter((function(t){return Boolean(t)}));return n.length===o.length?n[0]:void 0},on=function(t,e){var n=en(t,e),o=n.filter((function(t){return Boolean(t)}));return{hasNodesWithoutMarks:n.length!==o.length,marks:o}},rn=function(t,e){var n=t.find((function(t){return"style"===t.type.name})),o=n&&n.attrs.style;return ze(o,e)},an=function(t,e,n,o,r){var i=r.create({style:o.style}),a=[],s=[],l=null,c=null;return t.doc.nodesBetween(e,n,(function(t,d,u){if(t.isInline){var p=t.marks;if(!i.isInSet(p)&&u.type.allowsMarkType(i.type)){var f=Math.max(d,e),h=Math.min(d+t.nodeSize,n),m=rn(p,o);if(m.changed||o.newValue){for(var v=m.changed?{style:m.style||null}:{style:[o.style]+": "+o.newValue+";"},g=r.isInSet(p)?p.find((function(t){return"style"===t.type.name})):null,y=g?Ne.__assign({},g.attrs,v):v,b=r.create(y),w=b.addToSet(p),k=0;k<p.length;k++)p[k].isInSet(w)||(l&&l.to===f&&l.mark.eq(p[k])?l.to=h:(l=new Vt(f,h,p[k]),a.push(l)));var _=c&&c.to===f,C=_&&b.attrs.style===c.mark.attrs.style;_&&C?c.to=h:Object.keys(y).some((function(t){return null!==y[t]}))&&(c=new $t(f,h,b),s.push(c))}}}})),a.forEach((function(e){return t.step(e)})),s.forEach((function(e){return t.step(e)})),a.length+s.length>0},sn=function(t,e){var n=t.schema.marks.style;return(n?en(t,n):[]).map((function(t){return tn(t,e)})).filter((function(t){return null!==t}))},ln=function(t,e){return function(n,o,r){var i=n.selection,a=i.empty,s=i.$cursor,l=i.ranges;if(a&&!s||!Ue(n.doc,l,t))return!1;var c,d,u,p,f=!1;if(o){var h=r||n.tr;if(s){var m=n.storedMarks||s.marks();if(t.isInSet(m)){var v=rn(m,e),g=m.find((function(t){return"style"===t.type.name})),y=Ne.__assign({},g?g.attrs:{},{style:v.style||null});if(c=g.attrs,d=y,u=Object.keys(c),p=Object.keys(d),u.length===p.length&&u.every((function(t){return c[t]===d[t]})))return!1;o(h.removeStoredMark(t)),Object.keys(y).some((function(t){return null!==y[t]}))&&o(h.addStoredMark(t.create(y))),f=!0}}else{for(var b=0;b<l.length;b++){var w=l[b],k=w.$from,_=w.$to;f=an(h,k.pos,_.pos,e,t)}f&&(h.scrollIntoView(),o(h))}}return f}},cn=function(t,e,n){return function(o,r){var i=o.schema.marks,a=t.altStyle,s=t.altMarks,l=void 0===s?[]:s,c=t.mark,d=e||o.tr,u=!1,p=!1,f=function(){return p=!0};a&&i.style&&(u=ln(i.style,{style:a.name,value:a.value})(o,f,d));var h=[c].concat(l).filter((function(t){return i[t]})).map((function(t){return Qe(o,{mark:t})&&i[t]})).filter((function(t){return t}));return h.length?function(t,e,n,o){var r=e.selection,i=r.$cursor,a=r.ranges;if(o=o||e.tr,i)t.forEach((function(t){t.isInSet(e.storedMarks||i.marks())&&n(o.removeStoredMark(t))}));else{for(var s=function(e){var n=a[e],r=n.$from,i=n.$to;t.forEach((function(t){Xe(o,r.pos,i.pos,t)}))},l=0;l<a.length;l++)s(l);n(o.scrollIntoView())}}(h,o,f,d):u||Ge(i[c],n,d)(o,f),p&&r(d),p}},dn=function(t,e){return function(n,o){var r=n.schema.marks.style,i={style:t.style,value:/^.+$/,newValue:t.value},a=n.tr;e&&a.setMeta("commandName",e),a.setMeta("args",t);var s=n.selection,l=s.empty,c=s.$cursor,d=s.ranges;if(l&&!c||!r||!Ue(n.doc,d,r))return!1;if(c){var u=n.storedMarks||c.marks(),p=r.isInSet(u)?u.find((function(t){return"style"===t.type.name})):null,f={style:null};if(p&&p.attrs.style){var h=ze(p.attrs.style,i);h.changed&&h.style&&(f.style=h.style)}else i.newValue&&(f.style=[i.style]+": "+i.newValue+";");var m=p?Ne.__assign({},p.attrs,f):f;return Object.keys(m).some((function(t){return null!==m[t]}))?o(a.addStoredMark(r.create(m))):o(a.removeStoredMark(r)),!0}return ln(r,i)(n,o,a)}},un=function(t,e){return function(n,o){var r=n.selection.$cursor;if(r){var i=r.parent,a=r.index(),s=n.schema.marks[t.mark],l=i.child(a).marks.find((function(t){return t.type===s})),c=i.childCount,d=r.pos-r.textOffset,u=i.child(a).nodeSize,p=void 0,f=void 0;for(p=a-1;p>=0&&l.isInSet(i.child(p).marks);)u+=f=i.child(p).nodeSize,d-=f,p-=1;for(p=a+1;p<c&&l.isInSet(i.child(p).marks);)u+=i.child(p).nodeSize,p+=1;o(Xe(e||n.tr,d,d+u,l))}else cn(t,e)(n,o)}},pn=function(t,e){var n=t.mark,o=t.attrs;return void 0===e&&(e="link"),function(t,r){var i=t.schema.marks,a=t.tr;e&&(a.setMeta("commandName",e),a.setMeta("args",o));var s=!1,l=function(){return s=!0};if(function(t,e){var n=en(t,e);return 1===n.length&&n[0]?n[0]:null}(t,i[n]))!function(t,e){return function(n,o){var r=n.selection,i=r.$cursor,a=r.from,s=r.to,l=n.schema.marks[t.mark];if(i){var c=i.parent,d=i.index(),u=c.child(d).marks.find((function(t){return t.type===l})),p=c.childCount,f=i.pos-i.textOffset,h=c.child(d).nodeSize,m=void 0,v=void 0;for(m=d-1;m>=0&&u.isInSet(c.child(m).marks);)h+=v=c.child(m).nodeSize,f-=v,m-=1;for(m=d+1;m<p&&u.isInSet(c.child(m).marks);)h+=c.child(m).nodeSize,m+=1;e.removeMark(f,f+h,l),e.addMark(f,f+h,l.create(t.attrs)),o(e)}else e.doc.nodesBetween(a,s,(function(n,r){n.isInline&&l.isInSet(n.marks)&&(e.removeMark(r,r+n.nodeSize,l),e.addMark(r,r+n.nodeSize,l.create(t.attrs)),o(e))}))}}({mark:n,attrs:o},a)(t,l);else{var c=t;Qe(t,{mark:n})&&(un({mark:n,attrs:o},a)(t,l),c=ve.create({doc:a.doc,selection:a.selection})),s?Ge(i[n],o,a)(c,l):cn({mark:n},a,o)(c,l)}return s&&r(a),s}},fn=function(t){return function(e,n){n(e.tr.insertText(t.text,t.from,t.to))}},hn=function(t){return function(e,n){var o=e.schema.nodes.image,r=o.createAndFill(t);Fe(r)(e,(function(e){return n(e.setMeta("commandName","insertImage").setMeta("args",t))}))}},mn=function(t,e,n,o){if(!n.isTextblock)return!1;t.selection.ranges.forEach((function(r){var a=t.steps.length,s=r.$from.pos,l=r.$to.pos;t.doc.nodesBetween(s,l,(function(r,s){if(r.eq(e)&&r.isTextblock&&!r.hasMarkup(n,o)&&function(t,e,n){var o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}(t.doc,t.mapping.slice(a).map(s),n)){t.clearIncompatible(t.mapping.slice(a).map(s,1),n);var l=t.mapping.slice(a),c=l.map(s,1),d=l.map(s+r.nodeSize,1),u=new p(i.from(n.create(o,null,r.marks)),0,0);return t.step(new Tt(c,d,c+1,d-1,u,1,!0)),!1}}))}))},vn=function(t,e){void 0===e&&(e={blocksInSelection:!1});var n=t.doc,o=t.selection,r=o.$from,i=o.ranges,a=e.blocksInSelection,s=[],l=o instanceof ie?o.node:void 0;return l?l.isBlock?(s.push(l),l.nodesBetween(0,l.content.size,(function(t){t.isBlock&&s.push(t)}))):!a&&r.parent&&r.parent.isBlock&&s.push(r.parent):i.forEach((function(t){var e=t.$from.pos,o=t.$to.pos;n.nodesBetween(e,o,(function(t,n,r,i){t.isBlock&&(!a||n>=e&&n+t.content.size+2<=o)&&s.push(t)}))})),s},gn=function(t,e){return function(n,o){var r=vn(n),i=n.schema.nodes,a=n.tr;a.setMeta("commandName",e),a.setMeta("args",{value:t}),r.forEach((function(e){if(e.type.isTextblock)if("p"===t){var n=e.attrs,o=n.level,r=Ne.__rest(n,["level"]);mn(a,e,i.paragraph,r)}else if(/^h[1-6]$/i.test(t)){o=parseInt(t.substr(1),10);mn(a,e,i.heading,Ne.__assign({},e.attrs,{level:o}))}else if("blockquote"===t){var s=e.attrs;o=s.level,r=Ne.__rest(s,["level"]);mn(a,e,i.blockquote,r)}}));var s=a.docChanged;return s&&o(a.scrollIntoView()),s}},yn=function(t,e){void 0===e&&(e={blocksInSelection:!0});var n=t.doc,o=t.selection,r=e.blocksInSelection,i=e.blockNodeType;vn({doc:n,selection:o},{blocksInSelection:r}).filter((function(t){return t.isTextblock})).forEach((function(e){var n=e.attrs||{},o=n.style,r=void 0===o?"":o,a=n.class,s=void 0===a?"":a,l=Ne.__rest(n,["style","class"]),c=i||e.type;(r||s||c!==e.type)&&mn(t,e,c,l)}))},bn=function(t){var e=vn(t),n=t.schema.nodes,o=[];return e.forEach((function(t){t.type===n.paragraph?o.push("p"):t.type===n.heading?o.push("h"+t.attrs.level):t.type===n.blockquote&&n.blockquote.isTextblock&&o.push("blockquote")})),o},wn=function(t,e){var n,o,r=t.attrs.style;r&&e.forEach((function(t){o={style:t.name,value:/^.+$/,newValue:t.value},n=ze(r,o),r=n.changed?n.style:r}));return r=r||e.reduce((function(t,e){return(t&&e.value?t+" ":"")+e.value?e.name+": "+e.value+";":""}),""),Object.assign({},t.attrs,{style:r||null})},kn=function(t,e){var n=t.selection,o=n.from,r=n.to,i=!1;return t.doc.nodesBetween(o,r,(function(t){return!(i=i||t.type===e)})),i},_n=function(t){var e=bn(t);return 1===new Set(e).size?e[0]:null},Cn=function(t){return{tag:_n(t)||""}},xn=function(t,e){return function(n,o){var r=vn(n),i=n.tr;i.setMeta("commandName",e),r.forEach((function(e){if(e.type.isTextblock){var n={},o=t.find((function(t){return t.node===e.type.name}));o&&(n=wn(e,o.style)),mn(i,e,e.type,n)}}));var a=i.docChanged;return a&&o(i.scrollIntoView()),a}},Sn=function(t,e){var n=vn(t),o=!1;return n.forEach((function(t){if(!o&&t.type.isTextblock&&t.attrs.style){var n=e.find((function(e){return e.node===t.type.name}));n&&(o=n.style.every((function(e){return!!e.value&&new RegExp(e.name+":\\s?"+e.value,"i").test(t.attrs.style)})))}})),o},En=function(t){return void 0===t&&(t={blocksInSelection:!0}),function(e,n){var o=e.tr,r=t.blocksInSelection,i=t.blockNodeType,a=(t.exceptMarks||[e.schema.marks.link]).filter(Boolean);Ze(o,{except:a}),yn(o,{blocksInSelection:r,blockNodeType:i});var s=o.docChanged;return s&&n&&n(o),s}},Tn=["ol",0],Mn=["ul",0],Dn=["li",0],On={attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:function(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1}}}],toDOM:function(t){return 1==t.attrs.order?Tn:["ol",{start:t.attrs.order},0]}},An={parseDOM:[{tag:"ul"}],toDOM:function(){return Mn}},In={parseDOM:[{tag:"li"}],toDOM:function(){return Dn},defining:!0};function Bn(t,e){var n={};for(var o in t)n[o]=t[o];for(var r in e)n[r]=e[r];return n}function Nn(t,e,n){return t.append({ordered_list:Bn(On,{content:"list_item+",group:n}),bullet_list:Bn(An,{content:"list_item+",group:n}),list_item:Bn(In,{content:e})})}function zn(t,e){return function(n,o){var r=n.selection,a=r.$from,s=r.$to,l=a.blockRange(s),c=!1,d=l;if(!l)return!1;if(l.depth>=2&&a.node(l.depth-1).type.compatibleContent(t)&&0==l.startIndex){if(0==a.index(l.depth-1))return!1;var u=n.doc.resolve(l.start-2);d=new E(u,u,l.depth),l.endIndex<l.parent.childCount&&(l=new E(a,n.doc.resolve(s.end(l.depth)),l.depth)),c=!0}var f=At(d,t,e,l);return!!f&&(o&&o(function(t,e,n,o,r){for(var a=i.empty,s=n.length-1;s>=0;s--)a=i.from(n[s].type.create(n[s].attrs,a));t.step(new Tt(e.start-(o?2:0),e.end,e.start,e.end,new p(a,0,0),n.length,!0));for(var l=0,c=0;c<n.length;c++)n[c].type==r&&(l=c+1);for(var d=n.length-l,u=e.start+n.length-(o?2:0),f=e.parent,h=e.startIndex,m=e.endIndex,v=!0;h<m;h++,v=!1)!v&&Bt(t.doc,u,d)&&(t.split(u,d),u+=2*d),u+=f.child(h).nodeSize;return t}(n.tr,l,f,c,t).scrollIntoView()),!0)}}function Rn(t){return function(e,n){var o=e.selection,r=o.$from,a=o.$to,s=o.node;if(s&&s.isBlock||r.depth<2||!r.sameParent(a))return!1;var l=r.node(-1);if(l.type!=t)return!1;if(0==r.parent.content.size&&r.node(-1).childCount==r.indexAfter(-1)){if(2==r.depth||r.node(-3).type!=t||r.index(-2)!=r.node(-2).childCount-1)return!1;if(n){for(var c=i.empty,d=r.index(-1)?1:r.index(-2)?2:3,u=r.depth-d;u>=r.depth-3;u--)c=i.from(r.node(u).copy(c));var f=r.indexAfter(-1)<r.node(-2).childCount?1:r.indexAfter(-2)<r.node(-3).childCount?2:3;c=c.append(i.from(t.createAndFill()));var h=r.before(r.depth-(d-1)),m=e.tr.replace(h,r.after(-f),new p(c,4-d,0)),v=-1;m.doc.nodesBetween(h,m.doc.content.size,(function(t,e){if(v>-1)return!1;t.isTextblock&&0==t.content.size&&(v=e+1)})),v>-1&&m.setSelection(e.selection.constructor.near(m.doc.resolve(v))),n(m.scrollIntoView())}return!0}var g=a.pos==r.end()?l.contentMatchAt(0).defaultType:null,y=e.tr.delete(r.pos,a.pos),b=g&&[null,{type:g}];return!!Bt(y.doc,r.pos,2,b)&&(n&&n(y.split(r.pos,2,b).scrollIntoView()),!0)}}function Pn(t){return function(e,n){var o=e.selection,r=o.$from,a=o.$to,s=r.blockRange(a,(function(e){return e.childCount&&e.firstChild.type==t}));return!!s&&(!n||(r.node(s.depth-1).type==t?function(t,e,n,o){var r=t.tr,a=o.end,s=o.$to.end(o.depth);a<s&&(r.step(new Tt(a-1,s,a,s,new p(i.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new E(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));return e(r.lift(o,Ot(o)).scrollIntoView()),!0}(e,n,t,s):function(t,e,n){for(var o=t.tr,r=n.parent,a=n.end,s=n.endIndex-1,l=n.startIndex;s>l;s--)a-=r.child(s).nodeSize,o.delete(a-1,a+1);var c=o.doc.resolve(n.start),d=c.nodeAfter;if(o.mapping.map(n.end)!=n.start+c.nodeAfter.nodeSize)return!1;var u=0==n.startIndex,f=n.endIndex==r.childCount,h=c.node(-1),m=c.index(-1);if(!h.canReplace(m+(u?0:1),m+1,d.content.append(f?i.empty:i.from(r))))return!1;var v=c.pos,g=v+d.nodeSize;return o.step(new Tt(v-(u?1:0),g+(f?1:0),v+1,g-1,new p((u?i.empty:i.from(r.copy(i.empty))).append(f?i.empty:i.from(r.copy(i.empty))),u?0:1,f?0:1),u?0:1)),e(o.scrollIntoView()),!0}(e,n,s)))}}function Ln(t){return function(e,n){var o=e.selection,r=o.$from,a=o.$to,s=r.blockRange(a,(function(e){return e.childCount&&e.firstChild.type==t}));if(!s)return!1;var l=s.startIndex;if(0==l)return!1;var c=s.parent,d=c.child(l-1);if(d.type!=t)return!1;if(n){var u=d.lastChild&&d.lastChild.type==c.type,f=i.from(u?t.create():null),h=new p(i.from(t.create(null,i.from(c.type.create(null,f)))),u?3:1,0),m=s.start,v=s.end;n(e.tr.step(new Tt(m-(u?3:1),v,m,v,h,1,!0)).scrollIntoView())}return!0}}var Fn={orderedList:"ordered_list",bulletList:"bullet_list",listItem:"list_item"},$n={listType:Fn.orderedList,types:Ne.__assign({},Fn)},Vn={listType:Fn.bulletList,types:Ne.__assign({},Fn)},jn={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:30,unit:"px"}],listsTypes:Ne.__assign({},Fn)},Wn={nodes:[{node:"paragraph",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"},{node:"heading",style:"margin-left",rtlStyle:"margin-right",step:-30,unit:"px"}],listsTypes:Ne.__assign({},Fn)};function Hn(t,e){return!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0)}function qn(t,e,n){var o=t.selection.$cursor;if(!o||(n?!n.endOfTextblock("backward",t):o.parentOffset>0))return!1;var r=Un(o);if(!r){var i=o.blockRange(),a=i&&Ot(i);return null!=a&&(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)}var s=r.nodeBefore;if(!s.type.spec.isolating&&uo(t,r,e))return!0;if(0==o.parent.content.size&&(Jn(s,"end")||ie.isSelectable(s))){var l=jt(t.doc,o.before(),o.after(),p.empty);if(l.slice.size<l.to-l.from){if(e){var c=t.tr.step(l);c.setSelection(Jn(s,"end")?te.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):ie.create(c.doc,r.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}}return!(!s.isAtom||r.depth!=o.depth-1)&&(e&&e(t.tr.delete(r.pos-s.nodeSize,r.pos).scrollIntoView()),!0)}function Jn(t,e,n){for(;t;t="start"==e?t.firstChild:t.lastChild){if(t.isTextblock)return!0;if(n&&1!=t.childCount)return!1}return!1}function Kn(t,e,n){var o=t.selection,r=o.$head,i=r;if(!o.empty)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Un(r)}var a=i&&i.nodeBefore;return!(!a||!ie.isSelectable(a))&&(e&&e(t.tr.setSelection(ie.create(t.doc,i.pos-a.nodeSize)).scrollIntoView()),!0)}function Un(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Gn(t,e,n){var o=t.selection.$cursor;if(!o||(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size))return!1;var r=Yn(o);if(!r)return!1;var i=r.nodeAfter;if(uo(t,r,e))return!0;if(0==o.parent.content.size&&(Jn(i,"start")||ie.isSelectable(i))){var a=jt(t.doc,o.before(),o.after(),p.empty);if(a.slice.size<a.to-a.from){if(e){var s=t.tr.step(a);s.setSelection(Jn(i,"start")?te.findFrom(s.doc.resolve(s.mapping.map(r.pos)),1):ie.create(s.doc,s.mapping.map(r.pos))),e(s.scrollIntoView())}return!0}}return!(!i.isAtom||r.depth!=o.depth-1)&&(e&&e(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0)}function Xn(t,e,n){var o=t.selection,r=o.$head,i=r;if(!o.empty)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Yn(r)}var a=i&&i.nodeAfter;return!(!a||!ie.isSelectable(a))&&(e&&e(t.tr.setSelection(ie.create(t.doc,i.pos)).scrollIntoView()),!0)}function Yn(t){if(!t.parent.type.spec.isolating)for(var e=t.depth-1;e>=0;e--){var n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function Zn(t,e){var n,o=t.selection,r=o instanceof ie;if(r){if(o.node.isTextblock||!Nt(t.doc,o.from))return!1;n=o.from}else if(null==(n=Rt(t.doc,o.from,-1)))return!1;if(e){var i=t.tr.join(n);r&&i.setSelection(ie.create(i.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0}function Qn(t,e){var n,o=t.selection;if(o instanceof ie){if(o.node.isTextblock||!Nt(t.doc,o.to))return!1;n=o.to}else if(null==(n=Rt(t.doc,o.to,1)))return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0}function to(t,e){var n=t.selection,o=n.$from,r=n.$to,i=o.blockRange(r),a=i&&Ot(i);return null!=a&&(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)}function eo(t,e){var n=t.selection,o=n.$head,r=n.$anchor;return!(!o.parent.type.spec.code||!o.sameParent(r))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}function no(t){for(var e=0;e<t.edgeCount;e++){var n=t.edge(e).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function oo(t,e){var n=t.selection,o=n.$head,r=n.$anchor;if(!o.parent.type.spec.code||!o.sameParent(r))return!1;var i=o.node(-1),a=o.indexAfter(-1),s=no(i.contentMatchAt(a));if(!i.canReplaceWith(a,a,s))return!1;if(e){var l=o.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(te.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0}function ro(t,e){var n=t.selection,o=n.$from,r=n.$to;if(n instanceof se||o.parent.inlineContent||r.parent.inlineContent)return!1;var i=no(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){var a=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,s=t.tr.insert(a,i.createAndFill());s.setSelection(oe.create(s.doc,a+1)),e(s.scrollIntoView())}return!0}function io(t,e){var n=t.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var o=n.before();if(Bt(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}var r=n.blockRange(),i=r&&Ot(r);return null!=i&&(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)}function ao(t,e){var n=t.selection,o=n.$from,r=n.$to;if(t.selection instanceof ie&&t.selection.node.isBlock)return!(!o.parentOffset||!Bt(t.doc,o.pos))&&(e&&e(t.tr.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;if(e){var i=r.parentOffset==r.parent.content.size,a=t.tr;(t.selection instanceof oe||t.selection instanceof se)&&a.deleteSelection();var s=0==o.depth?null:no(o.node(-1).contentMatchAt(o.indexAfter(-1))),l=i&&s?[{type:s}]:null,c=Bt(a.doc,a.mapping.map(o.pos),1,l);if(l||c||!Bt(a.doc,a.mapping.map(o.pos),1,s&&[{type:s}])||(l=[{type:s}],c=!0),c&&(a.split(a.mapping.map(o.pos),1,l),!i&&!o.parentOffset&&o.parent.type!=s)){var d=a.mapping.map(o.before()),u=a.doc.resolve(d);o.node(-1).canReplaceWith(u.index(),u.index()+1,s)&&a.setNodeMarkup(a.mapping.map(o.before()),s)}e(a.scrollIntoView())}return!0}function so(t,e){return ao(t,e&&function(n){var o=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();o&&n.ensureMarks(o),e(n)})}function lo(t,e){var n,o=t.selection,r=o.$from,i=o.to,a=r.sharedDepth(i);return 0!=a&&(n=r.before(a),e&&e(t.tr.setSelection(ie.create(t.doc,n))),!0)}function co(t,e){return e&&e(t.tr.setSelection(new se(t.doc))),!0}function uo(t,e,n){var o,r,a=e.nodeBefore,s=e.nodeAfter;if(a.type.spec.isolating||s.type.spec.isolating)return!1;if(function(t,e,n){var o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!!(o&&r&&o.type.compatibleContent(r.type))&&(!o.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!(!e.parent.canReplace(i,i+1)||!r.isTextblock&&!Nt(t.doc,e.pos))&&(n&&n(t.tr.clearIncompatible(e.pos,o.type,o.contentMatchAt(o.childCount)).join(e.pos).scrollIntoView()),!0))}(t,e,n))return!0;var l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(o=(r=a.contentMatchAt(a.childCount)).findWrapping(s.type))&&r.matchType(o[0]||s.type).validEnd){if(n){for(var c=e.pos+s.nodeSize,d=i.empty,u=o.length-1;u>=0;u--)d=i.from(o[u].create(null,d));d=i.from(a.copy(d));var f=t.tr.step(new Tt(e.pos-1,c,e.pos,c,new p(d,1,0),o.length,!0)),h=c+2*o.length;Nt(f.doc,h)&&f.join(h),n(f.scrollIntoView())}return!0}var m=te.findFrom(e,1),v=m&&m.$from.blockRange(m.$to),g=v&&Ot(v);if(null!=g&&g>=e.depth)return n&&n(t.tr.lift(v,g).scrollIntoView()),!0;if(l&&Jn(s,"start",!0)&&Jn(a,"end")){for(var y=a,b=[];b.push(y),!y.isTextblock;)y=y.lastChild;for(var w=s,k=1;!w.isTextblock;w=w.firstChild)k++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){for(var _=i.empty,C=b.length-1;C>=0;C--)_=i.from(b[C].copy(_));n(t.tr.step(new Tt(e.pos-b.length,e.pos+s.nodeSize,e.pos+k,e.pos+s.nodeSize-k,new p(_,b.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function po(t){return function(e,n){for(var o=e.selection,r=t<0?o.$from:o.$to,i=r.depth;r.node(i).isInline;){if(!i)return!1;i--}return!!r.node(i).isTextblock&&(n&&n(e.tr.setSelection(oe.create(e.doc,t<0?r.start(i):r.end(i)))),!0)}}var fo=po(-1),ho=po(1);function mo(t,e){return function(n,o){var r=n.selection,i=r.$from,a=r.$to,s=i.blockRange(a),l=s&&At(s,t,e);return!!l&&(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0)}}function vo(t,e){return function(n,o){var r=n.selection,i=r.from,a=r.to,s=!1;return n.doc.nodesBetween(i,a,(function(o,r){if(s)return!1;if(o.isTextblock&&!o.hasMarkup(t,e))if(o.type==t)s=!0;else{var i=n.doc.resolve(r),a=i.index();s=i.parent.canReplaceWith(a,a+1,t)}})),!!s&&(o&&o(n.tr.setBlockType(i,a,t,e).scrollIntoView()),!0)}}function go(t,e){return function(n,o){var r=n.selection,i=r.empty,a=r.$cursor,s=r.ranges;if(i&&!a||!function(t,e,n){for(var o=function(o){var r=e[o],i=r.$from,a=r.$to,s=0==i.depth&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,a.pos,(function(t){if(s)return!1;s=t.inlineContent&&t.type.allowsMarkType(n)})),s)return{v:!0}},r=0;r<e.length;r++){var i=o(r);if(i)return i.v}return!1}(n.doc,s,t))return!1;if(o)if(a)t.isInSet(n.storedMarks||a.marks())?o(n.tr.removeStoredMark(t)):o(n.tr.addStoredMark(t.create(e)));else{for(var l=!1,c=n.tr,d=0;!l&&d<s.length;d++){var u=s[d],p=u.$from,f=u.$to;l=n.doc.rangeHasMark(p.pos,f.pos,t)}for(var h=0;h<s.length;h++){var m=s[h],v=m.$from,g=m.$to;if(l)c.removeMark(v.pos,g.pos,t);else{var y=v.pos,b=g.pos,w=v.nodeAfter,k=g.nodeBefore,_=w&&w.isText?/^\s*/.exec(w.text)[0].length:0,C=k&&k.isText?/\s*$/.exec(k.text)[0].length:0;y+_<b&&(y+=_,b-=C),c.addMark(y,b,t.create(e))}}o(c.scrollIntoView())}return!0}}function yo(t,e){if(Array.isArray(e)){var n=e;e=function(t){return n.indexOf(t.type.name)>-1}}return function(n,o,r){return t(n,o&&function(t,e){return function(n){if(!n.isGeneric)return t(n);for(var o=[],r=0;r<n.mapping.maps.length;r++){for(var i=n.mapping.maps[r],a=0;a<o.length;a++)o[a]=i.map(o[a]);i.forEach((function(t,e,n,r){return o.push(n,r)}))}for(var s=[],l=0;l<o.length;l+=2)for(var c=o[l],d=o[l+1],u=n.doc.resolve(c),p=u.sharedDepth(d),f=u.node(p),h=u.indexAfter(p),m=u.after(p+1);m<=d;++h){var v=f.maybeChild(h);if(!v)break;if(h&&-1==s.indexOf(m)){var g=f.child(h-1);g.type==v.type&&e(g,v)&&s.push(m)}m+=v.nodeSize}s.sort((function(t,e){return t-e}));for(var y=s.length-1;y>=0;y--)Nt(n.doc,s[y])&&n.join(s[y]);t(n)}}(o,e),r)}}function bo(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return function(e,n,o){for(var r=0;r<t.length;r++)if(t[r](e,n,o))return!0;return!1}}var wo=bo(Hn,qn,Kn),ko=bo(Hn,Gn,Xn),_o={Enter:bo(eo,ro,io,ao),"Mod-Enter":oo,Backspace:wo,"Mod-Backspace":wo,"Shift-Backspace":wo,Delete:ko,"Mod-Delete":ko,"Mod-a":co},Co={"Ctrl-h":_o.Backspace,"Alt-Backspace":_o["Mod-Backspace"],"Ctrl-d":_o.Delete,"Ctrl-Alt-Backspace":_o["Mod-Delete"],"Alt-Delete":_o["Mod-Delete"],"Alt-d":_o["Mod-Delete"],"Ctrl-a":fo,"Ctrl-e":ho};for(var xo in _o)Co[xo]=_o[xo];_o.Home=fo,_o.End=ho;var So=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&"darwin"==os.platform())?Co:_o,Eo=function(t,e){return mo(t.schema.nodes.blockquote)(t,e)},To=function(t,e){var n=t.selection,o=n.$from,r=n.$to,i=t.schema.nodes.blockquote,a=t.doc,s=-1,l=o.blockRange(r);l&&a.nodesBetween(l.start,l.end,(function(t,e,n,o){t.type===i&&(s=e)}));var c=-1!==s;return e&&c&&e(t.tr.lift(l,a.resolve(s).depth)),c},Mo=function(t,e,n){return function(o,r){var i=vn(o),a=o.tr;a.setMeta("commandName",e),i.forEach((function(e){if(e.type.isTextblock){var o=void 0,r=t.find((function(t){return t.node===e.type.name}));if(r){var i="rtl"===n?r.rtlStyle:r.style,s={name:i,value:r.step>0?""+r.step+r.unit:""};if(e.attrs.style){var l=new RegExp(i+":\\s?(\\d+)"+r.unit,"i"),c=e.attrs.style.match(l);if(c){var d=parseFloat(c[1])+r.step;d=d<=0?"":d,s.value=""+d+(d?r.unit:"")}}o=wn(e,[s])}o&&mn(a,e,e.type,o)}}));var s=a.docChanged;return s&&r(a.scrollIntoView()),s}},Do=function(t,e,n){var o=vn(t),r=!1;return o.forEach((function(t){if(!r&&t.type.isTextblock&&t.attrs.style){var o=e.find((function(e){return e.node===t.type.name}));if(o){var i="rtl"===n?o.rtlStyle:o.style,a=new RegExp(i+":\\s?\\d+"+o.unit,"i");r=a.test(t.attrs.style)}}})),r},Oo=function(t,e){return Ln(e)(t)},Ao=function(t,e){var n=t.schema.nodes[e.listsTypes.listItem],o=t.schema.nodes[e.listsTypes.orderedList],r=t.schema.nodes[e.listsTypes.bulletList],i=!!Le(o,2)(t.selection),a=!!Le(r,2)(t.selection);return(i||a)&&Pn(n)(t)},Io=function(t,e){var n=t.schema.nodes,o=n[jn.listsTypes.listItem];return(Do(t,e.nodes)||jn.nodes.some((function(e){return n[e.node]&&kn(t,n[e.node])})))&&!kn(t,o)},Bo=function(t,e){var n=t.schema.nodes[jn.listsTypes.listItem],o=Io(t,jn);Oo(t,n)?Ln(n)(t,e):o&&Mo(jn.nodes)(t,e)},No=function(t,e){var n=t.schema.nodes,o=n[Wn.listsTypes.listItem],r=Io(t,Wn);kn(t,n.blockquote)?To(t,e):Ao(t,Wn)?Pn(o)(t,e):r&&Mo(Wn.nodes)(t,e)},zo=function(t,e,n){for(var o=e.depth,r=t.nodes[n.bulletList],i=t.nodes[n.orderedList],a=t.nodes[n.listItem],s=e.depth;s>0;s--){var l=e.node(s);if(l.type!==r&&l.type!==i||(o=s),l.type!==r&&l.type!==i&&l.type!==a)break}return o-1};function Ro(t){return function(e,n,o){if(!o)return!1;var r=(e=o.state).schema.nodes[t.listType],i=e.selection,a=i.$from,s=i.$to,l=a.node(-2),c=a.node(-3),d=function(t,e,n,o){return 0===function(t,e,n){var o=Array(),r=function(t,e){var n=["blockquote","bulletList","orderedList"];if(1===e.depth)return e;var o=e.node(e.depth),r=e;for(;e.depth>=1;)e=t.resolve(e.before(e.depth)),(o=e.node(e.depth))&&-1!==n.indexOf(o.type.name)&&(r=e);return r}(t,e).depth,i=t.resolve(e.start(r));for(;i.pos<=n.start(n.depth);){var a=Math.min(i.depth,r),s=i.node(a);if(s&&o.push(s),0===a)break;var l=t.resolve(i.after(a));if(l.start(a)>=t.nodeSize-2)break;l.depth!==i.depth&&(l=t.resolve(l.pos+2)),i=l.depth?t.resolve(l.start(l.depth)):t.resolve(l.end(l.depth))}return o}(t,e,n).filter((function(t){return t.type!==o})).length}(e.doc,a,s,r);return(l&&l.type===r||c&&c.type===r)&&d?Lo(t)(e,n):(d||(Lo(t)(e,n),e=o.state),function(t,e){void 0===e&&(e={});return yo(zn(t,e),(function(e,n){return e.type===n.type&&e.type===t}))}(r,t.listAttrs)(e,n))}}function Po(t,e,n,o){var r=o||t.schema.nodes.listItem,a=e.$from,s=e.$to,l=a.blockRange(s,(function(t){return t.childCount&&t.firstChild.type===r}));if(!l||l.depth<2||a.node(l.depth-1).type!==r)return n;var c=l.end,d=s.end(l.depth);return c<d&&(n.step(new Tt(c-1,d,c,d,new p(i.from(r.create(void 0,l.parent.copy())),1,0),1,!0)),l=new E(n.doc.resolve(a.pos),n.doc.resolve(d),l.depth)),n.lift(l,Ot(l)).scrollIntoView()}function Lo(t){return function(e,n){var o=e.tr,r=e.selection,i=r.$from,a=r.$to;return o.doc.nodesBetween(i.pos,a.pos,(function(n,r){if(n.isTextblock||"blockquote"===n.type.name||"div"===n.type.name){var i=new ie(o.doc.resolve(o.mapping.map(r))),a=i.$from.blockRange(i.$to);if(!a||i.$from.parent.type!==e.schema.nodes[t.listItem])return!1;var s=a&&Ot(a);if(null==s)return!1;o.lift(a,s)}})),n&&n(o),!0}}var Fo=/list\-style\-type:\s?([\w-]+)/,$o=function(t){var e=t.style||"",n=Fo.exec(e);return n&&n[1]||""},Vo=function(t,e,n,o,r){var i=o.listType,a=o.listAttrs,s=void 0===a?{style:null}:a,l=t.selection,c=l.$from.node(l.$from.depth-2),d=l.$to.node(l.$to.depth-2);if(c&&c.type.name===i&&$o(c.attrs)===$o(s)&&d&&d.type.name===i&&$o(d.attrs)===$o(s)){var u=n.state.schema.nodes,p={bulletList:u[o.bulletList],orderedList:u[o.orderedList],listItem:u[o.listItem]},f=function(t,e){for(var n,o=e.bulletList,r=e.orderedList,i=e.listItem,a=t.depth-1;a>0;a--){var s=t.node(a);if(s.type!==o&&s.type!==r||(n=a),s.type!==o&&s.type!==r&&s.type!==i)break}return n}(l.$to,p),h=function(t,e,n,o,r,i){i||(i=t.schema.nodes.listItem);var a=!1;return r.doc.nodesBetween(e,n,(function(n,s){if(!a&&n.type===i&&s>e){a=!0;for(var l=o+3;l>o+2;){var c=r.doc.resolve(r.mapping.map(s));l=c.depth;var d=r.doc.resolve(r.mapping.map(s+n.textContent.length)),u=new oe(c,d);r=Po(t,u,r,i)}}})),r}(t,l.$to.pos,l.$to.end(f),f,n.state.tr,p.listItem);return(h=function(t,e,n){var o=t.selection,r=o.from,i=o.to,a=t.schema.nodes,s=a.paragraph,l=a.heading,c=[];e.doc.nodesBetween(r,i,(function(t,e){t.type!==s&&t.type!==l||c.push({node:t,pos:e})}));for(var d=c.length-1;d>=0;d--){var u=c[d],p=e.doc.resolve(e.mapping.map(u.pos));if(p.depth>0){var f=void 0;f=u.node.textContent&&u.node.textContent.length>0?e.doc.resolve(e.mapping.map(u.pos+u.node.textContent.length)):e.doc.resolve(e.mapping.map(u.pos+1));var h=p.blockRange(f);h&&e.lift(h,zo(t.schema,p,n))}}return e}(t,h,o)).setMeta("commandName",r),e(h),!0}return Ro(o)(t,e,n)};function jo(t,e,n){return Vo(t,e,n,Ne.__assign({listType:Vn.listType},Vn.types))}function Wo(t,e,n){return Vo(t,e,n,Ne.__assign({listType:$n.listType},$n.types))}for(var Ho=function(t,e){return{name:t,value:e}},qo=[{node:"paragraph",style:[Ho("text-align","left")]},{node:"heading",style:[Ho("text-align","left")]}],Jo=[{node:"paragraph",style:[Ho("text-align","right")]},{node:"heading",style:[Ho("text-align","right")]}],Ko=[{node:"paragraph",style:[Ho("text-align","center")]},{node:"heading",style:[Ho("text-align","center")]}],Uo=[{node:"paragraph",style:[Ho("text-align","justify")]},{node:"heading",style:[Ho("text-align","justify")]}],Go=[{node:"paragraph",style:[Ho("text-align","")]},{node:"heading",style:[Ho("text-align","")]}],Xo={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},Yo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},Zo="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Qo="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),tr="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),er="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),nr="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),or=Zo&&(er||+Zo[1]<57)||tr&&er,rr=0;rr<10;rr++)Xo[48+rr]=Xo[96+rr]=String(rr);for(rr=1;rr<=24;rr++)Xo[rr+111]="F"+rr;for(rr=65;rr<=90;rr++)Xo[rr]=String.fromCharCode(rr+32),Yo[rr]=String.fromCharCode(rr);for(var ir in Xo)Yo.hasOwnProperty(ir)||(Yo[ir]=Xo[ir]);var ar="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function sr(t){var e,n,o,r,i=t.split(/-(?!$)/),a=i[i.length-1];"Space"==a&&(a=" ");for(var s=0;s<i.length-1;s++){var l=i[s];if(/^(cmd|meta|m)$/i.test(l))r=!0;else if(/^a(lt)?$/i.test(l))e=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else if(/^s(hift)?$/i.test(l))o=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);ar?r=!0:n=!0}}return e&&(a="Alt-"+a),n&&(a="Ctrl-"+a),r&&(a="Meta-"+a),o&&(a="Shift-"+a),a}function lr(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}function cr(t){return new be({props:{handleKeyDown:dr(t)}})}function dr(t){var e=function(t){var e=Object.create(null);for(var n in t)e[sr(n)]=t[n];return e}(t);return function(t,n){var o,r=function(t){var e=!(or&&(t.ctrlKey||t.altKey||t.metaKey)||(Qo||nr)&&t.shiftKey&&t.key&&1==t.key.length)&&t.key||(t.shiftKey?Yo:Xo)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(n),i=1==r.length&&" "!=r,a=e[lr(r,n,!i)];if(a&&a(t.state,t.dispatch,t))return!0;if(i&&(n.shiftKey||n.altKey||n.metaKey||r.charCodeAt(0)>127)&&(o=Xo[n.keyCode])&&o!=r){var s=e[lr(o,n,!0)];if(s&&s(t.state,t.dispatch,t))return!0}else if(i&&n.shiftKey){var l=e[lr(r,n,!0)];if(l&&l(t.state,t.dispatch,t))return!0}return!1}}var ur={};if("undefined"!=typeof navigator&&"undefined"!=typeof document){var pr=/Edge\/(\d+)/.exec(navigator.userAgent),fr=/MSIE \d/.test(navigator.userAgent),hr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),mr=ur.ie=!!(fr||hr||pr);ur.ie_version=fr?document.documentMode||6:hr?+hr[1]:pr?+pr[1]:null,ur.gecko=!mr&&/gecko\/(\d+)/i.test(navigator.userAgent),ur.gecko_version=ur.gecko&&+(/Firefox\/(\d+)/.exec(navigator.userAgent)||[0,0])[1];var vr=!mr&&/Chrome\/(\d+)/.exec(navigator.userAgent);ur.chrome=!!vr,ur.chrome_version=vr&&+vr[1],ur.safari=!mr&&/Apple Computer/.test(navigator.vendor),ur.ios=ur.safari&&(/Mobile\/\w+/.test(navigator.userAgent)||navigator.maxTouchPoints>2),ur.mac=ur.ios||/Mac/.test(navigator.platform),ur.android=/Android \d/.test(navigator.userAgent),ur.webkit="webkitFontSmoothing"in document.documentElement.style,ur.webkit_version=ur.webkit&&+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]}var gr=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},yr=function(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e},br=null,wr=function(t,e,n){var o=br||(br=document.createRange());return o.setEnd(t,null==n?t.nodeValue.length:n),o.setStart(t,e||0),o},kr=function(t,e,n,o){return n&&(Cr(t,e,n,o,-1)||Cr(t,e,n,o,1))},_r=/^(img|br|input|textarea|hr)$/i;function Cr(t,e,n,o,r){for(;;){if(t==n&&e==o)return!0;if(e==(r<0?0:xr(t))){var i=t.parentNode;if(!i||1!=i.nodeType||Sr(t)||_r.test(t.nodeName)||"false"==t.contentEditable)return!1;e=gr(t)+(r<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(r<0?-1:0)]).contentEditable)return!1;e=r<0?xr(t):0}}}function xr(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Sr(t){for(var e,n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var Er=function(t){var e=t.isCollapsed;return e&&ur.chrome&&t.rangeCount&&!t.getRangeAt(0).collapsed&&(e=!1),e};function Tr(t,e){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Mr(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Dr(t,e){return"number"==typeof t?t:t[e]}function Or(t){var e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function Ar(t,e,n){for(var o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument,a=n||t.dom;a;a=yr(a))if(1==a.nodeType){var s=a==i.body||1!=a.nodeType,l=s?Mr(i):Or(a),c=0,d=0;if(e.top<l.top+Dr(o,"top")?d=-(l.top-e.top+Dr(r,"top")):e.bottom>l.bottom-Dr(o,"bottom")&&(d=e.bottom-l.bottom+Dr(r,"bottom")),e.left<l.left+Dr(o,"left")?c=-(l.left-e.left+Dr(r,"left")):e.right>l.right-Dr(o,"right")&&(c=e.right-l.right+Dr(r,"right")),c||d)if(s)i.defaultView.scrollBy(c,d);else{var u=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);var f=a.scrollLeft-u,h=a.scrollTop-p;e={left:e.left-f,top:e.top-h,right:e.right-f,bottom:e.bottom-h}}if(s)break}}function Ir(t){for(var e=[],n=t.ownerDocument;t&&(e.push({dom:t,top:t.scrollTop,left:t.scrollLeft}),t!=n);t=yr(t));return e}function Br(t,e){for(var n=0;n<t.length;n++){var o=t[n],r=o.dom,i=o.top,a=o.left;r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=a&&(r.scrollLeft=a)}}var Nr=null;function zr(t,e){for(var n,o,r=2e8,i=0,a=e.top,s=e.top,l=t.firstChild,c=0;l;l=l.nextSibling,c++){var d=void 0;if(1==l.nodeType)d=l.getClientRects();else{if(3!=l.nodeType)continue;d=wr(l).getClientRects()}for(var u=0;u<d.length;u++){var p=d[u];if(p.top<=a&&p.bottom>=s){a=Math.max(p.bottom,a),s=Math.min(p.top,s);var f=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(f<r){n=l,r=f,o=f&&3==n.nodeType?{left:p.right<e.left?p.right:p.left,top:e.top}:e,1==l.nodeType&&f&&(i=c+(e.left>=(p.left+p.right)/2?1:0));continue}}!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=c+1)}}return n&&3==n.nodeType?function(t,e){for(var n=t.nodeValue.length,o=document.createRange(),r=0;r<n;r++){o.setEnd(t,r+1),o.setStart(t,r);var i=Lr(o,1);if(i.top!=i.bottom&&Rr(e,i))return{node:t,offset:r+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}(n,o):!n||r&&1==n.nodeType?{node:t,offset:i}:zr(n,o)}function Rr(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Pr(t,e){var n,o,r,i,a=t.dom.ownerDocument;if(a.caretPositionFromPoint)try{var s=a.caretPositionFromPoint(e.left,e.top);s&&(r=(n=s).offsetNode,i=n.offset)}catch(t){}if(!r&&a.caretRangeFromPoint){var l=a.caretRangeFromPoint(e.left,e.top);l&&(r=(o=l).startContainer,i=o.startOffset)}var c,d=(t.root.elementFromPoint?t.root:a).elementFromPoint(e.left,e.top+1);if(!d||!t.dom.contains(1!=d.nodeType?d.parentNode:d)){var u=t.dom.getBoundingClientRect();if(!Rr(e,u))return null;if(!(d=function t(e,n,o){var r=e.childNodes.length;if(r&&o.top<o.bottom)for(var i=Math.max(0,Math.min(r-1,Math.floor(r*(n.top-o.top)/(o.bottom-o.top))-2)),a=i;;){var s=e.childNodes[a];if(1==s.nodeType)for(var l=s.getClientRects(),c=0;c<l.length;c++){var d=l[c];if(Rr(n,d))return t(s,n,d)}if((a=(a+1)%r)==i)break}return e}(t.dom,e,u)))return null}if(ur.safari)for(var p=d;r&&p;p=yr(p))p.draggable&&(r=i=null);if(d=function(t,e){var n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(d,e),r){if(ur.gecko&&1==r.nodeType&&(i=Math.min(i,r.childNodes.length))<r.childNodes.length){var f,h=r.childNodes[i];"IMG"==h.nodeName&&(f=h.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}r==t.dom&&i==r.childNodes.length-1&&1==r.lastChild.nodeType&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:0!=i&&1==r.nodeType&&"BR"==r.childNodes[i-1].nodeName||(c=function(t,e,n,o){for(var r=-1,i=e;i!=t.dom;){var a=t.docView.nearestDesc(i,!0);if(!a)return null;if(a.node.isBlock&&a.parent){var s=a.dom.getBoundingClientRect();if(s.left>o.left||s.top>o.top)r=a.posBefore;else{if(!(s.right<o.left||s.bottom<o.top))break;r=a.posAfter}}i=a.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n)}(t,r,i,e))}null==c&&(c=function(t,e,n){var o=zr(e,n),r=o.node,i=o.offset,a=-1;if(1==r.nodeType&&!r.firstChild){var s=r.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,a)}(t,d,e));var m=t.docView.nearestDesc(d,!0);return{pos:c,inside:m?m.posAtStart-m.border:-1}}function Lr(t,e){var n=t.getClientRects();return n.length?n[e<0?0:n.length-1]:t.getBoundingClientRect()}var Fr=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function $r(t,e,n){var o=t.docView.domFromPos(e,n<0?-1:1),r=o.node,i=o.offset,a=ur.webkit||ur.gecko;if(3==r.nodeType){if(!a||!Fr.test(r.nodeValue)&&(n<0?i:i!=r.nodeValue.length)){var s=i,l=i,c=n<0?1:-1;return n<0&&!i?(l++,c=-1):n>=0&&i==r.nodeValue.length?(s--,c=1):n<0?s--:l++,Vr(Lr(wr(r,s,l),c),c<0)}var d=Lr(wr(r,i,i),n);if(ur.gecko&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){var u=Lr(wr(r,i-1,i-1),-1);if(u.top==d.top){var p=Lr(wr(r,i,i+1),-1);if(p.top!=d.top)return Vr(p,p.left<u.left)}}return d}if(!t.state.doc.resolve(e).parent.inlineContent){if(i&&(n<0||i==xr(r))){var f=r.childNodes[i-1];if(1==f.nodeType)return jr(f.getBoundingClientRect(),!1)}if(i<xr(r)){var h=r.childNodes[i];if(1==h.nodeType)return jr(h.getBoundingClientRect(),!0)}return jr(r.getBoundingClientRect(),n>=0)}if(i&&(n<0||i==xr(r))){var m=r.childNodes[i-1],v=3==m.nodeType?wr(m,xr(m)-(a?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(v)return Vr(Lr(v,1),!1)}if(i<xr(r)){for(var g=r.childNodes[i];g.pmViewDesc&&g.pmViewDesc.ignoreForCoords;)g=g.nextSibling;var y=g?3==g.nodeType?wr(g,0,a?0:1):1==g.nodeType?g:null:null;if(y)return Vr(Lr(y,-1),!0)}return Vr(Lr(3==r.nodeType?wr(r):r,-n),n>=0)}function Vr(t,e){if(0==t.width)return t;var n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function jr(t,e){if(0==t.height)return t;var n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Wr(t,e,n){var o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}var Hr=/[\u0590-\u08ac]/;var qr=null,Jr=null,Kr=!1;function Ur(t,e,n){return qr==e&&Jr==n?Kr:(qr=e,Jr=n,Kr="up"==n||"down"==n?function(t,e,n){var o=e.selection,r="up"==n?o.$from:o.$to;return Wr(t,e,(function(){for(var e=t.docView.domFromPos(r.pos,"up"==n?-1:1).node;;){var o=t.docView.nearestDesc(e,!0);if(!o)break;if(o.node.isBlock){e=o.dom;break}e=o.dom.parentNode}for(var i=$r(t,r.pos,1),a=e.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=wr(a,0,a.nodeValue.length).getClientRects()}for(var l=0;l<s.length;l++){var c=s[l];if(c.bottom>c.top+1&&("up"==n?i.top-c.top>2*(c.bottom-i.top):c.bottom-i.bottom>2*(i.bottom-c.top)))return!1}}return!0}))}(t,e,n):function(t,e,n){var o=e.selection.$head;if(!o.parent.isTextblock)return!1;var r=o.parentOffset,i=!r,a=r==o.parent.content.size,s=t.root.getSelection();return Hr.test(o.parent.textContent)&&s.modify?Wr(t,e,(function(){var e=s.getRangeAt(0),r=s.focusNode,i=s.focusOffset,a=s.caretBidiLevel;s.modify("move",n,"character");var l=!(o.depth?t.docView.domAfterPos(o.before()):t.dom).contains(1==s.focusNode.nodeType?s.focusNode:s.focusNode.parentNode)||r==s.focusNode&&i==s.focusOffset;return s.removeAllRanges(),s.addRange(e),null!=a&&(s.caretBidiLevel=a),l})):"left"==n||"backward"==n?i:a}(t,e,n))}var Gr=function(t,e,n,o){this.parent=t,this.children=e,this.dom=n,n.pmViewDesc=this,this.contentDOM=o,this.dirty=0},Xr={size:{configurable:!0},border:{configurable:!0},posBefore:{configurable:!0},posAtStart:{configurable:!0},posAfter:{configurable:!0},posAtEnd:{configurable:!0},contentLost:{configurable:!0},domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};Gr.prototype.matchesWidget=function(){return!1},Gr.prototype.matchesMark=function(){return!1},Gr.prototype.matchesNode=function(){return!1},Gr.prototype.matchesHack=function(t){return!1},Gr.prototype.parseRule=function(){return null},Gr.prototype.stopEvent=function(){return!1},Xr.size.get=function(){for(var t=0,e=0;e<this.children.length;e++)t+=this.children[e].size;return t},Xr.border.get=function(){return 0},Gr.prototype.destroy=function(){this.parent=null,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=null);for(var t=0;t<this.children.length;t++)this.children[t].destroy()},Gr.prototype.posBeforeChild=function(t){for(var e=0,n=this.posAtStart;e<this.children.length;e++){var o=this.children[e];if(o==t)return n;n+=o.size}},Xr.posBefore.get=function(){return this.parent.posBeforeChild(this)},Xr.posAtStart.get=function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0},Xr.posAfter.get=function(){return this.posBefore+this.size},Xr.posAtEnd.get=function(){return this.posAtStart+this.size-2*this.border},Gr.prototype.localPosFromDOM=function(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){var o,r;if(t==this.contentDOM)o=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.previousSibling}for(;o&&(!(r=o.pmViewDesc)||r.parent!=this);)o=o.previousSibling;return o?this.posBeforeChild(r)+r.size:this.posAtStart}var i,a;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(a=i.pmViewDesc)||a.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(a):this.posAtEnd}var s;if(t==this.dom&&this.contentDOM)s=e>gr(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var l=t;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.parentNode.firstChild!=l)break}if(null==s&&e==t.childNodes.length)for(var c=t;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.parentNode.lastChild!=c)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart},Gr.prototype.nearestDesc=function(t,e){for(var n=!0,o=t;o;o=o.parentNode){var r=this.getDesc(o);if(r&&(!e||r.node)){if(!n||!r.nodeDOM||(1==r.nodeDOM.nodeType?r.nodeDOM.contains(1==t.nodeType?t:t.parentNode):r.nodeDOM==t))return r;n=!1}}},Gr.prototype.getDesc=function(t){for(var e=t.pmViewDesc,n=e;n;n=n.parent)if(n==this)return e},Gr.prototype.posFromDOM=function(t,e,n){for(var o=t;o;o=o.parentNode){var r=this.getDesc(o);if(r)return r.localPosFromDOM(t,e,n)}return-1},Gr.prototype.descAt=function(t){for(var e=0,n=0;e<this.children.length;e++){var o=this.children[e],r=n+o.size;if(n==t&&r!=n){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(t<r)return o.descAt(t-n-o.border);n=r}},Gr.prototype.domFromPos=function(t,e){if(!this.contentDOM)return{node:this.dom,offset:0};for(var n=0,o=0,r=0;n<this.children.length;n++){var i=this.children[n],a=r+i.size;if(a>t||i instanceof ri){o=t-r;break}r=a}if(o)return this.children[n].domFromPos(o-this.children[n].border,e);for(var s=void 0;n&&!(s=this.children[n-1]).size&&s instanceof Zr&&s.widget.type.side>=0;n--);if(e<=0){for(var l,c=!0;(l=n?this.children[n-1]:null)&&l.dom.parentNode!=this.contentDOM;n--,c=!1);return l&&e&&c&&!l.border&&!l.domAtom?l.domFromPos(l.size,e):{node:this.contentDOM,offset:l?gr(l.dom)+1:0}}for(var d,u=!0;(d=n<this.children.length?this.children[n]:null)&&d.dom.parentNode!=this.contentDOM;n++,u=!1);return d&&u&&!d.border&&!d.domAtom?d.domFromPos(0,e):{node:this.contentDOM,offset:d?gr(d.dom):this.contentDOM.childNodes.length}},Gr.prototype.parseRange=function(t,e,n){if(void 0===n&&(n=0),0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var o=-1,r=-1,i=n,a=0;;a++){var s=this.children[a],l=i+s.size;if(-1==o&&t<=l){var c=i+s.border;if(t>=c&&e<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(t,e,c);t=i;for(var d=a;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){o=gr(u.dom)+1;break}t-=u.size}-1==o&&(o=0)}if(o>-1&&(l>e||a==this.children.length-1)){e=l;for(var p=a+1;p<this.children.length;p++){var f=this.children[p];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){r=gr(f.dom);break}e+=f.size}-1==r&&(r=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:t,to:e,fromOffset:o,toOffset:r}},Gr.prototype.emptyChildAt=function(t){if(this.border||!this.contentDOM||!this.children.length)return!1;var e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)},Gr.prototype.domAfterPos=function(t){var e=this.domFromPos(t,0),n=e.node,o=e.offset;if(1!=n.nodeType||o==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[o]},Gr.prototype.setSelection=function(t,e,n,o){for(var r=Math.min(t,e),i=Math.max(t,e),a=0,s=0;a<this.children.length;a++){var l=this.children[a],c=s+l.size;if(r>s&&i<c)return l.setSelection(t-s-l.border,e-s-l.border,n,o);s=c}var d=this.domFromPos(t,t?-1:1),u=e==t?d:this.domFromPos(e,e?-1:1),p=n.getSelection(),f=!1;if((ur.gecko||ur.safari)&&t==e){var h=d.node,m=d.offset;if(3==h.nodeType){if((f=m&&"\n"==h.nodeValue[m-1])&&m==h.nodeValue.length)for(var v=h,g=void 0;v;v=v.parentNode){if(g=v.nextSibling){"BR"==g.nodeName&&(d=u={node:g.parentNode,offset:gr(g)+1});break}var y=v.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{var b=h.childNodes[m-1];f=b&&("BR"==b.nodeName||"false"==b.contentEditable)}}if(ur.gecko&&p.focusNode&&p.focusNode!=u.node&&1==p.focusNode.nodeType){var w=p.focusNode.childNodes[p.focusOffset];w&&"false"==w.contentEditable&&(o=!0)}if(o||f&&ur.safari||!kr(d.node,d.offset,p.anchorNode,p.anchorOffset)||!kr(u.node,u.offset,p.focusNode,p.focusOffset)){var k=!1;if((p.extend||t==e)&&!f){p.collapse(d.node,d.offset);try{t!=e&&p.extend(u.node,u.offset),k=!0}catch(t){if(!(t instanceof DOMException))throw t}}if(!k){if(t>e){var _=d;d=u,u=_}var C=document.createRange();C.setEnd(u.node,u.offset),C.setStart(d.node,d.offset),p.removeAllRanges(),p.addRange(C)}}},Gr.prototype.ignoreMutation=function(t){return!this.contentDOM&&"selection"!=t.type},Xr.contentLost.get=function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)},Gr.prototype.markDirty=function(t,e){for(var n=0,o=0;o<this.children.length;o++){var r=this.children[o],i=n+r.size;if(n==i?t<=i&&e>=n:t<i&&e>n){var a=n+r.border,s=i-r.border;if(t>=a&&e<=s)return this.dirty=t==n||e==i?2:1,void(t!=a||e!=s||!r.contentLost&&r.dom.parentNode==this.contentDOM?r.markDirty(t-a,e-a):r.dirty=3);r.dirty=r.dom!=r.contentDOM||r.dom.parentNode!=this.contentDOM||r.children.length?3:2}n=i}this.dirty=2},Gr.prototype.markParentsDirty=function(){for(var t=1,e=this.parent;e;e=e.parent,t++){var n=1==t?2:1;e.dirty<n&&(e.dirty=n)}},Xr.domAtom.get=function(){return!1},Xr.ignoreForCoords.get=function(){return!1},Object.defineProperties(Gr.prototype,Xr);var Yr=[],Zr=function(t){function e(e,n,o,r){var i,a=n.type.toDOM;if("function"==typeof a&&(a=a(o,(function(){return i?i.parent?i.parent.posBeforeChild(i):void 0:r}))),!n.type.spec.raw){if(1!=a.nodeType){var s=document.createElement("span");s.appendChild(a),a=s}a.contentEditable=!1,a.classList.add("ProseMirror-widget")}t.call(this,e,Yr,a,null),this.widget=n,i=this}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.matchesWidget=function(t){return 0==this.dirty&&t.type.eq(this.widget.type)},e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.stopEvent=function(t){var e=this.widget.spec.stopEvent;return!!e&&e(t)},e.prototype.ignoreMutation=function(t){return"selection"!=t.type||this.widget.spec.ignoreSelection},e.prototype.destroy=function(){this.widget.type.destroy(this.dom),t.prototype.destroy.call(this)},n.domAtom.get=function(){return!0},Object.defineProperties(e.prototype,n),e}(Gr),Qr=function(t){function e(e,n,o,r){t.call(this,e,Yr,n,null),this.textDOM=o,this.text=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0}};return n.size.get=function(){return this.text.length},e.prototype.localPosFromDOM=function(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e},e.prototype.domFromPos=function(t){return{node:this.textDOM,offset:t}},e.prototype.ignoreMutation=function(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue},Object.defineProperties(e.prototype,n),e}(Gr),ti=function(t){function e(e,n,o,r){t.call(this,e,[],o,r),this.mark=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.create=function(t,n,o,r){var i=r.nodeViews[n.type.name],a=i&&i(n,r,o);return a&&a.dom||(a=ut.renderSpec(document,n.type.spec.toDOM(n,o))),new e(t,n,a.dom,a.contentDOM||a.dom)},e.prototype.parseRule=function(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}},e.prototype.matchesMark=function(t){return 3!=this.dirty&&this.mark.eq(t)},e.prototype.markDirty=function(e,n){if(t.prototype.markDirty.call(this,e,n),0!=this.dirty){for(var o=this.parent;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=0}},e.prototype.slice=function(t,n,o){var r=e.create(this.parent,this.mark,!0,o),i=this.children,a=this.size;n<a&&(i=vi(i,n,a,o)),t>0&&(i=vi(i,0,t,o));for(var s=0;s<i.length;s++)i[s].parent=r;return r.children=i,r},e}(Gr),ei=function(t){function e(e,n,o,r,i,a,s,l,c){t.call(this,e,n.isLeaf?Yr:[],i,a),this.nodeDOM=s,this.node=n,this.outerDeco=o,this.innerDeco=r,a&&this.updateChildren(l,c)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={size:{configurable:!0},border:{configurable:!0},domAtom:{configurable:!0}};return e.create=function(t,n,o,r,i,a){var s,l,c=i.nodeViews[n.type.name],d=c&&c(n,i,(function(){return l?l.parent?l.parent.posBeforeChild(l):void 0:a}),o,r),u=d&&d.dom,p=d&&d.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else u||(u=(s=ut.renderSpec(document,n.type.spec.toDOM(n))).dom,p=s.contentDOM);p||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable=!1),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=ui(u,o,n),d?l=new ii(t,n,o,r,u,p,f,d,i,a+1):n.isText?new oi(t,n,o,r,u,f,i):new e(t,n,o,r,u,p,f,i,a+1)},e.prototype.parseRule=function(){var t=this;if(this.node.type.spec.reparseInView)return null;var e={node:this.node.type.name,attrs:this.node.attrs};return"pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM&&!this.contentLost?e.contentElement=this.contentDOM:e.getContent=function(){return t.contentDOM?i.empty:t.node.content},e},e.prototype.matchesNode=function(t,e,n){return 0==this.dirty&&t.eq(this.node)&&pi(e,this.outerDeco)&&n.eq(this.innerDeco)},n.size.get=function(){return this.node.nodeSize},n.border.get=function(){return this.node.isLeaf?0:1},e.prototype.updateChildren=function(t,e){var n=this,o=this.node.inlineContent,r=e,i=t.composing&&this.localCompositionInfo(t,e),a=i&&i.pos>-1?i:null,s=i&&i.pos<0,l=new hi(this,a&&a.node);!function(t,e,n,o){var r=e.locals(t),i=0;if(0==r.length){for(var a=0;a<t.childCount;a++){var s=t.child(a);o(s,r,e.forChild(i,s),a),i+=s.nodeSize}return}for(var l=0,c=[],d=null,u=0;;){if(l<r.length&&r[l].to==i){for(var p=r[l++],f=void 0;l<r.length&&r[l].to==i;)(f||(f=[p])).push(r[l++]);if(f){f.sort(mi);for(var h=0;h<f.length;h++)n(f[h],u,!!d)}else n(p,u,!!d)}var m=void 0,v=void 0;if(d)v=-1,m=d,d=null;else{if(!(u<t.childCount))break;v=u,m=t.child(u++)}for(var g=0;g<c.length;g++)c[g].to<=i&&c.splice(g--,1);for(;l<r.length&&r[l].from<=i&&r[l].to>i;)c.push(r[l++]);var y=i+m.nodeSize;if(m.isText){var b=y;l<r.length&&r[l].from<b&&(b=r[l].from);for(var w=0;w<c.length;w++)c[w].to<b&&(b=c[w].to);b<y&&(d=m.cut(b-i),m=m.cut(0,b-i),y=b,v=-1)}var k=c.length?m.isInline&&!m.isLeaf?c.filter((function(t){return!t.inline})):c.slice():Yr;o(m,k,e.forChild(i,m),v),i=y}}(this.node,this.innerDeco,(function(e,i,a){e.spec.marks?l.syncToMarks(e.spec.marks,o,t):e.type.side>=0&&!a&&l.syncToMarks(i==n.node.childCount?d.none:n.node.child(i).marks,o,t),l.placeWidget(e,t,r)}),(function(e,n,a,c){var d;l.syncToMarks(e.marks,o,t),l.findNodeMatch(e,n,a,c)||s&&t.state.selection.from>r&&t.state.selection.to<r+e.nodeSize&&(d=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(e,n,a,d,t)||l.updateNextNode(e,n,a,t,c)||l.addNode(e,n,a,t,r),r+=e.nodeSize})),l.syncToMarks(Yr,o,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(a&&this.protectLocalComposition(t,a),function t(e,n,o){for(var r=e.firstChild,i=!1,a=0;a<n.length;a++){var s=n[a],l=s.dom;if(l.parentNode==e){for(;l!=r;)r=fi(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(l,r);if(s instanceof ti){var c=r?r.previousSibling:e.lastChild;t(s.contentDOM,s.children,o),r=c?c.nextSibling:e.firstChild}}for(;r;)r=fi(r),i=!0;i&&o.trackWrites==e&&(o.trackWrites=null)}(this.contentDOM,this.children,t),ur.ios&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))},e.prototype.localCompositionInfo=function(t,e){var n=t.state.selection,o=n.from,r=n.to;if(!(!(t.state.selection instanceof oe)||o<e||r>e+this.node.content.size)){var i=t.root.getSelection(),a=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];t=t.childNodes[e-1],e=xr(t)}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(i.focusNode,i.focusOffset);if(a&&this.dom.contains(a.parentNode)){if(this.node.inlineContent){var s=a.nodeValue,l=function(t,e,n,o){for(var r=0,i=0;r<t.childCount&&i<=o;){var a=t.child(r++),s=i;if(i+=a.nodeSize,a.isText){for(var l=a.text;r<t.childCount;){var c=t.child(r++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n&&s<o){var d=l.lastIndexOf(e,o-s-1);if(d>=0&&d+e.length+s>=n)return s+d}}}return-1}(this.node.content,s,o-e,r-e);return l<0?null:{node:a,pos:l,text:s}}return{node:a,pos:-1}}}},e.prototype.protectLocalComposition=function(t,e){var n=e.node,o=e.pos,r=e.text;if(!this.getDesc(n)){for(var i=n;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=null)}var a=new Qr(this,i,n,r);t.compositionNodes.push(a),this.children=vi(this.children,o,o+r.length,t,a)}},e.prototype.update=function(t,e,n,o){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,o),!0)},e.prototype.updateInner=function(t,e,n,o){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=0},e.prototype.updateOuterDeco=function(t){if(!pi(t,this.outerDeco)){var e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ci(this.dom,this.nodeDOM,li(this.outerDeco,this.node,e),li(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=null,this.dom.pmViewDesc=this),this.outerDeco=t}},e.prototype.selectNode=function(){this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)},e.prototype.deselectNode=function(){this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")},n.domAtom.get=function(){return this.node.isAtom},Object.defineProperties(e.prototype,n),e}(Gr);function ni(t,e,n,o,r){return ui(o,e,t),new ei(null,t,e,n,o,o,o,r,0)}var oi=function(t){function e(e,n,o,r,i,a,s){t.call(this,e,n,o,r,i,null,a,s)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0}};return e.prototype.parseRule=function(){for(var t=this.nodeDOM.parentNode;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}},e.prototype.update=function(t,e,n,o){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=t,this.dirty=0,!0)},e.prototype.inParent=function(){for(var t=this.parent.contentDOM,e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1},e.prototype.domFromPos=function(t){return{node:this.nodeDOM,offset:t}},e.prototype.localPosFromDOM=function(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):t.prototype.localPosFromDOM.call(this,e,n,o)},e.prototype.ignoreMutation=function(t){return"characterData"!=t.type&&"selection"!=t.type},e.prototype.slice=function(t,n,o){var r=this.node.cut(t,n),i=document.createTextNode(r.text);return new e(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)},e.prototype.markDirty=function(e,n){t.prototype.markDirty.call(this,e,n),this.dom==this.nodeDOM||0!=e&&n!=this.nodeDOM.nodeValue.length||(this.dirty=3)},n.domAtom.get=function(){return!1},Object.defineProperties(e.prototype,n),e}(ei),ri=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={domAtom:{configurable:!0},ignoreForCoords:{configurable:!0}};return e.prototype.parseRule=function(){return{ignore:!0}},e.prototype.matchesHack=function(t){return 0==this.dirty&&this.dom.nodeName==t},n.domAtom.get=function(){return!0},n.ignoreForCoords.get=function(){return"IMG"==this.dom.nodeName},Object.defineProperties(e.prototype,n),e}(Gr),ii=function(t){function e(e,n,o,r,i,a,s,l,c,d){t.call(this,e,n,o,r,i,a,s,c,d),this.spec=l}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.update=function(e,n,o,r){if(3==this.dirty)return!1;if(this.spec.update){var i=this.spec.update(e,n,o);return i&&this.updateInner(e,n,o,r),i}return!(!this.contentDOM&&!e.isLeaf)&&t.prototype.update.call(this,e,n,o,r)},e.prototype.selectNode=function(){this.spec.selectNode?this.spec.selectNode():t.prototype.selectNode.call(this)},e.prototype.deselectNode=function(){this.spec.deselectNode?this.spec.deselectNode():t.prototype.deselectNode.call(this)},e.prototype.setSelection=function(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o):t.prototype.setSelection.call(this,e,n,o,r)},e.prototype.destroy=function(){this.spec.destroy&&this.spec.destroy(),t.prototype.destroy.call(this)},e.prototype.stopEvent=function(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)},e.prototype.ignoreMutation=function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):t.prototype.ignoreMutation.call(this,e)},e}(ei);function ai(t){t&&(this.nodeName=t)}ai.prototype=Object.create(null);var si=[new ai];function li(t,e,n){if(0==t.length)return si;for(var o=n?si[0]:new ai,r=[o],i=0;i<t.length;i++){var a=t[i].type.attrs;if(a)for(var s in a.nodeName&&r.push(o=new ai(a.nodeName)),a){var l=a[s];null!=l&&(n&&1==r.length&&r.push(o=new ai(e.isInline?"span":"div")),"class"==s?o.class=(o.class?o.class+" ":"")+l:"style"==s?o.style=(o.style?o.style+";":"")+l:"nodeName"!=s&&(o[s]=l))}}return r}function ci(t,e,n,o){if(n==si&&o==si)return e;for(var r=e,i=0;i<o.length;i++){var a=o[i],s=n[i];if(i){var l=void 0;s&&s.nodeName==a.nodeName&&r!=t&&(l=r.parentNode)&&l.tagName.toLowerCase()==a.nodeName||((l=document.createElement(a.nodeName)).pmIsDeco=!0,l.appendChild(r),s=si[0]),r=l}di(r,s||si[0],a)}return r}function di(t,e,n){for(var o in e)"class"==o||"style"==o||"nodeName"==o||o in n||t.removeAttribute(o);for(var r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){for(var i=e.class?e.class.split(" ").filter(Boolean):Yr,a=n.class?n.class.split(" ").filter(Boolean):Yr,s=0;s<i.length;s++)-1==a.indexOf(i[s])&&t.classList.remove(i[s]);for(var l=0;l<a.length;l++)-1==i.indexOf(a[l])&&t.classList.add(a[l]);0==t.classList.length&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(e.style);)t.style.removeProperty(c[1]);n.style&&(t.style.cssText+=n.style)}}function ui(t,e,n){return ci(t,t,si,li(e,n,1!=t.nodeType))}function pi(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function fi(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}var hi=function(t,e){this.top=t,this.lock=e,this.index=0,this.stack=[],this.changed=!1,this.preMatch=function(t,e){var n=e,o=n.children.length,r=t.childCount,i=new Map,a=[];t:for(;r>0;){for(var s=void 0;;)if(o){var l=n.children[o-1];if(!(l instanceof ti)){s=l,o--;break}n=l,o=l.children.length}else{if(n==e)break t;o=n.parent.children.indexOf(n),n=n.parent}var c=s.node;if(c){if(c!=t.child(r-1))break;--r,i.set(s,r),a.push(s)}}return{index:r,matched:i,matches:a.reverse()}}(t.node.content,t)};function mi(t,e){return t.type.side-e.type.side}function vi(t,e,n,o,r){for(var i=[],a=0,s=0;a<t.length;a++){var l=t[a],c=s,d=s+=l.size;c>=n||d<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,o)),r&&(i.push(r),r=null),d>n&&i.push(l.slice(n-c,l.size,o)))}return i}function gi(t,e){var n=t.root.getSelection(),o=t.state.doc;if(!n.focusNode)return null;var r=t.docView.nearestDesc(n.focusNode),i=r&&0==r.size,a=t.docView.posFromDOM(n.focusNode,n.focusOffset);if(a<0)return null;var s,l,c=o.resolve(a);if(Er(n)){for(s=c;r&&!r.node;)r=r.parent;if(r&&r.node.isAtom&&ie.isSelectable(r.node)&&r.parent&&(!r.node.isInline||!function(t,e,n){for(var o=0==e,r=e==xr(t);o||r;){if(t==n)return!0;var i=gr(t);if(!(t=t.parentNode))return!1;o=o&&0==i,r=r&&i==xr(t)}}(n.focusNode,n.focusOffset,r.dom))){var d=r.posBefore;l=new ie(a==d?c:o.resolve(d))}}else{var u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset);if(u<0)return null;s=o.resolve(u)}l||(l=Ei(t,s,c,"pointer"==e||t.state.selection.head<c.pos&&!i?1:-1));return l}function yi(t){return t.editable?t.hasFocus():Ti(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function bi(t,e){var n=t.state.selection;if(xi(t,n),yi(t)){if(!e&&t.mouseDown&&t.mouseDown.allowDefault&&ur.chrome){var o=t.root.getSelection(),r=t.domObserver.currentSelection;if(o.anchorNode&&kr(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset))return t.mouseDown.delayedSelectionSync=!0,void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){var e=t.root.getSelection(),n=document.createRange(),o=t.cursorWrapper.dom,r="IMG"==o.nodeName;r?n.setEnd(o.parentNode,gr(o)+1):n.setEnd(o,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!r&&!t.state.selection.visible&&ur.ie&&ur.ie_version<=11&&(o.disabled=!0,o.disabled=!1)}(t);else{var i,a,s=n.anchor,l=n.head;!wi||n instanceof oe||(n.$from.parent.inlineContent||(i=ki(t,n.from)),n.empty||n.$from.parent.inlineContent||(a=ki(t,n.to))),t.docView.setSelection(s,l,t.root,e),wi&&(i&&Ci(i),a&&Ci(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){var e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.hideSelectionGuard);var n=t.root.getSelection(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.hideSelectionGuard=function(){n.anchorNode==o&&n.anchorOffset==r||(e.removeEventListener("selectionchange",t.hideSelectionGuard),setTimeout((function(){yi(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}hi.prototype.destroyBetween=function(t,e){if(t!=e){for(var n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}},hi.prototype.destroyRest=function(){this.destroyBetween(this.index,this.top.children.length)},hi.prototype.syncToMarks=function(t,e,n){for(var o=0,r=this.stack.length>>1,i=Math.min(r,t.length);o<i&&(o==r-1?this.top:this.stack[o+1<<1]).matchesMark(t[o])&&!1!==t[o].type.spec.spanning;)o++;for(;o<r;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),r--;for(;r<t.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++)if(this.top.children[s].matchesMark(t[r])){a=s;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=ti.create(this.top,t[r],e,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,r++}},hi.prototype.findNodeMatch=function(t,e,n,o){var r,i=-1;if(o>=this.preMatch.index&&(r=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&r.matchesNode(t,e,n))i=this.top.children.indexOf(r,this.index);else for(var a=this.index,s=Math.min(this.top.children.length,a+5);a<s;a++){var l=this.top.children[a];if(l.matchesNode(t,e,n)&&!this.preMatch.matched.has(l)){i=a;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)},hi.prototype.updateNodeAt=function(t,e,n,o,r){return!!this.top.children[o].update(t,e,n,r)&&(this.destroyBetween(this.index,o),this.index=o+1,!0)},hi.prototype.findIndexWithChild=function(t){for(;;){var e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){var n=t.pmViewDesc;if(n)for(var o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==n)return o;return-1}t=e}},hi.prototype.updateNextNode=function(t,e,n,o,r){for(var i=this.index;i<this.top.children.length;i++){var a=this.top.children[i];if(a instanceof ei){var s=this.preMatch.matched.get(a);if(null!=s&&s!=r)return!1;var l=a.dom;if(!(this.lock&&(l==this.lock||1==l.nodeType&&l.contains(this.lock.parentNode))&&!(t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&3!=a.dirty&&pi(e,a.outerDeco)))&&a.update(t,e,n,o))return this.destroyBetween(this.index,i),a.dom!=l&&(this.changed=!0),this.index++,!0;break}}return!1},hi.prototype.addNode=function(t,e,n,o,r){this.top.children.splice(this.index++,0,ei.create(this.top,t,e,n,o,r)),this.changed=!0},hi.prototype.placeWidget=function(t,e,n){var o=this.index<this.top.children.length?this.top.children[this.index]:null;if(!o||!o.matchesWidget(t)||t!=o.widget&&o.widget.type.toDOM.parentNode){var r=new Zr(this.top,t,e,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++},hi.prototype.addTextblockHacks=function(){for(var t=this.top.children[this.index-1];t instanceof ti;)t=t.children[t.children.length-1];t&&t instanceof oi&&!/\n$/.test(t.node.text)||((ur.safari||ur.chrome)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG"),this.addHackNode("BR"))},hi.prototype.addHackNode=function(t){if(this.index<this.top.children.length&&this.top.children[this.index].matchesHack(t))this.index++;else{var e=document.createElement(t);"IMG"==t&&(e.className="ProseMirror-separator"),"BR"==t&&(e.className="ProseMirror-trailingBreak"),this.top.children.splice(this.index++,0,new ri(this.top,Yr,e,null)),this.changed=!0}};var wi=ur.safari||ur.chrome&&ur.chrome_version<63;function ki(t,e){var n=t.docView.domFromPos(e,0),o=n.node,r=n.offset,i=r<o.childNodes.length?o.childNodes[r]:null,a=r?o.childNodes[r-1]:null;if(ur.safari&&i&&"false"==i.contentEditable)return _i(i);if(!(i&&"false"!=i.contentEditable||a&&"false"!=a.contentEditable)){if(i)return _i(i);if(a)return _i(a)}}function _i(t){return t.contentEditable="true",ur.safari&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Ci(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function xi(t,e){if(e instanceof ie){var n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Si(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Si(t)}function Si(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=null)}function Ei(t,e,n,o){return t.someProp("createSelectionBetween",(function(o){return o(t,e,n)}))||oe.between(e,n,o)}function Ti(t){var e=t.root.getSelection();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Mi(t,e){var n=t.selection,o=n.$anchor,r=n.$head,i=e>0?o.max(r):o.min(r),a=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return a&&te.findFrom(a,e)}function Di(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Oi(t,e,n){var o=t.state.selection;if(!(o instanceof oe)){if(o instanceof ie&&o.node.isInline)return Di(t,new oe(e>0?o.$to:o.$from));var r=Mi(t.state,e);return!!r&&Di(t,r)}if(!o.empty||n.indexOf("s")>-1)return!1;if(t.endOfTextblock(e>0?"right":"left")){var i=Mi(t.state,e);return!!(i&&i instanceof ie)&&Di(t,i)}if(!(ur.mac&&n.indexOf("m")>-1)){var a,s=o.$head,l=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText)return!1;var c=e<0?s.pos-l.nodeSize:s.pos;return!!(l.isAtom||(a=t.docView.descAt(c))&&!a.contentDOM)&&(ie.isSelectable(l)?Di(t,new ie(e<0?t.state.doc.resolve(s.pos-l.nodeSize):s)):!!ur.webkit&&Di(t,new oe(t.state.doc.resolve(e<0?c:c+l.nodeSize))))}}function Ai(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Ii(t){var e=t.pmViewDesc;return e&&0==e.size&&(t.nextSibling||"BR"!=t.nodeName)}function Bi(t){var e=t.root.getSelection(),n=e.focusNode,o=e.focusOffset;if(n){var r,i,a=!1;for(ur.gecko&&1==n.nodeType&&o<Ai(n)&&Ii(n.childNodes[o])&&(a=!0);;)if(o>0){if(1!=n.nodeType)break;var s=n.childNodes[o-1];if(Ii(s))r=n,i=--o;else{if(3!=s.nodeType)break;o=(n=s).nodeValue.length}}else{if(zi(n))break;for(var l=n.previousSibling;l&&Ii(l);)r=n.parentNode,i=gr(l),l=l.previousSibling;if(l)o=Ai(n=l);else{if((n=n.parentNode)==t.dom)break;o=0}}a?Ri(t,e,n,o):r&&Ri(t,e,r,i)}}function Ni(t){var e=t.root.getSelection(),n=e.focusNode,o=e.focusOffset;if(n){for(var r,i,a=Ai(n);;)if(o<a){if(1!=n.nodeType)break;if(!Ii(n.childNodes[o]))break;r=n,i=++o}else{if(zi(n))break;for(var s=n.nextSibling;s&&Ii(s);)r=s.parentNode,i=gr(s)+1,s=s.nextSibling;if(s)o=0,a=Ai(n=s);else{if((n=n.parentNode)==t.dom)break;o=a=0}}r&&Ri(t,e,r,i)}}function zi(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Ri(t,e,n,o){if(Er(e)){var r=document.createRange();r.setEnd(n,o),r.setStart(n,o),e.removeAllRanges(),e.addRange(r)}else e.extend&&e.extend(n,o);t.domObserver.setCurSelection();var i=t.state;setTimeout((function(){t.state==i&&bi(t)}),50)}function Pi(t,e,n){var o=t.state.selection;if(o instanceof oe&&!o.empty||n.indexOf("s")>-1)return!1;if(ur.mac&&n.indexOf("m")>-1)return!1;var r=o.$from,i=o.$to;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){var a=Mi(t.state,e);if(a&&a instanceof ie)return Di(t,a)}if(!r.parent.inlineContent){var s=e<0?r:i,l=o instanceof se?te.near(s,e):te.findFrom(s,e);return!!l&&Di(t,l)}return!1}function Li(t,e){if(!(t.state.selection instanceof oe))return!0;var n=t.state.selection,o=n.$head,r=n.$anchor,i=n.empty;if(!o.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;var a=!o.textOffset&&(e<0?o.nodeBefore:o.nodeAfter);if(a&&!a.isText){var s=t.state.tr;return e<0?s.delete(o.pos-a.nodeSize,o.pos):s.delete(o.pos,o.pos+a.nodeSize),t.dispatch(s),!0}return!1}function Fi(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function $i(t,e){var n=e.keyCode,o=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);return 8==n||ur.mac&&72==n&&"c"==o?Li(t,-1)||Bi(t):46==n||ur.mac&&68==n&&"c"==o?Li(t,1)||Ni(t):13==n||27==n||(37==n?Oi(t,-1,o)||Bi(t):39==n?Oi(t,1,o)||Ni(t):38==n?Pi(t,-1,o)||Bi(t):40==n?function(t){if(ur.safari&&!(t.state.selection.$head.parentOffset>0)){var e=t.root.getSelection(),n=e.focusNode,o=e.focusOffset;if(n&&1==n.nodeType&&0==o&&n.firstChild&&"false"==n.firstChild.contentEditable){var r=n.firstChild;Fi(t,r,!0),setTimeout((function(){return Fi(t,r,!1)}),20)}}}(t)||Pi(t,1,o)||Ni(t):o==(ur.mac?"m":"c")&&(66==n||73==n||89==n||90==n))}function Vi(t){var e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(ur.safari&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||ur.safari&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0}}function ji(t,e,n,o,r){if(e<0){var a=t.lastSelectionTime>Date.now()-50?t.lastSelectionOrigin:null,s=gi(t,a);if(s&&!t.state.selection.eq(s)){var l=t.state.tr.setSelection(s);"pointer"==a?l.setMeta("pointer",!0):"key"==a&&l.scrollIntoView(),t.dispatch(l)}}else{var c=t.state.doc.resolve(e),d=c.sharedDepth(n);e=c.before(d+1),n=t.state.doc.resolve(n).after(d+1);var u=t.state.selection,p=function(t,e,n){var o=t.docView.parseRange(e,n),r=o.node,i=o.fromOffset,a=o.toOffset,s=o.from,l=o.to,c=t.root.getSelection(),d=null,u=c.anchorNode;if(u&&t.dom.contains(1==u.nodeType?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Er(c)||d.push({node:c.focusNode,offset:c.focusOffset})),ur.chrome&&8===t.lastKeyCode)for(var p=a;p>i;p--){var f=r.childNodes[p-1],h=f.pmViewDesc;if("BR"==f.nodeName&&!h){a=p;break}if(!h||h.size)break}var m=t.state.doc,v=t.someProp("domParser")||tt.fromSchema(t.state.schema),g=m.resolve(s),y=null,b=v.parse(r,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:i,to:a,preserveWhitespace:"pre"!=g.parent.type.whitespace||"full",editableContent:!0,findPositions:d,ruleFromNode:Vi,context:g});if(d&&null!=d[0].pos){var w=d[0].pos,k=d[1]&&d[1].pos;null==k&&(k=w),y={anchor:w+s,head:k+s}}return{doc:b,sel:y,from:s,to:l}}(t,e,n);if(ur.chrome&&t.cursorWrapper&&p.sel&&p.sel.anchor==t.cursorWrapper.deco.from){var f=t.cursorWrapper.deco.type.toDOM.nextSibling,h=f&&f.nodeValue?f.nodeValue.length:1;p.sel={anchor:p.sel.anchor+h,head:p.sel.anchor+h}}var m,v,g=t.state.doc,y=g.slice(p.from,p.to);8===t.lastKeyCode&&Date.now()-100<t.lastKeyCodeTime?(m=t.state.selection.to,v="end"):(m=t.state.selection.from,v="start"),t.lastKeyCode=null;var b=function(t,e,n,o,r){var i=t.findDiffStart(e,n);if(null==i)return null;var a=t.findDiffEnd(e,n+t.size,n+e.size),s=a.a,l=a.b;if("end"==r){var c=Math.max(0,i-Math.min(s,l));o-=s+c-i}if(s<i&&t.size<e.size){l=(i-=o<=i&&o>=s?i-o:0)+(l-s),s=i}else if(l<i){s=(i-=o<=i&&o>=l?i-o:0)+(s-l),l=i}return{start:i,endA:s,endB:l}}(y.content,p.doc.content,p.from,m,v);if(!b){if(!(o&&u instanceof oe&&!u.empty&&u.$head.sameParent(u.$anchor))||t.composing||p.sel&&p.sel.anchor!=p.sel.head){if((ur.ios&&t.lastIOSEnter>Date.now()-225||ur.android)&&r.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName}))&&t.someProp("handleKeyDown",(function(e){return e(t,Tr(13,"Enter"))})))return void(t.lastIOSEnter=0);if(p.sel){var w=Wi(t,t.state.doc,p.sel);w&&!w.eq(t.state.selection)&&t.dispatch(t.state.tr.setSelection(w))}return}b={start:u.from,endA:u.to,endB:u.to}}t.domChangeCount++,t.state.selection.from<t.state.selection.to&&b.start==b.endB&&t.state.selection instanceof oe&&(b.start>t.state.selection.from&&b.start<=t.state.selection.from+2?b.start=t.state.selection.from:b.endA<t.state.selection.to&&b.endA>=t.state.selection.to-2&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),ur.ie&&ur.ie_version<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>p.from&&"  "==p.doc.textBetween(b.start-p.from-1,b.start-p.from+1)&&(b.start--,b.endA--,b.endB--);var k,_=p.doc.resolveNoCache(b.start-p.from),C=p.doc.resolveNoCache(b.endB-p.from),x=_.sameParent(C)&&_.parent.inlineContent;if((ur.ios&&t.lastIOSEnter>Date.now()-225&&(!x||r.some((function(t){return"DIV"==t.nodeName||"P"==t.nodeName})))||!x&&_.pos<p.doc.content.size&&(k=te.findFrom(p.doc.resolve(_.pos+1),1,!0))&&k.head==C.pos)&&t.someProp("handleKeyDown",(function(e){return e(t,Tr(13,"Enter"))})))t.lastIOSEnter=0;else if(t.state.selection.anchor>b.start&&function(t,e,n,o,r){if(!o.parent.isTextblock||n-e<=r.pos-o.pos||Hi(o,!0,!1)<r.pos)return!1;var i=t.resolve(e);if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var a=t.resolve(Hi(i,!0,!0));if(!a.parent.isTextblock||a.pos>n||Hi(a,!0,!1)<n)return!1;return o.parent.content.cut(o.parentOffset).eq(a.parent.content)}(g,b.start,b.endA,_,C)&&t.someProp("handleKeyDown",(function(e){return e(t,Tr(8,"Backspace"))})))ur.android&&ur.chrome&&t.domObserver.suppressSelectionUpdates();else{ur.chrome&&ur.android&&b.toB==b.from&&(t.lastAndroidDelete=Date.now()),ur.android&&!x&&_.start()!=C.start()&&0==C.parentOffset&&_.depth==C.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==b.endA&&(b.endB-=2,C=p.doc.resolveNoCache(b.endB-p.from),setTimeout((function(){t.someProp("handleKeyDown",(function(e){return e(t,Tr(13,"Enter"))}))}),20));var S,E,T,M,D=b.start,O=b.endA;if(x)if(_.pos==C.pos)ur.ie&&ur.ie_version<=11&&0==_.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((function(){return bi(t)}),20)),S=t.state.tr.delete(D,O),E=g.resolve(b.start).marksAcross(g.resolve(b.endA));else if(b.endA==b.endB&&(M=g.resolve(b.start))&&(T=function(t,e){for(var n,o,r,a=t.firstChild.marks,s=e.firstChild.marks,l=a,c=s,d=0;d<s.length;d++)l=s[d].removeFromSet(l);for(var u=0;u<a.length;u++)c=a[u].removeFromSet(c);if(1==l.length&&0==c.length)o=l[0],n="add",r=function(t){return t.mark(o.addToSet(t.marks))};else{if(0!=l.length||1!=c.length)return null;o=c[0],n="remove",r=function(t){return t.mark(o.removeFromSet(t.marks))}}for(var p=[],f=0;f<e.childCount;f++)p.push(r(e.child(f)));if(i.from(p).eq(t))return{mark:o,type:n}}(_.parent.content.cut(_.parentOffset,C.parentOffset),M.parent.content.cut(M.parentOffset,b.endA-M.start()))))S=t.state.tr,"add"==T.type?S.addMark(D,O,T.mark):S.removeMark(D,O,T.mark);else if(_.parent.child(_.index()).isText&&_.index()==C.index()-(C.textOffset?0:1)){var A=_.parent.textBetween(_.parentOffset,C.parentOffset);if(t.someProp("handleTextInput",(function(e){return e(t,D,O,A)})))return;S=t.state.tr.insertText(A,D,O)}if(S||(S=t.state.tr.replace(D,O,p.doc.slice(b.start-p.from,b.endB-p.from))),p.sel){var I=Wi(t,S.doc,p.sel);I&&!(ur.chrome&&ur.android&&t.composing&&I.empty&&(b.start!=b.endB||t.lastAndroidDelete<Date.now()-100)&&(I.head==D||I.head==S.mapping.map(O)-1)||ur.ie&&I.empty&&I.head==D)&&S.setSelection(I)}E&&S.ensureMarks(E),t.dispatch(S.scrollIntoView())}}}function Wi(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ei(t,e.resolve(n.anchor),e.resolve(n.head))}function Hi(t,e,n){for(var o=t.depth,r=e?t.end():t.pos;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n)for(var i=t.node(o).maybeChild(t.indexAfter(o));i&&!i.isLeaf;)i=i.firstChild,r++;return r}function qi(t,e){for(var n=[],o=e.content,r=e.openStart,i=e.openEnd;r>1&&i>1&&1==o.childCount&&1==o.firstChild.childCount;){r--,i--;var a=o.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),o=a.content}var s=t.someProp("clipboardSerializer")||ut.fromSchema(t.state.schema),l=Qi(),c=l.createElement("div");c.appendChild(s.serializeFragment(o,{document:l}));for(var d,u=c.firstChild;u&&1==u.nodeType&&(d=Yi[u.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var f=l.createElement(d[p]);c.firstChild;)f.appendChild(c.firstChild);c.appendChild(f),"tbody"!=d[p]&&(r++,i++)}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",r+" "+i+" "+JSON.stringify(n)),{dom:c,text:t.someProp("clipboardTextSerializer",(function(t){return t(e)}))||e.content.textBetween(0,e.content.size,"\n\n")}}function Ji(t,e,n,o,r){var a,s,l=r.parent.type.spec.code;if(!n&&!e)return null;var c=e&&(o||l||!n);if(c){if(t.someProp("transformPastedText",(function(t){e=t(e,l||o)})),l)return e?new p(i.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0):p.empty;var d=t.someProp("clipboardTextParser",(function(t){return t(e,r,o)}));if(d)s=d;else{var u=r.marks(),f=t.state.schema,h=ut.fromSchema(f);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((function(t){var e=a.appendChild(document.createElement("p"));t&&e.appendChild(h.serializeNode(f.text(t,u)))}))}}else t.someProp("transformPastedHTML",(function(t){n=t(n)})),a=function(t){var e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var n,o=Qi().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t);(n=r&&Yi[r[1].toLowerCase()])&&(t=n.map((function(t){return"<"+t+">"})).join("")+t+n.map((function(t){return"</"+t+">"})).reverse().join(""));if(o.innerHTML=t,n)for(var i=0;i<n.length;i++)o=o.querySelector(n[i])||o;return o}(n),ur.webkit&&function(t){for(var e=t.querySelectorAll(ur.chrome?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<e.length;n++){var o=e[n];1==o.childNodes.length&&" "==o.textContent&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}(a);var m=a&&a.querySelector("[data-pm-slice]"),v=m&&/^(\d+) (\d+) (.*)/.exec(m.getAttribute("data-pm-slice"));if(!s){var g=t.someProp("clipboardParser")||t.someProp("domParser")||tt.fromSchema(t.state.schema);s=g.parseSlice(a,{preserveWhitespace:!(!c&&!v),context:r,ruleFromNode:function(t){if("BR"==t.nodeName&&!t.nextSibling&&t.parentNode&&!Ki.test(t.parentNode.nodeName))return{ignore:!0}}})}if(v)s=function(t,e){if(!t.size)return t;var n,o=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}for(var r=t.content,a=t.openStart,s=t.openEnd,l=n.length-2;l>=0;l-=2){var c=o.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;r=i.from(c.create(n[l+1],r)),a++,s++}return new p(r,a,s)}(Xi(s,+v[1],+v[2]),v[3]);else if((s=p.maxOpen(function(t,e){if(t.childCount<2)return t;for(var n=function(n){var o=e.node(n).contentMatchAt(e.index(n)),r=void 0,a=[];if(t.forEach((function(t){if(a){var e,n=o.findWrapping(t.type);if(!n)return a=null;if(e=a.length&&r.length&&function t(e,n,o,r,a){if(a<e.length&&a<n.length&&e[a]==n[a]){var s=t(e,n,o,r.lastChild,a+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(a==e.length-1?o.type:e[a+1]))return r.copy(r.content.append(i.from(Ui(o,e,a+1))))}}(n,r,t,a[a.length-1],0))a[a.length-1]=e;else{a.length&&(a[a.length-1]=function t(e,n){if(0==n)return e;var o=e.content.replaceChild(e.childCount-1,t(e.lastChild,n-1)),r=e.contentMatchAt(e.childCount).fillBefore(i.empty,!0);return e.copy(o.append(r))}(a[a.length-1],r.length));var s=Ui(t,n);a.push(s),o=o.matchType(s.type,s.attrs),r=n}}})),a)return{v:i.from(a)}},o=e.depth;o>=0;o--){var r=n(o);if(r)return r.v}return t}(s.content,r),!0)).openStart||s.openEnd){for(var y=0,b=0,w=s.content.firstChild;y<s.openStart&&!w.type.spec.isolating;y++,w=w.firstChild);for(var k=s.content.lastChild;b<s.openEnd&&!k.type.spec.isolating;b++,k=k.lastChild);s=Xi(s,y,b)}return t.someProp("transformPasted",(function(t){s=t(s)})),s}var Ki=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ui(t,e,n){void 0===n&&(n=0);for(var o=e.length-1;o>=n;o--)t=e[o].create(null,i.from(t));return t}function Gi(t,e,n,o,r,a){var s=e<0?t.firstChild:t.lastChild,l=s.content;return r<o-1&&(l=Gi(l,e,n,o,r+1,a)),r>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,t.childCount>1||a<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(i.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Xi(t,e,n){return e<t.openStart&&(t=new p(Gi(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new p(Gi(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}var Yi={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},Zi=null;function Qi(){return Zi||(Zi=document.implementation.createHTMLDocument("title"))}var ta={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ea=ur.ie&&ur.ie_version<=11,na=function(){this.anchorNode=this.anchorOffset=this.focusNode=this.focusOffset=null};na.prototype.set=function(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset},na.prototype.eq=function(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset};var oa=function(t,e){var n=this;this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=window.MutationObserver&&new window.MutationObserver((function(t){for(var e=0;e<t.length;e++)n.queue.push(t[e]);ur.ie&&ur.ie_version<=11&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),this.currentSelection=new na,ea&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.suppressingSelectionUpdates=!1};oa.prototype.flushSoon=function(){var t=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((function(){t.flushingSoon=-1,t.flush()}),20))},oa.prototype.forceFlush=function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())},oa.prototype.start=function(){this.observer&&this.observer.observe(this.view.dom,ta),ea&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()},oa.prototype.stop=function(){var t=this;if(this.observer){var e=this.observer.takeRecords();if(e.length){for(var n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout((function(){return t.flush()}),20)}this.observer.disconnect()}ea&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()},oa.prototype.connectSelection=function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)},oa.prototype.disconnectSelection=function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)},oa.prototype.suppressSelectionUpdates=function(){var t=this;this.suppressingSelectionUpdates=!0,setTimeout((function(){return t.suppressingSelectionUpdates=!1}),50)},oa.prototype.onSelectionChange=function(){if((!(t=this.view).editable||t.root.activeElement==t.dom)&&Ti(t)){var t;if(this.suppressingSelectionUpdates)return bi(this.view);if(ur.ie&&ur.ie_version<=11&&!this.view.state.selection.empty){var e=this.view.root.getSelection();if(e.focusNode&&kr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}},oa.prototype.setCurSelection=function(){this.currentSelection.set(this.view.root.getSelection())},oa.prototype.ignoreSelectionChange=function(t){if(0==t.rangeCount)return!0;var e=t.getRangeAt(0).commonAncestorContainer,n=this.view.docView.nearestDesc(e);return n&&n.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0},oa.prototype.flush=function(){if(this.view.docView&&!(this.flushingSoon>-1)){var t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);var e=this.view.root.getSelection(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Ti(this.view)&&!this.ignoreSelectionChange(e),o=-1,r=-1,i=!1,a=[];if(this.view.editable)for(var s=0;s<t.length;s++){var l=this.registerMutation(t[s],a);l&&(o=o<0?l.from:Math.min(l.from,o),r=r<0?l.to:Math.max(l.to,r),l.typeOver&&(i=!0))}if(ur.gecko&&a.length>1){var c=a.filter((function(t){return"BR"==t.nodeName}));if(2==c.length){var d=c[0],u=c[1];d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}}(o>-1||n)&&(o>-1&&(this.view.docView.markDirty(o,r),function(t){if(ra)return;ra=!0,"normal"==getComputedStyle(t.dom).whiteSpace&&console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.")}(this.view)),this.handleDOMChange(o,r,i,a),this.view.docView&&this.view.docView.dirty?this.view.updateState(this.view.state):this.currentSelection.eq(e)||bi(this.view),this.currentSelection.set(e))}},oa.prototype.registerMutation=function(t,e){if(e.indexOf(t.target)>-1)return null;var n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(var o=0;o<t.addedNodes.length;o++)e.push(t.addedNodes[o]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};var r=t.previousSibling,i=t.nextSibling;if(ur.ie&&ur.ie_version<=11&&t.addedNodes.length)for(var a=0;a<t.addedNodes.length;a++){var s=t.addedNodes[a],l=s.previousSibling,c=s.nextSibling;(!l||Array.prototype.indexOf.call(t.addedNodes,l)<0)&&(r=l),(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(i=c)}var d=r&&r.parentNode==t.target?gr(r)+1:0,u=n.localPosFromDOM(t.target,d,-1),p=i&&i.parentNode==t.target?gr(i):t.target.childNodes.length;return{from:u,to:n.localPosFromDOM(t.target,p,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}};var ra=!1;var ia={},aa={};function sa(t,e){t.lastSelectionOrigin=e,t.lastSelectionTime=Date.now()}function la(t){t.someProp("handleDOMEvents",(function(e){for(var n in e)t.eventHandlers[n]||t.dom.addEventListener(n,t.eventHandlers[n]=function(e){return ca(t,e)})}))}function ca(t,e){return t.someProp("handleDOMEvents",(function(n){var o=n[e.type];return!!o&&(o(t,e)||e.defaultPrevented)}))}function da(t){return{left:t.clientX,top:t.clientY}}function ua(t,e,n,o,r){if(-1==o)return!1;for(var i=t.state.doc.resolve(o),a=function(o){if(t.someProp(e,(function(e){return o>i.depth?e(t,n,i.nodeAfter,i.before(o),r,!0):e(t,n,i.node(o),i.before(o),r,!1)})))return{v:!0}},s=i.depth+1;s>0;s--){var l=a(s);if(l)return l.v}return!1}function pa(t,e,n){t.focused||t.focus();var o=t.state.tr.setSelection(e);"pointer"==n&&o.setMeta("pointer",!0),t.dispatch(o)}function fa(t,e,n,o,r){return ua(t,"handleClickOn",e,n,o)||t.someProp("handleClick",(function(n){return n(t,e,o)}))||(r?function(t,e){if(-1==e)return!1;var n,o,r=t.state.selection;r instanceof ie&&(n=r.node);for(var i=t.state.doc.resolve(e),a=i.depth+1;a>0;a--){var s=a>i.depth?i.nodeAfter:i.node(a);if(ie.isSelectable(s)){o=n&&r.$from.depth>0&&a>=r.$from.depth&&i.before(r.$from.depth+1)==r.$from.pos?i.before(r.$from.depth):i.before(a);break}}return null!=o&&(pa(t,ie.create(t.state.doc,o),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;var n=t.state.doc.resolve(e),o=n.nodeAfter;return!!(o&&o.isAtom&&ie.isSelectable(o))&&(pa(t,new ie(n),"pointer"),!0)}(t,n))}function ha(t,e,n,o){return ua(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",(function(n){return n(t,e,o)}))}function ma(t,e,n,o){return ua(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",(function(n){return n(t,e,o)}))||function(t,e,n){if(0!=n.button)return!1;var o=t.state.doc;if(-1==e)return!!o.inlineContent&&(pa(t,oe.create(o,0,o.content.size),"pointer"),!0);for(var r=o.resolve(e),i=r.depth+1;i>0;i--){var a=i>r.depth?r.nodeAfter:r.node(i),s=r.before(i);if(a.inlineContent)pa(t,oe.create(o,s+1,s+1+a.content.size),"pointer");else{if(!ie.isSelectable(a))continue;pa(t,ie.create(o,s),"pointer")}return!0}}(t,n,o)}function va(t){return Ca(t)}aa.keydown=function(t,e){if(t.shiftKey=16==e.keyCode||e.shiftKey,!ba(t,e)&&(t.lastKeyCode=e.keyCode,t.lastKeyCodeTime=Date.now(),!ur.android||!ur.chrome||13!=e.keyCode))if(229!=e.keyCode&&t.domObserver.forceFlush(),!ur.ios||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)t.someProp("handleKeyDown",(function(n){return n(t,e)}))||$i(t,e)?e.preventDefault():sa(t,"key");else{var n=Date.now();t.lastIOSEnter=n,t.lastIOSEnterFallbackTimeout=setTimeout((function(){t.lastIOSEnter==n&&(t.someProp("handleKeyDown",(function(e){return e(t,Tr(13,"Enter"))})),t.lastIOSEnter=0)}),200)}},aa.keyup=function(t,e){16==e.keyCode&&(t.shiftKey=!1)},aa.keypress=function(t,e){if(!(ba(t,e)||!e.charCode||e.ctrlKey&&!e.altKey||ur.mac&&e.metaKey))if(t.someProp("handleKeyPress",(function(n){return n(t,e)})))e.preventDefault();else{var n=t.state.selection;if(!(n instanceof oe&&n.$from.sameParent(n.$to))){var o=String.fromCharCode(e.charCode);t.someProp("handleTextInput",(function(e){return e(t,n.$from.pos,n.$to.pos,o)}))||t.dispatch(t.state.tr.insertText(o).scrollIntoView()),e.preventDefault()}}};var ga=ur.mac?"metaKey":"ctrlKey";ia.mousedown=function(t,e){t.shiftKey=e.shiftKey;var n=va(t),o=Date.now(),r="singleClick";o-t.lastClick.time<500&&function(t,e){var n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}(e,t.lastClick)&&!e[ga]&&("singleClick"==t.lastClick.type?r="doubleClick":"doubleClick"==t.lastClick.type&&(r="tripleClick")),t.lastClick={time:o,x:e.clientX,y:e.clientY,type:r};var i=t.posAtCoords(da(e));i&&("singleClick"==r?(t.mouseDown&&t.mouseDown.done(),t.mouseDown=new ya(t,i,e,n)):("doubleClick"==r?ha:ma)(t,i.pos,i.inside,e)?e.preventDefault():sa(t,"pointer"))};var ya=function(t,e,n,o){var r,i,a=this;if(this.view=t,this.startDoc=t.state.doc,this.pos=e,this.event=n,this.flushed=o,this.selectNode=n[ga],this.allowDefault=n.shiftKey,this.delayedSelectionSync=!1,e.inside>-1)r=t.state.doc.nodeAt(e.inside),i=e.inside;else{var s=t.state.doc.resolve(e.pos);r=s.parent,i=s.depth?s.before():0}this.mightDrag=null;var l=o?null:n.target,c=l?t.docView.nearestDesc(l,!0):null;this.target=c?c.dom:null;var d=t.state.selection;(0==n.button&&r.type.spec.draggable&&!1!==r.type.spec.selectable||d instanceof ie&&d.from<=i&&d.to>i)&&(this.mightDrag={node:r,pos:i,addAttr:this.target&&!this.target.draggable,setUneditable:this.target&&ur.gecko&&!this.target.hasAttribute("contentEditable")}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((function(){a.view.mouseDown==a&&a.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),sa(t,"pointer")};function ba(t,e){return!!t.composing||!!(ur.safari&&Math.abs(e.timeStamp-t.compositionEndedAt)<500)&&(t.compositionEndedAt=-2e8,!0)}ya.prototype.done=function(){var t=this;this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((function(){return bi(t.view)})),this.view.mouseDown=null},ya.prototype.up=function(t){if(this.done(),this.view.dom.contains(3==t.target.nodeType?t.target.parentNode:t.target)){var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(da(t))),this.allowDefault||!e?sa(this.view,"pointer"):fa(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||ur.safari&&this.mightDrag&&!this.mightDrag.node.isAtom||ur.chrome&&!(this.view.state.selection instanceof oe)&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(pa(this.view,te.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):sa(this.view,"pointer")}},ya.prototype.move=function(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0),sa(this.view,"pointer"),0==t.buttons&&this.done()},ia.touchdown=function(t){va(t),sa(t,"pointer")},ia.contextmenu=function(t){return va(t)};var wa=ur.android?5e3:-1;function ka(t,e){clearTimeout(t.composingTimeout),e>-1&&(t.composingTimeout=setTimeout((function(){return Ca(t)}),e))}function _a(t){var e;for(t.composing&&(t.composing=!1,t.compositionEndedAt=((e=document.createEvent("Event")).initEvent("event",!0,!0),e.timeStamp));t.compositionNodes.length>0;)t.compositionNodes.pop().markParentsDirty()}function Ca(t,e){if(!(ur.android&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),_a(t),e||t.docView&&t.docView.dirty){var n=gi(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}aa.compositionstart=aa.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var e=t.state,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((function(t){return!1===t.type.spec.inclusive}))))t.markCursor=t.state.storedMarks||n.marks(),Ca(t,!0),t.markCursor=null;else if(Ca(t),ur.gecko&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var o=t.root.getSelection(),r=o.focusNode,i=o.focusOffset;r&&1==r.nodeType&&0!=i;){var a=i<0?r.lastChild:r.childNodes[i-1];if(!a)break;if(3==a.nodeType){o.collapse(a,a.nodeValue.length);break}r=a,i=-1}t.composing=!0}ka(t,wa)},aa.compositionend=function(t,e){t.composing&&(t.composing=!1,t.compositionEndedAt=e.timeStamp,ka(t,20))};var xa=ur.ie&&ur.ie_version<15||ur.ios&&ur.webkit_version<604;function Sa(t,e,n,o){var r=Ji(t,e,n,t.shiftKey,t.state.selection.$from);if(t.someProp("handlePaste",(function(e){return e(t,o,r||p.empty)})))return!0;if(!r)return!1;var i=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(r),a=i?t.state.tr.replaceSelectionWith(i,t.shiftKey):t.state.tr.replaceSelection(r);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}ia.copy=aa.cut=function(t,e){var n=t.state.selection,o="cut"==e.type;if(!n.empty){var r=xa?null:e.clipboardData,i=qi(t,n.content()),a=i.dom,s=i.text;r?(e.preventDefault(),r.clearData(),r.setData("text/html",a.innerHTML),r.setData("text/plain",s)):function(t,e){if(t.dom.parentNode){var n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";var o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout((function(){n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}}(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},aa.paste=function(t,e){if(!t.composing||ur.android){var n=xa?null:e.clipboardData;n&&Sa(t,n.getData("text/plain"),n.getData("text/html"),e)?e.preventDefault():function(t,e){if(t.dom.parentNode){var n=t.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus(),setTimeout((function(){t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Sa(t,o.value,null,e):Sa(t,o.textContent,o.innerHTML,e)}),50)}}(t,e)}};var Ea=function(t,e){this.slice=t,this.move=e},Ta=ur.mac?"altKey":"ctrlKey";for(var Ma in ia.dragstart=function(t,e){var n=t.mouseDown;if(n&&n.done(),e.dataTransfer){var o=t.state.selection,r=o.empty?null:t.posAtCoords(da(e));if(r&&r.pos>=o.from&&r.pos<=(o instanceof ie?o.to-1:o.to));else if(n&&n.mightDrag)t.dispatch(t.state.tr.setSelection(ie.create(t.state.doc,n.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){var i=t.docView.nearestDesc(e.target,!0);i&&i.node.type.spec.draggable&&i!=t.docView&&t.dispatch(t.state.tr.setSelection(ie.create(t.state.doc,i.posBefore)))}var a=t.state.selection.content(),s=qi(t,a),l=s.dom,c=s.text;e.dataTransfer.clearData(),e.dataTransfer.setData(xa?"Text":"text/html",l.innerHTML),e.dataTransfer.effectAllowed="copyMove",xa||e.dataTransfer.setData("text/plain",c),t.dragging=new Ea(a,!e[Ta])}},ia.dragend=function(t){var e=t.dragging;window.setTimeout((function(){t.dragging==e&&(t.dragging=null)}),50)},aa.dragover=aa.dragenter=function(t,e){return e.preventDefault()},aa.drop=function(t,e){var n=t.dragging;if(t.dragging=null,e.dataTransfer){var o=t.posAtCoords(da(e));if(o){var r=t.state.doc.resolve(o.pos);if(r){var i=n&&n.slice;i?t.someProp("transformPasted",(function(t){i=t(i)})):i=Ji(t,e.dataTransfer.getData(xa?"Text":"text/plain"),xa?null:e.dataTransfer.getData("text/html"),!1,r);var a=n&&!e[Ta];if(t.someProp("handleDrop",(function(n){return n(t,e,i||p.empty,a)})))e.preventDefault();else if(i){e.preventDefault();var s=i?Lt(t.state.doc,r.pos,i):r.pos;null==s&&(s=r.pos);var l=t.state.tr;a&&l.deleteSelection();var c=l.mapping.map(s),d=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),!l.doc.eq(u)){var f=l.doc.resolve(c);if(d&&ie.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new ie(f));else{var h=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((function(t,e,n,o){return h=o})),l.setSelection(Ei(t,f,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}}}}}},ia.focus=function(t){t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.root.getSelection())&&bi(t)}),20))},ia.blur=function(t,e){t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),e.relatedTarget&&t.dom.contains(e.relatedTarget)&&t.domObserver.currentSelection.set({}),t.focused=!1)},ia.beforeinput=function(t,e){if(ur.chrome&&ur.android&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();var n=t.domChangeCount;setTimeout((function(){if(t.domChangeCount==n&&(t.dom.blur(),t.focus(),!t.someProp("handleKeyDown",(function(e){return e(t,Tr(8,"Backspace"))})))){var e=t.state.selection.$cursor;e&&e.pos>0&&t.dispatch(t.state.tr.delete(e.pos-1,e.pos).scrollIntoView())}}),50)}},aa)ia[Ma]=aa[Ma];function Da(t,e){if(t==e)return!0;for(var n in t)if(t[n]!==e[n])return!1;for(var o in e)if(!(o in t))return!1;return!0}var Oa=function(t,e){this.spec=e||Ra,this.side=this.spec.side||0,this.toDOM=t};Oa.prototype.map=function(t,e,n,o){var r=t.mapResult(e.from+o,this.side<0?-1:1),i=r.pos;return r.deleted?null:new Ba(i-n,i-n,this)},Oa.prototype.valid=function(){return!0},Oa.prototype.eq=function(t){return this==t||t instanceof Oa&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Da(this.spec,t.spec))},Oa.prototype.destroy=function(t){this.spec.destroy&&this.spec.destroy(t)};var Aa=function(t,e){this.spec=e||Ra,this.attrs=t};Aa.prototype.map=function(t,e,n,o){var r=t.map(e.from+o,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+o,this.spec.inclusiveEnd?1:-1)-n;return r>=i?null:new Ba(r,i,this)},Aa.prototype.valid=function(t,e){return e.from<e.to},Aa.prototype.eq=function(t){return this==t||t instanceof Aa&&Da(this.attrs,t.attrs)&&Da(this.spec,t.spec)},Aa.is=function(t){return t.type instanceof Aa};var Ia=function(t,e){this.spec=e||Ra,this.attrs=t};Ia.prototype.map=function(t,e,n,o){var r=t.mapResult(e.from+o,1);if(r.deleted)return null;var i=t.mapResult(e.to+o,-1);return i.deleted||i.pos<=r.pos?null:new Ba(r.pos-n,i.pos-n,this)},Ia.prototype.valid=function(t,e){var n,o=t.content.findIndex(e.from),r=o.index,i=o.offset;return i==e.from&&!(n=t.child(r)).isText&&i+n.nodeSize==e.to},Ia.prototype.eq=function(t){return this==t||t instanceof Ia&&Da(this.attrs,t.attrs)&&Da(this.spec,t.spec)};var Ba=function(t,e,n){this.from=t,this.to=e,this.type=n},Na={spec:{configurable:!0},inline:{configurable:!0}};Ba.prototype.copy=function(t,e){return new Ba(t,e,this.type)},Ba.prototype.eq=function(t,e){return void 0===e&&(e=0),this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to},Ba.prototype.map=function(t,e,n){return this.type.map(t,this,e,n)},Ba.widget=function(t,e,n){return new Ba(t,t,new Oa(e,n))},Ba.inline=function(t,e,n,o){return new Ba(t,e,new Aa(n,o))},Ba.node=function(t,e,n,o){return new Ba(t,e,new Ia(n,o))},Na.spec.get=function(){return this.type.spec},Na.inline.get=function(){return this.type instanceof Aa},Object.defineProperties(Ba.prototype,Na);var za=[],Ra={},Pa=function(t,e){this.local=t&&t.length?t:za,this.children=e&&e.length?e:za};Pa.create=function(t,e){return e.length?Wa(e,t,0,Ra):La},Pa.prototype.find=function(t,e,n){var o=[];return this.findInner(null==t?0:t,null==e?1e9:e,o,0,n),o},Pa.prototype.findInner=function(t,e,n,o,r){for(var i=0;i<this.local.length;i++){var a=this.local[i];a.from<=e&&a.to>=t&&(!r||r(a.spec))&&n.push(a.copy(a.from+o,a.to+o))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){var l=this.children[s]+1;this.children[s+2].findInner(t-l,e-l,n,o+l,r)}},Pa.prototype.map=function(t,e,n){return this==La||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Ra)},Pa.prototype.mapInner=function(t,e,n,o,r){for(var i,a=0;a<this.local.length;a++){var s=this.local[a].map(t,n,o);s&&s.type.valid(e,s)?(i||(i=[])).push(s):r.onRemove&&r.onRemove(this.local[a].spec)}return this.children.length?function(t,e,n,o,r,i,a){for(var s=t.slice(),l=function(t,e,n,o){for(var a=0;a<s.length;a+=3){var l=s[a+1],c=void 0;-1==l||t>l+i||(e>=s[a]+i?s[a+1]=-1:n>=r&&(c=o-n-(e-t))&&(s[a]+=c,s[a+1]+=c))}},c=0;c<n.maps.length;c++)n.maps[c].forEach(l);for(var d=!1,u=0;u<s.length;u+=3)if(-1==s[u+1]){var p=n.map(t[u]+i),f=p-r;if(f<0||f>=o.content.size){d=!0;continue}var h=n.map(t[u+1]+i,-1)-r,m=o.content.findIndex(f),v=m.index,g=m.offset,y=o.maybeChild(v);if(y&&g==f&&g+y.nodeSize==h){var b=s[u+2].mapInner(n,y,p+1,t[u]+i+1,a);b!=La?(s[u]=f,s[u+1]=h,s[u+2]=b):(s[u+1]=-2,d=!0)}else d=!0}if(d){var w=Wa(function(t,e,n,o,r,i,a){function s(t,e){for(var i=0;i<t.local.length;i++){var l=t.local[i].map(o,r,e);l?n.push(l):a.onRemove&&a.onRemove(t.local[i].spec)}for(var c=0;c<t.children.length;c+=3)s(t.children[c+2],t.children[c]+e+1)}for(var l=0;l<t.length;l+=3)-1==t[l+1]&&s(t[l+2],e[l]+i+1);return n}(s,t,e||[],n,r,i,a),o,0,a);e=w.local;for(var k=0;k<s.length;k+=3)s[k+1]<0&&(s.splice(k,3),k-=3);for(var _=0,C=0;_<w.children.length;_+=3){for(var x=w.children[_];C<s.length&&s[C]<x;)C+=3;s.splice(C,0,w.children[_],w.children[_+1],w.children[_+2])}}return new Pa(e&&e.sort(Ha),s)}(this.children,i,t,e,n,o,r):i?new Pa(i.sort(Ha)):La},Pa.prototype.add=function(t,e){return e.length?this==La?Pa.create(t,e):this.addInner(t,e,0):this},Pa.prototype.addInner=function(t,e,n){var o,r=this,i=0;t.forEach((function(t,a){var s,l=a+n;if(s=Va(e,t,l)){for(o||(o=r.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(t,s,l+1):o.splice(i,0,a,a+t.nodeSize,Wa(s,t,l+1,Ra)),i+=3}}));for(var a=$a(i?ja(e):e,-n),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||a.splice(s--,1);return new Pa(a.length?this.local.concat(a).sort(Ha):this.local,o||this.children)},Pa.prototype.remove=function(t){return 0==t.length||this==La?this:this.removeInner(t,0)},Pa.prototype.removeInner=function(t,e){for(var n=this.children,o=this.local,r=0;r<n.length;r+=3){for(var i=void 0,a=n[r]+e,s=n[r+1]+e,l=0,c=void 0;l<t.length;l++)(c=t[l])&&c.from>a&&c.to<s&&(t[l]=null,(i||(i=[])).push(c));if(i){n==this.children&&(n=this.children.slice());var d=n[r+2].removeInner(i,a+1);d!=La?n[r+2]=d:(n.splice(r,3),r-=3)}}if(o.length)for(var u=0,p=void 0;u<t.length;u++)if(p=t[u])for(var f=0;f<o.length;f++)o[f].eq(p,e)&&(o==this.local&&(o=this.local.slice()),o.splice(f--,1));return n==this.children&&o==this.local?this:o.length||n.length?new Pa(o,n):La},Pa.prototype.forChild=function(t,e){if(this==La)return this;if(e.isLeaf)return Pa.empty;for(var n,o,r=0;r<this.children.length;r+=3)if(this.children[r]>=t){this.children[r]==t&&(n=this.children[r+2]);break}for(var i=t+1,a=i+e.content.size,s=0;s<this.local.length;s++){var l=this.local[s];if(l.from<a&&l.to>i&&l.type instanceof Aa){var c=Math.max(i,l.from)-i,d=Math.min(a,l.to)-i;c<d&&(o||(o=[])).push(l.copy(c,d))}}if(o){var u=new Pa(o.sort(Ha));return n?new Fa([u,n]):u}return n||La},Pa.prototype.eq=function(t){if(this==t)return!0;if(!(t instanceof Pa)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(var n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0},Pa.prototype.locals=function(t){return qa(this.localsInner(t))},Pa.prototype.localsInner=function(t){if(this==La)return za;if(t.inlineContent||!this.local.some(Aa.is))return this.local;for(var e=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Aa||e.push(this.local[n]);return e};var La=new Pa;Pa.empty=La,Pa.removeOverlap=qa;var Fa=function(t){this.members=t};function $a(t,e){if(!e||!t.length)return t;for(var n=[],o=0;o<t.length;o++){var r=t[o];n.push(new Ba(r.from+e,r.to+e,r.type))}return n}function Va(t,e,n){if(e.isLeaf)return null;for(var o=n+e.nodeSize,r=null,i=0,a=void 0;i<t.length;i++)(a=t[i])&&a.from>n&&a.to<o&&((r||(r=[])).push(a),t[i]=null);return r}function ja(t){for(var e=[],n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function Wa(t,e,n,o){var r=[],i=!1;e.forEach((function(e,a){var s=Va(t,e,a+n);if(s){i=!0;var l=Wa(s,e,n+a+1,o);l!=La&&r.push(a,a+e.nodeSize,l)}}));for(var a=$a(i?ja(t):t,-n).sort(Ha),s=0;s<a.length;s++)a[s].type.valid(e,a[s])||(o.onRemove&&o.onRemove(a[s].spec),a.splice(s--,1));return a.length||r.length?new Pa(a,r):La}function Ha(t,e){return t.from-e.from||t.to-e.to}function qa(t){for(var e=t,n=0;n<e.length-1;n++){var o=e[n];if(o.from!=o.to)for(var r=n+1;r<e.length;r++){var i=e[r];if(i.from!=o.from){i.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,i.from),Ja(e,r,o.copy(i.from,o.to)));break}i.to!=o.to&&(e==t&&(e=t.slice()),e[r]=i.copy(i.from,o.to),Ja(e,r+1,i.copy(o.to,i.to)))}}return e}function Ja(t,e,n){for(;e<t.length&&Ha(n,t[e])>0;)e++;t.splice(e,0,n)}function Ka(t){var e=[];return t.someProp("decorations",(function(n){var o=n(t.state);o&&o!=La&&e.push(o)})),t.cursorWrapper&&e.push(Pa.create(t.state.doc,[t.cursorWrapper.deco])),Fa.from(e)}Fa.prototype.map=function(t,e){var n=this.members.map((function(n){return n.map(t,e,Ra)}));return Fa.from(n)},Fa.prototype.forChild=function(t,e){if(e.isLeaf)return Pa.empty;for(var n=[],o=0;o<this.members.length;o++){var r=this.members[o].forChild(t,e);r!=La&&(r instanceof Fa?n=n.concat(r.members):n.push(r))}return Fa.from(n)},Fa.prototype.eq=function(t){if(!(t instanceof Fa)||t.members.length!=this.members.length)return!1;for(var e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0},Fa.prototype.locals=function(t){for(var e,n=!0,o=0;o<this.members.length;o++){var r=this.members[o].localsInner(t);if(r.length)if(e){n&&(e=e.slice(),n=!1);for(var i=0;i<r.length;i++)e.push(r[i])}else e=r}return e?qa(n?e:e.sort(Ha)):za},Fa.from=function(t){switch(t.length){case 0:return La;case 1:return t[0];default:return new Fa(t)}};var Ua,Ga,Xa=function(t,e){this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(ns),this.dispatch=this.dispatch.bind(this),this._root=null,this.focused=!1,this.trackWrites=null,this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):t.apply?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=ts(this),this.markCursor=null,this.cursorWrapper=null,Qa(this),this.nodeViews=es(this),this.docView=ni(this.state.doc,Za(this),Ka(this),this.dom,this),this.lastSelectedViewDesc=null,this.dragging=null,function(t){t.shiftKey=!1,t.mouseDown=null,t.lastKeyCode=null,t.lastKeyCodeTime=0,t.lastClick={time:0,x:0,y:0,type:""},t.lastSelectionOrigin=null,t.lastSelectionTime=0,t.lastIOSEnter=0,t.lastIOSEnterFallbackTimeout=null,t.lastAndroidDelete=0,t.composing=!1,t.composingTimeout=null,t.compositionNodes=[],t.compositionEndedAt=-2e8,t.domObserver=new oa(t,(function(e,n,o,r){return ji(t,e,n,o,r)})),t.domObserver.start(),t.domChangeCount=0,t.eventHandlers=Object.create(null);var e=function(e){var n=ia[e];t.dom.addEventListener(e,t.eventHandlers[e]=function(e){!function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}(t,e)||ca(t,e)||!t.editable&&e.type in aa||n(t,e)})};for(var n in ia)e(n);ur.safari&&t.dom.addEventListener("input",(function(){return null})),la(t)}(this),this.prevDirectPlugins=[],this.pluginViews=[],this.updatePluginViews()},Ya={props:{configurable:!0},root:{configurable:!0},isDestroyed:{configurable:!0}};function Za(t){var e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),e.translate="no",t.someProp("attributes",(function(n){if("function"==typeof n&&(n=n(t.state)),n)for(var o in n)"class"==o&&(e.class+=" "+n[o]),"style"==o?e.style=(e.style?e.style+";":"")+n[o]:e[o]||"contenteditable"==o||"nodeName"==o||(e[o]=String(n[o]))})),[Ba.node(0,t.state.doc.content.size,e)]}function Qa(t){if(t.markCursor){var e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),t.cursorWrapper={dom:e,deco:Ba.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ts(t){return!t.someProp("editable",(function(e){return!1===e(t.state)}))}function es(t){var e={};return t.someProp("nodeViews",(function(t){for(var n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])})),e}function ns(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}if(Ya.props.get=function(){if(this._props.state!=this.state){var t=this._props;for(var e in this._props={},t)this._props[e]=t[e];this._props.state=this.state}return this._props},Xa.prototype.update=function(t){t.handleDOMEvents!=this._props.handleDOMEvents&&la(this),this._props=t,t.plugins&&(t.plugins.forEach(ns),this.directPlugins=t.plugins),this.updateStateInner(t.state,!0)},Xa.prototype.setProps=function(t){var e={};for(var n in this._props)e[n]=this._props[n];for(var o in e.state=this.state,t)e[o]=t[o];this.update(e)},Xa.prototype.updateState=function(t){this.updateStateInner(t,this.state.plugins!=t.plugins)},Xa.prototype.updateStateInner=function(t,e){var n=this,o=this.state,r=!1,i=!1;if(t.storedMarks&&this.composing&&(_a(this),i=!0),this.state=t,e){var a=es(this);(function(t,e){var n=0,o=0;for(var r in t){if(t[r]!=e[r])return!0;n++}for(var i in e)o++;return n!=o})(a,this.nodeViews)&&(this.nodeViews=a,r=!0),la(this)}this.editable=ts(this),Qa(this);var s=Ka(this),l=Za(this),c=e?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=r||!this.docView.matchesNode(t.doc,l,s);!d&&t.selection.eq(o.selection)||(i=!0);var u,p,f,h,m,v,g,y,b,w,k,_="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&function(t){for(var e,n,o=t.dom.getBoundingClientRect(),r=Math.max(0,o.top),i=(o.left+o.right)/2,a=r+1;a<Math.min(innerHeight,o.bottom);a+=5){var s=t.root.elementFromPoint(i,a);if(s!=t.dom&&t.dom.contains(s)){var l=s.getBoundingClientRect();if(l.top>=r-20){e=s,n=l.top;break}}}return{refDOM:e,refTop:n,stack:Ir(t.dom)}}(this);if(i){this.domObserver.stop();var C=d&&(ur.ie||ur.chrome)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&(h=o.selection,m=t.selection,v=Math.min(h.$anchor.sharedDepth(h.head),m.$anchor.sharedDepth(m.head)),h.$anchor.start(v)!=m.$anchor.start(v));if(d){var x=ur.chrome?this.trackWrites=this.root.getSelection().focusNode:null;!r&&this.docView.update(t.doc,l,s,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=ni(t.doc,l,s,this.dom,this)),x&&!this.trackWrites&&(C=!0)}C||!(this.mouseDown&&this.domObserver.currentSelection.eq(this.root.getSelection())&&(u=this,p=u.docView.domFromPos(u.state.selection.anchor,0),f=u.root.getSelection(),kr(p.node,p.offset,f.anchorNode,f.anchorOffset)))?bi(this,C):(xi(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}if(this.updatePluginViews(o),"reset"==c)this.dom.scrollTop=0;else if("to selection"==c){var S=this.root.getSelection().focusNode;this.someProp("handleScrollToSelection",(function(t){return t(n)}))||(t.selection instanceof ie?Ar(this,this.docView.domAfterPos(t.selection.from).getBoundingClientRect(),S):Ar(this,this.coordsAtPos(t.selection.head,1),S))}else _&&(y=(g=_).refDOM,b=g.refTop,w=g.stack,k=y?y.getBoundingClientRect().top:0,Br(w,0==k?0:k-b))},Xa.prototype.destroyPluginViews=function(){for(var t;t=this.pluginViews.pop();)t.destroy&&t.destroy()},Xa.prototype.updatePluginViews=function(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var e=0;e<this.pluginViews.length;e++){var n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var o=0;o<this.directPlugins.length;o++){var r=this.directPlugins[o];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(var i=0;i<this.state.plugins.length;i++){var a=this.state.plugins[i];a.spec.view&&this.pluginViews.push(a.spec.view(this))}}},Xa.prototype.someProp=function(t,e){var n,o=this._props&&this._props[t];if(null!=o&&(n=e?e(o):o))return n;for(var r=0;r<this.directPlugins.length;r++){var i=this.directPlugins[r].props[t];if(null!=i&&(n=e?e(i):i))return n}var a=this.state.plugins;if(a)for(var s=0;s<a.length;s++){var l=a[s].props[t];if(null!=l&&(n=e?e(l):l))return n}},Xa.prototype.hasFocus=function(){return this.root.activeElement==this.dom},Xa.prototype.focus=function(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(Nr)return t.focus(Nr);var e=Ir(t);t.focus(null==Nr?{get preventScroll(){return Nr={preventScroll:!0},!0}}:void 0),Nr||(Nr=!1,Br(e,0))}(this.dom),bi(this),this.domObserver.start()},Ya.root.get=function(){var t=this._root;if(null==t)for(var e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=function(){return document.getSelection()}),this._root=e;return t||document},Xa.prototype.posAtCoords=function(t){return Pr(this,t)},Xa.prototype.coordsAtPos=function(t,e){return void 0===e&&(e=1),$r(this,t,e)},Xa.prototype.domAtPos=function(t,e){return void 0===e&&(e=0),this.docView.domFromPos(t,e)},Xa.prototype.nodeDOM=function(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null},Xa.prototype.posAtDOM=function(t,e,n){void 0===n&&(n=-1);var o=this.docView.posFromDOM(t,e,n);if(null==o)throw new RangeError("DOM position not inside the editor");return o},Xa.prototype.endOfTextblock=function(t,e){return Ur(this,e||this.state,t)},Xa.prototype.destroy=function(){this.docView&&(!function(t){for(var e in t.domObserver.stop(),t.eventHandlers)t.dom.removeEventListener(e,t.eventHandlers[e]);clearTimeout(t.composingTimeout),clearTimeout(t.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ka(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)},Ya.isDestroyed.get=function(){return null==this.docView},Xa.prototype.dispatchEvent=function(t){return function(t,e){ca(t,e)||!ia[e.type]||!t.editable&&e.type in aa||ia[e.type](t,e)}(this,t)},Xa.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))},Object.defineProperties(Xa.prototype,Ya),"undefined"!=typeof WeakMap){var rs=new WeakMap;Ua=function(t){return rs.get(t)},Ga=function(t,e){return rs.set(t,e),e}}else{var is=[],as=0;Ua=function(t){for(var e=0;e<is.length;e+=2)if(is[e]==t)return is[e+1]},Ga=function(t,e){return 10==as&&(as=0),is[as++]=t,is[as++]=e}}var ss=function(t,e,n,o){this.left=t,this.top=e,this.right=n,this.bottom=o},ls=function(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o};function cs(t){if(t.colwidth)return t.colwidth.slice();for(var e=[],n=0;n<t.colspan;n++)e.push(0);return e}function ds(t,e){var n=t.getAttribute("data-colwidth"),o=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map((function(t){return Number(t)})):null,r=Number(t.getAttribute("colspan")||1),i={colspan:r,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:o&&o.length==r?o:null};for(var a in e){var s=e[a].getFromDOM,l=s&&s(t);null!=l&&(i[a]=l)}return i}function us(t,e){var n={};for(var o in 1!=t.attrs.colspan&&(n.colspan=t.attrs.colspan),1!=t.attrs.rowspan&&(n.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(n["data-colwidth"]=t.attrs.colwidth.join(",")),e){var r=e[o].setDOMAttr;r&&r(t.attrs[o],n)}return n}function ps(t){var e=t.cellAttributes||{},n={colspan:{default:1},rowspan:{default:1},colwidth:{default:null}};for(var o in e)n[o]={default:e[o].default};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM:function(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:function(){return["tr",0]}},table_cell:{content:t.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:function(t){return ds(t,e)}}],toDOM:function(t){return["td",us(t,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:function(t){return ds(t,e)}}],toDOM:function(t){return["th",us(t,e),0]}}}}function fs(t){var e=t.cached.tableNodeTypes;if(!e)for(var n in e=t.cached.tableNodeTypes={},t.nodes){var o=t.nodes[n],r=o.spec.tableRole;r&&(e[r]=o)}return e}ls.prototype.findCell=function(t){for(var e=0;e<this.map.length;e++){var n=this.map[e];if(n==t){for(var o=e%this.width,r=e/this.width|0,i=o+1,a=r+1,s=1;i<this.width&&this.map[e+s]==n;s++)i++;for(var l=1;a<this.height&&this.map[e+this.width*l]==n;l++)a++;return new ss(o,r,i,a)}}throw new RangeError("No cell with offset "+t+" found")},ls.prototype.colCount=function(t){for(var e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError("No cell with offset "+t+" found")},ls.prototype.nextCell=function(t,e,n){var o=this.findCell(t),r=o.left,i=o.right,a=o.top,s=o.bottom;return"horiz"==e?(n<0?0==r:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?0==a:s==this.height)?null:this.map[r+this.width*(n<0?a-1:s)]},ls.prototype.rectBetween=function(t,e){var n=this.findCell(t),o=n.left,r=n.right,i=n.top,a=n.bottom,s=this.findCell(e),l=s.left,c=s.right,d=s.top,u=s.bottom;return new ss(Math.min(o,l),Math.min(i,d),Math.max(r,c),Math.max(a,u))},ls.prototype.cellsInRect=function(t){for(var e=[],n={},o=t.top;o<t.bottom;o++)for(var r=t.left;r<t.right;r++){var i=o*this.width+r,a=this.map[i];n[a]||(n[a]=!0,r==t.left&&r&&this.map[i-1]==a||o==t.top&&o&&this.map[i-this.width]==a||e.push(a))}return e},ls.prototype.positionAt=function(t,e,n){for(var o=0,r=0;;o++){var i=r+n.child(o).nodeSize;if(o==t){for(var a=e+t*this.width,s=(t+1)*this.width;a<s&&this.map[a]<r;)a++;return a==s?i-1:this.map[a]}r=i}},ls.get=function(t){return Ua(t)||Ga(t,function(t){if("table"!=t.type.spec.tableRole)throw new RangeError("Not a table node: "+t.type.name);for(var e=function(t){for(var e=-1,n=!1,o=0;o<t.childCount;o++){var r=t.child(o),i=0;if(n)for(var a=0;a<o;a++)for(var s=t.child(a),l=0;l<s.childCount;l++){var c=s.child(l);a+c.attrs.rowspan>o&&(i+=c.attrs.colspan)}for(var d=0;d<r.childCount;d++){var u=r.child(d);i+=u.attrs.colspan,u.attrs.rowspan>1&&(n=!0)}-1==e?e=i:e!=i&&(e=Math.max(e,i))}return e}(t),n=t.childCount,o=[],r=0,i=null,a=[],s=0,l=e*n;s<l;s++)o[s]=0;for(var c=0,d=0;c<n;c++){var u=t.child(c);d++;for(var p=0;;p++){for(;r<o.length&&0!=o[r];)r++;if(p==u.childCount)break;for(var f=u.child(p),h=f.attrs,m=h.colspan,v=h.rowspan,g=h.colwidth,y=0;y<v;y++){if(y+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:v-y});break}for(var b=r+y*e,w=0;w<m;w++){0==o[b+w]?o[b+w]=d:(i||(i=[])).push({type:"collision",row:c,pos:d,n:m-w});var k=g&&g[w];if(k){var _=(b+w)%e*2,C=a[_];null==C||C!=k&&1==a[_+1]?(a[_]=k,a[_+1]=1):C==k&&a[_+1]++}}}r+=m,d+=f.nodeSize}for(var x=(c+1)*e,S=0;r<x;)0==o[r++]&&S++;S&&(i||(i=[])).push({type:"missing",row:c,n:S}),d++}for(var E=new ls(e,n,o,i),T=!1,M=0;!T&&M<a.length;M+=2)null!=a[M]&&a[M+1]<n&&(T=!0);T&&function(t,e,n){t.problems||(t.problems=[]);for(var o=0,r={};o<t.map.length;o++){var i=t.map[o];if(!r[i]){r[i]=!0;for(var a=n.nodeAt(i),s=null,l=0;l<a.attrs.colspan;l++){var c=(o+l)%t.width,d=e[2*c];null==d||a.attrs.colwidth&&a.attrs.colwidth[l]==d||((s||(s=cs(a.attrs)))[l]=d)}s&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:s})}}}(E,a,t);return E}(t))};var hs=new _e("selectingCells");function ms(t){for(var e=t.depth-1;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return t.node(0).resolve(t.before(e+1));return null}function vs(t){for(var e=t.selection.$head,n=e.depth;n>0;n--)if("row"==e.node(n).type.spec.tableRole)return!0;return!1}function gs(t){var e=t.selection;return e.$anchorCell?e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell:e.node&&"cell"==e.node.type.spec.tableRole?e.$anchor:ms(e.$head)||function(t){for(var e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){var o=e.type.spec.tableRole;if("cell"==o||"header_cell"==o)return t.doc.resolve(n)}for(var r=t.nodeBefore,i=t.pos;r;r=r.lastChild,i--){var a=r.type.spec.tableRole;if("cell"==a||"header_cell"==a)return t.doc.resolve(i-r.nodeSize)}}(e.$head)}function ys(t){return"row"==t.parent.type.spec.tableRole&&t.nodeAfter}function bs(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function ws(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function ks(t){return ls.get(t.node(-1)).findCell(t.pos-t.start(-1))}function _s(t){return ls.get(t.node(-1)).colCount(t.pos-t.start(-1))}function Cs(t,e,n){var o=t.start(-1),r=ls.get(t.node(-1)).nextCell(t.pos-o,e,n);return null==r?null:t.node(0).resolve(o+r)}function xs(t,e,n){var o={};for(var r in t)o[r]=t[r];return o[e]=n,o}function Ss(t,e,n){void 0===n&&(n=1);var o=xs(t,"colspan",t.colspan-n);return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some((function(t){return t>0}))||(o.colwidth=null)),o}function Es(t,e,n){void 0===n&&(n=1);var o=xs(t,"colspan",t.colspan+n);if(o.colwidth){o.colwidth=o.colwidth.slice();for(var r=0;r<n;r++)o.colwidth.splice(e,0,0)}return o}function Ts(t,e,n){for(var o=fs(e.type.schema).header_cell,r=0;r<t.height;r++)if(e.nodeAt(t.map[n+r*t.width]).type!=o)return!1;return!0}var Ms=function(t){function e(e,n){void 0===n&&(n=e);var o=e.node(-1),r=ls.get(o),i=e.start(-1),a=r.rectBetween(e.pos-i,n.pos-i),s=e.node(0),l=r.cellsInRect(a).filter((function(t){return t!=n.pos-i}));l.unshift(n.pos-i);var c=l.map((function(t){var e=o.nodeAt(t),n=t+i+1;return new ne(s.resolve(n),s.resolve(n+e.content.size))}));t.call(this,c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(t,n){var o=t.resolve(n.map(this.$anchorCell.pos)),r=t.resolve(n.map(this.$headCell.pos));if(ys(o)&&ys(r)&&ws(o,r)){var i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?e.rowSelection(o,r):i&&this.isColSelection()?e.colSelection(o,r):new e(o,r)}return oe.between(o,r)},e.prototype.content=function(){for(var t=this.$anchorCell.node(-1),e=ls.get(t),n=this.$anchorCell.start(-1),o=e.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),r={},a=[],s=o.top;s<o.bottom;s++){for(var l=[],c=s*e.width+o.left,d=o.left;d<o.right;d++,c++){var u=e.map[c];if(!r[u]){r[u]=!0;var f=e.findCell(u),h=t.nodeAt(u),m=o.left-f.left,v=f.right-o.right;if(m>0||v>0){var g=h.attrs;m>0&&(g=Ss(g,0,m)),v>0&&(g=Ss(g,g.colspan-v,v)),h=f.left<o.left?h.type.createAndFill(g):h.type.create(g,h.content)}if(f.top<o.top||f.bottom>o.bottom){var y=xs(h.attrs,"rowspan",Math.min(f.bottom,o.bottom)-Math.max(f.top,o.top));h=f.top<o.top?h.type.createAndFill(y):h.type.create(y,h.content)}l.push(h)}}a.push(t.child(s).copy(i.from(l)))}var b=this.isColSelection()&&this.isRowSelection()?t:a;return new p(i.from(b),1,1)},e.prototype.replace=function(e,n){void 0===n&&(n=p.empty);for(var o=e.steps.length,r=this.ranges,i=0;i<r.length;i++){var a=r[i],s=a.$from,l=a.$to,c=e.mapping.slice(o);e.replace(c.map(s.pos),c.map(l.pos),i?p.empty:n)}var d=t.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);d&&e.setSelection(d)},e.prototype.replaceWith=function(t,e){this.replace(t,new p(i.from(e),0,0))},e.prototype.forEachCell=function(t){for(var e=this.$anchorCell.node(-1),n=ls.get(e),o=this.$anchorCell.start(-1),r=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o)),i=0;i<r.length;i++)t(e.nodeAt(r[i]),o+r[i])},e.prototype.isColSelection=function(){var t=this.$anchorCell.index(-1),e=this.$headCell.index(-1);if(Math.min(t,e)>0)return!1;var n=t+this.$anchorCell.nodeAfter.attrs.rowspan,o=e+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,o)==this.$headCell.node(-1).childCount},e.colSelection=function(t,n){void 0===n&&(n=t);var o=ls.get(t.node(-1)),r=t.start(-1),i=o.findCell(t.pos-r),a=o.findCell(n.pos-r),s=t.node(0);return i.top<=a.top?(i.top>0&&(t=s.resolve(r+o.map[i.left])),a.bottom<o.height&&(n=s.resolve(r+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(n=s.resolve(r+o.map[a.left])),i.bottom<o.height&&(t=s.resolve(r+o.map[o.width*(o.height-1)+i.right-1]))),new e(t,n)},e.prototype.isRowSelection=function(){var t=ls.get(this.$anchorCell.node(-1)),e=this.$anchorCell.start(-1),n=t.colCount(this.$anchorCell.pos-e),o=t.colCount(this.$headCell.pos-e);if(Math.min(n,o)>0)return!1;var r=n+this.$anchorCell.nodeAfter.attrs.colspan,i=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(r,i)==t.width},e.prototype.eq=function(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos},e.rowSelection=function(t,n){void 0===n&&(n=t);var o=ls.get(t.node(-1)),r=t.start(-1),i=o.findCell(t.pos-r),a=o.findCell(n.pos-r),s=t.node(0);return i.left<=a.left?(i.left>0&&(t=s.resolve(r+o.map[i.top*o.width])),a.right<o.width&&(n=s.resolve(r+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(n=s.resolve(r+o.map[a.top*o.width])),i.right<o.width&&(t=s.resolve(r+o.map[o.width*(i.top+1)-1]))),new e(t,n)},e.prototype.toJSON=function(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}},e.fromJSON=function(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))},e.create=function(t,n,o){return void 0===o&&(o=n),new e(t.resolve(n),t.resolve(o))},e.prototype.getBookmark=function(){return new Ds(this.$anchorCell.pos,this.$headCell.pos)},e}(te);Ms.prototype.visible=!1,te.jsonID("cell",Ms);var Ds=function(t,e){this.anchor=t,this.head=e};function Os(t){if(!(t.selection instanceof Ms))return null;var e=[];return t.selection.forEachCell((function(t,n){e.push(Ba.node(n,n+t.nodeSize,{class:"selectedCell"}))})),Pa.create(t.doc,e)}function As(t){if(!t.size)return null;for(var e=t.content,n=t.openStart,o=t.openEnd;1==e.childCount&&(n>0&&o>0||"table"==e.firstChild.type.spec.tableRole);)n--,o--,e=e.firstChild.content;var r=e.firstChild,a=r.type.spec.tableRole,s=r.type.schema,l=[];if("row"==a)for(var c=0;c<e.childCount;c++){var d=e.child(c).content,u=c?0:Math.max(0,n-1),f=c<e.childCount-1?0:Math.max(0,o-1);(u||f)&&(d=Is(fs(s).row,new p(d,u,f)).content),l.push(d)}else{if("cell"!=a&&"header_cell"!=a)return null;l.push(n||o?Is(fs(s).row,new p(e,n,o)).content:e)}return function(t,e){for(var n=[],o=0;o<e.length;o++)for(var r=e[o],a=r.childCount-1;a>=0;a--)for(var s=r.child(a).attrs,l=s.rowspan,c=s.colspan,d=o;d<o+l;d++)n[d]=(n[d]||0)+c;for(var u=0,p=0;p<n.length;p++)u=Math.max(u,n[p]);for(var f=0;f<n.length;f++)if(f>=e.length&&e.push(i.empty),n[f]<u){for(var h=fs(t).cell.createAndFill(),m=[],v=n[f];v<u;v++)m.push(h);e[f]=e[f].append(i.from(m))}return{height:e.length,width:u,rows:e}}(s,l)}function Is(t,e){var n=t.createAndFill();return new wt(n).replace(0,n.content.size,e).doc}function Bs(t,e,n){var o=t.width,r=t.height,a=t.rows;if(o!=e){for(var s=[],l=[],c=0;c<a.length;c++){for(var d=a[c],u=[],p=s[c]||0,f=0;p<e;f++){var h=d.child(f%d.childCount);p+h.attrs.colspan>e&&(h=h.type.create(Ss(h.attrs,h.attrs.colspan,p+h.attrs.colspan-e),h.content)),u.push(h),p+=h.attrs.colspan;for(var m=1;m<h.attrs.rowspan;m++)s[c+m]=(s[c+m]||0)+h.attrs.colspan}l.push(i.from(u))}a=l,o=e}if(r!=n){for(var v=[],g=0,y=0;g<n;g++,y++){for(var b=[],w=a[y%r],k=0;k<w.childCount;k++){var _=w.child(k);g+_.attrs.rowspan>n&&(_=_.type.create(xs(_.attrs,"rowspan",Math.max(1,n-_.attrs.rowspan)),_.content)),b.push(_)}v.push(i.from(b))}a=v,r=n}return{width:o,height:r,rows:a}}function Ns(t,e,n,o,r,i,a,s){if(0==a||a==e.height)return!1;for(var l=!1,c=r;c<i;c++){var d=a*e.width+c,u=e.map[d];if(e.map[d-e.width]==u){l=!0;var p=n.nodeAt(u),f=e.findCell(u),h=f.top,m=f.left;t.setNodeMarkup(t.mapping.slice(s).map(u+o),null,xs(p.attrs,"rowspan",a-h)),t.insert(t.mapping.slice(s).map(e.positionAt(a,m,n)),p.type.createAndFill(xs(p.attrs,"rowspan",h+p.attrs.rowspan-a))),c+=p.attrs.colspan-1}}return l}function zs(t,e,n,o,r,i,a,s){if(0==a||a==e.width)return!1;for(var l=!1,c=r;c<i;c++){var d=c*e.width+a,u=e.map[d];if(e.map[d-1]==u){l=!0;var p=n.nodeAt(u),f=e.colCount(u),h=t.mapping.slice(s).map(u+o);t.setNodeMarkup(h,null,Ss(p.attrs,a-f,p.attrs.colspan-(a-f))),t.insert(h+p.nodeSize,p.type.createAndFill(Ss(p.attrs,0,a-f))),c+=p.attrs.rowspan-1}}return l}function Rs(t,e,n,o,r){var a=n?t.doc.nodeAt(n-1):t.doc,s=ls.get(a),l=o.top,c=o.left,d=c+r.width,u=l+r.height,f=t.tr,h=0;function m(){a=n?f.doc.nodeAt(n-1):f.doc,s=ls.get(a),h=f.mapping.maps.length}(function(t,e,n,o,r,a,s){var l,c,d=fs(t.doc.type.schema);if(r>e.width)for(var u=0,p=0;u<e.height;u++){var f=n.child(u);p+=f.nodeSize;var h=[],m=void 0;m=null==f.lastChild||f.lastChild.type==d.cell?l||(l=d.cell.createAndFill()):c||(c=d.header_cell.createAndFill());for(var v=e.width;v<r;v++)h.push(m);t.insert(t.mapping.slice(s).map(p-1+o),h)}if(a>e.height){for(var g=[],y=0,b=(e.height-1)*e.width;y<Math.max(e.width,r);y++){var w=!(y>=e.width)&&n.nodeAt(e.map[b+y]).type==d.header_cell;g.push(w?c||(c=d.header_cell.createAndFill()):l||(l=d.cell.createAndFill()))}for(var k=d.row.create(null,i.from(g)),_=[],C=e.height;C<a;C++)_.push(k);t.insert(t.mapping.slice(s).map(o+n.nodeSize-2),_)}return!(!l&&!c)})(f,s,a,n,d,u,h)&&m(),Ns(f,s,a,n,c,d,l,h)&&m(),Ns(f,s,a,n,c,d,u,h)&&m(),zs(f,s,a,n,l,u,c,h)&&m(),zs(f,s,a,n,l,u,d,h)&&m();for(var v=l;v<u;v++){var g=s.positionAt(v,c,a),y=s.positionAt(v,d,a);f.replace(f.mapping.slice(h).map(g+n),f.mapping.slice(h).map(y+n),new p(r.rows[v-l],0,0))}m(),f.setSelection(new Ms(f.doc.resolve(n+s.positionAt(l,c,a)),f.doc.resolve(n+s.positionAt(u-1,d-1,a)))),e(f)}Ds.prototype.map=function(t){return new Ds(t.map(this.anchor),t.map(this.head))},Ds.prototype.resolve=function(t){var e=t.resolve(this.anchor),n=t.resolve(this.head);return"row"==e.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&e.index()<e.parent.childCount&&n.index()<n.parent.childCount&&ws(e,n)?new Ms(e,n):te.near(n,1)};var Ps=dr({ArrowLeft:Fs("horiz",-1),ArrowRight:Fs("horiz",1),ArrowUp:Fs("vert",-1),ArrowDown:Fs("vert",1),"Shift-ArrowLeft":$s("horiz",-1),"Shift-ArrowRight":$s("horiz",1),"Shift-ArrowUp":$s("vert",-1),"Shift-ArrowDown":$s("vert",1),Backspace:Vs,"Mod-Backspace":Vs,Delete:Vs,"Mod-Delete":Vs});function Ls(t,e,n){return!n.eq(t.selection)&&(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Fs(t,e){return function(n,o,r){var i=n.selection;if(i instanceof Ms)return Ls(n,o,te.near(i.$headCell,e));if("horiz"!=t&&!i.empty)return!1;var a=qs(r,t,e);if(null==a)return!1;if("horiz"==t)return Ls(n,o,te.near(n.doc.resolve(i.head+e),e));var s,l=n.doc.resolve(a),c=Cs(l,t,e);return s=c?te.near(c,1):e<0?te.near(n.doc.resolve(l.before(-1)),-1):te.near(n.doc.resolve(l.after(-1)),1),Ls(n,o,s)}}function $s(t,e){return function(n,o,r){var i=n.selection;if(!(i instanceof Ms)){var a=qs(r,t,e);if(null==a)return!1;i=new Ms(n.doc.resolve(a))}var s=Cs(i.$headCell,t,e);return!!s&&Ls(n,o,new Ms(i.$anchorCell,s))}}function Vs(t,e){var n=t.selection;if(!(n instanceof Ms))return!1;if(e){var o=t.tr,r=fs(t.schema).cell.createAndFill().content;n.forEachCell((function(t,e){t.content.eq(r)||o.replace(o.mapping.map(e+1),o.mapping.map(e+t.nodeSize-1),new p(r,0,0))})),o.docChanged&&e(o)}return!0}function js(t,e){var n=ms(t.state.doc.resolve(e));return!!n&&(t.dispatch(t.state.tr.setSelection(new Ms(n))),!0)}function Ws(t,e,n){if(!vs(t.state))return!1;var o=As(n),r=t.state.selection;if(r instanceof Ms){o||(o={width:1,height:1,rows:[i.from(Is(fs(t.state.schema).cell,n))]});var a=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=ls.get(a).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=Bs(o,l.right-l.left,l.bottom-l.top),Rs(t.state,t.dispatch,s,l,o),!0}if(o){var c=gs(t.state),d=c.start(-1);return Rs(t.state,t.dispatch,d,ls.get(c.node(-1)).findCell(c.pos-d),o),!0}return!1}function Hs(t,e){if(!e.ctrlKey&&!e.metaKey){var n,o=Js(t,e.target);if(e.shiftKey&&t.state.selection instanceof Ms)r(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&null!=(n=ms(t.state.selection.$anchor))&&Ks(t,e).pos!=n.pos)r(n,e),e.preventDefault();else if(!o)return;t.root.addEventListener("mouseup",i),t.root.addEventListener("dragstart",i),t.root.addEventListener("mousemove",a)}function r(e,n){var o=Ks(t,n),r=null==hs.getState(t.state);if(!o||!ws(e,o)){if(!r)return;o=e}var i=new Ms(e,o);if(r||!t.state.selection.eq(i)){var a=t.state.tr.setSelection(i);r&&a.setMeta(hs,e.pos),t.dispatch(a)}}function i(){t.root.removeEventListener("mouseup",i),t.root.removeEventListener("dragstart",i),t.root.removeEventListener("mousemove",a),null!=hs.getState(t.state)&&t.dispatch(t.state.tr.setMeta(hs,-1))}function a(n){var a,s=hs.getState(t.state);if(null!=s)a=t.state.doc.resolve(s);else if(Js(t,n.target)!=o&&!(a=Ks(t,e)))return i();a&&r(a,n)}}function qs(t,e,n){if(!(t.state.selection instanceof oe))return null;for(var o=t.state.selection.$head,r=o.depth-1;r>=0;r--){var i=o.node(r);if((n<0?o.index(r):o.indexAfter(r))!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){var a=o.before(r),s="vert"==e?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(s)?a:null}}return null}function Js(t,e){for(;e&&e!=t.dom;e=e.parentNode)if("TD"==e.nodeName||"TH"==e.nodeName)return e}function Ks(t,e){var n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?ms(t.state.doc.resolve(n.pos)):null}var Us=new _e("fix-tables");function Gs(t,e){var n,o=function(e,o){"table"==e.type.spec.tableRole&&(n=function(t,e,n,o){var r=ls.get(e);if(!r.problems)return o;o||(o=t.tr);for(var i,a,s=[],l=0;l<r.height;l++)s.push(0);for(var c=0;c<r.problems.length;c++){var d=r.problems[c];if("collision"==d.type){for(var u=e.nodeAt(d.pos),p=0;p<u.attrs.rowspan;p++)s[d.row+p]+=d.n;o.setNodeMarkup(o.mapping.map(n+1+d.pos),null,Ss(u.attrs,u.attrs.colspan-d.n,d.n))}else if("missing"==d.type)s[d.row]+=d.n;else if("overlong_rowspan"==d.type){var f=e.nodeAt(d.pos);o.setNodeMarkup(o.mapping.map(n+1+d.pos),null,xs(f.attrs,"rowspan",f.attrs.rowspan-d.n))}else if("colwidth mismatch"==d.type){var h=e.nodeAt(d.pos);o.setNodeMarkup(o.mapping.map(n+1+d.pos),null,xs(h.attrs,"colwidth",d.colwidth))}}for(var m=0;m<s.length;m++)s[m]&&(null==i&&(i=m),a=m);for(var v=0,g=n+1;v<r.height;v++){var y=e.child(v),b=g+y.nodeSize,w=s[v];if(w>0){var k="cell";y.firstChild&&(k=y.firstChild.type.spec.tableRole);for(var _=[],C=0;C<w;C++)_.push(fs(t.schema)[k].createAndFill());var x=0!=v&&i!=v-1||a!=v?b-1:g+1;o.insert(o.mapping.map(x),_)}g=b}return o.setMeta(Us,{fixTables:!0})}(t,e,o,n))};return e?e.doc!=t.doc&&function t(e,n,o,r){var i=e.childCount,a=n.childCount;t:for(var s=0,l=0;s<a;s++){for(var c=n.child(s),d=l,u=Math.min(i,s+3);d<u;d++)if(e.child(d)==c){l=d+1,o+=c.nodeSize;continue t}r(c,o),l<i&&e.child(l).sameMarkup(c)?t(e.child(l),c,o+1,r):c.nodesBetween(0,c.content.size,r,o+1),o+=c.nodeSize}}(e.doc,t.doc,0,o):t.doc.descendants(o),n}function Xs(t){var e,n=t.selection,o=gs(t),r=o.node(-1),i=o.start(-1),a=ls.get(r);return(e=n instanceof Ms?a.rectBetween(n.$anchorCell.pos-i,n.$headCell.pos-i):a.findCell(o.pos-i)).tableStart=i,e.map=a,e.table=r,e}function Ys(t,e,n){var o=e.map,r=e.tableStart,i=e.table,a=n>0?-1:0;Ts(o,i,n+a)&&(a=0==n||n==o.width?null:0);for(var s=0;s<o.height;s++){var l=s*o.width+n;if(n>0&&n<o.width&&o.map[l-1]==o.map[l]){var c=o.map[l],d=i.nodeAt(c);t.setNodeMarkup(t.mapping.map(r+c),null,Es(d.attrs,n-o.colCount(c))),s+=d.attrs.rowspan-1}else{var u=null==a?fs(i.type.schema).cell:i.nodeAt(o.map[l+a]).type,p=o.positionAt(s,n,i);t.insert(t.mapping.map(r+p),u.createAndFill())}}return t}function Zs(t,e){if(!vs(t))return!1;if(e){var n=Xs(t);e(Ys(t.tr,n,n.left))}return!0}function Qs(t,e){if(!vs(t))return!1;if(e){var n=Xs(t);e(Ys(t.tr,n,n.right))}return!0}function tl(t,e,n){for(var o=e.map,r=e.table,i=e.tableStart,a=t.mapping.maps.length,s=0;s<o.height;){var l=s*o.width+n,c=o.map[l],d=r.nodeAt(c);if(n>0&&o.map[l-1]==c||n<o.width-1&&o.map[l+1]==c)t.setNodeMarkup(t.mapping.slice(a).map(i+c),null,Ss(d.attrs,n-o.colCount(c)));else{var u=t.mapping.slice(a).map(i+c);t.delete(u,u+d.nodeSize)}s+=d.attrs.rowspan}}function el(t,e){if(!vs(t))return!1;if(e){var n=Xs(t),o=t.tr;if(0==n.left&&n.right==n.map.width)return!1;for(var r=n.right-1;tl(o,n,r),r!=n.left;r--)n.table=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc,n.map=ls.get(n.table);e(o)}return!0}function nl(t,e,n){for(var o=fs(e.type.schema).header_cell,r=0;r<t.width;r++)if(e.nodeAt(t.map[r+n*t.width]).type!=o)return!1;return!0}function ol(t,e,n){for(var o=e.map,r=e.tableStart,i=e.table,a=r,s=0;s<n;s++)a+=i.child(s).nodeSize;var l=[],c=n>0?-1:0;nl(o,i,n+c)&&(c=0==n||n==o.height?null:0);for(var d=0,u=o.width*n;d<o.width;d++,u++)if(n>0&&n<o.height&&o.map[u]==o.map[u-o.width]){var p=o.map[u],f=i.nodeAt(p).attrs;t.setNodeMarkup(r+p,null,xs(f,"rowspan",f.rowspan+1)),d+=f.colspan-1}else{var h=null==c?fs(i.type.schema).cell:i.nodeAt(o.map[u+c*o.width]).type;l.push(h.createAndFill())}return t.insert(a,fs(i.type.schema).row.create(null,l)),t}function rl(t,e){if(!vs(t))return!1;if(e){var n=Xs(t);e(ol(t.tr,n,n.top))}return!0}function il(t,e){if(!vs(t))return!1;if(e){var n=Xs(t);e(ol(t.tr,n,n.bottom))}return!0}function al(t,e,n){for(var o=e.map,r=e.table,i=e.tableStart,a=0,s=0;s<n;s++)a+=r.child(s).nodeSize;var l=a+r.child(n).nodeSize,c=t.mapping.maps.length;t.delete(a+i,l+i);for(var d=0,u=n*o.width;d<o.width;d++,u++){var p=o.map[u];if(n>0&&p==o.map[u-o.width]){var f=r.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(c).map(p+i),null,xs(f,"rowspan",f.rowspan-1)),d+=f.colspan-1}else if(n<o.width&&p==o.map[u+o.width]){var h=r.nodeAt(p),m=h.type.create(xs(h.attrs,"rowspan",h.attrs.rowspan-1),h.content),v=o.positionAt(n+1,d,r);t.insert(t.mapping.slice(c).map(i+v),m),d+=h.attrs.colspan-1}}}function sl(t,e){if(!vs(t))return!1;if(e){var n=Xs(t),o=t.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(var r=n.bottom-1;al(o,n,r),r!=n.top;r--)n.table=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc,n.map=ls.get(n.table);e(o)}return!0}function ll(t){var e=t.content;return 1==e.childCount&&e.firstChild.isTextblock&&0==e.firstChild.childCount}function cl(t,e){var n=t.selection;if(!(n instanceof Ms)||n.$anchorCell.pos==n.$headCell.pos)return!1;var o=Xs(t),r=o.map;if(function(t,e){for(var n=t.width,o=t.height,r=t.map,i=e.top*n+e.left,a=i,s=(e.bottom-1)*n+e.left,l=i+(e.right-e.left-1),c=e.top;c<e.bottom;c++){if(e.left>0&&r[a]==r[a-1]||e.right<n&&r[l]==r[l+1])return!0;a+=n,l+=n}for(var d=e.left;d<e.right;d++){if(e.top>0&&r[i]==r[i-n]||e.bottom<o&&r[s]==r[s+n])return!0;i++,s++}return!1}(r,o))return!1;if(e){for(var a,s,l=t.tr,c={},d=i.empty,u=o.top;u<o.bottom;u++)for(var p=o.left;p<o.right;p++){var f=r.map[u*r.width+p],h=o.table.nodeAt(f);if(!c[f])if(c[f]=!0,null==a)a=f,s=h;else{ll(h)||(d=d.append(h.content));var m=l.mapping.map(f+o.tableStart);l.delete(m,m+h.nodeSize)}}if(l.setNodeMarkup(a+o.tableStart,null,xs(Es(s.attrs,s.attrs.colspan,o.right-o.left-s.attrs.colspan),"rowspan",o.bottom-o.top)),d.size){var v=a+1+s.content.size,g=ll(s)?a+1:v;l.replaceWith(g+o.tableStart,v+o.tableStart,d)}l.setSelection(new Ms(l.doc.resolve(a+o.tableStart))),e(l)}return!0}function dl(t,e){var n=fs(t.schema);return ul((function(t){var e=t.node;return n[e.type.spec.tableRole]}))(t,e)}function ul(t){return function(e,n){var o,r,i=e.selection;if(i instanceof Ms){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,r=i.$anchorCell.pos}else{if(!(o=function(t){for(var e=t.depth;e>0;e--){var n=t.node(e).type.spec.tableRole;if("cell"===n||"header_cell"===n)return t.node(e)}return null}(i.$from)))return!1;r=ms(i.$from).pos}if(1==o.attrs.colspan&&1==o.attrs.rowspan)return!1;if(n){var a=o.attrs,s=[],l=a.colwidth;a.rowspan>1&&(a=xs(a,"rowspan",1)),a.colspan>1&&(a=xs(a,"colspan",1));for(var c,d=Xs(e),u=e.tr,p=0;p<d.right-d.left;p++)s.push(l?xs(a,"colwidth",l&&l[p]?[l[p]]:null):a);for(var f=d.top;f<d.bottom;f++){var h=d.map.positionAt(f,d.left,d.table);f==d.top&&(h+=o.nodeSize);for(var m=d.left,v=0;m<d.right;m++,v++)m==d.left&&f==d.top||u.insert(c=u.mapping.map(h+d.tableStart,1),t({node:o,row:f,col:m}).createAndFill(s[v]))}u.setNodeMarkup(r,t({node:o,row:d.top,col:d.left}),s[0]),i instanceof Ms&&u.setSelection(new Ms(u.doc.resolve(i.$anchorCell.pos),c&&u.doc.resolve(c))),n(u)}return!0}}function pl(t,e){return function(n,o){if(!vs(n))return!1;var r=gs(n);if(r.nodeAfter.attrs[t]===e)return!1;if(o){var i=n.tr;n.selection instanceof Ms?n.selection.forEachCell((function(n,o){n.attrs[t]!==e&&i.setNodeMarkup(o,null,xs(n.attrs,t,e))})):i.setNodeMarkup(r.pos,null,xs(r.nodeAfter.attrs,t,e)),o(i)}return!0}}function fl(t,e,n){for(var o=e.map.cellsInRect({left:0,top:0,right:"row"==t?e.map.width:1,bottom:"column"==t?e.map.height:1}),r=0;r<o.length;r++){var i=e.table.nodeAt(o[r]);if(i&&i.type!==n.header_cell)return!1}return!0}function hl(t,e){return(e=e||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(t){return function(e,n){if(!vs(e))return!1;if(n){for(var o=fs(e.schema),r=Xs(e),i=e.tr,a=r.map.cellsInRect("column"==t?new ss(r.left,0,r.right,r.map.height):"row"==t?new ss(0,r.top,r.map.width,r.bottom):r),s=a.map((function(t){return r.table.nodeAt(t)})),l=0;l<a.length;l++)s[l].type==o.header_cell&&i.setNodeMarkup(r.tableStart+a[l],o.cell,s[l].attrs);if(0==i.steps.length)for(var c=0;c<a.length;c++)i.setNodeMarkup(r.tableStart+a[c],o.header_cell,s[c].attrs);n(i)}return!0}}(t):function(e,n){if(!vs(e))return!1;if(n){var o=fs(e.schema),r=Xs(e),i=e.tr,a=fl("row",r,o),s=fl("column",r,o),l=("column"===t?a:"row"===t&&s)?1:0,c="column"==t?new ss(0,l,1,r.map.height):"row"==t?new ss(l,0,r.map.width,1):r,d="column"==t?s?o.cell:o.header_cell:"row"==t?a?o.cell:o.header_cell:o.cell;r.map.cellsInRect(c).forEach((function(t){var e=t+r.tableStart,n=i.doc.nodeAt(e);n&&i.setNodeMarkup(e,d,n.attrs)})),n(i)}return!0}}var ml=hl("row",{useDeprecatedLogic:!0}),vl=hl("column",{useDeprecatedLogic:!0}),gl=hl("cell",{useDeprecatedLogic:!0});function yl(t){return function(e,n){if(!vs(e))return!1;var o=function(t,e){if(e<0){var n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(var o=t.index(-1)-1,r=t.before();o>=0;o--){var i=t.node(-1).child(o);if(i.childCount)return r-1-i.lastChild.nodeSize;r-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;for(var a=t.node(-1),s=t.indexAfter(-1),l=t.after();s<a.childCount;s++){var c=a.child(s);if(c.childCount)return l+1;l+=c.nodeSize}}}(gs(e),t);if(null!=o){if(n){var r=e.doc.resolve(o);n(e.tr.setSelection(oe.between(r,bs(r))).scrollIntoView())}return!0}}}function bl(t,e){for(var n=t.selection.$anchor,o=n.depth;o>0;o--){if("table"==n.node(o).type.spec.tableRole)return e&&e(t.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0}return!1}var wl=function(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),kl(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))};function kl(t,e,n,o,r,i){for(var a=0,s=!0,l=e.firstChild,c=t.firstChild,d=0,u=0;d<c.childCount;d++)for(var p=c.child(d).attrs,f=p.colspan,h=p.colwidth,m=0;m<f;m++,u++){var v=r==u?i:h&&h[m],g=v?v+"px":"";a+=v||o,v||(s=!1),l?(l.style.width!=g&&(l.style.width=g),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=g}for(;l;){var y=l.nextSibling;l.parentNode.removeChild(l),l=y}s?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}wl.prototype.update=function(t){return t.type==this.node.type&&(this.node=t,kl(t,this.colgroup,this.table,this.cellMinWidth),!0)},wl.prototype.ignoreMutation=function(t){return"attributes"==t.type&&(t.target==this.table||this.colgroup.contains(t.target))};var _l=new _e("tableColumnResizing");function Cl(t){void 0===t&&(t={});var e=t.handleWidth;void 0===e&&(e=5);var n=t.cellMinWidth;void 0===n&&(n=25);var o=t.View;void 0===o&&(o=wl);var r=t.lastColumnResizable;return void 0===r&&(r=!0),new be({key:_l,state:{init:function(t,e){return this.spec.props.nodeViews[fs(e.schema).table.name]=function(t,e){return new o(t,n,e)},new xl(-1,!1)},apply:function(t,e){return e.apply(t)}},props:{attributes:function(t){return _l.getState(t).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove:function(t,n){!function(t,e,n,o,r){var i=_l.getState(t.state);if(!i.dragging){var a=function(t){for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.classList.contains("ProseMirror")?null:t.parentNode;return t}(e.target),s=-1;if(a){var l=a.getBoundingClientRect(),c=l.left,d=l.right;e.clientX-c<=n?s=Sl(t,e,"left"):d-e.clientX<=n&&(s=Sl(t,e,"right"))}if(s!=i.activeHandle){if(!r&&-1!==s){var u=t.state.doc.resolve(s),p=u.node(-1),f=ls.get(p),h=u.start(-1);if(f.colCount(u.pos-h)+u.nodeAfter.attrs.colspan-1==f.width-1)return}Tl(t,s)}}}(t,n,e,0,r)},mouseleave:function(t){!function(t){var e=_l.getState(t.state);e.activeHandle>-1&&!e.dragging&&Tl(t,-1)}(t)},mousedown:function(t,e){!function(t,e,n){var o=_l.getState(t.state);if(-1==o.activeHandle||o.dragging)return!1;var r=t.state.doc.nodeAt(o.activeHandle),i=function(t,e,n){var o=n.colspan,r=n.colwidth,i=r&&r[r.length-1];if(i)return i;var a=t.domAtPos(e),s=a.node.childNodes[a.offset].offsetWidth,l=o;if(r)for(var c=0;c<o;c++)r[c]&&(s-=r[c],l--);return s/l}(t,o.activeHandle,r.attrs);function a(e){window.removeEventListener("mouseup",a),window.removeEventListener("mousemove",s);var o=_l.getState(t.state);o.dragging&&(!function(t,e,n){for(var o=t.state.doc.resolve(e),r=o.node(-1),i=ls.get(r),a=o.start(-1),s=i.colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1,l=t.state.tr,c=0;c<i.height;c++){var d=c*i.width+s;if(!c||i.map[d]!=i.map[d-i.width]){var u=i.map[d],p=r.nodeAt(u).attrs,f=1==p.colspan?0:s-i.colCount(u);if(!p.colwidth||p.colwidth[f]!=n){var h=p.colwidth?p.colwidth.slice():Ml(p.colspan);h[f]=n,l.setNodeMarkup(a+u,null,xs(p,"colwidth",h))}}}l.docChanged&&t.dispatch(l)}(t,o.activeHandle,El(o.dragging,e,n)),t.dispatch(t.state.tr.setMeta(_l,{setDragging:null})))}function s(e){if(!e.which)return a(e);var o=_l.getState(t.state),r=El(o.dragging,e,n);!function(t,e,n,o){var r=t.state.doc.resolve(e),i=r.node(-1),a=r.start(-1),s=ls.get(i).colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,l=t.domAtPos(r.start(-1)).node;for(;"TABLE"!=l.nodeName;)l=l.parentNode;kl(i,l.firstChild,l,o,s,n)}(t,o.activeHandle,r,n)}t.dispatch(t.state.tr.setMeta(_l,{setDragging:{startX:e.clientX,startWidth:i}})),window.addEventListener("mouseup",a),window.addEventListener("mousemove",s),e.preventDefault()}(t,e,n)}},decorations:function(t){var e=_l.getState(t);if(e.activeHandle>-1)return function(t,e){for(var n=[],o=t.doc.resolve(e),r=o.node(-1),i=ls.get(r),a=o.start(-1),s=i.colCount(o.pos-a)+o.nodeAfter.attrs.colspan,l=0;l<i.height;l++){var c=s+l*i.width-1;if(!(s!=i.width&&i.map[c]==i.map[c+1]||0!=l&&i.map[c-1]==i.map[c-1-i.width])){var d=i.map[c],u=a+d+r.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",n.push(Ba.widget(u,p))}}return Pa.create(t.doc,n)}(t,e.activeHandle)},nodeViews:{}}})}var xl=function(t,e){this.activeHandle=t,this.dragging=e};function Sl(t,e,n){var o=t.posAtCoords({left:e.clientX,top:e.clientY});if(!o)return-1;var r=o.pos,i=ms(t.state.doc.resolve(r));if(!i)return-1;if("right"==n)return i.pos;var a=ls.get(i.node(-1)),s=i.start(-1),l=a.map.indexOf(i.pos-s);return l%a.width==0?-1:s+a.map[l-1]}function El(t,e,n){var o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function Tl(t,e){t.dispatch(t.state.tr.setMeta(_l,{setHandle:e}))}function Ml(t){for(var e=[],n=0;n<t;n++)e.push(0);return e}function Dl(t){void 0===t&&(t={});var e=t.allowTableNodeSelection;return void 0===e&&(e=!1),new be({key:hs,state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(hs);if(null!=n)return-1==n?null:n;if(null==e||!t.docChanged)return e;var o=t.mapping.mapResult(e),r=o.deleted,i=o.pos;return r?null:i}},props:{decorations:Os,handleDOMEvents:{mousedown:Hs},createSelectionBetween:function(t){if(null!=hs.getState(t.state))return t.state.selection},handleTripleClick:js,handleKeyDown:Ps,handlePaste:Ws},appendTransaction:function(t,n,o){return function(t,e,n){var o,r,i=(e||t).selection,a=(e||t).doc;if(i instanceof ie&&(r=i.node.type.spec.tableRole)){if("cell"==r||"header_cell"==r)o=Ms.create(a,i.from);else if("row"==r){var s=a.resolve(i.from+1);o=Ms.rowSelection(s,s)}else if(!n){var l=ls.get(i.node),c=i.from+1,d=c+l.map[l.width*l.height-1];o=Ms.create(a,c+1,d)}}else i instanceof oe&&function(t){var e=t.$from,n=t.$to;if(e.pos==n.pos||e.pos<e.pos-6)return!1;for(var o=e.pos,r=n.pos,i=e.depth;i>=0&&!(e.after(i+1)<e.end(i));i--,o++);for(var a=n.depth;a>=0&&!(n.before(a+1)>n.start(a));a--,r--);return o==r&&/row|table/.test(e.node(i).type.spec.tableRole)}(i)?o=oe.create(a,i.from):i instanceof oe&&function(t){for(var e,n,o=t.$from,r=t.$to,i=o.depth;i>0;i--){var a=o.node(i);if("cell"===a.type.spec.tableRole||"header_cell"===a.type.spec.tableRole){e=a;break}}for(var s=r.depth;s>0;s--){var l=r.node(s);if("cell"===l.type.spec.tableRole||"header_cell"===l.type.spec.tableRole){n=l;break}}return e!==n&&0===r.parentOffset}(i)&&(o=oe.create(a,i.$from.start(),i.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}(o,Gs(o,n),e)}})}xl.prototype.apply=function(t){var e=this,n=t.getMeta(_l);if(n&&null!=n.setHandle)return new xl(n.setHandle,null);if(n&&void 0!==n.setDragging)return new xl(e.activeHandle,n.setDragging);if(e.activeHandle>-1&&t.docChanged){var o=t.mapping.map(e.activeHandle,-1);ys(t.doc.resolve(o))||(o=null),e=new xl(o,e.dragging)}return e};var Ol=["blockquote",0],Al=["hr"],Il=["pre",["code",0]],Bl=["ol",0],Nl=["ul",0],zl=["li",0],Rl=function(t){for(var e,n={},o=t.attributes,r=0;r<o.length;r++)n[(e=o[r]).name]=e.value;return n},Pl=function(t){var e={};return t.forEach((function(t){e[t]={default:null}})),e},Ll=function(){return Pl(["style","class","id"])},Fl=function(t,e){for(var n in t)if(n&&null!==t[n]&&n!==e)return!0;return!1},$l=function(t,e){var n={};for(var o in t)o&&null!==t[o]&&o!==e&&(n[o]=t[o]);return n},Vl=function(t){var e;return(e={})[t]={name:t,inclusive:!0,parseDOM:[{tag:t}],toDOM:function(){return[t,0]}},e},jl=Ne.__assign({link:{attrs:Ne.__assign({},Ll(),{href:{default:null},target:{default:null},title:{default:null}}),inclusive:!1,parseDOM:[{tag:"a",getAttrs:Rl}],toDOM:function(t){return["a",$l(t.attrs),0]}}},Vl("strong"),Vl("b"),Vl("em"),Vl("i"),Vl("u"),Vl("del"),Vl("sub"),Vl("sup"),Vl("code"),{style:{attrs:Ne.__assign({},Ll()),parseDOM:[{tag:"span",getAttrs:Rl}],toDOM:function(t){return Fl(t.attrs)?["span",$l(t.attrs),0]:["span",0]}}}),Wl=function(t){var e;return(e={})[t]={default:null,getFromDOM:function(e){return e.getAttribute(t)},setDOMAttr:function(e,n){n[t]=e}},e},Hl=Ne.__assign({},Wl("style"),Wl("class"),Wl("id"),Wl("headers")),ql={doc:{content:"colgroup*"},col:{attrs:Pl(["id","class","style","span"]),parseDOM:[{getAttrs:Rl,tag:"col"}],toDOM:function(t){return["col",t.attrs]}},colgroup:{attrs:Pl(["id","class","style","span"]),content:"col*",parseDOM:[{getAttrs:Rl,tag:"colgroup"}],toDOM:function(t){return["colgroup",t.attrs,0]}},text:{inline:!0,group:"inline"}},Jl=new Z({nodes:ql,marks:{}}),Kl=ps({tableGroup:"block",cellContent:"block+",cellAttributes:Hl});Kl.table_row.attrs=Ne.__assign({},Kl.table_row.attrs,Pl([Ce,"style","class","id"])),Kl.table_row.toDOM=function(t){return["tr",$l(t.attrs),0]},Kl.table_row.parseDOM=[{tag:"tr",getAttrs:Rl}],Kl.table.attrs=Ne.__assign({},Kl.table.attrs,Pl(["style","class","id","k-colgroup-data"])),Kl.table.toDOM=function(t){var e=Fl(t.attrs)?$l(t.attrs,"k-colgroup-data"):{},n=null;if(t.attrs["k-colgroup-data"]&&!function(t){for(var e=!1,n=t.child(0),o=0;o<n.childCount;o++){if(n.child(o).attrs.colwidth){e=!0;break}}return e}(t)){var o=Oe(Me(t.attrs["k-colgroup-data"]),Jl,{preserveWhitespace:!1}),r=De(o).firstChild;if(r){var i=Array.from(r.children).map((function(t){return["col",Rl(t)]}));n=["colgroup",Rl(r)].concat(i)}}return n?["table",e,n,["tbody",0]]:["table",e,["tbody",0]]},Kl.table.parseDOM=[{tag:"table",getAttrs:function(t){var e=Rl(t),n=Array.from(t.childNodes).find((function(t){return"COLGROUP"===t.nodeName}));return n&&(e["k-colgroup-data"]=n.outerHTML),e}}];var Ul=Ne.__assign({doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:Ne.__assign({},Ll()),parseDOM:[{tag:"p",getAttrs:Rl}],toDOM:function(t){return Fl(t.attrs)?["p",$l(t.attrs),0]:["p",0]}},div:{content:"block*",group:"block",attrs:Ne.__assign({},Ll()),parseDOM:[{tag:"div",getAttrs:Rl}],toDOM:function(t){return Fl(t.attrs)?["div",$l(t.attrs),0]:["div",0]}},blockquote:{attrs:Ne.__assign({},Ll()),content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote",getAttrs:Rl}],toDOM:function(t){return Fl(t.attrs)?["blockquote",$l(t.attrs),0]:Ol}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:function(){return Al}},heading:{attrs:Ne.__assign({},Ll(),{level:{default:1}}),content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",getAttrs:function(t){return Ne.__assign({},Rl(t),{level:1})}},{tag:"h2",getAttrs:function(t){return Ne.__assign({},Rl(t),{level:2})}},{tag:"h3",getAttrs:function(t){return Ne.__assign({},Rl(t),{level:3})}},{tag:"h4",getAttrs:function(t){return Ne.__assign({},Rl(t),{level:4})}},{tag:"h5",getAttrs:function(t){return Ne.__assign({},Rl(t),{level:5})}},{tag:"h6",getAttrs:function(t){return Ne.__assign({},Rl(t),{level:6})}}],toDOM:function(t){return Fl(t.attrs,"level")?["h"+t.attrs.level,$l(t.attrs,"level"),0]:["h"+t.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM:function(){return Il}},text:{inline:!0,group:"inline"},image:{inline:!0,attrs:Ne.__assign({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}},Ll()),group:"inline",draggable:!0,parseDOM:[{tag:"img",getAttrs:Rl}],toDOM:function(t){return Fl(t.attrs)?["img",$l(t.attrs)]:["img"]}},hard_break:{inline:!0,attrs:Ne.__assign({},Ll()),group:"inline",selectable:!1,parseDOM:[{tag:"br",getAttrs:Rl}],toDOM:function(t){return Fl(t.attrs)?["br",$l(t.attrs)]:["br"]}},ordered_list:{content:"list_item+",group:"block",attrs:Ne.__assign({},Ll(),{type:{default:null},order:{default:1}}),parseDOM:[{tag:"ol",getAttrs:function(t){return Ne.__assign({},Rl(t),{order:t.hasAttribute("start")?parseInt(t.getAttribute("start")||"1",10):1})}}],toDOM:function(t){return 1===t.attrs.order?Fl(t.attrs,"order")?["ol",$l(t.attrs,"order"),0]:Bl:["ol",Ne.__assign({},$l(t.attrs,"order"),{start:t.attrs.order}),0]}},bullet_list:{content:"list_item+",group:"block",attrs:Ne.__assign({},Ll()),parseDOM:[{tag:"ul",getAttrs:Rl}],toDOM:function(t){return Fl(t.attrs)?["ul",$l(t.attrs),0]:Nl}},list_item:{content:"(paragraph | heading) block*",attrs:Ne.__assign({},Ll()),parseDOM:[{tag:"li",getAttrs:Rl}],toDOM:function(t){return Fl(t.attrs)?["li",$l(t.attrs),0]:zl},defining:!0}},Kl),Gl=function(){};Gl.prototype.append=function(t){return t.length?(t=Gl.from(t),!this.length&&t||t.length<200&&this.leafAppend(t)||this.length<200&&t.leafPrepend(this)||this.appendInner(t)):this},Gl.prototype.prepend=function(t){return t.length?Gl.from(t).append(this):this},Gl.prototype.appendInner=function(t){return new Yl(this,t)},Gl.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Gl.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Gl.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Gl.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Gl.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var o=[];return this.forEach((function(e,n){return o.push(t(e,n))}),e,n),o},Gl.from=function(t){return t instanceof Gl?t:t&&t.length?new Xl(t):Gl.empty};var Xl=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,o){for(var r=e;r<n;r++)if(!1===t(this.values[r],o+r))return!1},e.prototype.forEachInvertedInner=function(t,e,n,o){for(var r=e-1;r>=n;r--)if(!1===t(this.values[r],o+r))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=200)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=200)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Gl);Gl.empty=new Xl([]);var Yl=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,o){var r=this.left.length;return!(e<r&&!1===this.left.forEachInner(t,e,Math.min(n,r),o))&&(!(n>r&&!1===this.right.forEachInner(t,Math.max(e-r,0),Math.min(this.length,n)-r,o+r))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,o){var r=this.left.length;return!(e>r&&!1===this.right.forEachInvertedInner(t,e-r,Math.max(n,r)-r,o+r))&&(!(n<r&&!1===this.left.forEachInvertedInner(t,Math.min(e,r),n,o))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Gl),Zl=Gl,Ql=function(t,e){this.items=t,this.eventCount=e};Ql.prototype.popEvent=function(t,e){var n=this;if(0==this.eventCount)return null;for(var o,r,i=this.items.length;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(o=this.remapping(i,this.items.length),r=o.maps.length);var a,s,l=t.tr,c=[],d=[];return this.items.forEach((function(t,e){if(!t.step)return o||(o=n.remapping(i,e+1),r=o.maps.length),r--,void d.push(t);if(o){d.push(new tc(t.map));var u,p=t.step.map(o.slice(r));p&&l.maybeStep(p).doc&&(u=l.mapping.maps[l.mapping.maps.length-1],c.push(new tc(u,null,null,c.length+d.length))),r--,u&&o.appendMap(u,r)}else l.maybeStep(t.step);return t.selection?(a=o?t.selection.map(o.slice(r)):t.selection,s=new Ql(n.items.slice(0,i).append(d.reverse().concat(c)),n.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:l,selection:a}},Ql.prototype.addTransform=function(t,e,n,o){for(var r=[],i=this.eventCount,a=this.items,s=!o&&a.length?a.get(a.length-1):null,l=0;l<t.steps.length;l++){var c,d=t.steps[l].invert(t.docs[l]),u=new tc(t.mapping.maps[l],d,e);(c=s&&s.merge(u))&&(u=c,l?r.pop():a=a.slice(0,a.length-1)),r.push(u),e&&(i++,e=null),o||(s=u)}var p,f,h,m=i-n.depth;return m>nc&&(f=m,(p=a).forEach((function(t,e){if(t.selection&&0==f--)return h=e,!1})),a=p.slice(h),i-=m),new Ql(a.append(r),i)},Ql.prototype.remapping=function(t,e){var n=new yt;return this.items.forEach((function(e,o){var r=null!=e.mirrorOffset&&o-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:null;n.appendMap(e.map,r)}),t,e),n},Ql.prototype.addMaps=function(t){return 0==this.eventCount?this:new Ql(this.items.append(t.map((function(t){return new tc(t)}))),this.eventCount)},Ql.prototype.rebased=function(t,e){if(!this.eventCount)return this;var n=[],o=Math.max(0,this.items.length-e),r=t.mapping,i=t.steps.length,a=this.eventCount;this.items.forEach((function(t){t.selection&&a--}),o);var s=e;this.items.forEach((function(e){var o=r.getMirror(--s);if(null!=o){i=Math.min(i,o);var l=r.maps[o];if(e.step){var c=t.steps[o].invert(t.docs[o]),d=e.selection&&e.selection.map(r.slice(s+1,o));d&&a++,n.push(new tc(l,c,d))}else n.push(new tc(l))}}),o);for(var l=[],c=e;c<i;c++)l.push(new tc(r.maps[c]));var d=this.items.slice(0,o).append(l).append(n),u=new Ql(d,a);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u},Ql.prototype.emptyItemCount=function(){var t=0;return this.items.forEach((function(e){e.step||t++})),t},Ql.prototype.compress=function(t){void 0===t&&(t=this.items.length);var e=this.remapping(0,t),n=e.maps.length,o=[],r=0;return this.items.forEach((function(i,a){if(a>=t)o.push(i),i.selection&&r++;else if(i.step){var s=i.step.map(e.slice(n)),l=s&&s.getMap();if(n--,l&&e.appendMap(l,n),s){var c=i.selection&&i.selection.map(e.slice(n));c&&r++;var d,u=new tc(l.invert(),s,c),p=o.length-1;(d=o.length&&o[p].merge(u))?o[p]=d:o.push(u)}}else i.map&&n--}),this.items.length,0),new Ql(Zl.from(o.reverse()),r)},Ql.empty=new Ql(Zl.empty,0);var tc=function(t,e,n,o){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=o};tc.prototype.merge=function(t){if(this.step&&t.step&&!t.selection){var e=t.step.merge(this.step);if(e)return new tc(e.getMap().invert(),e,this.selection)}};var ec=function(t,e,n,o){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=o},nc=20;function oc(t){var e=[];return t.forEach((function(t,n,o,r){return e.push(o,r)})),e}function rc(t,e){if(!t)return null;for(var n=[],o=0;o<t.length;o+=2){var r=e.map(t[o],1),i=e.map(t[o+1],-1);r<=i&&n.push(r,i)}return n}function ic(t,e,n,o){var r=lc(e),i=dc.get(e).spec.config,a=(o?t.undone:t.done).popEvent(e,r);if(a){var s=a.selection.resolve(a.transform.doc),l=(o?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),i,r),c=new ec(o?l:a.remaining,o?a.remaining:l,null,0);n(a.transform.setSelection(s).setMeta(dc,{redo:o,historyState:c}).scrollIntoView())}}var ac=!1,sc=null;function lc(t){var e=t.plugins;if(sc!=e){ac=!1,sc=e;for(var n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ac=!0;break}}return ac}function cc(t){return t.setMeta(uc,!0)}var dc=new _e("history"),uc=new _e("closeHistory");function pc(t){return t={depth:t&&t.depth||100,newGroupDelay:t&&t.newGroupDelay||500},new be({key:dc,state:{init:function(){return new ec(Ql.empty,Ql.empty,null,0)},apply:function(e,n,o){return function(t,e,n,o){var r,i=n.getMeta(dc);if(i)return i.historyState;n.getMeta(uc)&&(t=new ec(t.done,t.undone,null,0));var a=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(a&&a.getMeta(dc))return a.getMeta(dc).redo?new ec(t.done.addTransform(n,null,o,lc(e)),t.undone,oc(n.mapping.maps[n.steps.length-1]),t.prevTime):new ec(t.done,t.undone.addTransform(n,null,o,lc(e)),null,t.prevTime);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))return(r=n.getMeta("rebased"))?new ec(t.done.rebased(n,r),t.undone.rebased(n,r),rc(t.prevRanges,n.mapping),t.prevTime):new ec(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),rc(t.prevRanges,n.mapping),t.prevTime);var s=0==t.prevTime||!a&&(t.prevTime<(n.time||0)-o.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;var n=!1;return t.mapping.maps[0].forEach((function(t,o){for(var r=0;r<e.length;r+=2)t<=e[r+1]&&o>=e[r]&&(n=!0)})),n}(n,t.prevRanges)),l=a?rc(t.prevRanges,n.mapping):oc(n.mapping.maps[n.steps.length-1]);return new ec(t.done.addTransform(n,s?e.selection.getBookmark():null,o,lc(e)),Ql.empty,l,n.time)}(n,o,e,t)}},config:t,props:{handleDOMEvents:{beforeinput:function(t,e){var n="historyUndo"==e.inputType?fc(t.state,t.dispatch):"historyRedo"==e.inputType&&hc(t.state,t.dispatch);return n&&e.preventDefault(),n}}}})}function fc(t,e){var n=dc.getState(t);return!(!n||0==n.done.eventCount)&&(e&&ic(n,t,e,!1),!0)}function hc(t,e){var n=dc.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&ic(n,t,e,!0),!0)}function mc(t){var e=dc.getState(t);return e?e.done.eventCount:0}function vc(t){var e=dc.getState(t);return e?e.undone.eventCount:0}var gc=function(t,e){var n;this.match=t,this.handler="string"==typeof e?(n=e,function(t,e,o,r){var i=n;if(e[1]){var a=e[0].lastIndexOf(e[1]);i+=e[0].slice(a+e[1].length);var s=(o+=a)-r;s>0&&(i=e[0].slice(a-s,a)+i,o=r)}return t.tr.insertText(i,o,r)}):e};function yc(t){var e=t.rules,n=new be({state:{init:function(){return null},apply:function(t,e){var n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:function(t,o,r,i){return bc(t,o,r,i,e,n)},handleDOMEvents:{compositionend:function(t){setTimeout((function(){var o=t.state.selection.$cursor;o&&bc(t,o.pos,o.pos,"",e,n)}))}}},isInputRules:!0});return n}function bc(t,e,n,o,r,i){if(t.composing)return!1;var a=t.state,s=a.doc.resolve(e);if(s.parent.type.spec.code)return!1;for(var l=s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,null,"")+o,c=0;c<r.length;c++){var d=r[c].match.exec(l),u=d&&r[c].handler(a,d,e-(d[0].length-o.length),n);if(u)return t.dispatch(u.setMeta(i,{transform:u,from:e,to:n,text:o})),!0}return!1}function wc(t,e){for(var n=t.plugins,o=0;o<n.length;o++){var r=n[o],i=void 0;if(r.spec.isInputRules&&(i=r.getState(t))){if(e){for(var a=t.tr,s=i.transform,l=s.steps.length-1;l>=0;l--)a.step(s.steps[l].invert(s.docs[l]));if(i.text){var c=a.doc.resolve(i.from).marks();a.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else a.delete(i.from,i.to);e(a)}return!0}}return!1}var kc=new gc(/--$/,"—"),_c=new gc(/\.\.\.$/,"…"),Cc=new gc(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),xc=new gc(/"$/,"”"),Sc=new gc(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),Ec=new gc(/'$/,"’"),Tc=[Cc,xc,Sc,Ec];function Mc(t,e,n,o){return new gc(t,(function(t,r,i,a){var s=n instanceof Function?n(r):n,l=t.tr.delete(i,a),c=l.doc.resolve(i).blockRange(),d=c&&At(c,e,s);if(!d)return null;l.wrap(c,d);var u=l.doc.resolve(i-1).nodeBefore;return u&&u.type==e&&Nt(l.doc,i-1)&&(!o||o(r,u))&&l.join(i-1),l}))}function Dc(t,e,n){return new gc(t,(function(t,o,r,i){var a=t.doc.resolve(r),s=n instanceof Function?n(o):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),e)?t.tr.delete(r,i).setBlockType(r,r,e,s):null}))}var Oc={mark:"strong",altMarks:["b"],altStyle:{name:"font-weight",value:/^(bold(er)?|[5-9]\d{2,})$/}},Ac={mark:"em",altMarks:["i"],altStyle:{name:"font-style",value:/^italic$/i}},Ic={mark:"u",altStyle:{name:"text-decoration",value:/^underline$/i}},Bc={mark:"del",altStyle:{name:"text-decoration",value:/^line-through$/i}},Nc={mark:"sub"},zc={mark:"sup"},Rc={mark:"link"},Pc="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Lc=function(t,e){var n={},o=e&&e.applyToWord||!1;if(n["Mod-z"]=fc,n["Shift-Mod-z"]=hc,n.Backspace=bo(wc,Hn,qn,Kn),n.Enter=bo(eo,ro,io,so),Pc||(n["Mod-y"]=hc),t.marks.strong&&(n["Mod-b"]=Ke(cn,Ne.__assign({},Oc,{applyToWord:o}))),t.marks.em&&(n["Mod-i"]=Ke(cn,Ne.__assign({},Ac,{applyToWord:o}))),t.marks.u&&(n["Mod-u"]=Ke(cn,Ne.__assign({},Ic,{applyToWord:o}))),t.nodes.hard_break){var r=t.nodes.hard_break,i=bo(oo,(function(t,e){return e(t.tr.replaceSelectionWith(r.create()).scrollIntoView()),!0}));n["Shift-Enter"]=i}return n},Fc=function(t){var e,n={};return t.nodes.list_item&&(n.Enter=(e=t.nodes.list_item,function(t,n){return Rn(e)(t,(function(e){var o=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();o&&e.ensureMarks(o),n(e)}))})),n},$c=/style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi,Vc=function(t){return/^MsoListParagraph/.test(t.className)},jc=function(t){var e=t.innerHTML;return e=(e=e.replace(/<!--(.|\s)*?-->/gi,"")).replace(/<\/?[^>]+?\/?>/gm,"")},Wc=function(t,e){var n=document.createElement(t);return n.style.listStyleType=e,n},Hc=function(t){var e=null;return/^\d/.test(t)||(e=(/^[a-z]/.test(t)?"lower-":"upper-")+(/^[ivxlcdm]/i.test(t)?"roman":"alpha")),e},qc=function(t,e){var n=[];Array.from(t).forEach((function(t){if(t.nodeType===Node.ELEMENT_NODE){var o=t;o.getAttribute("datalist")?(n.push(t),e.add(n)):Vc(o)&&n.length?n.push(t):(n=[],"DIV"===o.nodeName?qc(o.children,e):"TABLE"===o.nodeName&&Array.from(o.querySelectorAll("td,th")).forEach((function(t){qc(t.children,e)})))}}))},Jc=function(t){var e,n=t.innerHTML,o=function(t){return t.replace(/^(?:&nbsp;|[\u00a0\n\r\s])+/,"")};return n=n.replace(/<\/?\w+[^>]*>/g,"").replace(/&nbsp;/g," "),/^[\u2022\u00b7\u00a7\u00d8oØüvn][\u00a0 ]+/.test(n)?{tag:"ul",style:(e=o(jc(t)),/^[\u2022\u00b7\u00FC\u00D8\u002dv-]/.test(e)?null:/^o/.test(e)?"circle":"square")}:/^\s*\w+[\.\)][\u00a0 ]{2,}/.test(n)?{tag:"ol",style:Hc(o(jc(t)))}:void 0},Kc=function(t){var e,n=t.nodeName.toLowerCase();t.firstChild&&t.firstChild.nodeType===Node.COMMENT_NODE&&t.removeChild(t.firstChild),1===t.childNodes.length?e=t.firstChild.nodeType===Node.TEXT_NODE?jc(t):t.firstChild.innerHTML.replace(/^\w+[\.\)](&nbsp;)+ /,""):(t.removeChild(t.firstChild),3===t.firstChild.nodeType&&/^[ivxlcdm]+\.$/i.test(t.firstChild.nodeValue)&&t.removeChild(t.firstChild),/^(&nbsp;|\s)+$/i.test(t.firstChild.innerHTML)&&t.removeChild(t.firstChild),e="p"!==n?"<"+n+">"+t.innerHTML+"</"+n+">":t.innerHTML),t.parentNode.removeChild(t);var o=document.createElement("li");return o.innerHTML=e,o},Uc=function(t){var e=document.createElement("div");e.innerHTML=function(t){return t=t.replace($c,(function(t,e,n){return'datalist="'+e+'" datalevel="'+n+'" '+t}))}(t);var n=new Set;return qc(e.children,n),n.forEach((function(t){return function(t){var e,n,o,r,i,a,s,l,c,d,u,p,f,h=-1,m={};for(l=0;l<t.length;l++){var v=(f={datalist:(c=t[l]).getAttribute("datalist"),datalevel:c.getAttribute("datalevel")}).datalist,g=Jc(c);if(d=g&&g.tag){if(u=f.datalevel||parseFloat(c.style.marginLeft||0),f.datalevel||c.style.marginLeft){var y=d+v;m[u]||(m[u]={}),(!n||n<0)&&(n=u,o=v,r=(s=t.filter((function(t){return t.getAttribute("datalist")===String(o)})))[s.length-1],a=Wc(d,g&&g.style),c.parentNode.insertBefore(a,c),h=u,m[u][y]=a),i=r===c,p=m[u][y],(u>h||!p)&&(p=Wc(d,g&&g.style),m[u][y]=p,e.appendChild(p)),e=Kc(c),p.appendChild(e),i?n=h=-1:h=u}}else!e||i&&!Vc(c)||(c.style.marginLeft&&(c.style.marginLeft=""),c.style.marginLeft&&(c.style.margin=""),e.appendChild(c))}}(t)})),e.innerHTML},Gc=function(t){return t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/,"$1")).replace(/<\/?[ovw]:[^>]*?>/gi,"")).replace(/<\\?\??xml[^>]*>/gi,"")).replace(/<(?:link|meta) [^>]+?>/gi,"")).replace(/<style[^>]*?>\s*<\/style>/gi,"")).replace(/<\/?st1:.*?>/gi,"")).replace(/<a name="[a-zA-Z0-9_]+">/gim,"")).replace(/v:shapes?="[^"]+"/gi,"")).replace(/<!\[if !supportLists\]>/gi,"")).replace(/<!\[endif\]>/gi,"")},Xc=function(t){return t.replace(/<!--[\s\S]+?-->/g,"")},Yc=function(t,e){return t.replace(new RegExp("<\\/?("+e+")(?:\\s[^>]*?)?>","gi"),"")},Zc=function(t){t.ownerElement&&t.ownerElement.removeAttribute(t.name)},Qc=function(t){/^Mso/.test(t.value)&&Zc(t)},td=/\s*;\s*/,ed=/\s*:\s*/,nd=function(t){var e,n,o=t.value.split(td).filter((function(t){return Boolean(t)})),r=t.ownerElement.style,i="";o.forEach((function(t){var o;o=t.split(ed),e=o[0],n=o[1],void 0!==r[e]&&(i+=e+": "+n+"; ")})),(i=i.trim())?t.value=i:Zc(t)},od=function(t,e){var n=t;if(e.convertMsLists&&(n=Uc(n)),e.stripTags&&(n=Yc(n,e.stripTags)),e.attributes){var o=document.createElement("div");o.innerHTML=n,Array.from(o.querySelectorAll("*")).forEach((function(t){return function(t,e){if(t.nodeType===Node.ELEMENT_NODE){for(var n=t.attributes.length-1;n>=0;n--){var o=t.attributes[n];e[o.name]?e[o.name](o):e["*"]&&e["*"](o)}"SPAN"===t.nodeName&&0===t.attributes.length&&function(t){var e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}(t)}}(t,e.attributes)})),n=o.innerHTML}return n};function rd(t){for(var e=t.length,n=new Array(e/2),o=0;o<e;o+=2)n[o]=String.fromCharCode(parseInt(t.substring(o,o+2),16));return btoa(n.join(""))}var id=/<img\s[^>]*?src=(?:'|")file:\/[^'"]+(?:'|")[^>]*>/gi,ad=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,sd=new RegExp("(?:("+ad.source+"))([\\da-fA-F\\s]+)\\}","g"),ld=/[^\da-fA-F]/g,cd=/file:\/[^'"]+\.(jpg|png|gif)/i,dd=/\\(png|jpeg)blip\\/,ud=function(t,e){var n=t.match(id);if(!n||-1===e.types.indexOf("text/rtf"))return t;var o=e.getData("text/rtf"),r=[],i=o.match(sd);if(!o||!i)return t;for(var a=0,s=i;a<s.length;a++){var l=s[a],c=dd.exec(l);if(c){var d=l.replace(ad,"").replace(ld,"");r.push("data:image/"+c[1]+";base64,"+rd(d))}}return n.length!==r.length?t:t.replace(id,(function(t){var e=r.shift()||"";return t.replace(cd,e)}))},pd=function(t,e,n,o,r){var i,a,s,l,c,d,u=[],p=[],f=e.matchCase,h=e.matchWord,m=e.useRegExp,v=e.text;if(m&&(/^\\$/.test(v)||/[^\\]\\$/.test(v))&&(v=v.substring(0,v.length-1)),!v)return u;var g=f?"g":"gi",y=m?new RegExp(v,g):bd(v,g);return t.nodesBetween(n,o,(function(e,f,m){if(r(u))return!1;e.inlineContent&&f+e.content.size>=n&&(p.length=0,e.nodesBetween(0,e.content.size,(function(e,m,v,g){if(r(u))return!1;var b=1+f+m;if(e.isText&&b+e.nodeSize>=n){if(c=e.text||"",d=v.childCount-1>=g+1&&v.child(g+1),p.push(n<=b?{text:c,start:b}:{text:c.slice(n-b),start:n}),d&&d.isText)return;for(a=p.map((function(t){return t.text})).join(""),i=y.exec(a);null!==i&&(s=p[0].start+i.index,l=s+i[0].length,n<=s&&o>=l&&yd(i,h)&&u.push(oe.create(t,s,l)),!r(u));)i=y.exec(a)}else p.length=0})))})),u},fd=function(t,e){var n=e.backward,o=e.matchCyclic,r=Ne.__rest(e,["backward","matchCyclic"]),i=n?function(){return!1}:function(t){return t.length>0},a=t.doc,s=t.selection,l=[];return n?!(l=pd(a,r,0,s.from,i)).length&&o&&(l=pd(a,r,s.from,a.content.size,i)):!(l=pd(a,r,s.to,a.content.size,i)).length&&o&&(l=pd(a,r,0,s.to,i)),l.length?l[l.length-1]:null},hd=function(t,e){return pd(t,e,0,t.content.size,(function(){return!1}))},md=function(t,e,n){var o=t.from,r=t.to;return n.insertText(e,o,r).setSelection(oe.create(n.doc,o,o+e.length)),n},vd=function(t,e,n){var o=hd(t.doc,n);if(0===o.length)return null;for(var r=t.tr,i=o.length-1;i>=0;i--)r.insertText(e,o[i].from,o[i].to);return r},gd=/^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/,yd=function(t,e){if(e){if(!0===e){var n=t.input,o=n.charAt(t.index-1),r=n.charAt(t.index+t[0].length);return gd.test(o)&&gd.test(r)}return e(t)}return!0},bd=function(t,e){var n=t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d").replace(/\s/g,"\\s");return new RegExp(n,e)};function wd(t){var e={class:"k-placeholder","data-placeholder":t};return new be({key:new _e("placeholder"),props:{decorations:function(t){var n=t.doc,o=n.content.firstChild;if(!(0===n.childCount||1===n.childCount&&o.inlineContent&&0===o.childCount))return Pa.empty;var r=[];return n.descendants((function(t,n){r.push(Ba.node(n,n+t.nodeSize,e))})),Pa.create(n,r)}}})}var kd=/\s+/g,_d=/text-align/,Cd=function(){return new be({key:new _e("spaces-fix"),props:{decorations:function(t){var e,n,o,r,i=[],a=t.doc;return a.nodesBetween(0,a.content.size,(function(t,a,s){if(t.type.isText&&function(t){return _d.test(t&&t.attrs&&t.attrs.style||"")}(s))for(n=kd.exec(t.text||"");null!==n;){if(e=a+n.index,o=n[0].length,n.index+o<n.input.length)for(r=0;r<=o-1;r+=2)i.push(Ba.inline(e+r,e+r+1,{style:"white-space: normal"}));n=kd.exec(t.text||"")}})),Pa.create(a,i)}}})},xd=new _e("highlight");function Sd(t){return void 0===t&&(t=xd),new be({key:t,state:{init:function(){return null},apply:function(t){return t.getMeta(this.spec.key)}},props:{decorations:function(t){var e=(this.spec.key.getState(t)||[]).map((function(t){return Ba.inline(t.from,t.to,t.attrs)}));return Pa.create(t.doc,e)}}})}var Ed=new _e("image-resize"),Td={southeast:{x:1,y:1},east:{x:1,y:0},south:{x:0,y:1},north:{x:0,y:-1},west:{x:-1,y:0},southwest:{x:-1,y:1},northwest:{x:-1,y:-1},northeast:{x:1,y:-1}},Md=Object.keys(Td),Dd=function(t,e,n){t.style[e]=n+"px"},Od=/[^\-]width:|[^\-]height:/,Ad=/^.+$/,Id=function(){function t(t,e,n,o){this.activeHandle=t,this.dragging=e,this.rect=n,this.nodePosition=o}return t.prototype.apply=function(e){var n=e.getMeta(Ed);return n?new t(n.activeHandle,n.setDragging,n.rect,n.nodePosition):this},t}(),Bd=function(t,e,n){var o=e.target.getAttribute("data-direction");if(!o)return!1;var r=Ed.getState(t.state);e.preventDefault();var i=t.state.tr;function a(e){!function(t,e,n){var o=Ed.getState(t.state),r=o.rect,i=o.dragging,a=o.nodePosition,s=o.activeHandle;if(i&&r){var l=t.nodeDOM(a),c=Td[s],d=(e.clientX-i.startX)*c.x,u=(e.clientY-i.startY)*c.y,p=c.x?d+l.width:r.width,f=c.y?u+l.height:r.height;if(n.lockRatio&&c.x&&c.y){var h=Math.min(p/l.width,f/l.height),m=l.width*h,v=l.height*h;i.startX=e.clientX-(p-m)*c.x,i.startY=e.clientY-(f-v)*c.y,p=m,f=v}else i.startX=c.x?e.clientX:i.startX,i.startY=c.y?e.clientY:i.startY;Dd(l,"width",p),Dd(l,"height",f),r.top=l.offsetTop,r.left=l.offsetLeft,r.width=l.offsetWidth,r.height=l.offsetHeight;var g=l.nextElementSibling;g.style.width=r.width+"px",g.style.height=r.height+"px",g.style.top=r.top+"px",g.style.left=r.left+"px"}}(t,e,n)}return i.setMeta(Ed,{setDragging:{startX:e.clientX,startY:e.clientY},activeHandle:o,rect:r.rect,nodePosition:r.nodePosition}),i.setMeta("addToHistory",!1),t.dispatch(i),e.view.addEventListener("mouseup",(function e(n){n.view.removeEventListener("mouseup",e),n.view.removeEventListener("mousemove",a),function(t){var e=Ed.getState(t.state),n=e.rect,o=e.dragging,r=e.nodePosition;if(o&&n){var i=t.state.selection;if(i instanceof ie){var a=i.node.attrs,s=n.width,l=n.height,c=void 0;if(Od.test(a.style||"")){var d=ze(a.style,{style:"width",value:Ad,newValue:s+"px"}),u=ze(d.style||"",{style:"height",value:Ad,newValue:l+"px"}).style;c=Ne.__assign({},a,{style:u})}else c=Ne.__assign({},a,{width:s,height:l});var p=i.node.type.createAndFill(c);if(p){var f=t.state.tr;f.replaceWith(r,r+1,p),f.setSelection(ie.create(f.doc,r)),f.setMeta("commandName","image-resize"),f.setMeta("args",c),f.setMeta(Ed,{setDragging:null,activeHandle:null,rect:n,nodePosition:r}),t.dispatch(f)}}}}(t)})),e.view.addEventListener("mousemove",a),!0},Nd=function(t){return void 0===t&&(t={node:"image",lockRatio:!0}),new be({key:Ed,view:function(e){return{resize:function(){Ed.getState(e.state).rect&&e.dispatch(e.state.tr.setMeta("resize",!0))},get window(){return e.dom.ownerDocument&&e.dom.ownerDocument.defaultView},attachResize:function(){var t=this.window;t&&(t.removeEventListener("resize",this.resize),t.addEventListener("resize",this.resize))},removeResize:function(){var t=this.window;t&&t.removeEventListener("resize",this.resize)},update:function(e,n){var o=e.state,r=o.selection,i=o.schema.nodes[t.node],a=Ed.getState(o),s=a.rect;if(r instanceof ie&&i===r.node.type){var l=e.nodeDOM(r.from),c={top:l.offsetTop,left:l.offsetLeft,width:l.offsetWidth,height:l.offsetHeight};if(!n.selection.eq(r)||s&&(s.width!==c.width||s.height!==c.height||s.top!==c.top||s.left!==c.left)){var d=o.tr;d.setMeta(Ed,{rect:c,nodePosition:r.from}),e.dispatch(d),this.attachResize()}}else s&&(a.rect=null,a.nodePosition=-1)},destroy:function(){this.removeResize()}}},state:{init:function(){return new Id("",null,null,-1)},apply:function(t,e){return e.apply(t)}},props:{handleDOMEvents:{mousedown:function(e,n){return Bd(e,n,t)}},decorations:function(e){var n=e.selection,o=e.schema.nodes[t.node],r=Ed.getState(e).rect;if(r&&n instanceof ie&&o===n.node.type){var i=document.createElement("div");i.className="k-editor-resize-handles-wrapper",i.style.width=r.width+"px",i.style.height=r.height+"px",i.style.top=r.top+"px",i.style.left=r.left+"px";for(var a=0;a<Md.length;a++){var s=document.createElement("div");s.className="k-editor-resize-handle "+Md[a],s.setAttribute("data-direction",Md[a]),i.appendChild(s)}return Pa.create(e.doc,[Ba.widget(e.selection.from+1,i)])}return Pa.empty}}})},zd=new _e("caret-color");function Rd(){return new be({key:zd,props:{decorations:function(t){var e=t.doc,n=t.selection,o=t.storedMarks;if(!n.empty||!o)return Pa.empty;var r=tn((o||[]).find((function(t){return"style"===t.type.name})),{name:"color",value:/^.+$/});if(!r)return Pa.empty;var i=n.$anchor.parent,a=[];return e.descendants((function(t,e){t.eq(i)&&a.push(Ba.node(e,e+t.nodeSize,{style:"caret-color: "+r}))})),Pa.create(e,a)}}})}function Pd(t){return void 0===t&&(t={}),new be({view:function(e){return new Ld(e,t)}})}var Ld=function(t,e){var n=this;this.editorView=t,this.width=e.width||1,this.color=e.color||"black",this.class=e.class,this.cursorPos=null,this.element=null,this.timeout=null,this.handlers=["dragover","dragend","drop","dragleave"].map((function(e){var o=function(t){return n[e](t)};return t.dom.addEventListener(e,o),{name:e,handler:o}}))};Ld.prototype.destroy=function(){var t=this;this.handlers.forEach((function(e){var n=e.name,o=e.handler;return t.editorView.dom.removeEventListener(n,o)}))},Ld.prototype.update=function(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())},Ld.prototype.setCursor=function(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())},Ld.prototype.updateOverlay=function(){var t,e=this.editorView.state.doc.resolve(this.cursorPos);if(!e.parent.inlineContent){var n=e.nodeBefore,o=e.nodeAfter;if(n||o){var r=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?r.bottom:r.top;n&&o&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:r.left,right:r.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!t){var a=this.editorView.coordsAtPos(this.cursorPos);t={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}var s,l,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color),!c||c==document.body&&"static"==getComputedStyle(c).position)s=-pageXOffset,l=-pageYOffset;else{var d=c.getBoundingClientRect();s=d.left-c.scrollLeft,l=d.top-c.scrollTop}this.element.style.left=t.left-s+"px",this.element.style.top=t.top-l+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"},Ld.prototype.scheduleRemoval=function(t){var e=this;clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.setCursor(null)}),t)},Ld.prototype.dragover=function(t){if(this.editorView.editable){var e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),n=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),o=n&&n.type.spec.disableDropCursor,r="function"==typeof o?o(this.editorView,e):o;if(e&&!r){var i=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&null==(i=Lt(this.editorView.state.doc,i,this.editorView.dragging.slice)))return this.setCursor(null);this.setCursor(i),this.scheduleRemoval(5e3)}}},Ld.prototype.dragend=function(){this.scheduleRemoval(20)},Ld.prototype.drop=function(){this.scheduleRemoval(20)},Ld.prototype.dragleave=function(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)};var Fd=function(t){function e(e){t.call(this,e,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.map=function(n,o){var r=n.resolve(o.map(this.head));return e.valid(r)?new e(r):t.near(r)},e.prototype.content=function(){return p.empty},e.prototype.eq=function(t){return t instanceof e&&t.head==this.head},e.prototype.toJSON=function(){return{type:"gapcursor",pos:this.head}},e.fromJSON=function(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new e(t.resolve(n.pos))},e.prototype.getBookmark=function(){return new $d(this.anchor)},e.valid=function(t){var e=t.parent;if(e.isTextblock||!function(t){for(var e=t.depth;e>=0;e--){var n=t.index(e),o=t.node(e);if(0!=n)for(var r=o.child(n-1);;r=r.lastChild){if(0==r.childCount&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}else if(o.type.spec.isolating)return!0}return!0}(t)||!function(t){for(var e=t.depth;e>=0;e--){var n=t.indexAfter(e),o=t.node(e);if(n!=o.childCount)for(var r=o.child(n);;r=r.firstChild){if(0==r.childCount&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}else if(o.type.spec.isolating)return!0}return!0}(t))return!1;var n=e.type.spec.allowGapCursor;if(null!=n)return n;var o=e.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock},e.findFrom=function(t,n,o){t:for(;;){if(!o&&e.valid(t))return t;for(var r=t.pos,i=null,a=t.depth;;a--){var s=t.node(a);if(n>0?t.indexAfter(a)<s.childCount:t.index(a)>0){i=s.child(n>0?t.indexAfter(a):t.index(a)-1);break}if(0==a)return null;r+=n;var l=t.doc.resolve(r);if(e.valid(l))return l}for(;;){var c=n>0?i.firstChild:i.lastChild;if(!c){if(i.isAtom&&!i.isText&&!ie.isSelectable(i)){t=t.doc.resolve(r+i.nodeSize*n),o=!1;continue t}break}i=c,r+=n;var d=t.doc.resolve(r);if(e.valid(d))return d}return null}},e}(te);Fd.prototype.visible=!1,te.jsonID("gapcursor",Fd);var $d=function(t){this.pos=t};$d.prototype.map=function(t){return new $d(t.map(this.pos))},$d.prototype.resolve=function(t){var e=t.resolve(this.pos);return Fd.valid(e)?new Fd(e):te.near(e)};var Vd=function(){return new be({props:{decorations:Jd,createSelectionBetween:function(t,e,n){if(e.pos==n.pos&&Fd.valid(n))return new Fd(n)},handleClick:Hd,handleKeyDown:jd,handleDOMEvents:{beforeinput:qd}}})},jd=dr({ArrowLeft:Wd("horiz",-1),ArrowRight:Wd("horiz",1),ArrowUp:Wd("vert",-1),ArrowDown:Wd("vert",1)});function Wd(t,e){var n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,o,r){var i=t.selection,a=e>0?i.$to:i.$from,s=i.empty;if(i instanceof oe){if(!r.endOfTextblock(n)||0==a.depth)return!1;s=!1,a=t.doc.resolve(e>0?a.after():a.before())}var l=Fd.findFrom(a,e,s);return!!l&&(o&&o(t.tr.setSelection(new Fd(l))),!0)}}function Hd(t,e,n){if(!t.editable)return!1;var o=t.state.doc.resolve(e);if(!Fd.valid(o))return!1;var r=t.posAtCoords({left:n.clientX,top:n.clientY}).inside;return!(r>-1&&ie.isSelectable(t.state.doc.nodeAt(r)))&&(t.dispatch(t.state.tr.setSelection(new Fd(o))),!0)}function qd(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof Fd))return!1;var n=t.state.selection.$from,o=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;for(var r=i.empty,a=o.length-1;a>=0;a--)r=i.from(o[a].createAndFill(null,r));var s=t.state.tr.replace(n.pos,n.pos,new p(r,0,0));return s.setSelection(oe.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function Jd(t){if(!(t.selection instanceof Fd))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",Pa.create(t.doc,[Ba.widget(t.selection.head,e,{key:"gapcursor"})])}var Kd=function(t,e,n){for(var o,r=t.table,i=t.table_row,a=t.table_cell,s=[],l=0;l<e+1;l++){o=[];for(var c=0;c<n+1;c++)o.push(a.createAndFill());s.push(i.createAndFill(void 0,o))}return r.createAndFill(void 0,s)},Ud=function(t,e){for(var n=t.$head,o=n.depth;o>0;o--){var r=n.node(o);if(r.type.name===e)return{pos:n.before(o),node:r}}return null},Gd=function(t,e){return rl(t,e&&function(t){var n,o=Ud(t.selection,"table_row"),r=Ud(t.selection,"table");if(o&&r&&o.node.attrs[Ce]){for(var i=0,a=0;a<r.node.nodeSize;a++)if(r.node.child(a).eq(o.node)){i=a;break}var s=r.node.child(i-1),l=o.pos-s.nodeSize;t.setNodeMarkup(l,void 0,((n={})[Ce]=o.node.attrs[Ce],n))}return e(t)})},Xd=function(t,e){return il(t,e&&function(t){var n,o=Ud(t.selection,"table_row");if(o&&o.node.attrs[Ce]){var r=o.pos+o.node.nodeSize;t.setNodeMarkup(r,void 0,((n={})[Ce]=o.node.attrs[Ce],n))}return e(t)})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(10);e.outerWidth=function(t){var e=t.offsetWidth,n=getComputedStyle(t);return e+=parseFloat(n.marginLeft)||0+parseFloat(n.marginRight)||0},e.removeEntries=function(t,e){return Object.keys(t).filter((function(t){return e(t)})).reduce((function(e,n){var o;return Object.assign(e,((o={})[n]=t[n],o))}),{})},e.removeEmptyEntries=function(t){return e.removeEntries(t,(function(e){return null!==t[e]&&void 0!==t[e]&&""!==t[e]}))},e.isEmpty=function(t){return 0===Object.keys(t).length},e.isNullOrUndefined=function(t){return null==t},e.isPresent=function(t){return!e.isNullOrUndefined(t)},e.detectIE=function(){if(!o.isDocumentAvailable())return!1;var t=window.navigator.userAgent,e=t.indexOf("MSIE "),n=t.indexOf("Trident/");return e>0||n>0},e.safeString=function(t){return e.isNullOrUndefined(t)?"":t.toString()},e.first=function(t){return t[0]},e.last=function(t){return t[t.length-1]},e.unique=function(t){return Array.from(new Set(t))},e.split=function(t){return function(e){return e.split(t)}},e.trim=function(t){return t.trim()},e.filter=function(t){return function(e){return e.filter(t)}},e.toArray=function(t){return t instanceof Array?t:[t]},e.getUniqueStyleValues=function(t,n){if(t.hasNodesWithoutMarks)return"";var o=t.marks.filter((function(t){return"style"===t.type.name})).map((function(t){return t.attrs.style})).map(e.safeString).map(e.split(";")).map(e.filter((function(t){return t.includes(n)}))).map((function(t){return 0!==t.length?t:[n+": INVALID"]})).map(e.first).map(e.split(":")).map(e.last).map(e.trim).reduce((function(t,e){return t.indexOf(e)>-1?t:t.concat([e])}),[]);return o.indexOf("INVALID")>-1||1!==o.length?"":o[0]},e.conditionallyExecute=function(t){return function(e){return function(n){return e?t(n):n}}},e.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return t.reduce((function(t,e){return e(t)}),e)}}},function(t,e){t.exports=o},function(t,e){t.exports=r},function(t,e){t.exports=i},function(t,e){t.exports=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=function(t){function e(e,n,o,r,i){var a=t.call(this,e,n,o,r,i)||this;return a.dialog=e,a.button=n,a.editor=o,a.localization=r,a.toolsService=i,a}return o.__extends(e,t),e.prototype.clickHandler=function(){this.editor.openDialog(this.dialog)},e.prototype.onStateChange=function(t){this.button.selected=t[this.command].selected,this.button.disabled=t[this.command].disabled},e}(n(34).EditorCommandBase);e.EditorCommandDialog=r},function(t,e){t.exports=s},function(t,e){t.exports=l},function(t,e){t.exports=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(13),a=function(){function t(){this.valueChange=new r.EventEmitter}return t.prototype.onValueChange=function(t){this.valueChange.emit(t)},t.prototype.focus=function(){this.dropDownList.focus()},o.__decorate([r.Input(),o.__metadata("design:type",Array)],t.prototype,"data",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],t.prototype,"value",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Object)],t.prototype,"defaultItem",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Function)],t.prototype,"itemDisabled",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],t.prototype,"title",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Boolean)],t.prototype,"disabled",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Number)],t.prototype,"tabindex",void 0),o.__decorate([r.Output(),o.__metadata("design:type",r.EventEmitter)],t.prototype,"valueChange",void 0),o.__decorate([r.ViewChild("element",{static:!0}),o.__metadata("design:type",r.ElementRef)],t.prototype,"element",void 0),o.__decorate([r.ViewChild("element",{read:i.DropDownListComponent,static:!0}),o.__metadata("design:type",i.DropDownListComponent)],t.prototype,"dropDownList",void 0),t=o.__decorate([r.Component({selector:"kendo-editor-format-dropdownlist",template:'\n <kendo-dropdownlist\n #element\n kendoEditorDropDownTool\n [defaultItem]="defaultItem"\n [textField]="\'text\'"\n [valueField]="\'tag\'"\n [data]="data"\n [(value)]="value"\n [valuePrimitive]="true"\n [itemDisabled]="itemDisabled"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n <ng-template kendoDropDownListItemTemplate let-dataItem>\n <ng-container [ngSwitch]="dataItem.tag">\n <span *ngSwitchCase="\'h1\'" style="display: block; font-size: 2em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'h2\'" style="display: block; font-size: 1.5em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'h3\'" style="display: block; font-size: 1.17em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'h4\'" style="display: block; font-size: 1em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'h5\'" style="display: block; font-size: .83em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'h6\'" style="display: block; font-size: .67em; margin-left: 0; font-weight: bold;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase="\'p\'" style="display: block; margin-left: 0;">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchDefault>{{ dataItem.text }}</span>\n </ng-container>\n </ng-template>\n </kendo-dropdownlist>\n ',styles:["\n .k-dropdownlist {\n width: 13em;\n }\n "]})],t)}();e.FormatDropDownListComponent=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(13),a=function(){function t(){this.valueChange=new r.EventEmitter}return t.prototype.onValueChange=function(t){this.valueChange.emit(t)},t.prototype.focus=function(){this.dropDownList.focus()},o.__decorate([r.Input(),o.__metadata("design:type",Array)],t.prototype,"data",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],t.prototype,"value",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Object)],t.prototype,"defaultItem",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Function)],t.prototype,"itemDisabled",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],t.prototype,"title",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Boolean)],t.prototype,"disabled",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Number)],t.prototype,"tabindex",void 0),o.__decorate([r.Output(),o.__metadata("design:type",r.EventEmitter)],t.prototype,"valueChange",void 0),o.__decorate([r.ViewChild("element",{static:!0}),o.__metadata("design:type",r.ElementRef)],t.prototype,"element",void 0),o.__decorate([r.ViewChild("element",{read:i.DropDownListComponent,static:!0}),o.__metadata("design:type",i.DropDownListComponent)],t.prototype,"dropDownList",void 0),t=o.__decorate([r.Component({selector:"kendo-editor-fontfamily-dropdownlist",template:'\n <kendo-dropdownlist\n #element\n kendoEditorDropDownTool\n [defaultItem]="defaultItem"\n [textField]="\'text\'"\n [valueField]="\'fontName\'"\n [data]="data"\n [(value)]="value"\n [valuePrimitive]="true"\n [itemDisabled]="itemDisabled"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n <ng-template kendoDropDownListItemTemplate let-dataItem>\n <span [ngStyle]="{ \'font-family\': dataItem.fontName }">\n {{ dataItem.text }}\n </span>\n </ng-template>\n </kendo-dropdownlist>\n ',styles:["\n .k-dropdownlist {\n width: 13em;\n }\n "]})],t)}();e.FontFamilyDropDownListComponent=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(13),a=function(){function t(){this.valueChange=new r.EventEmitter}return t.prototype.onValueChange=function(t){this.valueChange.emit(t)},t.prototype.focus=function(){this.dropDownList.focus()},o.__decorate([r.Input(),o.__metadata("design:type",Array)],t.prototype,"data",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],t.prototype,"value",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Object)],t.prototype,"defaultItem",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Function)],t.prototype,"itemDisabled",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],t.prototype,"title",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Boolean)],t.prototype,"disabled",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Number)],t.prototype,"tabindex",void 0),o.__decorate([r.Output(),o.__metadata("design:type",r.EventEmitter)],t.prototype,"valueChange",void 0),o.__decorate([r.ViewChild("element",{static:!0}),o.__metadata("design:type",r.ElementRef)],t.prototype,"element",void 0),o.__decorate([r.ViewChild("element",{read:i.DropDownListComponent,static:!0}),o.__metadata("design:type",i.DropDownListComponent)],t.prototype,"dropDownList",void 0),t=o.__decorate([r.Component({selector:"kendo-editor-fontsize-dropdownlist",template:'\n <kendo-dropdownlist\n #element\n kendoEditorDropDownTool\n [defaultItem]="defaultItem"\n [textField]="\'text\'"\n [valueField]="\'size\'"\n [data]="data"\n [(value)]="value"\n [valuePrimitive]="true"\n [itemDisabled]="itemDisabled"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n </kendo-dropdownlist>\n ',styles:["\n .k-dropdownlist {\n width: 13em;\n }\n "]})],t)}();e.FontSizeDropDownListComponent=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(17),s=n(2),l=n(9),c=n(3),d=n(7),u=n(30),p=n(16),f=function(t){function e(e,n,o,r){var i=t.call(this)||this;return i.editor=e,i.localization=n,i.dialogService=o,i.ngZone=r,i.tabindex=-1,i.disabled=!1,i.views=["palette"],i}var n;return o.__extends(e,t),n=e,Object.defineProperty(e.prototype,"view",{get:function(){return this.views&&this.views.length>0?this.views[0]:null},set:function(t){this.views=[t]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this.localization.get(this.editorCommand)},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var t=this;this.subs=this.editor.stateChange.subscribe((function(e){var n=e.style;t.disabled=n.disabled}))},e.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe()},e.prototype.handleValueChange=function(t){this.editor.exec(this.editorCommand,t),this.editor.view.focus()},e.prototype.handleActiveColorClick=function(t){t.preventOpen(),this.handleValueChange(t.color)},e.prototype.onOpen=function(t){this.valueCache=t.value,t.reset()},e.prototype.onClose=function(t){var e=this;t.value||(t.value=this.valueCache),this.editor.shouldEmitFocus=!0,this.ngZone.onStable.pipe(p.take(1)).subscribe((function(){return e.editor.view.focus()}))},Object.defineProperty(e.prototype,"outerWidth",{get:function(){if(this.element)return l.outerWidth(this.element.nativeElement)},enumerable:!0,configurable:!0}),e.prototype.openDialog=function(){var t={appendTo:this.editor.dialogContainer,content:u.ColorPickerDialogComponent};this.editor.toolbar.toggle(!1),this.dialogService.open(t).content.instance.setData({editor:this.editor,value:this.value,title:this.title,editorCommand:this.editorCommand,paletteSettings:this.paletteSettings,icon:this.icon,views:this.views})},e.prototype.canFocus=function(){return!this.disabled},e.prototype.focus=function(){this.tabindex=0,this.overflows?this.colorPickerButton.nativeElement.focus():this.colorPicker.focus()},e.prototype.handleKey=function(){return this.tabindex=-1,!1},o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"value",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"icon",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Object)],e.prototype,"paletteSettings",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"editorCommand",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Boolean)],e.prototype,"disabled",void 0),o.__decorate([r.Input(),o.__metadata("design:type",Array)],e.prototype,"views",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String),o.__metadata("design:paramtypes",[String])],e.prototype,"view",null),o.__decorate([r.ViewChild("toolbarTemplate",{static:!0}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"toolbarTemplate",void 0),o.__decorate([r.ViewChild("popupTemplate",{static:!0}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"popupTemplate",void 0),o.__decorate([r.ViewChild("colorpicker",{read:r.ElementRef,static:!1}),o.__metadata("design:type",r.ElementRef)],e.prototype,"element",void 0),o.__decorate([r.ViewChild("colorpicker",{read:a.ColorPickerComponent,static:!1}),o.__metadata("design:type",a.ColorPickerComponent)],e.prototype,"colorPicker",void 0),o.__decorate([r.ViewChild("colorPickerButton",{read:r.ElementRef,static:!1}),o.__metadata("design:type",r.ElementRef)],e.prototype,"colorPickerButton",void 0),e=n=o.__decorate([r.Component({providers:[{provide:i.ToolBarToolComponent,useExisting:r.forwardRef((function(){return n}))}],selector:"kendo-toolbar-colorpicker",template:'\n <ng-template #toolbarTemplate>\n <kendo-colorpicker\n #colorpicker\n [attr.title]="title"\n [icon]="icon"\n [views]="views"\n [format]="\'hex\'"\n [value]="value"\n [paletteSettings]="paletteSettings"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="handleValueChange($event)"\n (activeColorClick)="handleActiveColorClick($event)"\n (open)="onOpen(colorpicker)"\n (close)="onClose(colorpicker)"\n >\n </kendo-colorpicker>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n tabindex="-1"\n type="button"\n kendoButton\n #colorPickerButton\n class="k-overflow-button"\n [icon]="icon"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (click)="openDialog()"\n >\n {{ title }}\n </button>\n </ng-template>\n '}),o.__param(0,r.Host()),o.__metadata("design:paramtypes",[c.EditorComponent,s.EditorLocalizationService,d.DialogService,r.NgZone])],e)}(i.ToolBarToolComponent);e.EditorColorPickerComponent=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.commandIcons={alignCenter:"align-center",alignJustify:"align-justify",alignLeft:"align-left",alignRight:"align-right",backColor:"background",blockquote:"blockquote",bold:"bold",cleanFormatting:"clear-css",createLink:"link-horizontal",foreColor:"foreground-color",indent:"indent-increase",insertFile:"file-add",insertImage:"image",insertOrderedList:"list-ordered",insertUnorderedList:"list-unordered",italic:"italic",outdent:"indent-decrease",print:"print",redo:"redo",selectAll:"select-all",strikethrough:"strikethrough",subscript:"sub-script",superscript:"sup-script",underline:"underline",undo:"undo",unlink:"unlink-horizontal",viewSource:"html",insertTable:"table-insert",addColumnBefore:"table-column-insert-left",addColumnAfter:"table-column-insert-right",addRowBefore:"table-row-insert-above",addRowAfter:"table-row-insert-below",deleteRow:"table-row-delete",deleteColumn:"table-column-delete",mergeCells:"cells-merge",splitCell:"cell-split-horizontally",deleteTable:"table-delete"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(39),r=n(8);e.Schema=r.Schema;var i=r.marks,a=Object.assign(r.nodes,o.semanticNodes);e.schema=new r.Schema({marks:i,nodes:a})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(7),a=n(2),s=function(t){function e(e,n){var o=t.call(this,e)||this;return o.dialog=e,o.localization=n,o.data="",o}return o.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.textarea.nativeElement.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.editor.exec("setHTML",this.getData()),this.dialog.close(),this.editor.view.focus()},e.prototype.getData=function(){return this.textarea.nativeElement.value},e.prototype.setData=function(){this.data=this.indent(this.editor.getSource())},e.prototype.textFor=function(t){return this.localization.get(t)},e.prototype.indent=function(t){return t.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/gi,"</$1>\n").replace(/<(ul|ol)([^>]*)><li/gi,"<$1$2>\n<li").replace(/<br \/>/gi,"<br />\n").replace(/\n$/,"")},o.__decorate([r.Input(),o.__metadata("design:type",Object)],e.prototype,"editor",void 0),o.__decorate([r.ViewChild("textarea",{static:!0}),o.__metadata("design:type",r.ElementRef)],e.prototype,"textarea",void 0),e=o.__decorate([r.Component({styles:["\n >>> .k-editor-textarea {\n height: 100%;\n }\n "],template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'viewSource\') }}\n </kendo-dialog-titlebar>\n <textarea [value]="data" #textarea class="k-textarea k-editor-textarea"></textarea>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogUpdate\') }}</button>\n </kendo-dialog-actions>\n '}),o.__metadata("design:paramtypes",[i.DialogRef,a.EditorLocalizationService])],e)}(i.DialogContentBase);e.SourceDialogComponent=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(12),a=n(7),s=n(8),l=n(9),c=n(2),d=n(10),u=function(t){function e(e,n){var o=t.call(this,e)||this;return o.dialog=e,o.localization=n,o.src=new i.FormControl("",i.Validators.required),o.alt=new i.FormControl(""),o.width=new i.FormControl("",i.Validators.min(1)),o.height=new i.FormControl("",i.Validators.min(1)),o.data={alt:"",height:"",src:"",width:""},o.imageData=new i.FormGroup({alt:o.alt,height:o.height,src:o.src,width:o.width}),o}return o.__extends(e,t),e.prototype.ngOnInit=function(){this.srcInputId="k-"+d.guid(),this.altTextInputId="k-"+d.guid(),this.widthInputId="k-"+d.guid(),this.heightInputId="k-"+d.guid()},e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.srcInput.nativeElement.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.src.value&&(this.editor.exec("insertImage",this.getData()),this.dialog.close(),this.editor.view.focus())},e.prototype.setData=function(t){var e=s.getNodeFromSelection(t);e&&(this.src.patchValue(e.attrs.src),this.alt.patchValue(e.attrs.alt),this.width.patchValue(e.attrs.width),this.height.patchValue(e.attrs.height))},e.prototype.textFor=function(t){return this.localization.get(t)},e.prototype.getData=function(){return{alt:this.alt.value,height:this.normalizeDimension(this.height.value),src:this.src.value,width:this.normalizeDimension(this.width.value)}},e.prototype.normalizeDimension=function(t){return Number.isNaN(parseInt(t,10))||parseInt(t,10)<=0?"":l.safeString(parseInt(t,10))},o.__decorate([r.Input(),o.__metadata("design:type",Object)],e.prototype,"editor",void 0),o.__decorate([r.ViewChild("srcInput",{read:r.ElementRef,static:!0}),o.__metadata("design:type",r.ElementRef)],e.prototype,"srcInput",void 0),e=o.__decorate([r.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'insertImage\') }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content">\n <div class="k-edit-label">\n <label [for]="srcInputId">{{ textFor(\'imageWebAddress\') }}</label>\n </div>\n <div class="k-edit-field">\n <input [id]="srcInputId" #srcInput [formControl]="src" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n <div class="k-edit-label">\n <label [for]="altTextInputId">{{ textFor(\'imageAltText\') }}</label>\n </div>\n <div class="k-edit-field">\n <input [id]="altTextInputId" [formControl]="alt" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n <div class="k-edit-label">\n <label [for]="widthInputId">{{ textFor(\'imageWidth\') }}</label>\n </div>\n <div class="k-edit-field">\n <input [id]="widthInputId" [formControl]="width" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n <div class="k-edit-label">\n <label [for]="heightInputId">{{ textFor(\'imageHeight\') }}</label>\n </div>\n <div class="k-edit-field">\n <input [id]="heightInputId" [formControl]="height" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton [disabled]="imageData.invalid"\n (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogInsert\') }}</button>\n </kendo-dialog-actions>\n '}),o.__metadata("design:paramtypes",[a.DialogRef,c.EditorLocalizationService])],e)}(a.DialogContentBase);e.ImageDialogComponent=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(12),a=n(7),s=n(8),l=n(9),c=n(2),d=function(t){function e(e,n){var o=t.call(this,e)||this;return o.dialog=e,o.localization=n,o.linkForm=new i.FormGroup({href:new i.FormControl("",i.Validators.required),text:new i.FormControl({value:"",disabled:!0},i.Validators.required),title:new i.FormControl("")}),o}return o.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.hrefInput.nativeElement.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){var t=this.getData();this.editor.exec(this.command,t),this.dialog.close(),this.editor.view.focus()},Object.defineProperty(e.prototype,"titleText",{get:function(){return this.localization.get(this.command)},enumerable:!0,configurable:!0}),e.prototype.setData=function(t,e){"createLink"===this.command&&this.linkForm.addControl("target",new i.FormControl);var n=s.getMark(t,t.schema.marks.link);if(n)this.linkForm.reset({href:n.attrs.href,title:n.attrs.title,target:l.isPresent(n.attrs.target),text:this.setLinkText(t)});else if(t.selection.empty){var o=e.applyToWord?s.expandSelection(t,(function(){}),e).state:t;o.selection.empty||this.linkForm.patchValue({text:s.getSelectionText(o)})}else this.linkForm.patchValue({text:s.getSelectionText(t)})},e.prototype.textForWithPrefix=function(t){var e="createLink"===this.command?"link":"file";return this.textFor(e+t)},e.prototype.textFor=function(t){return this.localization.get(t)},e.prototype.setLinkText=function(t){var e=t.selection;if(e.empty&&e.$cursor){var n=e.$cursor,o=n.index();return n.parent.child(o).text}return s.getSelectionText(t)},e.prototype.getData=function(){var t=this.linkForm.value;return l.isPresent(this.linkForm.controls.target)&&(t.target=t.target?"_blank":null),t},o.__decorate([r.Input(),o.__metadata("design:type",Object)],e.prototype,"editor",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"command",void 0),o.__decorate([r.ViewChild("hrefInput",{read:r.ElementRef,static:!0}),o.__metadata("design:type",r.ElementRef)],e.prototype,"hrefInput",void 0),e=o.__decorate([r.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ titleText }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content">\n <form novalidate [formGroup]="linkForm">\n <div class="k-edit-label">\n <label (click)="hrefInput.focus()">{{ textForWithPrefix(\'WebAddress\') }}</label>\n </div>\n <div class="k-edit-field">\n <input #hrefInput formControlName="href" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n\n <div class="k-edit-label">\n <label (click)="textInput.focus()">{{ textForWithPrefix(\'Text\') }}</label>\n </div>\n <div class="k-edit-field">\n <input #textInput formControlName="text" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n\n <div class="k-edit-label">\n <label (click)="titleInput.focus()">{{ textForWithPrefix(\'Title\') }}</label>\n </div>\n <div class="k-edit-field">\n <input #titleInput formControlName="title" type="text" class="k-textbox k-input k-rounded-md" />\n </div>\n <ng-container *ngIf="command === \'createLink\'">\n <div class="k-edit-label"></div>\n <div class="k-edit-field">\n <input type="checkbox" id="k-target-blank" kendoCheckBox formControlName="target" />\n <label class="k-checkbox-label" for="k-target-blank">{{ textForWithPrefix(\'OpenInNewWindow\') }}</label>\n </div>\n </ng-container>\n </form>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton [disabled]="linkForm.invalid" (click)="onConfirmAction()" [primary]="true">\n {{ textFor(\'dialogInsert\') }}\n </button>\n </kendo-dialog-actions>\n '}),o.__metadata("design:paramtypes",[a.DialogRef,c.EditorLocalizationService])],e)}(a.DialogContentBase);e.FileLinkDialogComponent=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EditorErrorMessages={schemaType:"Expected value of type Schema. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/",setSchemaOnce:"The Schema cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/",pluginsCallbackType:function(t){return"plugins must be a function, but received "+JSON.stringify(t)+"."},pastedContentCallbackType:function(t){return"pastedContent must be a function, but received "+JSON.stringify(t)+"."},setPluginsOnce:"The plugins cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/plugins/",setPlaceHolderOnce:"The placeholder cannot be changed dynamically. See https://www.telerik.com/kendo-angular-ui/components/editor/plugins/#toc-custom-plugins/",printTool:"The Print tool and functionality are supported only in iframe mode. See https://www.telerik.com/kendo-angular-ui-develop/components/editor/api/EditorPrintButtonDirective/"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=function(t){function e(e,n,o){var r=t.call(this)||this;return r.cleanedHtml=e,r.originalHtml=n,r.originalEvent=o,r}return o.__extends(e,t),e}(n(10).PreventableEvent);e.EditorPasteEvent=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(7),a=n(2),s=n(3),l=n(18),c=function(t){function e(e,n){var o=t.call(this,e)||this;return o.dialog=e,o.localization=n,o.data=[],o}return o.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.formatDropDownList.dropDownList.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.value&&this.editor.exec("format",{tag:this.value}),this.dialog.close()},e.prototype.setData=function(t){this.editor=t.editor,this.data=t.data,this.defaultItem=t.defaultItem,this.value=t.value,this.itemDisabled=t.itemDisabled},e.prototype.textFor=function(t){return this.localization.get(t)},o.__decorate([r.Input(),o.__metadata("design:type",s.EditorComponent)],e.prototype,"editor",void 0),o.__decorate([r.ViewChild("formatDropDownList",{read:l.FormatDropDownListComponent,static:!0}),o.__metadata("design:type",l.FormatDropDownListComponent)],e.prototype,"formatDropDownList",void 0),e=o.__decorate([r.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'format\') }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content" style="text-align: center;">\n <kendo-editor-format-dropdownlist\n #formatDropDownList\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n >\n </kendo-editor-format-dropdownlist>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton\n (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogApply\') }}</button>\n </kendo-dialog-actions>\n '}),o.__metadata("design:paramtypes",[i.DialogRef,a.EditorLocalizationService])],e)}(i.DialogContentBase);e.FormatDialogComponent=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(7),a=n(2),s=n(3),l=n(17),c=function(t){function e(e,n){var o=t.call(this,e)||this;return o.dialog=e,o.localization=n,o}return o.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.colorPicker.focus()}))},e.prototype.handleActiveColorClick=function(t){t.preventOpen(),this.value=t.color},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.value&&this.editor.exec(this.editorCommand,this.value),this.dialog.close(),this.editor.view.focus()},e.prototype.setData=function(t){this.editor=t.editor,this.value=t.value,this.editorCommand=t.editorCommand,this.paletteSettings=t.paletteSettings,this.icon=t.icon,this.views=t.view?[t.view]:t.views},e.prototype.textFor=function(t){return this.localization.get(t)},o.__decorate([r.Input(),o.__metadata("design:type",s.EditorComponent)],e.prototype,"editor",void 0),o.__decorate([r.ViewChild("colorpicker",{read:l.ColorPickerComponent,static:!0}),o.__metadata("design:type",l.ColorPickerComponent)],e.prototype,"colorPicker",void 0),e=o.__decorate([r.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(editorCommand) }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content" style="text-align: center;">\n <kendo-colorpicker\n #colorpicker\n [views]="views"\n [format]="\'hex\'"\n [attr.title]="title"\n [icon]="icon"\n [(value)]="value"\n [paletteSettings]="paletteSettings"\n (activeColorClick)="handleActiveColorClick($event)"\n >\n </kendo-colorpicker>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton\n (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogApply\') }}</button>\n </kendo-dialog-actions>\n '}),o.__metadata("design:paramtypes",[i.DialogRef,a.EditorLocalizationService])],e)}(i.DialogContentBase);e.ColorPickerDialogComponent=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(7),a=n(2),s=n(3),l=n(19),c=function(t){function e(e,n){var o=t.call(this,e)||this;return o.dialog=e,o.localization=n,o.data=[],o}return o.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.fontFamilyDropDownList.dropDownList.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.value&&this.editor.exec("fontFamily",this.value),this.dialog.close()},e.prototype.setData=function(t){this.editor=t.editor,this.data=t.data,this.defaultItem=t.defaultItem,this.value=t.value,this.itemDisabled=t.itemDisabled},e.prototype.textFor=function(t){return this.localization.get(t)},o.__decorate([r.Input(),o.__metadata("design:type",s.EditorComponent)],e.prototype,"editor",void 0),o.__decorate([r.ViewChild("fontFamilyDropDownList",{read:l.FontFamilyDropDownListComponent,static:!0}),o.__metadata("design:type",l.FontFamilyDropDownListComponent)],e.prototype,"fontFamilyDropDownList",void 0),e=o.__decorate([r.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'fontFamily\') }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content" style="text-align: center;">\n <kendo-editor-fontfamily-dropdownlist\n #fontFamilyDropDownList\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n >\n </kendo-editor-fontfamily-dropdownlist>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton\n (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogApply\') }}</button>\n </kendo-dialog-actions>\n '}),o.__metadata("design:paramtypes",[i.DialogRef,a.EditorLocalizationService])],e)}(i.DialogContentBase);e.FontFamilyDialogComponent=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(7),a=n(2),s=n(3),l=function(t){function e(e,n){var o=t.call(this,e)||this;return o.dialog=e,o.localization=n,o}return o.__extends(e,t),e.prototype.onCancelAction=function(){this.dialog.close(),this.editor.view.focus()},e.prototype.onCellClick=function(t){this.dialog.close(),this.editor.exec("insertTable",t),this.editor.view.focus()},e.prototype.setData=function(t){this.editor=t.editor},e.prototype.textFor=function(t){return this.localization.get(t)},o.__decorate([r.Input(),o.__metadata("design:type",s.EditorComponent)],e.prototype,"editor",void 0),e=o.__decorate([r.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'insertTable\') }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-ct-popup k-window-content" style="text-align: center;">\n <kendo-popup-table-grid (cellClick)="onCellClick($event)"></kendo-popup-table-grid>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n </kendo-dialog-actions>\n '}),o.__metadata("design:paramtypes",[i.DialogRef,a.EditorLocalizationService])],e)}(i.DialogContentBase);e.InsertTableDialogComponent=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(7),a=n(2),s=n(3),l=n(20),c=function(t){function e(e,n){var o=t.call(this,e)||this;return o.dialog=e,o.localization=n,o.data=[],o}return o.__extends(e,t),e.prototype.ngAfterViewInit=function(){var t=this;Promise.resolve(null).then((function(){t.fontSizeDropDownList.dropDownList.focus()}))},e.prototype.onCancelAction=function(){this.dialog.close()},e.prototype.onConfirmAction=function(){this.value&&this.editor.exec("fontSize",this.value),this.dialog.close()},e.prototype.setData=function(t){this.editor=t.editor,this.data=t.data,this.defaultItem=t.defaultItem,this.value=t.value,this.itemDisabled=t.itemDisabled},e.prototype.textFor=function(t){return this.localization.get(t)},o.__decorate([r.Input(),o.__metadata("design:type",s.EditorComponent)],e.prototype,"editor",void 0),o.__decorate([r.ViewChild("fontSizeDropDownList",{read:l.FontSizeDropDownListComponent,static:!0}),o.__metadata("design:type",l.FontSizeDropDownListComponent)],e.prototype,"fontSizeDropDownList",void 0),e=o.__decorate([r.Component({template:'\n <kendo-dialog-titlebar (close)="onCancelAction()">\n {{ textFor(\'fontSize\') }}\n </kendo-dialog-titlebar>\n <div class="k-editor-dialog">\n <div class="k-editor-dialog k-popup-edit-form k-window-content k-content">\n <div class="k-edit-form-container k-window-content" style="text-align: center;">\n <kendo-editor-fontsize-dropdownlist\n #fontSizeDropDownList\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n >\n </kendo-editor-fontsize-dropdownlist>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)="onCancelAction()">{{ textFor(\'dialogCancel\') }}</button>\n <button kendoButton\n (click)="onConfirmAction()" [primary]="true">{{ textFor(\'dialogApply\') }}</button>\n </kendo-dialog-actions>\n '}),o.__metadata("design:paramtypes",[i.DialogRef,a.EditorLocalizationService])],e)}(i.DialogContentBase);e.FontSizeDialogComponent=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(22),r=function(){function t(t,e,n,r,i){var a=this;this.command=t,this.button=e,this.editor=n,this.localization=r,this.toolsService=i,setTimeout((function(){var t=a.localization.get(a.command);t&&(a.button.showText="overflow",a.button.showIcon="both",a.button.text=t),a.button.toolbarOptions.icon||(a.button.icon=o.commandIcons[a.command]),a.button.title=t,a.toolsService.needsCheck.next()}))}return t.prototype.ngOnInit=function(){this.subs=this.editor.stateChange.subscribe(this.onStateChange.bind(this)),this.subs.add(this.button.click.subscribe(this.clickHandler.bind(this))),this.subs.add(this.button.pointerdown.subscribe(this.pointerdownHandler.bind(this)))},t.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe()},t.prototype.clickHandler=function(){},t.prototype.pointerdownHandler=function(t){},t.prototype.onStateChange=function(t){},t}();e.EditorCommandBase=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o.__extends(e,t),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"alignCenter",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"alignJustify",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"alignLeft",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"alignRight",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"backColor",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"blockquote",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"bold",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"cleanFormatting",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"createLink",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"fontFamily",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"fontSize",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"foreColor",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"format",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"indent",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"insertFile",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"insertImage",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"insertOrderedList",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"insertUnorderedList",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"italic",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"outdent",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"print",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"redo",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"selectAll",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"strikethrough",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"subscript",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"superscript",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"underline",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"undo",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"unlink",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"viewSource",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"insertTable",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"addColumnBefore",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"addColumnAfter",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"addRowBefore",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"addRowAfter",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"deleteColumn",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"deleteRow",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"deleteTable",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"dialogApply",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"dialogCancel",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"dialogInsert",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"dialogUpdate",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"fileText",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"fileTitle",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"fileWebAddress",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"imageAltText",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"imageHeight",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"imageWebAddress",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"imageWidth",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"linkOpenInNewWindow",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"linkText",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"linkTitle",void 0),o.__decorate([r.Input(),o.__metadata("design:type",String)],e.prototype,"linkWebAddress",void 0),e}(n(11).ComponentMessages);e.Messages=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3);e.EditorComponent=o.EditorComponent;var r=n(45);e.EditorModule=r.EditorModule;var i=n(23);e.schema=i.schema,e.Schema=i.Schema;var a=n(8);e.EditorState=a.EditorState,e.Plugin=a.Plugin,e.PluginKey=a.PluginKey,e.Transaction=a.Transaction,e.EditorView=a.EditorView,e.Decoration=a.Decoration,e.DecorationSet=a.DecorationSet,e.NodeType=a.NodeType,e.Node=a.Node,e.MarkType=a.MarkType,e.Mark=a.Mark,e.InputRule=a.InputRule,e.inputRules=a.inputRules,e.wrappingInputRule=a.wrappingInputRule,e.textblockTypeInputRule=a.textblockTypeInputRule,e.keymap=a.keymap,e.baseKeymap=a.baseKeymap,e.history=a.history,e.dropCursor=a.dropCursor,e.gapCursor=a.gapCursor,e.tableNodes=a.tableNodes,e.getSelectionText=a.getSelectionText;var s=n(28);e.EditorPasteEvent=s.EditorPasteEvent},function(t,e){t.exports=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.packageMetadata={name:"@progress/kendo-angular-editor",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1646842151,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(40);e.semanticTagNames=["article","main","nav","header","footer","aside","section"],e.semanticNodes=e.semanticTagNames.reduce((function(t,e){var n,i;return Object.assign(t,((n={})[e]=(i=e,{content:"block*",group:"block",attrs:o.__assign({},r.commonAttributes()),parseDOM:[{tag:i,getAttrs:r.getAttributes}],toDOM:function(t){return r.hasAttrs(t.attrs)?[i,r.getAttrs(t.attrs),r.hole]:[i,r.hole]}}),n))}),{})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);e.hasAttrs=function(t,e){for(var n in t)if(n&&null!==t[n]&&n!==e)return!0;return!1},e.getAttrs=function(t,e){var n={};for(var o in t)o&&null!==t[o]&&o!==e&&(n[o]=t[o]);return n},e.getAttributes=function(t){for(var e,n={},o=t.attributes,r=0;r<o.length;r++)n[(e=o[r]).name]=e.value;return n},e.serializeDOMAttrs=function(t){return Array.from(t.attributes).reduce((function(t,e){var n;return Object.assign({},t,((n={})[e.name]=e.value,n))}),{})},e.commonAttributes=function(){return o.__assign({},e.createDefaultAttributes(["class","id","style"]))},e.createDefaultAttributes=function(t){return void 0===t&&(t=[]),o.__assign({},t.reduce((function(t,e){var n;return o.__assign({},t,((n={})[e]={default:null},n))}),{}))},e.hole=0,e.isSchemaNode=function(t){return function(e){return e.type.name===t}},e.isTable=e.isSchemaNode("table"),e.isTableBody=e.isSchemaNode("table_body"),e.isTableHead=e.isSchemaNode("table_head"),e.isTableFoot=e.isSchemaNode("table_foot"),e.isTableRow=e.isSchemaNode("table_row"),e.isTableCell=e.isSchemaNode("table_cell"),e.isTableHeaderCell=e.isSchemaNode("table_header")},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(8),i=n(42),a=function(t,e){return r.alignBlocks(r.alignRemoveRules)(t,e)},s={bold:function(t){return r.expandToWordWrap(r.toggleInlineFormat,o.__assign({},r.bold,{applyToWord:t}))},cleanFormatting:function(t){return r.cleanFormatting(t)},createLink:function(t){return r.expandToWordWrap(r.applyLink,{mark:"link",attrs:t.value,applyToWord:t.applyToWord})},fontFamily:function(t){return r.expandToWordWrap(r.applyInlineStyle,{style:"font-family",value:t.value,applyToWord:t.applyToWord})},fontSize:function(t){return r.expandToWordWrap(r.applyInlineStyle,{style:"font-size",value:t.value+"px",applyToWord:t.applyToWord})},insertFile:function(t){return r.expandToWordWrap(r.applyLink,{mark:"link",attrs:t,applyToWord:t.applyToWord})},insertText:function(t){return r.insertText(t)},italic:function(t){return r.expandToWordWrap(r.toggleInlineFormat,o.__assign({},r.italic,{applyToWord:t}))},strikethrough:function(t){return r.expandToWordWrap(r.toggleInlineFormat,o.__assign({},r.strikethrough,{applyToWord:t}))},subscript:function(t){return r.expandToWordWrap(r.toggleInlineFormat,o.__assign({},r.subscript,{applyToWord:t}))},superscript:function(t){return r.expandToWordWrap(r.toggleInlineFormat,o.__assign({},r.superscript,{applyToWord:t}))},underline:function(t){return r.expandToWordWrap(r.toggleInlineFormat,o.__assign({},r.underline,{applyToWord:t}))},unlink:function(){return r.removeLink(r.link)},foreColor:function(t){return r.expandToWordWrap(r.applyInlineStyle,{style:"color",value:t.value,applyToWord:t.applyToWord})},backColor:function(t){return r.expandToWordWrap(r.applyInlineStyle,{style:"background-color",value:t.value,applyToWord:t.applyToWord})},selectAll:function(){return function(t,e){return r.selectAll(t,e)}}},l={alignCenter:function(){return function(t,e){return r.isAligned(t,r.alignCenterRules)?a(t,e):r.alignBlocks(r.alignCenterRules)(t,e)}},alignJustify:function(){return function(t,e){return r.isAligned(t,r.alignJustifyRules)?a(t,e):r.alignBlocks(r.alignJustifyRules)(t,e)}},alignLeft:function(){return function(t,e){return r.isAligned(t,r.alignLeftRules)?a(t,e):r.alignBlocks(r.alignLeftRules)(t,e)}},alignRight:function(){return function(t,e){return r.isAligned(t,r.alignRightRules)?a(t,e):r.alignBlocks(r.alignRightRules)(t,e)}},format:function(t){return r.formatBlockElements(t.tag)},getHTML:function(){return r.getHtml},indent:function(){return r.indent},insertImage:function(t){return r.insertImage(t)},insertOrderedList:function(){return r.toggleOrderedList},insertUnorderedList:function(){return r.toggleUnorderedList},outdent:function(){return r.outdent},redo:function(){return r.redo},setHTML:function(t){var e=t.content,n=t.parseOptions;return r.setHtml(e,"setHTML",n)},undo:function(){return r.undo},blockquote:function(){return r.blockquote}},c={insertTable:function(t){return i.insertTable(t)},addColumnBefore:function(){return r.addColumnBefore},addColumnAfter:function(){return r.addColumnAfter},addRowBefore:function(){return r.addRowBefore},addRowAfter:function(){return r.addRowAfter},deleteRow:function(){return r.deleteRow},deleteColumn:function(){return r.deleteColumn},mergeCells:function(){return r.mergeCells},splitCell:function(){return r.splitCell},deleteTable:function(){return r.deleteTable}};e.editorCommands=Object.assign({},s,l,c)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(8);e.insertTable=function(t){return function(e,n){var r=o.createTable(e.schema.nodes,t.rows,t.cols);r&&o.insertNode(r,!0)(e,n)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(8),r=n(8);e.getToolbarState=function(t,e){return{alignCenter:{selected:r.isAligned(t,r.alignCenterRules),disabled:!1},alignJustify:{selected:r.isAligned(t,r.alignJustifyRules),disabled:!1},alignLeft:{selected:r.isAligned(t,r.alignLeftRules),disabled:!1},alignRight:{selected:r.isAligned(t,r.alignRightRules),disabled:!1},bold:{selected:r.hasMark(t,r.bold),disabled:!1},cleanFormatting:{selected:!1,disabled:!o.cleanFormatting()(t)},format:{selected:r.activeNode(t),disabled:!1},blockquote:{selected:!1,disabled:!o.blockquote(t)},indent:{selected:!1,disabled:!(r.canIndentAsListItem(t,t.schema.nodes.list_item)||r.canBeIndented(t,r.indentRules))},insertOrderedList:{selected:r.hasNode(t,t.schema.nodes.ordered_list),disabled:!1},insertUnorderedList:{selected:r.hasNode(t,t.schema.nodes.bullet_list),disabled:!1},italic:{selected:r.hasMark(t,r.italic),disabled:!1},unlink:{selected:!1,disabled:!r.hasMark(t,r.link)},outdent:{selected:!1,get disabled(){return!(r.hasNode(t,t.schema.nodes.blockquote)||r.canOutdentAsListItem(t,r.outdentRules)||o.isIndented(t,r.outdentRules.nodes))}},redo:{selected:!1,disabled:!r.redo(t)},selectAll:{selected:!1,disabled:!1},strikethrough:{selected:r.hasMark(t,r.strikethrough),disabled:!1},style:{selected:r.getActiveMarks(t,t.schema.marks.style),disabled:!1},subscript:{selected:r.hasMark(t,r.subscript),disabled:!1},superscript:{selected:r.hasMark(t,r.superscript),disabled:!1},underline:{selected:r.hasMark(t,r.underline),disabled:!1},undo:{selected:!1,disabled:!r.undo(t)},createLink:{selected:!1,get disabled(){var n=t.selection.empty;return e&&e.applyToWord&&n?r.expandSelection(t,(function(){}),e).state.selection.empty:n}},insertFile:{selected:!1,disabled:t.selection.empty},insertImage:{selected:!1,disabled:!1},viewSource:{selected:!1,disabled:!1},print:{selected:!1,disabled:!1},insertTable:{selected:!1,disabled:!1},addColumnBefore:{selected:!1,disabled:!r.addColumnBefore(t)},addColumnAfter:{selected:!1,disabled:!r.addColumnAfter(t)},addRowBefore:{selected:!1,disabled:!r.addRowBefore(t)},addRowAfter:{selected:!1,disabled:!r.addRowAfter(t)},deleteRow:{selected:!1,disabled:!r.deleteRow(t)},deleteColumn:{selected:!1,disabled:!r.deleteColumn(t)},mergeCells:{selected:!1,disabled:!r.mergeCells(t)},splitCell:{selected:!1,disabled:!r.splitCell(t)},deleteTable:{selected:!1,disabled:!r.deleteTable(t)}}},e.initialToolBarState={alignCenter:{selected:!1,disabled:!1},alignJustify:{selected:!1,disabled:!1},alignLeft:{selected:!1,disabled:!1},alignRight:{selected:!1,disabled:!1},bold:{selected:!1,disabled:!1},italic:{selected:!1,disabled:!1},underline:{selected:!1,disabled:!1},strikethrough:{selected:!1,disabled:!1},subscript:{selected:!1,disabled:!1},superscript:{selected:!1,disabled:!1},format:{selected:{text:"Format",tag:null},disabled:!1},style:{selected:{marks:[],hasNodesWithoutMarks:!1},disabled:!1},cleanFormatting:{selected:!1,disabled:!0},blockquote:{selected:!1,disabled:!1},indent:{selected:!1,disabled:!1},outdent:{selected:!1,disabled:!1},insertOrderedList:{selected:!1,disabled:!1},insertUnorderedList:{selected:!1,disabled:!1},unlink:{selected:!1,disabled:!0},redo:{selected:!1,disabled:!0},undo:{selected:!1,disabled:!0},print:{selected:!1,disabled:!1},createLink:{selected:!1,disabled:!0},insertFile:{selected:!1,disabled:!0},insertImage:{selected:!1,disabled:!1},viewSource:{selected:!1,disabled:!1},insertTable:{selected:!1,disabled:!1},addColumnBefore:{selected:!1,disabled:!0},addColumnAfter:{selected:!1,disabled:!0},addRowBefore:{selected:!1,disabled:!0},addRowAfter:{selected:!1,disabled:!0},deleteRow:{selected:!1,disabled:!0},deleteColumn:{selected:!1,disabled:!0},mergeCells:{selected:!1,disabled:!0},splitCell:{selected:!1,disabled:!0},deleteTable:{selected:!1,disabled:!0},selectAll:{selected:!1,disabled:!1}},e.disabledToolBarState={alignCenter:{selected:!1,disabled:!0},alignJustify:{selected:!1,disabled:!0},alignLeft:{selected:!1,disabled:!0},alignRight:{selected:!1,disabled:!0},bold:{selected:!1,disabled:!0},italic:{selected:!1,disabled:!0},underline:{selected:!1,disabled:!0},strikethrough:{selected:!1,disabled:!0},subscript:{selected:!1,disabled:!0},superscript:{selected:!1,disabled:!0},format:{selected:{text:"Format",tag:null},disabled:!0},style:{selected:{marks:[],hasNodesWithoutMarks:!1},disabled:!0},cleanFormatting:{selected:!1,disabled:!0},blockquote:{selected:!1,disabled:!0},indent:{selected:!1,disabled:!0},outdent:{selected:!1,disabled:!0},insertOrderedList:{selected:!1,disabled:!0},insertUnorderedList:{selected:!1,disabled:!0},unlink:{selected:!1,disabled:!0},redo:{selected:!1,disabled:!0},undo:{selected:!1,disabled:!0},print:{selected:!1,disabled:!0},createLink:{selected:!1,disabled:!0},insertFile:{selected:!1,disabled:!0},insertImage:{selected:!1,disabled:!0},viewSource:{selected:!1,disabled:!0},insertTable:{selected:!1,disabled:!0},addColumnBefore:{selected:!1,disabled:!0},addColumnAfter:{selected:!1,disabled:!0},addRowBefore:{selected:!1,disabled:!0},addRowAfter:{selected:!1,disabled:!0},deleteRow:{selected:!1,disabled:!0},deleteColumn:{selected:!1,disabled:!0},mergeCells:{selected:!1,disabled:!0},splitCell:{selected:!1,disabled:!0},deleteTable:{selected:!1,disabled:!0},selectAll:{selected:!1,disabled:!0}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.defaultStyle='\n html, body {\n margin: 0;\n height: 100%;\n padding: 0;\n }\n\n html {\n min-height: 100%;\n }\n\n body {\n box-sizing: border-box;\n position: relative;\n word-wrap: break-word;\n padding: 8px;\n }\n\n body > .k-content {\n outline: 0;\n height: 100%;\n white-space: pre-wrap;\n }\n\n div.ProseMirror {\n position: relative;\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n }\n\n .ProseMirror pre {\n white-space: pre-wrap;\n }\n\n .k-content > p {\n margin: 0 0 1em;\n }\n\n .k-content table {\n white-space: pre-wrap;\n }\n\n .k-content .k-text-selected, .k-content::selection {\n color: HighlightText;\n background-color: Highlight;\n }\n\n .k-content .k-text-highlighted {\n background-color: #bbdefb;\n }\n\n .k-content .ProseMirror-selectednode {\n outline: 2px solid #8cf;\n }\n\n .ProseMirror-hideselection *::selection { background: transparent; }\n .ProseMirror-hideselection *::-moz-selection { background: transparent; }\n .ProseMirror-hideselection { caret-color: transparent; }\n\n .ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n }\n\n .ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n }\n\n @keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n }\n\n .ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n }\n\n .k-editor-resize-handles-wrapper {\n position: absolute;\n visibility: hidden;\n }\n\n .k-editor-resize-handle {\n position: absolute;\n visibility: visible;\n background-color: #fff;\n border: 1px solid #000;\n z-index: 100;\n width: 5px;\n height: 5px;\n }\n\n .k-editor-resize-handle.northwest {\n top: 0;\n left: 0;\n transform: translate(-50%, -50%);\n cursor: nw-resize;\n }\n\n .k-editor-resize-handle.north {\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n cursor: n-resize;\n }\n\n .k-editor-resize-handle.northeast {\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n cursor: ne-resize;\n }\n\n .k-editor-resize-handle.southwest {\n left: 0;\n bottom: 0;\n transform: translate(-50%, 50%);\n cursor: sw-resize;\n }\n\n .k-editor-resize-handle.south {\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 50%);\n cursor: s-resize;\n }\n\n .k-editor-resize-handle.southeast {\n right: 0;\n bottom: 0;\n transform: translate(50%, 50%);\n cursor: se-resize;\n }\n\n .k-editor-resize-handle.west {\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n cursor: w-resize;\n }\n\n .k-editor-resize-handle.east {\n top: 50%;\n right: 0;\n transform: translate(50%, -50%);\n cursor: e-resize;\n }\n\n .ProseMirror .k-placeholder::before {\n content: attr(data-placeholder);\n height: 0;\n color: #8a8a8a;\n float: left;\n opacity: 1;\n cursor: text;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n\n .ProseMirror li {\n position: relative;\n }\n\n li.ProseMirror-selectednode {\n outline: none;\n }\n\n li.ProseMirror-selectednode:after {\n content: "";\n position: absolute;\n left: -32px;\n right: -2px;\n top: -2px;\n bottom: -2px;\n border: 2px solid #8cf;\n pointer-events: none;\n }\n',e.tablesStyles='\n.ProseMirror .tableWrapper {\n overflow-x: auto;\n margin: 1em 0;\n}\n\n.ProseMirror table {\n margin: 0;\n border-collapse: collapse;\n table-layout: fixed;\n width: 100%;\n overflow: hidden;\n}\n\n.ProseMirror td, .ProseMirror th {\n min-width: 1em;\n border: 1px solid #ddd;\n padding: 3px 5px;\n vertical-align: top;\n box-sizing: border-box;\n position: relative;\n}\n\n.ProseMirror th {\n font-weight: bold;\n text-align: left;\n}\n\n.ProseMirror .column-resize-handle {\n position: absolute;\n right: -2px; top: 0; bottom: 0;\n width: 4px;\n z-index: 20;\n background-color: #adf;\n pointer-events: none;\n}\n\n.ProseMirror.resize-cursor {\n cursor: ew-resize;\n cursor: col-resize;\n}\n\n/* Give selected cells a blue overlay */\n.ProseMirror .selectedCell:after {\n z-index: 2;\n position: absolute;\n content: "";\n left: 0; right: 0; top: 0; bottom: 0;\n background: rgba(200, 200, 255, 0.4);\n pointer-events: none;\n}\n',e.rtlStyles="body { direction: rtl }"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(46),a=n(12),s=n(4),l=n(13),c=n(7),d=n(47),u=n(17),p=n(3),f=n(25),h=n(24),m=n(26),v=n(29),g=n(30),y=n(31),b=n(32),w=n(48),k=n(49),_=n(50),C=n(21),x=n(51),S=n(53),E=n(54),T=n(55),M=n(56),D=n(57),O=n(58),A=n(59),I=n(60),B=n(61),N=n(62),z=n(63),R=n(64),P=n(65),L=n(66),F=n(67),$=n(68),V=n(69),j=n(70),W=n(71),H=n(72),q=n(73),J=n(74),K=n(75),U=n(76),G=n(77),X=n(78),Y=n(79),Z=n(80),Q=n(81),tt=n(82),et=n(83),nt=n(84),ot=n(85),rt=n(86),it=n(87),at=n(88),st=n(89),lt=n(18),ct=n(19),dt=n(20),ut=n(33),pt=n(90),ft=n(91),ht=n(92),mt=[E.EditorAlignLeftButtonDirective,T.EditorAlignCenterButtonDirective,M.EditorAlignRightButtonDirective,D.EditorAlignJustifyButtonDirective,K.EditorInsertFileButtonDirective,A.EditorRedoButtonDirective,I.EditorUndoButtonDirective,B.EditorInsertImageButtonDirective,N.EditorIndentButtonDirective,z.EditorOutdentButtonDirective,R.EditorCreateLinkButtonDirective,P.EditorUnlinkButtonDirective,L.EditorInsertOrderedListButtonDirective,F.EditorInsertUnorderedListButtonDirective,$.EditorViewSourceButtonDirective,V.EditorBoldButtonDirective,j.EditorItalicButtonDirective,W.EditorUnderlineButtonDirective,H.EditorStrikethroughButtonDirective,q.EditorSubscriptButtonDirective,J.EditorSuperscriptButtonDirective,U.EditorForeColorDirective,G.EditorBackColorDirective,X.EditorCleanFormattingButtonDirective,Y.EditorAddColumnBeforeButtonDirective,Z.EditorAddColumnAfterButtonDirective,Q.EditorAddRowBeforeButtonDirective,tt.EditorAddRowAfterButtonDirective,et.EditorDeleteColumnButtonDirective,nt.EditorDeleteRowButtonDirective,ot.EditorDeleteTableButtonDirective,rt.EditorMergeCellsButtonDirective,it.EditorSplitCellButtonDirective,st.CustomMessagesComponent,at.LocalizedMessagesDirective,pt.DropDownToolDirective,ft.EditorPrintDirective,ht.EditorSelectAllButtonDirective,O.EditorBlockquoteDirective],vt=[k.EditorFontSizeComponent,_.EditorFontFamilyComponent,w.EditorFormatComponent,C.EditorColorPickerComponent,x.EditorInsertTableButtonComponent],gt=[m.FileLinkDialogComponent,f.ImageDialogComponent,h.SourceDialogComponent,v.FormatDialogComponent,g.ColorPickerDialogComponent,y.FontFamilyDialogComponent,ut.FontSizeDialogComponent,b.InsertTableDialogComponent],yt=[S.PopupTableGridComponent,lt.FormatDropDownListComponent,ct.FontFamilyDropDownListComponent,dt.FontSizeDropDownListComponent],bt=function(){function t(){}return t=o.__decorate([r.NgModule({declarations:[p.EditorComponent,mt,vt,gt,yt],entryComponents:[gt],exports:[p.EditorComponent,mt,vt,s.ToolBarModule,d.ButtonModule,a.FormsModule,a.ReactiveFormsModule,yt],imports:[i.CommonModule,a.FormsModule,a.ReactiveFormsModule,d.ButtonModule,u.ColorPickerModule,c.DialogModule,l.DropDownsModule,u.NumericTextBoxModule,u.CheckBoxModule,s.ToolBarModule,u.TextBoxModule]})],t)}();e.EditorModule=bt},function(t,e){t.exports=u},function(t,e){t.exports=p},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(7),s=n(9),l=n(3),c=n(2),d=n(29),u=n(18),p=n(5),f=function(t){function e(e,n,o,i){var a=t.call(this)||this;return a.editor=e,a.dialogService=n,a.localization=o,a.toolsService=i,a.disabled=!1,a.tabindex=-1,a.valueChange=new r.EventEmitter,a._data=[{text:"Paragraph",tag:"p"},{text:"Heading 1",tag:"h1"},{text:"Heading 2",tag:"h2"},{text:"Heading 3",tag:"h3"},{text:"Heading 4",tag:"h4"},{text:"Heading 5",tag:"h5"},{text:"Heading 6",tag:"h6"}],a}var n;return o.__extends(e,t),n=e,Object.defineProperty(e.prototype,"data",{get:function(){return this._data},set:function(t){this._data=t||this._data},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var t=this;this.itemDisabled=function(e){return!(t.overflows||!t.formatDropDownList||t.formatDropDownList.dropDownList.isOpen)||null===e.dataItem.tag},setTimeout((function(){t.defaultItem={text:t.title,tag:null},t.toolsService.needsCheck.next()})),this.subs=this.editor.stateChange.subscribe((function(e){var n=e.format,o=t.data.findIndex((function(t){return t.tag===n.selected.tag}));t.value=-1!==o?n.selected.tag:null,t.disabled=n.disabled}))},e.prototype.onValueChange=function(t){s.isPresent(t)&&(this.editor.exec("format",{tag:t}),this.editor.view.focus(),this.valueChange.emit(this.data.find((function(e){return e.tag===t}))))},e.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe()},Object.defineProperty(e.prototype,"outerWidth",{get:function(){var t=this.formatDropDownList.element;if(t)return s.outerWidth(t.nativeElement)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this.localization.get("format")},enumerable:!0,configurable:!0}),e.prototype.openDialog=function(){var t={appendTo:this.editor.dialogContainer,content:d.FormatDialogComponent};this.editor.toolbar.toggle(!1),this.dialogService.open(t).content.instance.setData({editor:this.editor,data:this.data,defaultItem:this.defaultItem,value:this.value,itemDisabled:this.itemDisabled})},e.prototype.canFocus=function(){return!this.disabled},e.prototype.focus=function(){this.tabindex=0,this.overflows?this.formatButton.nativeElement.focus():this.formatDropDownList.focus()},e.prototype.handleKey=function(){return this.tabindex=-1,!1},o.__decorate([r.Input(),o.__metadata("design:type",Array),o.__metadata("design:paramtypes",[Array])],e.prototype,"data",null),o.__decorate([r.Output(),o.__metadata("design:type",r.EventEmitter)],e.prototype,"valueChange",void 0),o.__decorate([r.ViewChild("toolbarTemplate",{static:!0}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"toolbarTemplate",void 0),o.__decorate([r.ViewChild("popupTemplate",{static:!0}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"popupTemplate",void 0),o.__decorate([r.ViewChild("formatDropDownList",{static:!1}),o.__metadata("design:type",u.FormatDropDownListComponent)],e.prototype,"formatDropDownList",void 0),o.__decorate([r.ViewChild("formatButton",{static:!1}),o.__metadata("design:type",r.ElementRef)],e.prototype,"formatButton",void 0),e=n=o.__decorate([r.Component({providers:[{provide:i.ToolBarToolComponent,useExisting:r.forwardRef((function(){return n}))}],selector:"kendo-toolbar-dropdownlist[kendoEditorFormat]",template:'\n <ng-template #toolbarTemplate>\n <kendo-editor-format-dropdownlist\n #formatDropDownList\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n [title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n </kendo-editor-format-dropdownlist>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n #formatButton\n [tabindex]="tabindex"\n type="button"\n kendoButton\n class="k-overflow-button"\n [icon]="\'apply-format\'"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (click)="openDialog()"\n >\n {{ title }}\n </button>\n </ng-template>\n '}),o.__param(0,r.Host()),o.__metadata("design:paramtypes",[l.EditorComponent,a.DialogService,c.EditorLocalizationService,p.EditorToolsService])],e)}(i.ToolBarToolComponent);e.EditorFormatComponent=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(9),s=n(3),l=n(2),c=n(7),d=n(33),u=n(20),p=n(5),f=function(t){function e(e,n,o,i){var a=t.call(this)||this;return a.editor=e,a.dialogService=n,a.localization=o,a.toolsService=i,a.disabled=!1,a.tabindex=-1,a.valueChange=new r.EventEmitter,a._data=[{text:"8px",size:8},{text:"10px",size:10},{text:"12px",size:12},{text:"14px",size:14},{text:"18px",size:18},{text:"24px",size:24},{text:"36px",size:36}],a}var n;return o.__extends(e,t),n=e,Object.defineProperty(e.prototype,"data",{get:function(){return this._data},set:function(t){this._data=t||this._data},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var t=this;this.itemDisabled=function(e){return!(t.overflows||!t.fontSizeDropDownList||t.fontSizeDropDownList.dropDownList.isOpen)||null===e.dataItem.size},setTimeout((function(){t.defaultItem={text:t.title,size:null},t.toolsService.needsCheck.next()})),this.subs=this.editor.stateChange.subscribe((function(e){var n=e.style;t.value=(a.getUniqueStyleValues(n.selected,"font-size").match(/\d+/g)||[null])[0],t.disabled=n.disabled}))},e.prototype.onValueChange=function(t){a.isPresent(t)&&(this.editor.exec("fontSize",t),this.editor.view.focus(),this.valueChange.emit(this.data.find((function(e){return e.size===parseInt(t,10)}))))},e.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe()},Object.defineProperty(e.prototype,"outerWidth",{get:function(){if(this.element)return a.outerWidth(this.element.nativeElement)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this.localization.get("fontSize")},enumerable:!0,configurable:!0}),e.prototype.openDialog=function(){var t={appendTo:this.editor.dialogContainer,content:d.FontSizeDialogComponent};this.editor.toolbar.toggle(!1),this.dialogService.open(t).content.instance.setData({editor:this.editor,data:this.data,defaultItem:this.defaultItem,value:this.value,itemDisabled:this.itemDisabled})},e.prototype.canFocus=function(){return!this.disabled},e.prototype.focus=function(){this.tabindex=0,this.overflows?this.fontSizeButton.nativeElement.focus():this.fontSizeDropDownList.focus()},e.prototype.handleKey=function(){return this.tabindex=-1,!1},o.__decorate([r.Input(),o.__metadata("design:type",Array),o.__metadata("design:paramtypes",[Array])],e.prototype,"data",null),o.__decorate([r.Output(),o.__metadata("design:type",r.EventEmitter)],e.prototype,"valueChange",void 0),o.__decorate([r.ViewChild("toolbarTemplate",{static:!0}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"toolbarTemplate",void 0),o.__decorate([r.ViewChild("popupTemplate",{static:!0}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"popupTemplate",void 0),o.__decorate([r.ViewChild("element",{static:!1}),o.__metadata("design:type",r.ElementRef)],e.prototype,"element",void 0),o.__decorate([r.ViewChild("element",{read:u.FontSizeDropDownListComponent,static:!1}),o.__metadata("design:type",u.FontSizeDropDownListComponent)],e.prototype,"fontSizeDropDownList",void 0),o.__decorate([r.ViewChild("fontSizeButton",{static:!1}),o.__metadata("design:type",r.ElementRef)],e.prototype,"fontSizeButton",void 0),e=n=o.__decorate([r.Component({providers:[{provide:i.ToolBarToolComponent,useExisting:r.forwardRef((function(){return n}))}],selector:"kendo-toolbar-dropdownlist[kendoEditorFontSize]",template:'\n <ng-template #toolbarTemplate>\n <kendo-editor-fontsize-dropdownlist\n #element\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n [title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n </kendo-editor-fontsize-dropdownlist>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n tabindex="-1"\n type="button"\n kendoButton\n #fontSizeButton\n class="k-overflow-button"\n [icon]="\'font-size\'"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (click)="openDialog()"\n >\n {{ title }}\n </button>\n </ng-template>\n '}),o.__param(0,r.Host()),o.__metadata("design:paramtypes",[s.EditorComponent,c.DialogService,l.EditorLocalizationService,p.EditorToolsService])],e)}(i.ToolBarToolComponent);e.EditorFontSizeComponent=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(9),s=n(3),l=n(2),c=n(7),d=n(31),u=n(19),p=n(5),f=function(t){function e(e,n,o,i){var a=t.call(this)||this;return a.editor=e,a.dialogService=n,a.localization=o,a.toolsService=i,a.disabled=!1,a.tabindex=-1,a.valueChange=new r.EventEmitter,a._data=[{text:"Arial",fontName:'Arial,"Helvetica Neue",Helvetica,sans-serif'},{text:"Courier New",fontName:'"Courier New",Courier,"Lucida Sans Typewriter","Lucida Typewriter",monospace'},{text:"Georgia",fontName:'Georgia,Times,"Times New Roman",serif'},{fontName:'Impact,Haettenschweiler,"Franklin Gothic Bold",Charcoal,"Helvetica Inserat","Bitstream Vera Sans Bold","Arial Black","sans serif"',text:"Impact"},{text:"Lucida Console",fontName:'"Lucida Console","Lucida Sans Typewriter",monaco,"Bitstream Vera Sans Mono",monospace'},{text:"Tahoma",fontName:"Tahoma,Verdana,Segoe,sans-serif"},{text:"Times New Roman",fontName:'TimesNewRoman,"Times New Roman",Times,Baskerville,Georgia,serif'},{text:"Trebuchet MS",fontName:'"Trebuchet MS","Lucida Grande","Lucida Sans Unicode","Lucida Sans",Tahoma,sans-serif'},{text:"Verdana",fontName:"Verdana,Geneva,sans-serif"}],a}var n;return o.__extends(e,t),n=e,Object.defineProperty(e.prototype,"data",{get:function(){return this._data},set:function(t){this._data=t||this._data},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var t=this;this.itemDisabled=function(e){return!(t.overflows||!t.fontFamilyDropDownList||t.fontFamilyDropDownList.dropDownList.isOpen)||null===e.dataItem.fontName},setTimeout((function(){t.defaultItem={text:t.title,fontName:null},t.toolsService.needsCheck.next()})),this.subs=this.editor.stateChange.subscribe((function(e){var n=e.style;t.value=a.getUniqueStyleValues(n.selected,"font-family")||null,t.disabled=n.disabled}))},e.prototype.onValueChange=function(t){a.isPresent(t)&&(this.editor.exec("fontFamily",t),this.editor.view.focus(),this.valueChange.emit(this.data.find((function(e){return e.fontName===t}))))},e.prototype.ngOnDestroy=function(){this.subs&&this.subs.unsubscribe()},Object.defineProperty(e.prototype,"outerWidth",{get:function(){if(this.element)return a.outerWidth(this.element.nativeElement)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this.localization.get("fontFamily")},enumerable:!0,configurable:!0}),e.prototype.openDialog=function(){var t={appendTo:this.editor.dialogContainer,content:d.FontFamilyDialogComponent};this.editor.toolbar.toggle(!1),this.dialogService.open(t).content.instance.setData({editor:this.editor,data:this.data,defaultItem:this.defaultItem,value:this.value,itemDisabled:this.itemDisabled})},e.prototype.canFocus=function(){return!this.disabled},e.prototype.focus=function(){this.tabindex=0,this.overflows?this.fontFamilyButton.nativeElement.focus():this.fontFamilyDropDownList.focus()},e.prototype.handleKey=function(){return this.tabindex=-1,!1},o.__decorate([r.Input(),o.__metadata("design:type",Array),o.__metadata("design:paramtypes",[Array])],e.prototype,"data",null),o.__decorate([r.Output(),o.__metadata("design:type",r.EventEmitter)],e.prototype,"valueChange",void 0),o.__decorate([r.ViewChild("toolbarTemplate",{static:!0}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"toolbarTemplate",void 0),o.__decorate([r.ViewChild("popupTemplate",{static:!0}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"popupTemplate",void 0),o.__decorate([r.ViewChild("element",{static:!1}),o.__metadata("design:type",r.ElementRef)],e.prototype,"element",void 0),o.__decorate([r.ViewChild("element",{read:u.FontFamilyDropDownListComponent,static:!1}),o.__metadata("design:type",u.FontFamilyDropDownListComponent)],e.prototype,"fontFamilyDropDownList",void 0),o.__decorate([r.ViewChild("fontFamilyButton",{static:!1}),o.__metadata("design:type",r.ElementRef)],e.prototype,"fontFamilyButton",void 0),e=n=o.__decorate([r.Component({providers:[{provide:i.ToolBarToolComponent,useExisting:r.forwardRef((function(){return n}))}],selector:"kendo-toolbar-dropdownlist[kendoEditorFontFamily]",template:'\n <ng-template #toolbarTemplate>\n <kendo-editor-fontfamily-dropdownlist\n #element\n [defaultItem]="defaultItem"\n [data]="data"\n [(value)]="value"\n [itemDisabled]="itemDisabled"\n [title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (valueChange)="onValueChange($event)"\n >\n </kendo-editor-fontfamily-dropdownlist>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n tabindex="-1"\n type="button"\n kendoButton\n #fontFamilyButton\n class="k-overflow-button"\n [icon]="\'font-family\'"\n [attr.title]="title"\n [disabled]="disabled"\n [tabindex]="tabindex"\n (click)="openDialog()"\n >\n {{ title }}\n </button>\n </ng-template>\n '}),o.__param(0,r.Host()),o.__metadata("design:paramtypes",[s.EditorComponent,c.DialogService,l.EditorLocalizationService,p.EditorToolsService])],e)}(i.ToolBarToolComponent);e.EditorFontFamilyComponent=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(15),a=n(16),s=n(4),l=n(52),c=n(9),d=n(3),u=n(2),p=n(7),f=n(32),h=n(10),m=function(t){function e(e,n,o,s){var l=t.call(this)||this;return l.editor=e,l.localization=n,l.popupService=o,l.dialogService=s,l.open=!1,l.buttonBlurred=new r.EventEmitter,l.cellClicked=new r.EventEmitter,l.subs=l.editor.stateChange.subscribe((function(t){var e=t.insertTable;l.disabled=e.disabled})),l.subs.add(l.buttonBlurred.pipe(a.concatMap((function(){return i.interval(200).pipe(a.take(1),a.takeUntil(l.cellClicked))}))).subscribe((function(){l.toggle(!1)}))),l}var n;return o.__extends(e,t),n=e,e.prototype.ngOnDestroy=function(){this.destroyPopup(),this.subs&&this.subs.unsubscribe()},Object.defineProperty(e.prototype,"outerWidth",{get:function(){if(this.element)return c.outerWidth(this.element.nativeElement)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this.localization.get("insertTable")},enumerable:!0,configurable:!0}),e.prototype.toggle=function(t){this.open=void 0===t?!this.open:t,this.destroyPopup(),this.open&&this.createPopup()},e.prototype.openDialog=function(){var t={appendTo:this.editor.dialogContainer,content:f.InsertTableDialogComponent};this.editor.toolbar.toggle(!1),this.dialogService.open(t).content.instance.setData({editor:this.editor})},e.prototype.onBlur=function(){this.tabIndex=-1,this.buttonBlurred.emit()},e.prototype.onCellClick=function(t){this.cellClicked.emit(),this.toggle(!1),this.editor.exec("insertTable",t)},e.prototype.canFocus=function(){return!this.disabled},e.prototype.focus=function(){this.tabIndex=0,this.getButton().focus()},e.prototype.handleKey=function(t){return t.keyCode===h.Keys.Space||t.keyCode===h.Keys.Enter||(this.tabIndex=-1,!1)},e.prototype.onTableWizardClick=function(){},e.prototype.createPopup=function(){var t="rtl"===this.editor.direction?"right":"left",e={horizontal:t,vertical:"bottom"},n={horizontal:t,vertical:"top"};this.popupRef=this.popupService.open({anchor:this.element,anchorAlign:e,animate:!0,content:this.popupGridTemplate,popupAlign:n,popupClass:"k-ct-popup k-group k-reset k-state-border-up",positionMode:"absolute"});var o=this.popupRef.popupElement;o.style.width="190px",o.style.height="164px",o.setAttribute("dir",this.editor.direction)},e.prototype.destroyPopup=function(){this.popupRef&&(this.popupRef.close(),this.popupRef=null)},e.prototype.getButton=function(){return(this.overflows?this.overflowElement:this.element).nativeElement},o.__decorate([r.ViewChild("toolbarTemplate",{static:!0}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"toolbarTemplate",void 0),o.__decorate([r.ViewChild("popupTemplate",{static:!1}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"popupTemplate",void 0),o.__decorate([r.ViewChild("element",{static:!1}),o.__metadata("design:type",r.ElementRef)],e.prototype,"element",void 0),o.__decorate([r.ViewChild("overflowElement",{static:!1}),o.__metadata("design:type",r.ElementRef)],e.prototype,"overflowElement",void 0),o.__decorate([r.ViewChild("popupGridTemplate",{static:!0}),o.__metadata("design:type",r.TemplateRef)],e.prototype,"popupGridTemplate",void 0),e=n=o.__decorate([r.Component({providers:[{provide:s.ToolBarToolComponent,useExisting:r.forwardRef((function(){return n}))}],selector:"kendo-editor-insert-table-button",template:'\n <ng-template #toolbarTemplate>\n <button\n type="button"\n kendoButton\n #element\n [attr.title]="title"\n [attr.tabindex]="tabIndex"\n [icon]="\'table-insert\'"\n [disabled]="disabled"\n (click)="toggle()"\n (blur)="onBlur()"\n ></button>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n kendoButton\n #overflowElement\n [attr.title]="title"\n [attr.tabindex]="tabIndex"\n [icon]="\'table-insert\'"\n [disabled]="disabled"\n (click)="openDialog()">\n {{ title }}\n </button>\n </ng-template>\n <ng-template #popupGridTemplate>\n <kendo-popup-table-grid (cellClick)="onCellClick($event)" (tableWizardClick)="onTableWizardClick()"></kendo-popup-table-grid>\n </ng-template>\n '}),o.__param(0,r.Host()),o.__metadata("design:paramtypes",[d.EditorComponent,u.EditorLocalizationService,l.PopupService,p.DialogService])],e)}(s.ToolBarToolComponent);e.EditorInsertTableButtonComponent=m},function(t,e){t.exports=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=function(){function t(){this.cellClick=new r.EventEmitter,this.tableWizardClick=new r.EventEmitter,this.state={rows:-1,cols:-1},this.rows=6,this.cols=8}return Object.defineProperty(t.prototype,"message",{get:function(){var t=this.state,e=t.rows,n=t.cols;return"Create a "+(e>-1?e+1:"")+" "+(n>-1?"x":"")+" "+(n>-1?n+1:"")+" table"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cells",{get:function(){return Array.from(Array(this.rows*this.cols).keys())},enumerable:!0,configurable:!0}),t.prototype.selected=function(t){var e=this.state,n=e.rows,o=e.cols,r=Math.floor(t/this.cols),i=t%this.cols;return r<=n&&i<=o},t.prototype.setState=function(t){var e=Math.floor(t/this.cols),n=t%this.cols;this.state={rows:e,cols:n}},t.prototype.resetState=function(){this.state={rows:-1,cols:-1}},t.prototype.insertTable=function(){this.cellClick.emit(this.state)},t.prototype.openTableWizard=function(){this.tableWizardClick.emit()},o.__decorate([r.Output(),o.__metadata("design:type",r.EventEmitter)],t.prototype,"cellClick",void 0),o.__decorate([r.Output(),o.__metadata("design:type",r.EventEmitter)],t.prototype,"tableWizardClick",void 0),t=o.__decorate([r.Component({selector:"kendo-popup-table-grid",template:'\n <div style="border-color: inherit;" (mouseleave)="resetState()" (click)="insertTable()">\n <span *ngFor="let i of cells"\n class="k-ct-cell"\n [class.k-state-selected]="selected(i)"\n [class.k-state-disabled]="!selected(i)"\n (mouseenter)="setState(i)">\n </span>\n </div>\n <div class="k-status" unselectable="on">{{ message }}</div>\n \x3c!-- uncomment when TableWizard is completed\n <div class="k-editor-toolbar" unselectable="on">\n <button type="button" kendoButton class="k-tool" [icon]="\'table-wizard\'" (click)="openTableWizard()" title="Table Wizard">Table Wizard</button>\n </div>\n --\x3e\n '})],t)}();e.PopupTableGridComponent=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"alignLeft",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorAlignLeftButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorAlignLeftButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"alignCenter",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorAlignCenterButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorAlignCenterButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"alignRight",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorAlignRightButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorAlignRightButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"alignJustify",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorAlignJustifyButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorAlignJustifyButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){var i=t.call(this,"blockquote",e,n,o,r)||this;return i.editor=n,i}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorBlockquoteButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorBlockquoteDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"redo",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorRedoButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorRedoButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"undo",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorUndoButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorUndoButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(14),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"insertImage",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorInsertImageButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandDialog);e.EditorInsertImageButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"indent",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorIndentButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorIndentButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"outdent",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorOutdentButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorOutdentButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(14),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"createLink",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorCreateLinkButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandDialog);e.EditorCreateLinkButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"unlink",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorUnlinkButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorUnlinkButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"insertOrderedList",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorInsertOrderedListButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorInsertOrderedListButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"insertUnorderedList",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorInsertUnorderedListButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorInsertUnorderedListButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(14),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"viewSource",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorViewSourceButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandDialog);e.EditorViewSourceButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"bold",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorBoldButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorBoldButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"italic",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorItalicButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorItalicButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"underline",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorUnderlineButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorUnderlineButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"strikethrough",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorStrikethroughButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorStrikethroughButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"subscript",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorSubscriptButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorSubscriptButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"superscript",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorSuperscriptButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorSuperscriptButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(3),a=n(14),s=n(4),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"insertFile",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorInsertFileButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[s.ToolBarButtonComponent,i.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(a.EditorCommandDialog);e.EditorInsertFileButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(21),a=n(22),s=function(){function t(t){this.colorPicker=t,this.colorPicker.icon=a.commandIcons.foreColor,this.colorPicker.editorCommand="foreColor"}return t=o.__decorate([r.Directive({selector:"[kendoEditorForeColor]"}),o.__metadata("design:paramtypes",[i.EditorColorPickerComponent])],t)}();e.EditorForeColorDirective=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(21),a=n(22),s=function(){function t(t){this.colorPicker=t,this.colorPicker.icon=a.commandIcons.backColor,this.colorPicker.editorCommand="backColor"}return t=o.__decorate([r.Directive({selector:"[kendoEditorBackColor]"}),o.__metadata("design:paramtypes",[i.EditorColorPickerComponent])],t)}();e.EditorBackColorDirective=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"cleanFormatting",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorCleanFormattingButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorCleanFormattingButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"addColumnBefore",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorAddColumnBeforeButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorAddColumnBeforeButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"addColumnAfter",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorAddColumnAfterButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorAddColumnAfterButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"addRowBefore",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorAddRowBeforeButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorAddRowBeforeButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"addRowAfter",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorAddRowAfterButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorAddRowAfterButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"deleteColumn",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorDeleteColumnButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorDeleteColumnButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"deleteRow",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorDeleteRowButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorDeleteRowButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"deleteTable",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorDeleteTableButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorDeleteTableButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"mergeCells",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorMergeCellsButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorMergeCellsButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"splitCell",e,n,o,r)||this}return o.__extends(e,t),e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorSplitCellButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorSplitCellButtonDirective=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(11),a=n(35),s=function(t){function e(e){var n=t.call(this)||this;return n.service=e,n}var n;return o.__extends(e,t),n=e,e=n=o.__decorate([r.Directive({providers:[{provide:a.Messages,useExisting:r.forwardRef((function(){return n}))}],selector:"[kendoEditorLocalizedMessages]"}),o.__metadata("design:paramtypes",[i.LocalizationService])],e)}(a.Messages);e.LocalizedMessagesDirective=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(11),a=n(35),s=function(t){function e(e){var n=t.call(this)||this;return n.service=e,n}var n;return o.__extends(e,t),n=e,Object.defineProperty(e.prototype,"override",{get:function(){return!0},enumerable:!0,configurable:!0}),e=n=o.__decorate([r.Component({providers:[{provide:a.Messages,useExisting:r.forwardRef((function(){return n}))}],selector:"kendo-editor-messages",template:""}),o.__metadata("design:paramtypes",[i.LocalizationService])],e)}(a.Messages);e.CustomMessagesComponent=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=function(){function t(t,e){this.hostEl=t,this.zone=e,this.preventDefault=function(t){t.preventDefault()}}return Object.defineProperty(t.prototype,"hostElement",{get:function(){return this.hostEl.nativeElement},enumerable:!0,configurable:!0}),t.prototype.ngAfterViewInit=function(){var t=this;this.zone.runOutsideAngular((function(){t.hostElement.addEventListener("pointerdown",t.preventDefault)}))},t.prototype.ngOnDestroy=function(){this.hostElement.removeEventListener("pointerdown",this.preventDefault)},t=o.__decorate([r.Directive({selector:"[kendoEditorDropDownTool]"}),o.__metadata("design:paramtypes",[r.ElementRef,r.NgZone])],t)}();e.DropDownToolDirective=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(27),d=n(5),u=function(t){function e(e,n,o,r){var i=t.call(this,"print",e,n,o,r)||this;return i.editor=n,i}return o.__extends(e,t),e.prototype.ngAfterViewInit=function(){if(r.isDevMode&&!this.editor.iframe)throw new Error(c.EditorErrorMessages.printTool)},e.prototype.clickHandler=function(){if(this.editor.iframe){var t=this.editor.view,e=t&&t.dom,n=e&&e.ownerDocument,o=n&&n.defaultView;o&&o.print()}},e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorPrintButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,d.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorPrintDirective=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(4),a=n(3),s=n(6),l=n(2),c=n(5),d=function(t){function e(e,n,o,r){return t.call(this,"selectAll",e,n,o,r)||this}return o.__extends(e,t),e.prototype.clickHandler=function(){this.editor.shouldEmitFocus=!0,t.prototype.clickHandler.call(this)},e=o.__decorate([r.Directive({selector:"kendo-toolbar-button[kendoEditorSelectAllButton]"}),o.__param(1,r.Host()),o.__metadata("design:paramtypes",[i.ToolBarButtonComponent,a.EditorComponent,l.EditorLocalizationService,c.EditorToolsService])],e)}(s.EditorCommandButton);e.EditorSelectAllButtonDirective=d}])}));