slate 0.47.7 → 0.47.8

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.
package/dist/slate.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("immutable")):"function"==typeof define&&define.amd?define(["exports","immutable"],t):t(e.Slate={},e.Immutable)}(this,function(e,t){"use strict";var n=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function r(e){return!0===n(e)&&"[object Object]"===Object.prototype.toString.call(e)}var o=function(e){var t,n;return!1!==r(e)&&("function"==typeof(t=e.constructor)&&(!1!==r(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")))},a=function(e,t){0},i=void 0,s=void 0;function u(){i=0,s=function(){return""+i++}}u();var c={create:function(e){if(null==e)return s();if("string"==typeof e)return e;throw new Error("Keys must be strings, but you passed: "+e)},setGenerator:function(e){s=e},resetGenerator:u},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},d=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),v=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},y=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},p=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},m=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},k=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),g=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)};function b(e,t){for(var n=S(e,t),r=0;r<n;r++){var o=e.get(r),a=t.get(r);if(o<a)return-1;if(o>a)return 1}return e.size===t.size?0:null}function A(e){if(null==e)return null;if(t.List.isList(e))return e;if(Array.isArray(e))return t.List(e);throw new Error("Paths can only be created from arrays or lists, but you passed: "+e)}function x(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:S(e,t);return[e.slice(0,n),t.slice(0,n)]}function w(e){return O(e,0-(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1)}function O(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1,r=e.get(n)+t;return e.set(n,r)}function N(e,t){var n=x(e,t),r=k(n,2),o=r[0],a=r[1];return e.size<t.size&&0===b(o,a)}function T(e,t){return e.equals(t)}function _(e,t){var n=e.size-1,r=x(e,t,n),o=k(r,2),a=o[0],i=o[1],s=e.get(n),u=t.get(n);return T(a,i)&&s<u}function S(e,t){return Math.min(e.size,t.size)}var P={compare:b,create:A,crop:x,decrement:w,getAncestors:function(e){return t.List().withMutations(function(t){for(var n=0;n<e.size;n++)t.push(e.slice(0,n))})},increment:O,isAbove:N,isAfter:function(e,t){var n=x(e,t),r=k(n,2);return 1===b(r[0],r[1])},isBefore:function(e,t){var n=x(e,t),r=k(n,2);return-1===b(r[0],r[1])},isEqual:T,isOlder:function(e,t){var n=e.size-1,r=x(e,t,n),o=k(r,2),a=o[0],i=o[1],s=e.get(n),u=t.get(n);return T(a,i)&&s>u},isPath:function(e){return(t.List.isList(e)||Array.isArray(e))&&e.every(function(e){return"number"==typeof e})},isSibling:function(e,t){if(e.size!==t.size)return!1;var n=e.butLast(),r=t.butLast();return n.equals(r)},isYounger:_,lift:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.slice(0,-1*t)},drop:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.slice(t)},max:function(e,t){return Math.max(e.size,t.size)},min:S,relate:function(e,t){for(var n=[],r=0;r<e.size&&r<t.size;r++){var o=e.get(r);if(o!==t.get(r))break;n.push(o)}return A(n)},transform:function(e,n){var r=n.type,o=n.position,a=n.path;if("add_mark"===r||"insert_text"===r||"remove_mark"===r||"remove_text"===r||"set_mark"===r||"set_node"===r||"set_selection"===r||"set_value"===r||"add_annotation"===r||"remove_annotation"===r||"set_annotation"===r||0===e.size)return t.List([e]);var i=a.size-1,s=T(a,e),u=_(a,e),c=N(a,e);if("insert_node"===r&&(s||u||c)&&(e=O(e,1,i)),"remove_node"===r&&(u?e=w(e,1,i):(s||c)&&(e=[])),"merge_node"===r&&(s||u?e=w(e,1,i):c&&(e=O(e=w(e,1,i),o,i+1))),"split_node"===r&&(s?e=[e,O(e)]:u?e=O(e,1,i):c&&e.get(i+1)>=o&&(e=w(e=O(e,1,i),o,i+1))),"move_node"===r){var l=n.newPath;if(T(a,l))return t.List([e]);c||s?e=_(a,l)&&a.size<l.size?w(l,1,S(l,a)-1).concat(e.slice(a.size)):l.concat(e.slice(a.size)):(u&&(e=w(e,1,i)),(_(l,e)||T(l,e)||N(l,e))&&(e=O(e,1,l.size-1)))}var f=Array.isArray(e)?e:[e];return t.List(f)}},B={key:void 0,offset:void 0,path:void 0},F=function(e){function t(){return f(this,t),m(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return y(t,e),d(t,[{key:"isAfterPoint",value:function(e){return!this.isUnset&&(this.key===e.key&&this.offset>e.offset||1===P.compare(this.path,e.path))}},{key:"isAfterRange",value:function(e){return!this.isUnset&&this.isAfterPoint(e.end)}},{key:"isAtEndOfRange",value:function(e){return!this.isUnset&&this.equals(e.end)}},{key:"isAtStartOfRange",value:function(e){return!this.isUnset&&this.equals(e.start)}},{key:"isBeforePoint",value:function(e){return!this.isUnset&&(this.key===e.key&&this.offset<e.offset||-1===P.compare(this.path,e.path))}},{key:"isBeforeRange",value:function(e){return!this.isUnset&&this.isBeforePoint(e.start)}},{key:"isInRange",value:function(e){return!this.isUnset&&(this.equals(e.start)||this.equals(e.end)||this.isAfterPoint(e.start)&&this.isBeforePoint(e.end))}},{key:"isAtEndOfNode",value:function(e){if(this.isUnset)return!1;var t=e.getLastText();return this.key===t.key&&this.offset===t.text.length}},{key:"isAtStartOfNode",value:function(e){if(this.isUnset)return!1;if(0!==this.offset)return!1;var t=e.getFirstText();return this.key===t.key}},{key:"isInNode",value:function(e){return!this.isUnset&&("text"===e.object&&e.key===this.key||!!e.hasNode(this.key))}},{key:"moveBackward",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return 0===e?this:e<0?this.moveForward(-e):this.setOffset(this.offset-e)}},{key:"moveForward",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return 0===e?this:e<0?this.moveBackward(-e):this.setOffset(this.offset+e)}},{key:"moveTo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.key;return"number"==typeof e?(t=e,e=this.path):"string"==typeof e?e=(n=e)===this.key?this.path:null:n=e.equals(this.path)?this.key:null,this.merge({key:n,path:e,offset:t})}},{key:"moveToStartOfNode",value:function(e){var t=e.getFirstText();return this.moveTo(t.key,0)}},{key:"moveToEndOfNode",value:function(e){var t=e.getLastText();return this.moveTo(t.key,t.text.length)}},{key:"normalize",value:function(e){if(null==this.key&&null==this.path)return this.setOffset(null);var n=this.key,r=this.offset,o=this.path,i=o&&e.getNode(o);if(!i&&(i=e.getNode(n)))return this.merge({path:e.getPath(n)});if(!i){a();var s=e.getFirstText();return s?this.merge({key:s.key,offset:0,path:e.getPath(s.key)}):t.create()}if("text"!==i.object){a();var u=i.getTextAtOffset(r),c=i.getOffset(u.key);return this.merge({offset:r-c,key:u.key,path:e.getPath(u.key)})}i&&o&&n&&n!==i.key&&a();var l=this.merge({key:i.key,path:null==o?e.getPath(i.key):o,offset:null==r?0:Math.min(r,i.text.length)});if(l.offset===i.text.length){var f=e.getClosestBlock(l.path).getNextText();f&&(l=l.merge({key:f.key,path:e.getPath(f.key),offset:0}))}return l}},{key:"setKey",value:function(e){return null!=e&&(e=c.create(e)),this.set("key",e)}},{key:"setOffset",value:function(e){return this.set("offset",e)}},{key:"setPath",value:function(e){return null!=e&&(e=P.create(e)),this.set("path",e)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,key:this.key,offset:this.offset,path:this.path&&this.path.toArray()};return e.preserveKeys||delete t.key,t}},{key:"unset",value:function(){return this.merge({key:null,offset:null,path:null})}},{key:"isSet",get:function(){return null!=this.key&&null!=this.offset&&null!=this.path}},{key:"isUnset",get:function(){return!this.isSet}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isPoint(e))return e;if(o(e))return t.fromJSON(e);throw new Error("`Point.create` only accepts objects or points, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isPoint(e))return{key:e.key,offset:e.offset,path:e.path};if(o(e)){var n={};return"key"in e&&(n.key=e.key),"offset"in e&&(n.offset=e.offset),"path"in e&&(n.path=P.create(e.path)),"path"in e&&!("key"in e)&&(n.key=null),"key"in e&&!("path"in e)&&(n.path=null),n}throw new Error("`Point.createProperties` only accepts objects or points, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.key,r=void 0===n?null:n,o=e.offset,a=void 0===o?null:o,i=e.path,s=void 0===i?null:i;return new t({key:r,offset:a,path:P.create(s)})}}]),t}(t.Record(B)),E=function(){function e(){f(this,e)}return d(e,null,[{key:"create",value:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.Map.isMap(n))return n;if(o(n))return e.fromJSON(n);throw new Error("`Data.create` only accepts objects or maps, but you passed it: "+n)}},{key:"fromJSON",value:function(e){return new t.Map(e)}}]),e}();E.fromJS=E.fromJSON;var j={data:void 0,type:void 0},C=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"toJSON",value:function(){return{object:this.object,type:this.type,data:this.data.toJSON()}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isMark(e))return e;if("string"==typeof e&&(e={type:e}),o(e))return n.fromJSON(e);throw new Error("`Mark.create` only accepts objects, strings or marks, but you passed it: "+e)}},{key:"createSet",value:function(e){if(t.Set.isSet(e)||Array.isArray(e))return new t.Set(e.map(n.create));if(null==e)return t.Set();throw new Error("`Mark.createSet` only accepts sets, arrays or null, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isMark(e))return{data:e.data,type:e.type};if("string"==typeof e)return{type:e};if(o(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=E.create(e.data)),t}throw new Error("`Mark.createProperties` only accepts objects, strings or marks, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.data,o=void 0===r?{}:r,a=e.type;if("string"!=typeof a)throw new Error("`Mark.fromJS` requires a `type` string.");return new n({type:a,data:new t.Map(o)})}},{key:"isMarkSet",value:function(e){return t.Set.isSet(e)&&e.every(function(e){return n.isMark(e)})}}]),n}(t.Record(j)),R={type:void 0,data:void 0,anchor:void 0,focus:void 0},L=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"setProperties",value:function(e){return e=n.createProperties(e),this.merge(e)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,type:this.type,data:this.data.toJSON(),anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isDecoration(e))return e;if(K.isRange(e))return n.fromJSON(K.createProperties(e));if(o(e))return n.fromJSON(e);throw new Error("`Decoration.create` only accepts objects or decorations, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Decoration.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isDecoration(e))return{type:e.type,data:e.data,anchor:F.createProperties(e.anchor),focus:F.createProperties(e.focus),mark:C.create(e.mark)};if(o(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=E.create(e.data)),"anchor"in e&&(t.anchor=F.create(e.anchor)),"focus"in e&&(t.focus=F.create(e.focus)),t}throw new Error("`Decoration.createProperties` only accepts objects or decorations, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.anchor,r=e.focus,o=e.type,i=e.data;if(e.mark&&!o&&(a(),o=e.mark.type,i=e.mark.data),!o)throw new Error("Decorations must be created with a `type`, but you passed: "+JSON.stringify(e));return new n({type:o,data:E.create(i||{}),anchor:F.fromJSON(t||{}),focus:F.fromJSON(r||{})})}}]),n}(t.Record(R)),D={anchor:void 0,focus:void 0,isFocused:void 0,marks:void 0},z=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"setIsFocused",value:function(e){return this.set("isFocused",e)}},{key:"setMarks",value:function(e){return this.set("marks",e)}},{key:"setProperties",value:function(e){var t=e=n.createProperties(e),r=t.anchor,o=t.focus,a=p(t,["anchor","focus"]);return r&&(a.anchor=F.create(r)),o&&(a.focus=F.create(o)),this.merge(a)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e),isFocused:this.isFocused,marks:null==this.marks?null:this.marks.toArray().map(function(e){return e.toJSON()})}}},{key:"isBlurred",get:function(){return!this.isFocused}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isSelection(e))return e;if(K.isRange(e))return n.fromJSON(K.createProperties(e));if(o(e))return n.fromJSON(e);throw new Error("`Selection.create` only accepts objects, ranges or selections, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isSelection(e))return{anchor:F.createProperties(e.anchor),focus:F.createProperties(e.focus),isFocused:e.isFocused,marks:e.marks};if(K.isRange(e))return{anchor:F.createProperties(e.anchor),focus:F.createProperties(e.focus)};if(o(e)){var t={};return"anchor"in e&&(t.anchor=F.create(e.anchor)),"focus"in e&&(t.focus=F.create(e.focus)),"isFocused"in e&&(t.isFocused=e.isFocused),"marks"in e&&(t.marks=null==e.marks?null:C.createSet(e.marks)),t}throw new Error("`Selection.createProperties` only accepts objects, ranges or selections, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.anchor,o=e.focus,a=e.isFocused,i=void 0!==a&&a,s=e.marks,u=void 0===s?null:s;return new n({anchor:F.fromJSON(r||{}),focus:F.fromJSON(o||{}),isFocused:i,marks:null==u?null:new t.Set(u.map(C.fromJSON))})}}]),n}(t.Record(D)),M={annotation:"@@__SLATE_ANNOTATION__@@",block:"@@__SLATE_BLOCK__@@",change:"@@__SLATE_CHANGE__@@",decoration:"@@__SLATE_DECORATION__@@",document:"@@__SLATE_DOCUMENT__@@",editor:"@@__SLATE_EDITOR__@@",inline:"@@__SLATE_INLINE__@@",leaf:"@@__SLATE_LEAF__@@",mark:"@@__SLATE_MARK__@@",operation:"@@__SLATE_OPERATION__@@",point:"@@__SLATE_POINT__@@",range:"@@__SLATE_RANGE__@@",selection:"@@__SLATE_SELECTION__@@",text:"@@__SLATE_TEXT__@@",value:"@@__SLATE_VALUE__@@"};function I(e,t){return!(!t||!t[M[e]])}var J={anchor:void 0,focus:void 0},K=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isRange(e))return"range"===e.object?e:n.fromJSON(n.createProperties(e));if(o(e))return n.fromJSON(e);throw new Error("`Range.create` only accepts objects or ranges, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Range.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isRange(e))return{anchor:F.createProperties(e.anchor),focus:F.createProperties(e.focus)};if(o(e)){var t={};return"anchor"in e&&(t.anchor=F.create(e.anchor)),"focus"in e&&(t.focus=F.create(e.focus)),t}throw new Error("`Range.createProperties` only accepts objects, annotations, decorations, ranges or selections, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.anchor,r=e.focus;return new n({anchor:F.fromJSON(t||{}),focus:F.fromJSON(r||{})})}},{key:"isRange",value:function(e){return I("range",e)||L.isDecoration(e)||z.isSelection(e)}}]),n}(t.Record(J)),U={key:void 0,type:void 0,data:void 0,anchor:void 0,focus:void 0},q=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"setProperties",value:function(e){return e=n.createProperties(e),this.merge(e)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,key:this.key,type:this.type,data:this.data.toJSON(),anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isAnnotation(e))return e;if(K.isRange(e))return n.fromJSON(K.createProperties(e));if(o(e))return n.fromJSON(e);throw new Error("`Annotation.create` only accepts objects or annotations, but you passed it: "+e)}},{key:"createMap",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.Map.isMap(e))return e;if(o(e)){var r={};for(var a in e){var i=e[a],s=n.create(i);r[a]=s}return t.Map(r)}throw new Error("`Annotation.createMap` only accepts arrays or lists, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isAnnotation(e))return{key:e.key,type:e.type,data:e.data,anchor:F.createProperties(e.anchor),focus:F.createProperties(e.focus)};if(o(e)){var t={};return"key"in e&&(t.key=e.key),"type"in e&&(t.type=e.type),"data"in e&&(t.data=E.create(e.data)),"anchor"in e&&(t.anchor=F.create(e.anchor)),"focus"in e&&(t.focus=F.create(e.focus)),t}throw new Error("`Annotation.createProperties` only accepts objects or annotations, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.key,r=e.type,o=e.data,a=e.anchor,i=e.focus;if(!t)throw new Error("Annotations must be created with a `key`, but you passed: "+JSON.stringify(e));if(!r)throw new Error("Annotations must be created with a `type`, but you passed: "+JSON.stringify(e));return new n({key:t,type:r,data:E.create(o||{}),anchor:F.fromJSON(a||{}),focus:F.fromJSON(i||{})})}}]),n}(t.Record(U)),V={data:void 0,key:void 0,nodes:void 0},W=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isDocument(e))return e;if((t.List.isList(e)||Array.isArray(e))&&(e={nodes:e}),o(e))return n.fromJSON(e);throw new Error("`Document.create` only accepts objects, arrays, lists or documents, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(n.isDocument(e))return e;var r=e.data,o=void 0===r?{}:r,a=e.key,i=void 0===a?c.create():a,s=e.nodes,u=void 0===s?[]:s;return new n({key:i,data:new t.Map(o),nodes:X.createList(u)})}}]),n}(t.Record(V)),$={data:void 0,key:void 0,nodes:void 0,type:void 0},G=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isInline(e))return e;if("string"==typeof e&&(e={type:e}),o(e))return n.fromJSON(e);throw new Error("`Inline.create` only accepts objects, strings or inlines, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Inline.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(n.isInline(e))return e;var r=e.data,o=void 0===r?{}:r,a=e.key,i=void 0===a?c.create():a,s=e.nodes,u=void 0===s?[]:s,l=e.type;if("string"!=typeof l)throw new Error("`Inline.fromJS` requires a `type` string.");return new n({key:i,type:l,data:new t.Map(o),nodes:X.createList(u)})}},{key:"isInlineList",value:function(e){return t.List.isList(e)&&e.every(function(e){return n.isInline(e)})}}]),n}(t.Record($)),Q=function(e,t){if(!e)throw new Error("Invariant failed")},Z={key:void 0,marks:void 0,text:void 0},Y=t.Record({text:void 0,marks:void 0,annotations:void 0,decorations:void 0}),H=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"addMark",value:function(e){e=C.create(e);var t=this.marks.add(e);return this.set("marks",t)}},{key:"addMarks",value:function(e){return e=C.createSet(e),this.set("marks",this.marks.union(e))}},{key:"getLeaves",value:function(e,n){var r=[{text:this.text,marks:this.marks,annotations:[],decorations:[]}],o=function(e,t){return[{text:e.text.slice(0,t),marks:e.marks,annotations:[].concat(g(e.annotations)),decorations:[].concat(g(e.decorations))},{text:e.text.slice(t),marks:e.marks,annotations:[].concat(g(e.annotations)),decorations:[].concat(g(e.decorations))}]},a=function(t){var a="annotations"===t?e.values():n,i=!0,s=!1,u=void 0;try{for(var c,l=a[Symbol.iterator]();!(i=(c=l.next()).done);i=!0){var f=c.value,d=f.start,v=f.end,h=[],y=0,p=!0,m=!1,g=void 0;try{for(var b,A=r[Symbol.iterator]();!(p=(b=A.next()).done);p=!0){var x=b.value,w=x.text.length,O=y;if(y+=w,d.offset<=O&&v.offset>=O+w)x[t].push(f),h.push(x);else if(d.offset>O+w||v.offset<O||v.offset===O&&0!==O)h.push(x);else{var N=x,T=void 0,_=void 0;if(v.offset<O+w){var S=o(N,v.offset-O),P=k(S,2);N=P[0],_=P[1]}if(d.offset>O){var B=o(N,d.offset-O),F=k(B,2);T=F[0],N=F[1]}N[t].push(f),T&&h.push(T),h.push(N),_&&h.push(_)}}}catch(e){m=!0,g=e}finally{try{!p&&A.return&&A.return()}finally{if(m)throw g}}r=h}}catch(e){s=!0,u=e}finally{try{!i&&l.return&&l.return()}finally{if(s)throw u}}};return a("annotations"),a("decorations"),r=r.map(function(e){return new Y(h({},e,{annotations:t.List(e.annotations),decorations:t.List(e.decorations)}))}),t.List(r)}},{key:"insertText",value:function(e,t){var n=this.text,r=n.slice(0,e)+t+n.slice(e);return this.set("text",r)}},{key:"removeMark",value:function(e){e=C.create(e);var t=this.marks.remove(e);return this.set("marks",t)}},{key:"removeText",value:function(e,t){var n=this.text,r=n.slice(0,e)+n.slice(e+t);return this.set("text",r)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,text:this.text,marks:this.marks.toArray().map(function(e){return e.toJSON()})};return e.preserveKeys&&(t.key=this.key),t}},{key:"setMark",value:function(e,t){var n=this.marks,r=C.create(e),o=r.merge(t),a=n.remove(r).add(o);return this.set("marks",a)}},{key:"splitText",value:function(e){var t=this.text;return[this.set("text",t.slice(0,e)),this.set("text",t.slice(e)).regenerateKey()]}},{key:"mergeText",value:function(e){var t=this.text+e.text;return this.set("text",t)}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(n.isText(e))return e;if("string"==typeof e&&(e={text:e}),o(e))return n.fromJSON(e);throw new Error("`Text.create` only accepts objects, arrays, strings or texts, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Text.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(n.isText(e))return e;Q(null==e.leaves);var t=e.text,r=void 0===t?"":t,o=e.marks,a=void 0===o?[]:o,i=e.key;return new n({key:void 0===i?c.create():i,text:r,marks:C.createSet(a)})}},{key:"isTextList",value:function(e){return t.List.isList(e)&&e.every(function(e){return n.isText(e)})}}]),n}(t.Record(Z)),X=function(){function e(){f(this,e)}return d(e,null,[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.isNode(t))return t;if(o(t)){var n=t.object;switch(!n&&t.kind&&(a(),n=t.kind),n){case"block":return te.create(t);case"document":return W.create(t);case"inline":return G.create(t);case"text":return H.create(t);default:throw new Error("`Node.create` requires a `object` string.")}}throw new Error("`Node.create` only accepts objects or nodes but you passed it: "+t)}},{key:"createList",value:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(n)||Array.isArray(n)){var r=[];return n.forEach(function(t){if(t&&"text"===t.object&&t.leaves&&Array.isArray(t.leaves)){a();var n=H.createList(t.leaves).toArray();r=r.concat(n)}else{var o=e.create(t);r.push(o)}}),t.List(r)}throw new Error("`Node.createList` only accepts lists or arrays, but you passed it: "+n)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(te.isBlock(e)||G.isInline(e))return{data:e.data,type:e.type};if("string"==typeof e)return{type:e};if(o(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=E.create(e.data)),t}throw new Error("`Node.createProperties` only accepts objects, strings, blocks or inlines, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.object;switch(!t&&e.kind&&(a(),t=e.kind),t){case"block":return te.fromJSON(e);case"document":return W.fromJSON(e);case"inline":return G.fromJSON(e);case"text":return H.fromJSON(e);default:throw new Error("`Node.fromJSON` requires an `object` of either 'block', 'document', 'inline' or 'text', but you passed: "+e)}}},{key:"isNode",value:function(e){return te.isBlock(e)||W.isDocument(e)||G.isInline(e)||H.isText(e)}},{key:"isNodeList",value:function(n){return t.List.isList(n)&&n.every(function(t){return e.isNode(t)})}}]),e}(),ee={data:void 0,key:void 0,nodes:void 0,type:void 0},te=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isBlock(e))return e;if("string"==typeof e&&(e={type:e}),o(e))return n.fromJSON(e);throw new Error("`Block.create` only accepts objects, strings or blocks, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Block.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(n.isBlock(e))return e;var r=e.data,o=void 0===r?{}:r,a=e.key,i=void 0===a?c.create():a,s=e.nodes,u=void 0===s?[]:s,l=e.type;if("string"!=typeof l)throw new Error("`Block.fromJSON` requires a `type` string.");return new n({key:i,type:l,data:t.Map(o),nodes:X.createList(u)})}},{key:"isBlockList",value:function(e){return t.List.isList(e)&&e.every(function(e){return n.isBlock(e)})}}]),n}(t.Record(ee)),ne={annotations:void 0,data:void 0,document:void 0,selection:void 0},re=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"addAnnotation",value:function(e){e=q.create(e);var t=this,n=t,r=n.annotations,o=n.document,a=e.key;return e=e.updatePoints(function(e){return e.normalize(o)}),r=r.set(a,e),t=t.set("annotations",r)}},{key:"addMark",value:function(e,t){t=C.create(t);var n=this,r=n.document;return r=r.addMark(e,t),n=n.set("document",r)}},{key:"insertNode",value:function(e,t){var n=this,r=n.document;return r=r.insertNode(e,t),n=(n=n.set("document",r)).mapRanges(function(e){return e.updatePoints(function(e){return e.setPath(null)})})}},{key:"insertText",value:function(e,t,n){var r=this,o=r.document,a=o.assertNode(e);return o=o.insertText(e,t,n),a=o.assertNode(e),r=(r=r.set("document",o)).mapPoints(function(e){return e.key===a.key&&e.offset>=t?e.setOffset(e.offset+n.length):e})}},{key:"mergeNode",value:function(e){var t=this,n=t.document,r=n.mergeNode(e);e=n.resolvePath(e);var o=P.decrement(e),a=n.getNode(o),i=n.getNode(e);return t=(t=t.set("document",r)).mapRanges(function(e){if("text"===i.object){var t=a.text.length;e.anchor.key===i.key&&(e=e.moveAnchorTo(a.key,t+e.anchor.offset)),e.focus.key===i.key&&(e=e.moveFocusTo(a.key,t+e.focus.offset))}return e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"moveNode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this,o=r.document;return P.isEqual(e,t)?r:(o=o.moveNode(e,t,n),r=(r=r.set("document",o)).mapPoints(function(e){return e.setPath(null)}))}},{key:"removeAnnotation",value:function(e){e=q.create(e);var t=this,n=t.annotations,r=e.key;return n=n.delete(r),t=t.set("annotations",n)}},{key:"removeMark",value:function(e,t){t=C.create(t);var n=this,r=n.document;return r=r.removeMark(e,t),n=n.set("document",r)}},{key:"removeNode",value:function(e){var t=this,n=t.document,r=n.assertNode(e),o="text"===r.object?r:r.getFirstText()||r,a="text"===r.object?r:r.getLastText()||r,i=n.getPreviousText(o.key),s=n.getNextText(a.key);return n=n.removeNode(e),t=(t=t.set("document",n)).mapRanges(function(e){var t=e,n=t.anchor,o=t.focus;return r.hasNode(n.key)&&(e=i?e.moveAnchorTo(i.key,i.text.length):s?e.moveAnchorTo(s.key,0):e.unset()),r.hasNode(o.key)&&(e=i?e.moveFocusTo(i.key,i.text.length):s?e.moveFocusTo(s.key,0):e.unset()),e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"removeText",value:function(e,t,n){var r=this,o=r.document,a=o.assertNode(e);o=o.removeText(e,t,n),r=r.set("document",o);var i=n.length,s=t,u=t+i;return r=r.mapPoints(function(e){return e.key!==a.key?e:e.offset>=u?e.setOffset(e.offset-i):e.offset>s?e.setOffset(s):e})}},{key:"setAnnotation",value:function(e,t){t=q.createProperties(t);var n=q.create(e),r=n.merge(t),o=this,a=o.annotations,i=n.key;return a=a.set(i,r),o=o.set("annotations",a)}},{key:"setNode",value:function(e,t){var n=this,r=n.document;return r=r.setNode(e,t),n=n.set("document",r)}},{key:"setMark",value:function(e,t,n){var r=this,o=r.document;return o=o.setMark(e,t,n),r=r.set("document",o)}},{key:"setProperties",value:function(e){var t=this,n=t.document,r=e.data,o=e.annotations,a={};return r&&(a.data=r),o&&(a.annotations=o.map(function(e){return e.isSet?e:n.resolveAnnotation(e)})),t=t.merge(a)}},{key:"setSelection",value:function(e){var t=this,n=t,r=n.document,o=n.selection,a=o.setProperties(e);return o=r.resolveSelection(a),t=t.set("selection",o)}},{key:"splitNode",value:function(e,t,n){var r=this,o=r.document,a=o.splitNode(e,t,n),i=o.assertNode(e);return r=(r=r.set("document",a)).mapRanges(function(e){var n=a.getNextText(i.key),r=e,o=r.anchor,s=r.focus;return i.key===o.key&&t<=o.offset&&(e=e.moveAnchorTo(n.key,o.offset-t)),i.key===s.key&&t<=s.offset&&(e=e.moveFocusTo(n.key,s.offset-t)),e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"mapRanges",value:function(e){var t=this,n=t,r=n.document,o=n.selection,a=n.annotations,i=o.isSet?e(o):o;i||(i=o.unset()),i!==o&&(i=r.createSelection(i)),t=t.set("selection",i);var s=a.map(function(t){var n=t.isSet?e(t):t;return n&&n!==t&&(n=r.createAnnotation(n)),n});return s=s.filter(function(e){return!!e}),t=t.set("annotations",s)}},{key:"mapPoints",value:function(e){return this.mapRanges(function(t){return t.updatePoints(e)})}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,document:this.document.toJSON(e)};return e.preserveData&&(t.data=this.data.toJSON(e)),e.preserveAnnotations&&(t.annotations=this.annotations.map(function(t){return t.toJSON(e)}).toObject()),e.preserveSelection&&(t.selection=this.selection.toJSON(e)),t}},{key:"change",value:function(){Q(!1)}},{key:"startBlock",get:function(){return this.selection.start.key&&this.document.getClosestBlock(this.selection.start.key)}},{key:"endBlock",get:function(){return this.selection.end.key&&this.document.getClosestBlock(this.selection.end.key)}},{key:"anchorBlock",get:function(){return this.selection.anchor.key&&this.document.getClosestBlock(this.selection.anchor.key)}},{key:"focusBlock",get:function(){return this.selection.focus.key&&this.document.getClosestBlock(this.selection.focus.key)}},{key:"startInline",get:function(){return this.selection.start.key&&this.document.getClosestInline(this.selection.start.key)}},{key:"endInline",get:function(){return this.selection.end.key&&this.document.getClosestInline(this.selection.end.key)}},{key:"anchorInline",get:function(){return this.selection.anchor.key&&this.document.getClosestInline(this.selection.anchor.key)}},{key:"focusInline",get:function(){return this.selection.focus.key&&this.document.getClosestInline(this.selection.focus.key)}},{key:"startText",get:function(){return this.selection.start.key&&this.document.getDescendant(this.selection.start.key)}},{key:"endText",get:function(){return this.selection.end.key&&this.document.getDescendant(this.selection.end.key)}},{key:"anchorText",get:function(){return this.selection.anchor.key&&this.document.getDescendant(this.selection.anchor.key)}},{key:"focusText",get:function(){return this.selection.focus.key&&this.document.getDescendant(this.selection.focus.key)}},{key:"nextBlock",get:function(){return this.selection.end.key&&this.document.getNextBlock(this.selection.end.key)}},{key:"previousBlock",get:function(){return this.selection.start.key&&this.document.getPreviousBlock(this.selection.start.key)}},{key:"nextInline",get:function(){return this.selection.end.key&&this.document.getNextInline(this.selection.end.key)}},{key:"previousInline",get:function(){return this.selection.start.key&&this.document.getPreviousInline(this.selection.start.key)}},{key:"nextText",get:function(){return this.selection.end.key&&this.document.getNextText(this.selection.end.key)}},{key:"previousText",get:function(){return this.selection.start.key&&this.document.getPreviousText(this.selection.start.key)}},{key:"marks",get:function(){return this.selection.isUnset?new t.Set:this.selection.marks||this.document.getMarksAtRange(this.selection)}},{key:"activeMarks",get:function(){return this.selection.isUnset?new t.Set:this.selection.marks||this.document.getActiveMarksAtRange(this.selection)}},{key:"blocks",get:function(){return this.selection.isUnset?new t.List:this.document.getLeafBlocksAtRange(this.selection)}},{key:"fragment",get:function(){return this.selection.isUnset?W.create():this.document.getFragmentAtRange(this.selection)}},{key:"inlines",get:function(){return this.selection.isUnset?new t.List:this.document.getLeafInlinesAtRange(this.selection)}},{key:"texts",get:function(){return this.selection.isUnset?new t.List:this.document.getTextsAtRange(this.selection)}},{key:"history",get:function(){Q(!1)}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n.isValue(e))return e;if(o(e))return n.fromJSON(e,t);throw new Error("`Value.create` only accepts objects or values, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isValue(e))return{annotations:e.annotations,data:e.data};if(o(e)){var t={};return"annotations"in e&&(t.annotations=q.createMap(e.annotations)),"data"in e&&(t.data=E.create(e.data)),t}throw new Error("`Value.createProperties` only accepts objects or values, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.data,r=void 0===t?{}:t,o=e.annotations,a=void 0===o?{}:o,i=e.document,s=void 0===i?{}:i,u=e.selection,c=void 0===u?{}:u;if(r=E.fromJSON(r),c=(s=W.fromJSON(s)).createSelection(c),a=q.createMap(a),c.isUnset){var l=s.getFirstText();l&&(c=c.moveToStartOfNode(l)),c=s.createSelection(c)}return new n({annotations:a,data:r,document:s,selection:c})}}]),n}(t.Record(ne)),oe="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function ae(){throw new Error("setTimeout has not been defined")}function ie(){throw new Error("clearTimeout has not been defined")}var se=ae,ue=ie;function ce(e){if(se===setTimeout)return setTimeout(e,0);if((se===ae||!se)&&setTimeout)return se=setTimeout,setTimeout(e,0);try{return se(e,0)}catch(t){try{return se.call(null,e,0)}catch(t){return se.call(this,e,0)}}}"function"==typeof oe.setTimeout&&(se=setTimeout),"function"==typeof oe.clearTimeout&&(ue=clearTimeout);var le,fe=[],de=!1,ve=-1;function he(){de&&le&&(de=!1,le.length?fe=le.concat(fe):ve=-1,fe.length&&ye())}function ye(){if(!de){var e=ce(he);de=!0;for(var t=fe.length;t;){for(le=fe,fe=[];++ve<t;)le&&le[ve].run();ve=-1,t=fe.length}le=null,de=!1,function(e){if(ue===clearTimeout)return clearTimeout(e);if((ue===ie||!ue)&&clearTimeout)return ue=clearTimeout,clearTimeout(e);try{ue(e)}catch(t){try{return ue.call(null,e)}catch(t){return ue.call(this,e)}}}(e)}}function pe(e,t){this.fun=e,this.array=t}pe.prototype.run=function(){this.fun.apply(null,this.array)};function me(){}var ke=me,ge=me,be=me,Ae=me,xe=me,we=me,Oe=me;var Ne=oe.performance||{},Te=Ne.now||Ne.mozNow||Ne.msNow||Ne.oNow||Ne.webkitNow||function(){return(new Date).getTime()};var _e=new Date;var Se={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];fe.push(new pe(e,t)),1!==fe.length||de||ce(ye)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ke,addListener:ge,once:be,off:Ae,removeListener:xe,removeAllListeners:we,emit:Oe,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Te.call(Ne),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-_e)/1e3}},Pe="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Be(e,t){return e(t={exports:{}},t.exports),t.exports}var Fe=1e3,Ee=60*Fe,je=60*Ee,Ce=24*je,Re=365.25*Ce,Le=function(e,t){t=t||{};var n,r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Re;case"days":case"day":case"d":return n*Ce;case"hours":case"hour":case"hrs":case"hr":case"h":return n*je;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ee;case"seconds":case"second":case"secs":case"sec":case"s":return n*Fe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===r&&!1===isNaN(e))return t.long?De(n=e,Ce,"day")||De(n,je,"hour")||De(n,Ee,"minute")||De(n,Fe,"second")||n+" ms":function(e){if(e>=Ce)return Math.round(e/Ce)+"d";if(e>=je)return Math.round(e/je)+"h";if(e>=Ee)return Math.round(e/Ee)+"m";if(e>=Fe)return Math.round(e/Fe)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function De(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var ze=Be(function(e,t){function n(e){var n;function o(){if(o.enabled){var e=o,r=+new Date,a=r-(n||r);e.diff=a,e.prev=n,e.curr=r,n=r;for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];i[0]=t.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var u=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;u++;var o=t.formatters[r];if("function"==typeof o){var a=i[u];n=o.call(e,a),i.splice(u,1),u--}return n}),t.formatArgs.call(e,i),(o.log||t.log||console.log.bind(console)).apply(e,i)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),o.destroy=r,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var a=t.instances[n];a.enabled=t.enabled(a.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=Le,t.instances=[],t.names=[],t.skips=[],t.formatters={}}),Me=(ze.coerce,ze.disable,ze.enable,ze.enabled,ze.humanize,ze.instances,ze.names,ze.skips,ze.formatters,Be(function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==Se&&"env"in Se&&(e=Se.env.DEBUG),e}(t=e.exports=ze).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,a=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&"%c"===e&&(a=++o)}),e.splice(a,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())})),Ie=(Me.log,Me.formatArgs,Me.save,Me.load,Me.useColors,Me.storage,Me.colors,Me("slate:operation:apply"));function Je(e,t){var n=(t=We.create(t)).type;switch(Ie(n,t),n){case"add_annotation":var r=t.annotation;return e.addAnnotation(r);case"add_mark":var o=t,a=o.path,i=o.mark;return e.addMark(a,i);case"insert_node":var s=t,u=s.path,c=s.node;return e.insertNode(u,c);case"insert_text":var l=t,f=l.path,d=l.offset,v=l.text,h=l.marks;return e.insertText(f,d,v,h);case"merge_node":var y=t.path;return e.mergeNode(y);case"move_node":var p=t,m=p.path,k=p.newPath;return e.moveNode(m,k);case"remove_annotation":var g=t.annotation;return e.removeAnnotation(g);case"remove_mark":var b=t,A=b.path,x=b.mark;return e.removeMark(A,x);case"remove_node":var w=t.path;return e.removeNode(w);case"remove_text":var O=t,N=O.path,T=O.offset,_=O.text;return e.removeText(N,T,_);case"set_annotation":var S=t,P=S.properties,B=S.newProperties;return e.setAnnotation(P,B);case"set_mark":var F=t,E=F.path,j=F.properties,C=F.newProperties;return e.setMark(E,j,C);case"set_node":var R=t,L=R.path,D=R.newProperties;return e.setNode(L,D);case"set_selection":var z=t.newProperties;return e.setSelection(z);case"set_value":var M=t.newProperties;return e.setProperties(M);case"split_node":var I=t,J=I.path,K=I.position,U=I.properties;return e.splitNode(J,K,U);default:throw new Error('Unknown operation type: "'+n+'".')}}var Ke=Me("slate:operation:invert");function Ue(e){var t=(e=We.create(e)).type;switch(Ke(t,e),t){case"move_node":var n=e,r=n.newPath,o=n.path;if(P.isEqual(r,o))return e;var a=P.transform(o,e).first(),i=P.transform(P.increment(o),e).first();return e.set("path",a).set("newPath",i);case"merge_node":var s=e.path,u=P.decrement(s);return e.set("type","split_node").set("path",u);case"split_node":var c=e.path,l=P.increment(c);return e.set("type","merge_node").set("path",l);case"set_annotation":case"set_node":case"set_value":case"set_selection":case"set_mark":var f=e,d=f.properties,v=f.newProperties;return e.set("properties",v).set("newProperties",d);case"insert_node":case"insert_text":return e.set("type",t.replace("insert_","remove_"));case"remove_node":case"remove_text":return e.set("type",t.replace("remove_","insert_"));case"add_annotation":case"add_mark":return e.set("type",t.replace("add_","remove_"));case"remove_annotation":case"remove_mark":return e.set("type",t.replace("remove_","add_"));default:throw new Error('Unknown operation type: "'+t+'".')}}var qe={add_mark:["path","mark","data"],add_annotation:["annotation","data"],insert_node:["path","node","data"],insert_text:["path","offset","text","data"],merge_node:["path","position","properties","target","data"],move_node:["path","newPath","data"],remove_annotation:["annotation","data"],remove_mark:["path","mark","data"],remove_node:["path","node","data"],remove_text:["path","offset","text","data"],set_annotation:["properties","newProperties","data"],set_mark:["path","properties","newProperties","data"],set_node:["path","properties","newProperties","data"],set_selection:["properties","newProperties","data"],set_value:["properties","newProperties","data"],split_node:["path","position","properties","target","data"]},Ve={annotation:void 0,data:void 0,length:void 0,mark:void 0,marks:void 0,newPath:void 0,newProperties:void 0,node:void 0,offset:void 0,path:void 0,position:void 0,properties:void 0,target:void 0,text:void 0,type:void 0},We=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"apply",value:function(e){return Je(e,this)}},{key:"invert",value:function(){return Ue(this)}},{key:"toJSON",value:function(){var e=this.object,t=this.type,n={object:e,type:t},r=qe[t],o=!0,a=!1,i=void 0;try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value,l=this[c];if("annotation"!==c&&"mark"!==c&&"marks"!==c&&"node"!==c&&"path"!==c&&"newPath"!==c||(l=l.toJSON()),"properties"===c&&"merge_node"===t){var f={};"data"in l&&(f.data=l.data.toJS()),"type"in l&&(f.type=l.type),l=f}if(("properties"===c||"newProperties"===c)&&"set_annotation"===t){var d={};"anchor"in l&&(d.anchor=l.anchor.toJS()),"focus"in l&&(d.focus=l.focus.toJS()),"key"in l&&(d.key=l.key),"mark"in l&&(d.mark=l.mark.toJS()),l=d}if(("properties"===c||"newProperties"===c)&&"set_mark"===t){var v={};"data"in l&&(v.data=l.data.toJS()),"type"in l&&(v.type=l.type),l=v}if(("properties"===c||"newProperties"===c)&&"set_node"===t){var h={};"data"in l&&(h.data=l.data.toJS()),"type"in l&&(h.type=l.type),l=h}if(("properties"===c||"newProperties"===c)&&"set_selection"===t){var y={};"anchor"in l&&(y.anchor=l.anchor.toJSON()),"focus"in l&&(y.focus=l.focus.toJSON()),"isFocused"in l&&(y.isFocused=l.isFocused),"marks"in l&&(y.marks=l.marks&&l.marks.toJSON()),l=y}if(("properties"===c||"newProperties"===c)&&"set_value"===t){var p={};"data"in l&&(p.data=l.data.toJS()),l=p}if("properties"===c&&"split_node"===t){var m={};"data"in l&&(m.data=l.data.toJS()),"type"in l&&(m.type=l.type),l=m}"data"===c&&(l=l.toJSON()),n[c]=l}}catch(e){a=!0,i=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw i}}return n}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isOperation(e))return e;if(o(e))return n.fromJSON(e);throw new Error("`Operation.create` only accepts objects or operations, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Operation.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(n.isOperation(e))return e;var r=e.type,o=qe[r],a={type:r};if(!o)throw new Error('`Operation.fromJSON` was passed an unrecognized operation type: "'+r+'"');var i=!0,s=!1,u=void 0;try{for(var c,l=o[Symbol.iterator]();!(i=(c=l.next()).done);i=!0){var f=c.value,d=e[f];if("data"===f&&void 0===d&&(d={}),void 0===d)throw new Error('`Operation.fromJSON` was passed a "'+r+'" operation without the required "'+f+'" attribute.');"annotation"===f&&(d=q.create(d)),"path"!==f&&"newPath"!==f||(d=P.create(d)),"mark"===f&&(d=C.create(d)),"node"===f&&(d=X.create(d)),"properties"!==f&&"newProperties"!==f||"set_annotation"!==r||(d=q.createProperties(d)),"properties"!==f&&"newProperties"!==f||"set_mark"!==r||(d=C.createProperties(d)),"properties"!==f&&"newProperties"!==f||"set_node"!==r&&"merge_node"!==r&&"split_node"!==r||(d=X.createProperties(d)),"properties"!==f&&"newProperties"!==f||"set_selection"!==r||(d=z.createProperties(d)),"properties"!==f&&"newProperties"!==f||"set_value"!==r||(d=re.createProperties(d)),"data"===f&&(d=t.Map(d)),a[f]=d}}catch(e){s=!0,u=e}finally{try{!i&&l.return&&l.return()}finally{if(s)throw u}}return new n(a)}},{key:"isOperationList",value:function(e){return t.List.isList(e)&&e.every(function(e){return n.isOperation(e)})}}]),n}(t.Record(Ve)),$e={operations:void 0,value:void 0},Ge=function(e){function t(){return f(this,t),m(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return y(t,e),d(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,value:this.value.toJSON(e),operations:this.operations.toArray().map(function(t){return t.toJSON(e)})}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isChange(e))return e;if(o(e))return t.fromJSON(e);throw new Error("`Change.create` only accepts objects or changes, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.value,r=e.operations,o=void 0===r?[]:r;return new t({value:re.create(n),operations:We.createList(o)})}}]),t}(t.Record($e));function Qe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{onCommand:function(t,n,r){var o=t.type,a=t.args,i=e[o];if(!i)return r();n.command.apply(n,[i].concat(g(a)))},onConstruct:function(t,n){for(var r in e)t.registerCommand(r);return n()}}}var Ze=Be(function(e,t){!function(n){var r=t,o=e&&e.exports==r&&e,a="object"==typeof Pe&&Pe;a.global!==a&&a.window!==a||(n=a);var i=/([\0-\u02FF\u0370-\u1AAF\u1B00-\u1DBF\u1E00-\u20CF\u2100-\uD7FF\uE000-\uFE1F\uFE30-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])([\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]+)/g,s=/([\uD800-\uDBFF])([\uDC00-\uDFFF])/g,u=function(e){for(var t="",n=(e=e.replace(i,function(e,t,n){return u(n)+t}).replace(s,"$2$1")).length;n--;)t+=e.charAt(n);return t},c={version:"0.2.0",reverse:u};if(r&&!r.nodeType)if(o)o.exports=c;else for(var l in c)c.hasOwnProperty(l)&&(r[l]=c[l]);else n.esrever=c}(Pe)}).reverse,Ye=55296,He=57343,Xe=/\s/,et=/['\u2018\u2019]/,tt=/[\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;function nt(e){return Ye<=e&&e<=He}function rt(e,t){if(Xe.test(e))return!1;if(et.test(e)){var n=t.charAt(0),r=ot(n);if(rt(n=t.slice(0,r),t.slice(r)))return!0}return!tt.test(e)}function ot(e){return nt(e.charCodeAt(0))?2:1}function at(e){return ot(e.charAt(0))}function it(e){for(var t=0,n=0,r=!1,o=void 0;o=e.charAt(n);){var a=ot(o);if(rt(o=e.slice(n,n+a),e.slice(n+a)))r=!0,t+=a;else{if(r)break;t+=a}n+=a}return t}var st={getCharLength:ot,getCharOffset:at,getCharOffsetBackward:function(e,t){return e=e.slice(0,t),at(e=Ze(e))},getCharOffsetForward:function(e,t){return at(e=e.slice(t))},getWordOffset:it,getWordOffsetBackward:function(e,t){return e=e.slice(0,t),it(e=Ze(e))},getWordOffsetForward:function(e,t){return it(e=e.slice(t))},isSurrogate:nt,isWord:rt};function ut(e,t){t.isExpanded&&e.deleteAtRange(t);var n=e.value.document,r=t,o=r.start,a=r.end;return t=n.hasDescendant(o.path)?t.moveToStart():t.moveTo(a.path,0).normalize(n)}var ct={addMarkAtRange:function(e,t,n){if(!t.isCollapsed){var r=e.value.document,o=t.start,a=t.end,i=r.getTextsAtRange(t);e.withoutNormalizing(function(){i.forEach(function(t){var r=t.key,i=0,s=t.text.length;r===o.key&&(i=o.offset),r===a.key&&(s=a.offset),r===o.key&&r===a.key&&(s=a.offset-o.offset),e.addMarkByKey(r,i,s,n)})})}},addMarksAtRange:function(e,t,n){n.forEach(function(n){return e.addMarkAtRange(t,n)})},deleteAtRange:function(e,t){e.snapshotSelection();var n=e.value,r=t.start,o=t.end,a=r.key,i=r.offset,s=o.key,u=o.offset,c=n.document,l=c.hasVoidParent(a,e),f=c.hasVoidParent(s,e),d=c.getClosestBlock(a),v=c.getClosestBlock(s),h=0===i&&0===u&&!1===l&&a===d.getFirstText().key&&s===v.getFirstText().key&&a!==s;if(h&&f){var y=c.getPreviousText(s);s=y.key,u=y.text.length,f=c.hasVoidParent(s,e)}e.withoutNormalizing(function(){for(;l;){var t=c.getClosestVoid(a,e),n=c.getNextText(a);if(e.removeNodeByKey(t.key),a===s)return;if(!n)return;c=e.value.document,a=n.key,i=0,l=c.hasVoidParent(a,e)}for(;f;){var r=c.getClosestVoid(s,e),o=c.getPreviousText(s);e.removeNodeByKey(r.key),c=e.value.document,s=o.key,u=o.text.length,f=c.hasVoidParent(s,e)}if(a===s&&h)e.removeNodeByKey(d.key);else if(a!==s){d=c.getClosestBlock(a),v=c.getClosestBlock(s);var y=c.getNode(a),p=c.getNode(s),m=y.text.length-i,g=u,b=c.getCommonAncestor(a,s),A=b.getFurthestChild(a),x=b.getFurthestChild(s),w=c.getParent(d.key),O=w.nodes.indexOf(d),N=w.nodes.indexOf(v),T=void 0;for(T=y;T.key!==A.key;){var _=c.getParent(T.key),S=_.nodes.indexOf(T);_.nodes.slice(S+1).reverse().forEach(function(t){e.removeNodeByKey(t.key)}),T=_}var P=b.nodes.indexOf(A),B=b.nodes.indexOf(x);for(b.nodes.slice(P+1,B).reverse().forEach(function(t){e.removeNodeByKey(t.key)}),T=p;T.key!==x.key;){var F=c.getParent(T.key),E=F.nodes.indexOf(T);F.nodes.slice(0,E).reverse().forEach(function(t){e.removeNodeByKey(t.key)}),T=F}if(0!==m&&e.removeTextByKey(a,i,m),0!==g&&e.removeTextByKey(s,0,u),d.key!==v.key){c=e.value.document;var j=void 0,C=!0,R=!1,L=void 0;try{for(var D,z=c.ancestors(v.key)[Symbol.iterator]();!(C=(D=z.next()).done);C=!0){var M=D.value,I=k(M,1)[0];if(I.nodes.size>1)break;j=I}}catch(e){R=!0,L=e}finally{try{!C&&z.return&&z.return()}finally{if(R)throw L}}N!==O+1&&e.moveNodeByKey(v.key,w.key,O+1),h?e.removeNodeByKey(d.key):e.mergeNodeByKey(v.key),j&&e.removeNodeByKey(j.key)}}else{var J=i,K=u-i;e.removeTextByKey(a,J,K)}})},deleteBackwardAtRange:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){var r=e.value.document,o=t,a=o.start,i=o.focus;if(t.isExpanded)e.deleteAtRange(t);else{var s=r.getClosestVoid(a.path,e);if(s)e.removeNodeByKey(s.key);else if(!a.isAtStartOfNode(r)){var u=r.getClosestBlock(a.path);if(1!==r.nodes.size&&u&&""===u.text&&1===u.nodes.size)e.removeNodeByKey(u.key);else{var c=r.getDescendant(a.path);if(a.isAtStartOfNode(c)){var l=r.getPreviousText(c.key);r.getClosestInline(c.key)&&""===l.text&&(l=r.getPreviousText(l.key));var f=r.getClosestBlock(l.key),d=r.getClosestVoid(l.key,e);if(d)return void e.removeNodeByKey(d.key);if(1===n&&f!==u)return t=t.moveAnchorTo(l.key,l.text.length),void e.deleteAtRange(t)}if(n<=i.offset)return t=t.moveFocusBackward(n),void e.deleteAtRange(t);for(var v=c,h=0,y=i.offset;n>y;){var p=y+(v=r.getPreviousText(v.key)).text.length;if(n<=p){h=p-n;break}y=p}t=t.moveAnchorTo(v.key,h),e.deleteAtRange(t)}}}}},deleteCharBackwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path),a=o.getOffset(r.key)+r.offset,i=o.text,s=st.getCharOffsetBackward(i,a);e.deleteBackwardAtRange(t,s)}},deleteCharForwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path),a=o.getOffset(r.key)+r.offset,i=o.text,s=st.getCharOffsetForward(i,a);e.deleteForwardAtRange(t,s)}},deleteForwardAtRange:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){var r=e.value.document,o=t,a=o.start,i=o.focus;if(t.isExpanded)e.deleteAtRange(t);else{var s=r.getClosestVoid(a.path,e);if(s)e.removeNodeByKey(s.key);else{var u=r.getClosestBlock(a.path);if(u&&!e.isVoid(u)&&""===u.text&&1!==r.nodes.size){var c=r.getNextBlock(u.key);return e.removeNodeByKey(u.key),void(c&&c.key&&e.moveToStartOfNode(c))}if(!a.isAtEndOfNode(r)){var l=r.getDescendant(a.path);if(a.isAtEndOfNode(l)){var f=r.getNextText(l.key),d=r.getClosestBlock(f.key),v=r.getClosestVoid(f.key,e);if(v)return void e.removeNodeByKey(v.key);if(1===n&&d!==u)return t=t.moveFocusTo(f.key,0),void e.deleteAtRange(t)}if(n<=l.text.length-i.offset)return t=t.moveFocusForward(n),void e.deleteAtRange(t);for(var h=l,y=i.offset,p=l.text.length-i.offset;n>p;){var m=p+(h=r.getNextText(h.key)).text.length;if(n<=m){y=n-p;break}p=m}t=t.moveFocusTo(h.key,y),e.deleteAtRange(t)}}}}},deleteLineBackwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path).getOffset(r.key)+r.offset;e.deleteBackwardAtRange(t,o)}},deleteLineForwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path),a=o.getOffset(r.key)+r.offset;e.deleteForwardAtRange(t,o.text.length-a)}},deleteWordBackwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path),a=o.getOffset(r.key)+r.offset,i=o.text,s=0===a?1:st.getWordOffsetBackward(i,a);e.deleteBackwardAtRange(t,s)}},deleteWordForwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path),a=o.getOffset(r.key)+r.offset,i=o.text,s=st.getWordOffsetForward(i,a),u=0===s?1:s;e.deleteForwardAtRange(t,u)}},insertBlockAtRange:function(e,t,n){t=ut(e,t),n=te.create(n);var r=e.value.document,o=t.start,a=o.key,i=o.offset,s=r.getClosestBlock(a),u=r.getClosestInline(a),c=r.getParent(s.key),l=c.nodes.indexOf(s),f=lt(e,t);if("before"===f)e.insertNodeByKey(c.key,l,n);else if("behind"===f)e.insertNodeByKey(c.key,l+1,n);else{if(u&&e.isVoid(u)){var d=o.isAtEndOfNode(u),v=d?r.getNextText(a):r.getPreviousText(a),h=d?t.moveToStartOfNode(v):t.moveToEndOfNode(v);a=h.start.key,i=h.start.offset}e.withoutNormalizing(function(){e.splitDescendantsByKey(s.key,a,i),e.insertNodeByKey(c.key,l+1,n)})}}},lt=function(e,t){var n=e.value.document,r=t.start,o=r.key,a=n.getClosestBlock(o),i=n.getClosestInline(o);return e.isVoid(a)?r.isAtEndOfNode(a)?"behind":"before":i||""!==a.text?r.isAtStartOfNode(a)?"before":r.isAtEndOfNode(a)?"behind":"split":"behind"};ct.insertFragmentAtRange=function(e,n,r){e.withoutNormalizing(function(){if(n=ut(e,n),r.nodes.size){r=r.mapDescendants(function(e){return e.regenerateKey()});var o=n.start,a=e.value.document,i=a.getDescendant(o.path),s=a.getClosestBlock(i.key),u=s.getFurthestChild(i.key),c=o.isAtStartOfNode(s),l=a.getParent(s.key),f=l.nodes.indexOf(s),d=r.getBlocks(),v=r.nodes.first(),h=r.nodes.last(),y=d.first(),p=d.last(),m=ft(r,a,s.key);if(y===p&&e.isVoid(y))e.insertBlockAtRange(n,y);else if(m!==r||!v.hasBlockChildren()&&!h.hasBlockChildren()){if(y!==p){var k=m.getFurthest(y.key,function(e){return 1===e.nodes.size})||y,g=l.nodes.indexOf(s);m.removeNode(k.key).nodes.forEach(function(t,n){var r=g+n+1;e.insertNodeByKey(l.key,r,t)})}if(0!==o.offset&&e.splitDescendantsByKey(u.key,o.key,o.offset),i=(a=e.value.document).getDescendant(o.key),u=(s=a.getClosestBlock(o.key)).getFurthestChild(i.key),y!==p){var b=c?u:s.getNextSibling(u.key),A=b?s.nodes.skipUntil(function(e){return e.key===b.key}):t.List(),x=p.nodes.size;A.forEach(function(t,n){var r=x+n;e.moveNodeByKey(t.key,p.key,r)})}if(e.isVoid(s)||""!==s.text||s.findDescendant(function(t){return e.isVoid(t)})){var w=s.getFurthestChild(i.key),O=s.nodes.indexOf(w);y.nodes.forEach(function(t,n){var r=0===o.offset?0:1,a=O+n+r;e.insertNodeByKey(s.key,a,t)})}else e.removeNodeByKey(s.key),e.insertNodeByKey(l.key,f,y)}else{("before"===lt(e,n)?r.nodes:r.nodes.reverse()).forEach(function(t){e.insertBlockAtRange(n,t)})}}})};var ft=function(e,t,n){var r=function(e){if(e&&"text"!==e.object)return 1===e.nodes.size},o=function(e){return e&&e.nodes.first()},a=e;if(r(e)){var i=o(e),s=t.getFurthest(n,function(e){return e.type===i.type});for(s===t.getParent(n)&&(a=i);r(i)&&r(s)&&(i=o(i),s=o(s),i.type===s.type);)a=i}return a};ct.insertInlineAtRange=function(e,t,n){n=G.create(n),e.withoutNormalizing(function(){t=ut(e,t);var r=e.value.document,o=t.start,a=r.getParent(o.path),i=r.assertDescendant(o.path),s=a.nodes.indexOf(i);e.isVoid(a)||(e.splitNodeByPath(o.path,o.offset),e.insertNodeByKey(a.key,s+1,n))})},ct.insertTextAtRange=function(e,t,n,r){e.withoutNormalizing(function(){t=ut(e,t);var o=e.value.document,a=t.start,i=a.offset,s=o.getParent(a.path);e.isVoid(s)||e.insertTextByPath(a.path,i,n,r)})},ct.removeMarkAtRange=function(e,t,n){if(!t.isCollapsed){var r=e.value.document.getTextsAtRange(t),o=t.start,a=t.end;e.withoutNormalizing(function(){r.forEach(function(t){var r=t.key,i=0,s=t.text.length;r===o.key&&(i=o.offset),r===a.key&&(s=a.offset),r===o.key&&r===a.key&&(s=a.offset-o.offset),e.removeMarkByKey(r,i,s,n)})})}},ct.setBlocksAtRange=function(e,t,n){var r=e.value.document,o=r.getLeafBlocksAtRange(t),a=t.start,i=t.end,s=t.isCollapsed,u=r.hasVoidParent(a.path,e),c=r.getClosestBlock(a.path),l=r.getClosestBlock(i.key),f=!1===s&&0===a.offset&&0===i.offset&&!1===u&&a.key===c.getFirstText().key&&i.key===l.getFirstText().key?o.slice(0,-1):o;e.withoutNormalizing(function(){f.forEach(function(t){e.setNodeByKey(t.key,n)})})},ct.setInlinesAtRange=function(e,t,n){var r=e.value.document.getLeafInlinesAtRange(t);e.withoutNormalizing(function(){r.forEach(function(t){e.setNodeByKey(t.key,n)})})},ct.splitBlockAtRange=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t=ut(e,t),o=r.start,a=r.end,i=e.value,s=i.document,u=s.assertDescendant(o.path),c=s.getClosestBlock(u.key),l=0;c&&"block"===c.object&&l<n;)u=c,c=s.getClosestBlock(c.key),l++;e.withoutNormalizing(function(){if(e.splitDescendantsByKey(u.key,o.path,o.offset),i=e.value,s=i.document,t.isExpanded){t.isBackward&&(t=t.flip());var n=s.getNextBlock(u.key);t=(t=t.moveAnchorToStartOfNode(n)).setFocus(t.focus.setPath(null)),o.path.equals(a.path)&&(t=t.moveFocusTo(t.anchor.key,a.offset-o.offset)),t=s.resolveRange(t),e.deleteAtRange(t)}})},ct.splitInlineAtRange=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,r=(t=ut(e,t)).start,o=e.value.document,a=o.assertDescendant(r.path),i=o.getClosestInline(a.key),s=0;i&&"inline"===i.object&&s<n;)a=i,i=o.getClosestInline(i.key),s++;e.splitDescendantsByKey(a.key,r.path,r.offset)},ct.toggleMarkAtRange=function(e,t,n){t.isCollapsed||(n=C.create(n),e.value.document.getActiveMarksAtRange(t).some(function(e){return e.equals(n)})?e.removeMarkAtRange(t,n):e.addMarkAtRange(t,n))},ct.unwrapBlockAtRange=function(e,t,n){n=X.createProperties(n);var r=e.value.document,o=r.getLeafBlocksAtRange(t),a=o.map(function(e){return r.getClosest(e.key,function(e){return"block"===e.object&&((null==n.type||e.type===n.type)&&!(null!=n.data&&!e.data.isSuperset(n.data)))})}).filter(function(e){return e}).toOrderedSet().toList();e.withoutNormalizing(function(){a.forEach(function(t){var n=t.nodes.first(),a=t.nodes.last(),i=e.value.document.getParent(t.key),s=i.nodes.indexOf(t),u=t.nodes.filter(function(e){return o.some(function(t){return e===t||e.hasDescendant(t.key)})}),c=u.first(),l=u.last();if(n===c&&a===l)t.nodes.forEach(function(t,n){e.moveNodeByKey(t.key,i.key,s+n)}),e.removeNodeByKey(t.key);else if(a===l)t.nodes.skipUntil(function(e){return e===c}).forEach(function(t,n){e.moveNodeByKey(t.key,i.key,s+1+n)});else if(n===c)t.nodes.takeUntil(function(e){return e===l}).push(l).forEach(function(t,n){e.moveNodeByKey(t.key,i.key,s+n)});else{var f=c.getFirstText();e.splitDescendantsByKey(t.key,f.key,0),r=e.value.document,u.forEach(function(t,n){if(0===n){var o=t;t=r.getNextBlock(t.key),e.removeNodeByKey(o.key)}e.moveNodeByKey(t.key,i.key,s+1+n)})}})})},ct.unwrapInlineAtRange=function(e,t,n){n=X.createProperties(n);var r=e.value.document,o=r.getTextsAtRange(t).map(function(e){return r.getClosest(e.key,function(e){return"inline"===e.object&&((null==n.type||e.type===n.type)&&!(null!=n.data&&!e.data.isSuperset(n.data)))})}).filter(function(e){return e}).toOrderedSet().toList();e.withoutNormalizing(function(){o.forEach(function(t){var n=e.value.document.getParent(t.key),r=n.nodes.indexOf(t);t.nodes.forEach(function(t,o){e.moveNodeByKey(t.key,n.key,r+o)}),e.removeNodeByKey(t.key)})})},ct.wrapBlockAtRange=function(e,t,n){n=(n=te.create(n)).set("nodes",n.nodes.clear());var r=e.value.document,o=r.getLeafBlocksAtRange(t),a=o.first(),i=o.last(),s=void 0,u=void 0,c=void 0;if(1===o.length?(s=r.getParent(a.key),u=o):s=r.getClosest(a.key,function(e){return!!r.getClosest(i.key,function(t){return e===t})}),null==s&&(s=r),null==u){var l=s.nodes.reduce(function(e,t,n){return(t===a||t.hasDescendant(a.key))&&(e[0]=n),(t===i||t.hasDescendant(i.key))&&(e[1]=n),e},[]);c=l[0],u=s.nodes.slice(l[0],l[1]+1)}null==c&&(c=s.nodes.indexOf(u.first())),e.withoutNormalizing(function(){e.insertNodeByKey(s.key,c,n),u.forEach(function(t,r){e.moveNodeByKey(t.key,n.key,r)})})},ct.wrapInlineAtRange=function(e,t,n){var r=e.value.document,o=t.start,a=t.end;if(t.isCollapsed){var i=r.getClosestInline(o.path);if(!i)return;if(!e.isVoid(i))return;return e.wrapInlineByKey(i.key,n)}n=(n=G.create(n)).set("nodes",n.nodes.clear());var s=r.getLeafBlocksAtRange(t),u=r.getClosestBlock(o.path),c=r.getClosestBlock(a.path),l=r.getClosestInline(o.path),f=r.getClosestInline(a.path),d=u.getFurthestChild(o.key),v=c.getFurthestChild(a.key);e.withoutNormalizing(function(){l&&l===f||(e.splitDescendantsByKey(v.key,a.key,a.offset),e.splitDescendantsByKey(d.key,o.key,o.offset)),r=e.value.document,u=r.getDescendant(u.key),c=r.getDescendant(c.key),d=u.getFurthestChild(o.key),v=c.getFurthestChild(a.key);var i=u.nodes.indexOf(d),h=c.nodes.indexOf(v);if(l&&l===f){var y=u.getTextsAtRange(t).map(function(e){return o.key===e.key&&a.key===e.key?e.splitText(o.offset)[1].splitText(a.offset-o.offset)[0].regenerateKey():o.key===e.key?e.splitText(o.offset)[1].regenerateKey():a.key===e.key?e.splitText(a.offset)[0].regenerateKey():e.regenerateKey()});n=n.set("nodes",y),e.insertInlineAtRange(t,n)}else if(u===c){r=e.value.document,u=r.getClosestBlock(o.key),d=u.getFurthestChild(o.key);var p=r.getNextSibling(d.key),m=u.nodes.indexOf(p),k=o.key===a.key?p:u.getFurthestChild(a.key),g=u.nodes.skipUntil(function(e){return e===p}).takeUntil(function(e){return e===k}).push(k),b=n.regenerateKey();e.insertNodeByKey(u.key,m,b),g.forEach(function(t,n){e.moveNodeByKey(t.key,b.key,n)})}else{var A=u.nodes.slice(i+1),x=c.nodes.slice(0,h+1),w=n.regenerateKey(),O=n.regenerateKey();e.insertNodeByKey(u.key,i+1,w),e.insertNodeByKey(c.key,h,O),A.forEach(function(t,n){e.moveNodeByKey(t.key,w.key,n)}),x.forEach(function(t,n){e.moveNodeByKey(t.key,O.key,n)}),s.slice(1,-1).forEach(function(t){var r=n.regenerateKey();e.insertNodeByKey(t.key,0,r),t.nodes.forEach(function(t,n){e.moveNodeByKey(t.key,r.key,n)})})}})},ct.wrapTextAtRange=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,o=t.start,a=t.end,i=t.moveToStart(),s=t.moveToEnd();o.path.equals(a.path)&&(s=s.moveForward(n.length)),e.withoutNormalizing(function(){e.insertTextAtRange(i,n),e.insertTextAtRange(s,r)})};var dt=Array.isArray,vt="object"==typeof Pe&&Pe&&Pe.Object===Object&&Pe,ht="object"==typeof self&&self&&self.Object===Object&&self,yt=vt||ht||Function("return this")(),pt=yt.Symbol,mt=Object.prototype,kt=mt.hasOwnProperty,gt=mt.toString,bt=pt?pt.toStringTag:void 0;var At=function(e){var t=kt.call(e,bt),n=e[bt];try{e[bt]=void 0;var r=!0}catch(e){}var o=gt.call(e);return r&&(t?e[bt]=n:delete e[bt]),o},xt=Object.prototype.toString;var wt=function(e){return xt.call(e)},Ot="[object Null]",Nt="[object Undefined]",Tt=pt?pt.toStringTag:void 0;var _t=function(e){return null==e?void 0===e?Nt:Ot:Tt&&Tt in Object(e)?At(e):wt(e)};var St=function(e){return null!=e&&"object"==typeof e},Pt="[object Symbol]";var Bt=function(e){return"symbol"==typeof e||St(e)&&_t(e)==Pt},Ft=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Et=/^\w*$/;var jt=function(e,t){if(dt(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Bt(e))||Et.test(e)||!Ft.test(e)||null!=t&&e in Object(t)};var Ct=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Rt="[object AsyncFunction]",Lt="[object Function]",Dt="[object GeneratorFunction]",zt="[object Proxy]";var Mt,It=function(e){if(!Ct(e))return!1;var t=_t(e);return t==Lt||t==Dt||t==Rt||t==zt},Jt=yt["__core-js_shared__"],Kt=(Mt=/[^.]+$/.exec(Jt&&Jt.keys&&Jt.keys.IE_PROTO||""))?"Symbol(src)_1."+Mt:"";var Ut=function(e){return!!Kt&&Kt in e},qt=Function.prototype.toString;var Vt=function(e){if(null!=e){try{return qt.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Wt=/^\[object .+?Constructor\]$/,$t=Function.prototype,Gt=Object.prototype,Qt=$t.toString,Zt=Gt.hasOwnProperty,Yt=RegExp("^"+Qt.call(Zt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Ht=function(e){return!(!Ct(e)||Ut(e))&&(It(e)?Yt:Wt).test(Vt(e))};var Xt=function(e,t){return null==e?void 0:e[t]};var en=function(e,t){var n=Xt(e,t);return Ht(n)?n:void 0},tn=en(Object,"create");var nn=function(){this.__data__=tn?tn(null):{},this.size=0};var rn=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},on="__lodash_hash_undefined__",an=Object.prototype.hasOwnProperty;var sn=function(e){var t=this.__data__;if(tn){var n=t[e];return n===on?void 0:n}return an.call(t,e)?t[e]:void 0},un=Object.prototype.hasOwnProperty;var cn=function(e){var t=this.__data__;return tn?void 0!==t[e]:un.call(t,e)},ln="__lodash_hash_undefined__";var fn=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=tn&&void 0===t?ln:t,this};function dn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}dn.prototype.clear=nn,dn.prototype.delete=rn,dn.prototype.get=sn,dn.prototype.has=cn,dn.prototype.set=fn;var vn=dn;var hn=function(){this.__data__=[],this.size=0};var yn=function(e,t){return e===t||e!=e&&t!=t};var pn=function(e,t){for(var n=e.length;n--;)if(yn(e[n][0],t))return n;return-1},mn=Array.prototype.splice;var kn=function(e){var t=this.__data__,n=pn(t,e);return!(n<0||(n==t.length-1?t.pop():mn.call(t,n,1),--this.size,0))};var gn=function(e){var t=this.__data__,n=pn(t,e);return n<0?void 0:t[n][1]};var bn=function(e){return pn(this.__data__,e)>-1};var An=function(e,t){var n=this.__data__,r=pn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function xn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}xn.prototype.clear=hn,xn.prototype.delete=kn,xn.prototype.get=gn,xn.prototype.has=bn,xn.prototype.set=An;var wn=xn,On=en(yt,"Map");var Nn=function(){this.size=0,this.__data__={hash:new vn,map:new(On||wn),string:new vn}};var Tn=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var _n=function(e,t){var n=e.__data__;return Tn(t)?n["string"==typeof t?"string":"hash"]:n.map};var Sn=function(e){var t=_n(this,e).delete(e);return this.size-=t?1:0,t};var Pn=function(e){return _n(this,e).get(e)};var Bn=function(e){return _n(this,e).has(e)};var Fn=function(e,t){var n=_n(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function En(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}En.prototype.clear=Nn,En.prototype.delete=Sn,En.prototype.get=Pn,En.prototype.has=Bn,En.prototype.set=Fn;var jn=En,Cn="Expected a function";function Rn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Cn);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var i=e.apply(this,r);return n.cache=a.set(o,i)||a,i};return n.cache=new(Rn.Cache||jn),n}Rn.Cache=jn;var Ln=Rn,Dn=500;var zn=/^\./,Mn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,In=/\\(\\)?/g,Jn=function(e){var t=Ln(e,function(e){return n.size===Dn&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return zn.test(e)&&t.push(""),e.replace(Mn,function(e,n,r,o){t.push(r?o.replace(In,"$1"):n||e)}),t});var Kn=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o},Un=1/0,qn=pt?pt.prototype:void 0,Vn=qn?qn.toString:void 0;var Wn=function e(t){if("string"==typeof t)return t;if(dt(t))return Kn(t,e)+"";if(Bt(t))return Vn?Vn.call(t):"";var n=t+"";return"0"==n&&1/t==-Un?"-0":n};var $n=function(e){return null==e?"":Wn(e)};var Gn=function(e,t){return dt(e)?e:jt(e,t)?[e]:Jn($n(e))},Qn=1/0;var Zn=function(e){if("string"==typeof e||Bt(e))return e;var t=e+"";return"0"==t&&1/e==-Qn?"-0":t};var Yn=function(e,t){for(var n=0,r=(t=Gn(t,e)).length;null!=e&&n<r;)e=e[Zn(t[n++])];return n&&n==r?e:void 0},Hn=function(){try{var e=en(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Xn=function(e,t,n){"__proto__"==t&&Hn?Hn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},er=Object.prototype.hasOwnProperty;var tr=function(e,t,n){var r=e[t];er.call(e,t)&&yn(r,n)&&(void 0!==n||t in e)||Xn(e,t,n)},nr=9007199254740991,rr=/^(?:0|[1-9]\d*)$/;var or=function(e,t){return!!(t=null==t?nr:t)&&("number"==typeof e||rr.test(e))&&e>-1&&e%1==0&&e<t};var ar=function(e,t,n,r){if(!Ct(e))return e;for(var o=-1,a=(t=Gn(t,e)).length,i=a-1,s=e;null!=s&&++o<a;){var u=Zn(t[o]),c=n;if(o!=i){var l=s[u];void 0===(c=r?r(l,u,s):void 0)&&(c=Ct(l)?l:or(t[o+1])?[]:{})}tr(s,u,c),s=s[u]}return e};var ir=function(e,t,n){for(var r=-1,o=t.length,a={};++r<o;){var i=t[r],s=Yn(e,i);n(s,i)&&ar(a,Gn(i,e),s)}return a};var sr=function(e,t){return null!=e&&t in Object(e)},ur="[object Arguments]";var cr=function(e){return St(e)&&_t(e)==ur},lr=Object.prototype,fr=lr.hasOwnProperty,dr=lr.propertyIsEnumerable,vr=cr(function(){return arguments}())?cr:function(e){return St(e)&&fr.call(e,"callee")&&!dr.call(e,"callee")},hr=9007199254740991;var yr=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=hr};var pr=function(e,t,n){for(var r=-1,o=(t=Gn(t,e)).length,a=!1;++r<o;){var i=Zn(t[r]);if(!(a=null!=e&&n(e,i)))break;e=e[i]}return a||++r!=o?a:!!(o=null==e?0:e.length)&&yr(o)&&or(i,o)&&(dt(e)||vr(e))};var mr=function(e,t){return null!=e&&pr(e,t,sr)};var kr=function(e,t){return ir(e,t,function(t,n){return mr(e,n)})};var gr=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e},br=pt?pt.isConcatSpreadable:void 0;var Ar=function(e){return dt(e)||vr(e)||!!(br&&e&&e[br])};var xr=function e(t,n,r,o,a){var i=-1,s=t.length;for(r||(r=Ar),a||(a=[]);++i<s;){var u=t[i];n>0&&r(u)?n>1?e(u,n-1,r,o,a):gr(a,u):o||(a[a.length]=u)}return a};var wr=function(e){return null!=e&&e.length?xr(e,1):[]};var Or=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},Nr=Math.max;var Tr=function(e,t,n){return t=Nr(void 0===t?e.length-1:t,0),function(){for(var r=arguments,o=-1,a=Nr(r.length-t,0),i=Array(a);++o<a;)i[o]=r[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=r[o];return s[t]=n(i),Or(e,this,s)}};var _r=function(e){return function(){return e}};var Sr=Hn?function(e,t){return Hn(e,"toString",{configurable:!0,enumerable:!1,value:_r(t),writable:!0})}:function(e){return e},Pr=800,Br=16,Fr=Date.now;var Er=function(e){var t=0,n=0;return function(){var r=Fr(),o=Br-(r-n);if(n=r,o>0){if(++t>=Pr)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Sr);var jr=function(e){return Er(Tr(e,void 0,wr),e+"")},Cr=jr(function(e,t){return null==e?{}:kr(e,t)}),Rr={addMarkByPath:function(e,t,n,r,o){o=C.create(o),e.addMarksByPath(t,n,r,[o])},addMarksByPath:function(e,t,n,r,o){if((o=C.createSet(o)).size){var a=e.value.document.assertNode(t);e.withoutNormalizing(function(){n+r<a.text.length&&e.splitNodeByPath(t,n+r),n>0&&(e.splitNodeByPath(t,n),t=P.increment(t),n=0),o.forEach(function(n){e.applyOperation({type:"add_mark",path:t,mark:C.create(n)})})})}},replaceMarksByPath:function(e,t,n,r,o){var a=C.createSet(o),i=e.value.document.assertNode(t);i.marks.equals(a)||e.withoutNormalizing(function(){n+r<i.text.length&&e.splitNodeByPath(t,n+r),n>0&&(e.splitNodeByPath(t,n),t=P.increment(t),n=0);var o=a.subtract(i.marks);i.marks.subtract(a).forEach(function(n){e.applyOperation({type:"remove_mark",path:t,mark:C.create(n)})}),o.forEach(function(n){e.applyOperation({type:"add_mark",path:t,mark:C.create(n)})})})},insertFragmentByPath:function(e,t,n,r){r.nodes.forEach(function(r,o){e.insertNodeByPath(t,n+o,r)})},insertNodeByPath:function(e,t,n,r){e.applyOperation({type:"insert_node",path:t.concat(n),node:r})},insertTextByPath:function(e,t,n,r,o){var a=e.value,i=a.annotations;a.document.assertNode(t),e.withoutNormalizing(function(){var a=!0,s=!1,u=void 0;try{for(var c,l=i.values()[Symbol.iterator]();!(a=(c=l.next()).done);a=!0){var f=c.value,d=f.start,v=f.end;e.isAtomic(f)&&(d.path.equals(t)&&d.offset<n&&(!v.path.equals(t)||v.offset>n)&&e.removeAnnotation(f))}}catch(e){s=!0,u=e}finally{try{!a&&l.return&&l.return()}finally{if(s)throw u}}e.applyOperation({type:"insert_text",path:t,offset:n,text:r}),o&&e.replaceMarksByPath(t,n,r.length,o)})},mergeNodeByPath:function(e,t){var n=e.value.document,r=n.getDescendant(t),o=n.getPreviousSibling(t);if(!o)throw new Error('Unable to merge node with path "'+t+'", because it has no previous sibling.');var a="text"===o.object?o.text.length:o.nodes.size;e.applyOperation({type:"merge_node",path:t,position:a,properties:{type:r.type,data:r.data},target:null})},moveNodeByPath:function(e,t,n,r){if(P.isEqual(t,n))return e;var o=n.concat(r);if(P.isEqual(t,o))return e;e.applyOperation({type:"move_node",path:t,newPath:o})},removeMarkByPath:function(e,t,n,r,o){o=C.create(o),e.removeMarksByPath(t,n,r,[o])},removeMarksByPath:function(e,t,n,r,o){if((o=C.createSet(o)).size){var a=e.value.document.assertNode(t);o.intersect(a.marks).isEmpty()||e.withoutNormalizing(function(){n+r<a.text.length&&e.splitNodeByPath(t,n+r),n>0&&(e.splitNodeByPath(t,n),t=P.increment(t),n=0),o.forEach(function(o){e.applyOperation({type:"remove_mark",path:t,offset:n,length:r,mark:o})})})}},removeAllMarksByPath:function(e,t){var n=e.state.document.assertNode(t);e.withoutNormalizing(function(){if("text"!==n.object){var r=!0,o=!1,a=void 0;try{for(var i,s=n.texts()[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var u=i.value,c=k(u,2),l=c[0],f=c[1],d=t.concat(f);e.removeMarksByPath(d,0,l.text.length,l.marks)}}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}}else e.removeMarksByPath(t,0,n.text.length,n.marks)})},removeNodeByPath:function(e,t){var n=e.value.document.assertNode(t);e.applyOperation({type:"remove_node",path:t,node:n})},removeTextByPath:function(e,t,n,r){var o=e.value,a=o.document,i=o.annotations,s=a.assertNode(t).text.slice(n,n+r);e.withoutNormalizing(function(){var r=!0,o=!1,a=void 0;try{for(var u,c=i.values()[Symbol.iterator]();!(r=(u=c.next()).done);r=!0){var l=u.value,f=l.start,d=l.end;e.isAtomic(l)&&(f.path.equals(t)&&f.offset<n&&(!d.path.equals(t)||d.offset>n)&&e.removeAnnotation(l))}}catch(e){o=!0,a=e}finally{try{!r&&c.return&&c.return()}finally{if(o)throw a}}e.applyOperation({type:"remove_text",path:t,offset:n,text:s})})},replaceNodeByPath:function(e,t,n){n=X.create(n);var r=t.last(),o=P.lift(t);e.withoutNormalizing(function(){e.removeNodeByPath(t),e.insertNodeByPath(o,r,n)})},replaceTextByPath:function(e,t,n,r,o,a){e.withoutNormalizing(function(){e.removeTextByPath(t,n,r),e.insertTextByPath(t,n,o,a)})},setMarkByPath:function(e,t,n,r,o,a){o=C.create(o),a=C.createProperties(a);var i=e.value.document.assertNode(t);e.withoutNormalizing(function(){n+r<i.text.length&&e.splitNodeByPath(t,n+r),n>0&&(e.splitNodeByPath(t,n),t=P.increment(t),n=0),e.applyOperation({type:"set_mark",path:t,properties:o,newProperties:a})})},setNodeByPath:function(e,t,n){var r=e.value.document.assertNode(t);n=X.createProperties(n);var o=Cr(r,Object.keys(n));e.applyOperation({type:"set_node",path:t,properties:o,newProperties:n})},setTextByPath:function(e,t,n,r){var o=e.value.document.assertNode(t).text.length;e.replaceTextByPath(t,0,o,n,r)},splitNodeByPath:function(e,t,n){var r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).target,o=void 0===r?null:r,a=e.value.document.getDescendant(t);e.applyOperation({type:"split_node",path:t,position:n,target:o,properties:{type:a.type,data:a.data}})},splitDescendantsByPath:function(e,t,n,r){if(t.equals(n))e.splitNodeByPath(n,r);else{var o=e.value.document,a=r,i=n;e.withoutNormalizing(function(){e.splitNodeByKey(n,r);var s=!0,u=!1,c=void 0;try{for(var l,f=o.ancestors(n)[Symbol.iterator]();!(s=(l=f.next()).done);s=!0){var d=l.value,v=k(d,2)[1],h=a;if(a=i.last()+1,i=v,e.splitNodeByPath(v,a,{target:h}),v.equals(t))break}}catch(e){u=!0,c=e}finally{try{!s&&f.return&&f.return()}finally{if(u)throw c}}})}},unwrapInlineByPath:function(e,t,n){var r=e.value,o=r.document,a=r.selection,i=o.assertNode(t),s=i.getFirstText(),u=i.getLastText(),c=a.moveToRangeOfNode(s,u);e.unwrapInlineAtRange(c,n)},unwrapBlockByPath:function(e,t,n){var r=e.value,o=r.document,a=r.selection,i=o.assertNode(t),s=i.getFirstText(),u=i.getLastText(),c=a.moveToRangeOfNode(s,u);e.unwrapBlockAtRange(c,n)},unwrapNodeByPath:function(e,t){var n=e.value.document;n.assertNode(t);var r=P.lift(t),o=n.assertNode(r),a=t.last(),i=r.last(),s=P.lift(r),u=0===a,c=a===o.nodes.size-1;e.withoutNormalizing(function(){if(1===o.nodes.size)e.moveNodeByPath(t,s,i+1),e.removeNodeByPath(r);else if(u)e.moveNodeByPath(t,s,i);else if(c)e.moveNodeByPath(t,s,i+1);else{var n=P.increment(t,1,r.size-1);n=n.set(n.size-1,0),e.splitNodeByPath(r,a),e.moveNodeByPath(n,s,i+1)}})},unwrapChildrenByPath:function(e,t){t=P.create(t);var n=e.value.document.assertNode(t),r=P.lift(t),o=t.last(),a=n.nodes;e.withoutNormalizing(function(){a.reverse().forEach(function(n,i){var s=a.size-i-1,u=t.push(s);e.moveNodeByPath(u,r,o+1)}),e.removeNodeByPath(t)})},wrapBlockByPath:function(e,t,n){n=(n=te.create(n)).set("nodes",n.nodes.clear());var r=P.lift(t),o=t.last(),a=P.increment(t);e.withoutNormalizing(function(){e.insertNodeByPath(r,o,n),e.moveNodeByPath(a,t,0)})},wrapInlineByPath:function(e,t,n){n=(n=G.create(n)).set("nodes",n.nodes.clear());var r=P.lift(t),o=t.last(),a=P.increment(t);e.withoutNormalizing(function(){e.insertNodeByPath(r,o,n),e.moveNodeByPath(a,t,0)})},wrapNodeByPath:function(e,t,n){"block"===(n=X.create(n)).object?e.wrapBlockByPath(t,n):"inline"===n.object&&e.wrapInlineByPath(t,n)}},Lr=function(e){Rr[e+"ByKey"]=function(t,n){for(var r=arguments.length,o=Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];var i=t.value.document.assertPath(n);t[e+"ByPath"].apply(t,[i].concat(o))}},Dr=!0,zr=!1,Mr=void 0;try{for(var Ir,Jr=["addMark","insertFragment","insertNode","insertText","mergeNode","removeAllMarks","removeMark","removeNode","removeText","replaceMarks","replaceNode","replaceText","setMark","setNode","setText","splitNode","unwrapBlock","unwrapChildren","unwrapInline","unwrapNode","wrapBlock","wrapInline","wrapNode"][Symbol.iterator]();!(Dr=(Ir=Jr.next()).done);Dr=!0){Lr(Ir.value)}}catch(e){zr=!0,Mr=e}finally{try{!Dr&&Jr.return&&Jr.return()}finally{if(zr)throw Mr}}Rr.moveNodeByKey=function(e,t,n){for(var r=arguments.length,o=Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];var i=e.value.document,s=i.assertPath(t),u=i.assertPath(n);e.moveNodeByPath.apply(e,[s,u].concat(o))},Rr.splitDescendantsByKey=function(e,t,n){for(var r=arguments.length,o=Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];var i=e.value.document,s=i.assertPath(t),u=i.assertPath(n);e.splitDescendantsByPath.apply(e,[s,u].concat(o))};var Kr=function(){this.__data__=new wn,this.size=0};var Ur=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var qr=function(e){return this.__data__.get(e)};var Vr=function(e){return this.__data__.has(e)},Wr=200;var $r=function(e,t){var n=this.__data__;if(n instanceof wn){var r=n.__data__;if(!On||r.length<Wr-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new jn(r)}return n.set(e,t),this.size=n.size,this};function Gr(e){var t=this.__data__=new wn(e);this.size=t.size}Gr.prototype.clear=Kr,Gr.prototype.delete=Ur,Gr.prototype.get=qr,Gr.prototype.has=Vr,Gr.prototype.set=$r;var Qr=Gr;var Zr=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e};var Yr=function(e,t,n,r){var o=!n;n||(n={});for(var a=-1,i=t.length;++a<i;){var s=t[a],u=r?r(n[s],e[s],s,n,e):void 0;void 0===u&&(u=e[s]),o?Xn(n,s,u):tr(n,s,u)}return n};var Hr=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};var Xr=function(){return!1},eo=Be(function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,o=r&&r.exports===n?yt.Buffer:void 0,a=(o?o.isBuffer:void 0)||Xr;e.exports=a}),to={};to["[object Float32Array]"]=to["[object Float64Array]"]=to["[object Int8Array]"]=to["[object Int16Array]"]=to["[object Int32Array]"]=to["[object Uint8Array]"]=to["[object Uint8ClampedArray]"]=to["[object Uint16Array]"]=to["[object Uint32Array]"]=!0,to["[object Arguments]"]=to["[object Array]"]=to["[object ArrayBuffer]"]=to["[object Boolean]"]=to["[object DataView]"]=to["[object Date]"]=to["[object Error]"]=to["[object Function]"]=to["[object Map]"]=to["[object Number]"]=to["[object Object]"]=to["[object RegExp]"]=to["[object Set]"]=to["[object String]"]=to["[object WeakMap]"]=!1;var no=function(e){return St(e)&&yr(e.length)&&!!to[_t(e)]};var ro=function(e){return function(t){return e(t)}},oo=Be(function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,o=r&&r.exports===n&&vt.process,a=function(){try{return o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}),ao=oo&&oo.isTypedArray,io=ao?ro(ao):no,so=Object.prototype.hasOwnProperty;var uo=function(e,t){var n=dt(e),r=!n&&vr(e),o=!n&&!r&&eo(e),a=!n&&!r&&!o&&io(e),i=n||r||o||a,s=i?Hr(e.length,String):[],u=s.length;for(var c in e)!t&&!so.call(e,c)||i&&("length"==c||o&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||or(c,u))||s.push(c);return s},co=Object.prototype;var lo=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||co)};var fo=function(e,t){return function(n){return e(t(n))}},vo=fo(Object.keys,Object),ho=Object.prototype.hasOwnProperty;var yo=function(e){if(!lo(e))return vo(e);var t=[];for(var n in Object(e))ho.call(e,n)&&"constructor"!=n&&t.push(n);return t};var po=function(e){return null!=e&&yr(e.length)&&!It(e)};var mo=function(e){return po(e)?uo(e):yo(e)};var ko=function(e,t){return e&&Yr(t,mo(t),e)};var go=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},bo=Object.prototype.hasOwnProperty;var Ao=function(e){if(!Ct(e))return go(e);var t=lo(e),n=[];for(var r in e)("constructor"!=r||!t&&bo.call(e,r))&&n.push(r);return n};var xo=function(e){return po(e)?uo(e,!0):Ao(e)};var wo=function(e,t){return e&&Yr(t,xo(t),e)},Oo=Be(function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,o=r&&r.exports===n?yt.Buffer:void 0,a=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=a?a(n):new e.constructor(n);return e.copy(r),r}});var No=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var To=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,a=[];++n<r;){var i=e[n];t(i,n,e)&&(a[o++]=i)}return a};var _o=function(){return[]},So=Object.prototype.propertyIsEnumerable,Po=Object.getOwnPropertySymbols,Bo=Po?function(e){return null==e?[]:(e=Object(e),To(Po(e),function(t){return So.call(e,t)}))}:_o;var Fo=function(e,t){return Yr(e,Bo(e),t)},Eo=fo(Object.getPrototypeOf,Object),jo=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)gr(t,Bo(e)),e=Eo(e);return t}:_o;var Co=function(e,t){return Yr(e,jo(e),t)};var Ro=function(e,t,n){var r=t(e);return dt(e)?r:gr(r,n(e))};var Lo=function(e){return Ro(e,mo,Bo)};var Do=function(e){return Ro(e,xo,jo)},zo=en(yt,"DataView"),Mo=en(yt,"Promise"),Io=en(yt,"Set"),Jo=en(yt,"WeakMap"),Ko=Vt(zo),Uo=Vt(On),qo=Vt(Mo),Vo=Vt(Io),Wo=Vt(Jo),$o=_t;(zo&&"[object DataView]"!=$o(new zo(new ArrayBuffer(1)))||On&&"[object Map]"!=$o(new On)||Mo&&"[object Promise]"!=$o(Mo.resolve())||Io&&"[object Set]"!=$o(new Io)||Jo&&"[object WeakMap]"!=$o(new Jo))&&($o=function(e){var t=_t(e),n="[object Object]"==t?e.constructor:void 0,r=n?Vt(n):"";if(r)switch(r){case Ko:return"[object DataView]";case Uo:return"[object Map]";case qo:return"[object Promise]";case Vo:return"[object Set]";case Wo:return"[object WeakMap]"}return t});var Go=$o,Qo=Object.prototype.hasOwnProperty;var Zo=function(e){var t=e.length,n=e.constructor(t);return t&&"string"==typeof e[0]&&Qo.call(e,"index")&&(n.index=e.index,n.input=e.input),n},Yo=yt.Uint8Array;var Ho=function(e){var t=new e.constructor(e.byteLength);return new Yo(t).set(new Yo(e)),t};var Xo=function(e,t){var n=t?Ho(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)};var ea=function(e,t){return e.set(t[0],t[1]),e};var ta=function(e,t,n,r){var o=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++o]);++o<a;)n=t(n,e[o],o,e);return n};var na=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n},ra=1;var oa=function(e,t,n){var r=t?n(na(e),ra):na(e);return ta(r,ea,new e.constructor)},aa=/\w*$/;var ia=function(e){var t=new e.constructor(e.source,aa.exec(e));return t.lastIndex=e.lastIndex,t};var sa=function(e,t){return e.add(t),e};var ua=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n},ca=1;var la=function(e,t,n){var r=t?n(ua(e),ca):ua(e);return ta(r,sa,new e.constructor)},fa=pt?pt.prototype:void 0,da=fa?fa.valueOf:void 0;var va=function(e){return da?Object(da.call(e)):{}};var ha=function(e,t){var n=t?Ho(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)},ya="[object Boolean]",pa="[object Date]",ma="[object Map]",ka="[object Number]",ga="[object RegExp]",ba="[object Set]",Aa="[object String]",xa="[object Symbol]",wa="[object ArrayBuffer]",Oa="[object DataView]",Na="[object Float32Array]",Ta="[object Float64Array]",_a="[object Int8Array]",Sa="[object Int16Array]",Pa="[object Int32Array]",Ba="[object Uint8Array]",Fa="[object Uint8ClampedArray]",Ea="[object Uint16Array]",ja="[object Uint32Array]";var Ca=function(e,t,n,r){var o=e.constructor;switch(t){case wa:return Ho(e);case ya:case pa:return new o(+e);case Oa:return Xo(e,r);case Na:case Ta:case _a:case Sa:case Pa:case Ba:case Fa:case Ea:case ja:return ha(e,r);case ma:return oa(e,r,n);case ka:case Aa:return new o(e);case ga:return ia(e);case ba:return la(e,r,n);case xa:return va(e)}},Ra=Object.create,La=function(){function e(){}return function(t){if(!Ct(t))return{};if(Ra)return Ra(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Da=function(e){return"function"!=typeof e.constructor||lo(e)?{}:La(Eo(e))},za=1,Ma=2,Ia=4,Ja="[object Arguments]",Ka="[object Function]",Ua="[object GeneratorFunction]",qa="[object Object]",Va={};Va[Ja]=Va["[object Array]"]=Va["[object ArrayBuffer]"]=Va["[object DataView]"]=Va["[object Boolean]"]=Va["[object Date]"]=Va["[object Float32Array]"]=Va["[object Float64Array]"]=Va["[object Int8Array]"]=Va["[object Int16Array]"]=Va["[object Int32Array]"]=Va["[object Map]"]=Va["[object Number]"]=Va[qa]=Va["[object RegExp]"]=Va["[object Set]"]=Va["[object String]"]=Va["[object Symbol]"]=Va["[object Uint8Array]"]=Va["[object Uint8ClampedArray]"]=Va["[object Uint16Array]"]=Va["[object Uint32Array]"]=!0,Va["[object Error]"]=Va[Ka]=Va["[object WeakMap]"]=!1;var Wa=function e(t,n,r,o,a,i){var s,u=n&za,c=n&Ma,l=n&Ia;if(r&&(s=a?r(t,o,a,i):r(t)),void 0!==s)return s;if(!Ct(t))return t;var f=dt(t);if(f){if(s=Zo(t),!u)return No(t,s)}else{var d=Go(t),v=d==Ka||d==Ua;if(eo(t))return Oo(t,u);if(d==qa||d==Ja||v&&!a){if(s=c||v?{}:Da(t),!u)return c?Co(t,wo(s,t)):Fo(t,ko(s,t))}else{if(!Va[d])return a?t:{};s=Ca(t,d,e,u)}}i||(i=new Qr);var h=i.get(t);if(h)return h;i.set(t,s);var y=l?c?Do:Lo:c?keysIn:mo,p=f?void 0:y(t);return Zr(p||t,function(o,a){p&&(o=t[a=o]),tr(s,a,e(o,n,r,a,t,i))}),s};var $a=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var Ga=function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(o);++r<o;)a[r]=e[r+t];return a};var Qa=function(e,t){return t.length<2?e:Yn(e,Ga(t,0,-1))};var Za=function(e,t){return t=Gn(t,e),null==(e=Qa(e,t))||delete e[Zn($a(t))]},Ya="[object Object]",Ha=Function.prototype,Xa=Object.prototype,ei=Ha.toString,ti=Xa.hasOwnProperty,ni=ei.call(Object);var ri=function(e){if(!St(e)||_t(e)!=Ya)return!1;var t=Eo(e);if(null===t)return!0;var n=ti.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ei.call(n)==ni};var oi=function(e){return ri(e)?void 0:e},ai=jr(function(e,t){var n={};if(null==e)return n;var r=!1;t=Kn(t,function(t){return t=Gn(t,e),r||(r=t.length>1),t}),Yr(e,Do(e),n),r&&(n=Wa(n,7,oi));for(var o=t.length;o--;)Za(n,t[o]);return n}),ii={};ii.save=function(e,n){var r=e.operations,o=e.value.data,a=e.tmp,i=a.save,s=a.merge;if(!1!==i){var u,c,l=o.get("undos")||t.List(),f=l.last(),d=f&&f.last();if(null==s&&(0!==r.size?s=!0:(u=n,s=!!(c=d)&&("set_selection"===u.type&&"set_selection"===c.type||"insert_text"===u.type&&"insert_text"===c.type&&u.offset===c.offset+c.text.length&&u.path.equals(c.path)||"remove_text"===u.type&&"remove_text"===c.type&&u.offset+u.text.length===c.offset&&u.path.equals(c.path)))),s&&f){var v=f.push(n);l=(l=l.pop()).push(v)}else{var h=t.List([n]);l=l.push(h)}l.size>100&&(l=l.takeLast(100)),e.withoutSaving(function(){var n=t.List(),r=o.set("undos",l).set("redos",n);e.setData(r)})}},ii.redo=function(e){var n=e.value.data,r=n.get("redos")||t.List(),o=n.get("undos")||t.List(),a=r.last();a&&e.withoutSaving(function(){e.withoutNormalizing(function(){a.forEach(function(t){var n=t,r=n.type,o=n.properties;"set_selection"===r&&(t=t.set("properties",ai(o,"isFocused"))),e.applyOperation(t)}),r=r.pop(),o=o.push(a);var t=n.set("undos",o).set("redos",r);e.setData(t)})})},ii.undo=function(e){var n=e.value.data,r=n.get("redos")||t.List(),o=n.get("undos")||t.List(),a=o.last();a&&e.withoutSaving(function(){e.withoutNormalizing(function(){a.slice().reverse().map(function(e){return e.invert()}).forEach(function(t){var n=t,r=n.type,o=n.properties;"set_selection"===r&&(t=t.set("properties",ai(o,"isFocused"))),e.applyOperation(t)}),r=r.push(a),o=o.pop();var t=n.set("undos",o).set("redos",r);e.setData(t)})})},ii.withoutMerging=function(e,t){var n=e.tmp.merge;e.tmp.merge=!1,t(e),e.tmp.merge=n},ii.withoutSaving=function(e,t){var n=e.tmp.save;e.tmp.save=!1,t(e),e.tmp.save=n};var si={};function ui(e,t){for(var n,r=arguments.length,o=Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];var i=(n=e.value.selection)[t].apply(n,o);e.select(i)}function ci(e,t,n,r){var o=t.slice(0,1).toUpperCase()+t.slice(1),a=n.slice(0,1).toUpperCase()+n.slice(1),i=r.slice(0,1).toUpperCase()+r.slice(1),s="move"+o+"To"+a+"OfNode",u="text"===r?"getNode":"getClosest"+i,c=e.value,l=c.document,f=c.selection[t],d=l[u](f.key);d&&e[s](d)}function li(e,t,n,r,o){var a=t.slice(0,1).toUpperCase()+t.slice(1),i=n.slice(0,1).toUpperCase()+n.slice(1),s=r.slice(0,1).toUpperCase()+r.slice(1),u=o.slice(0,1).toUpperCase()+o.slice(1),c="move"+a+"To"+i+"OfNode",l="text"===o?"getNode":"getClosest"+u,f="get"+s+u,d=e.value,v=d.document,h=d.selection[t],y=v[l](h.key);if(y){var p=v[f](y.key);p&&e[c](p)}}function fi(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){if(n<0)return di(e,t,-n);var r=t.slice(0,1).toUpperCase()+t.slice(1),o=e.value,a=o.document,i=o.selection,s=i[t],u=a.hasVoidParent(s.path,e);if(!u&&s.offset-n>=0){var c=i["move"+r+"Backward"](n);e.select(c)}else{var l=a.getPreviousText(s.path);if(l){var f=a.getClosestBlock(s.path).hasNode(l.key),d=l&&a.hasVoidParent(l.key,e);if(e["move"+r+"ToEndOfNode"](l),!u&&!d&&f){var v=e.value.selection["move"+r+"Backward"](n);e.select(v)}}}}}function di(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){if(n<0)return fi(e,t,-n);var r=t.slice(0,1).toUpperCase()+t.slice(1),o=e.value,a=o.document,i=o.selection,s=i[t],u=a.getNode(s.path),c=a.hasVoidParent(s.path,e);if(!c&&s.offset+n<=u.text.length){var l=i["move"+r+"Forward"](n);e.select(l)}else{var f=a.getNextText(s.path);if(f){var d=a.getClosestBlock(s.path).hasNode(f.key),v=a.hasVoidParent(f.key,e);if(e["move"+r+"ToStartOfNode"](f),!c&&!v&&d){var h=e.value.selection["move"+r+"Forward"](n);e.select(h)}}}}}function vi(e,t){var n=e.value,r=n.document,o=n.selection[t],a=r.getClosestBlock(o.key),i=a.getOffset(o.key)+o.offset,s=a.text,u=st.getWordOffsetBackward(s,i);e.command(fi,t,u>0?u:1)}function hi(e,t){var n=e.value,r=n.document,o=n.selection[t],a=r.getClosestBlock(o.key),i=a.getOffset(o.key)+o.offset,s=a.text,u=st.getWordOffsetForward(s,i);e.command(di,t,u>0?u:1)}si.blur=function(e){e.select({isFocused:!1})},si.deselect=function(e){var t=z.create();e.select(t)},si.focus=function(e){e.select({isFocused:!0})},si.flip=function(e){e.command(ui,"flip")},si.moveAnchorBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[fi,"anchor"].concat(n))},si.moveAnchorWordBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[vi,"anchor"].concat(n))},si.moveAnchorForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[di,"anchor"].concat(n))},si.moveAnchorWordForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[hi,"anchor"].concat(n))},si.moveAnchorTo=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveAnchorTo"].concat(n))},si.moveAnchorToEndOfBlock=function(e){e.command(ci,"anchor","end","block")},si.moveAnchorToEndOfInline=function(e){e.command(ci,"anchor","end","inline")},si.moveAnchorToEndOfDocument=function(e){e.moveAnchorToEndOfNode(e.value.document).moveToAnchor()},si.moveAnchorToEndOfNextBlock=function(e){e.command(li,"anchor","end","next","block")},si.moveAnchorToEndOfNextInline=function(e){e.command(li,"anchor","end","next","inline")},si.moveAnchorToEndOfNextText=function(e){e.command(li,"anchor","end","next","text")},si.moveAnchorToEndOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveAnchorToEndOfNode"].concat(n))},si.moveAnchorToEndOfPreviousBlock=function(e){e.command(li,"anchor","end","previous","block")},si.moveAnchorToEndOfPreviousInline=function(e){e.command(li,"anchor","end","previous","inline")},si.moveAnchorToEndOfPreviousText=function(e){e.command(li,"anchor","end","previous","text")},si.moveAnchorToEndOfText=function(e){e.command(ci,"anchor","end","text")},si.moveAnchorToStartOfBlock=function(e){e.command(ci,"anchor","start","block")},si.moveAnchorToStartOfDocument=function(e){e.moveAnchorToStartOfNode(e.value.document).moveToAnchor()},si.moveAnchorToStartOfInline=function(e){e.command(ci,"anchor","start","inline")},si.moveAnchorToStartOfNextBlock=function(e){e.command(li,"anchor","start","next","block")},si.moveAnchorToStartOfNextInline=function(e){e.command(li,"anchor","start","next","inline")},si.moveAnchorToStartOfNextText=function(e){e.command(li,"anchor","start","next","text")},si.moveAnchorToStartOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveAnchorToStartOfNode"].concat(n))},si.moveAnchorToStartOfPreviousBlock=function(e){e.command(li,"anchor","start","previous","block")},si.moveAnchorToStartOfPreviousInline=function(e){e.command(li,"anchor","start","previous","inline")},si.moveAnchorToStartOfPreviousText=function(e){e.command(li,"anchor","start","previous","text")},si.moveAnchorToStartOfText=function(e){e.command(ci,"anchor","start","text")},si.moveBackward=function(e){for(var t,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=e.moveAnchorBackward.apply(e,r)).moveFocusBackward.apply(t,r)},si.moveWordBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.moveFocusWordBackward.apply(e,n).moveToFocus()},si.moveEndBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[fi,"end"].concat(n))},si.moveEndWordBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[vi,"end"].concat(n))},si.moveEndForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[di,"end"].concat(n))},si.moveEndWordForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[hi,"end"].concat(n))},si.moveEndTo=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveEndTo"].concat(n))},si.moveEndToEndOfBlock=function(e){e.command(ci,"end","end","block")},si.moveEndToEndOfDocument=function(e){e.moveEndToEndOfNode(e.value.document).moveToEnd()},si.moveEndToEndOfInline=function(e){e.command(ci,"end","end","inline")},si.moveEndToEndOfNextBlock=function(e){e.command(li,"end","end","next","block")},si.moveEndToEndOfNextInline=function(e){e.command(li,"end","end","next","inline")},si.moveEndToEndOfNextText=function(e){e.command(li,"end","end","next","text")},si.moveEndToEndOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveEndToEndOfNode"].concat(n))},si.moveEndToEndOfPreviousBlock=function(e){e.command(li,"end","end","previous","block")},si.moveEndToEndOfPreviousInline=function(e){e.command(li,"end","end","previous","inline")},si.moveEndToEndOfPreviousText=function(e){e.command(li,"end","end","previous","text")},si.moveEndToEndOfText=function(e){e.command(ci,"end","end","text")},si.moveEndToStartOfBlock=function(e){e.command(ci,"end","start","block")},si.moveEndToStartOfDocument=function(e){e.moveEndToStartOfNode(e.value.document).moveToEnd()},si.moveEndToStartOfInline=function(e){e.command(ci,"end","start","inline")},si.moveEndToStartOfNextBlock=function(e){e.command(li,"end","start","next","block")},si.moveEndToStartOfNextInline=function(e){e.command(li,"end","start","next","inline")},si.moveEndToStartOfNextText=function(e){e.command(li,"end","start","next","text")},si.moveEndToStartOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveEndToStartOfNode"].concat(n))},si.moveEndToStartOfPreviousBlock=function(e){e.command(li,"end","start","previous","block")},si.moveEndToStartOfPreviousInline=function(e){e.command(li,"end","start","previous","inline")},si.moveEndToStartOfPreviousText=function(e){e.command(li,"end","start","previous","text")},si.moveEndToStartOfText=function(e){e.command(ci,"end","start","text")},si.moveFocusBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[fi,"focus"].concat(n))},si.moveFocusWordBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[vi,"focus"].concat(n))},si.moveFocusForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[di,"focus"].concat(n))},si.moveFocusWordForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[hi,"focus"].concat(n))},si.moveFocusTo=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveFocusTo"].concat(n))},si.moveFocusToEndOfBlock=function(e){e.command(ci,"focus","end","block")},si.moveFocusToEndOfDocument=function(e){e.moveFocusToEndOfNode(e.value.document).moveToFocus()},si.moveFocusToEndOfInline=function(e){e.command(ci,"focus","end","inline")},si.moveFocusToEndOfNextBlock=function(e){e.command(li,"focus","end","next","block")},si.moveFocusToEndOfNextInline=function(e){e.command(li,"focus","end","next","inline")},si.moveFocusToEndOfNextText=function(e){e.command(li,"focus","end","next","text")},si.moveFocusToEndOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveFocusToEndOfNode"].concat(n))},si.moveFocusToEndOfPreviousBlock=function(e){e.command(li,"focus","end","previous","block")},si.moveFocusToEndOfPreviousInline=function(e){e.command(li,"focus","end","previous","inline")},si.moveFocusToEndOfPreviousText=function(e){e.command(li,"focus","end","previous","text")},si.moveFocusToEndOfText=function(e){e.command(ci,"focus","end","text")},si.moveFocusToStartOfBlock=function(e){e.command(ci,"focus","start","block")},si.moveFocusToStartOfDocument=function(e){e.moveFocusToStartOfNode(e.value.document).moveToFocus()},si.moveFocusToStartOfInline=function(e){e.command(ci,"focus","start","inline")},si.moveFocusToStartOfNextBlock=function(e){e.command(li,"focus","start","next","block")},si.moveFocusToStartOfNextInline=function(e){e.command(li,"focus","start","next","inline")},si.moveFocusToStartOfNextText=function(e){e.command(li,"focus","start","next","text")},si.moveFocusToStartOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveFocusToStartOfNode"].concat(n))},si.moveFocusToStartOfPreviousBlock=function(e){e.command(li,"focus","start","previous","block")},si.moveFocusToStartOfPreviousInline=function(e){e.command(li,"focus","start","previous","inline")},si.moveFocusToStartOfPreviousText=function(e){e.command(li,"focus","start","previous","text")},si.moveFocusToStartOfText=function(e){e.command(ci,"focus","start","text")},si.moveForward=function(e){for(var t,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=e.moveAnchorForward.apply(e,r)).moveFocusForward.apply(t,r)},si.moveWordForward=function(e){for(var t,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=e.moveFocusWordForward.apply(e,r)).moveToFocus.apply(t,r)},si.moveStartBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[fi,"start"].concat(n))},si.moveStartWordBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[vi,"start"].concat(n))},si.moveStartForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[di,"start"].concat(n))},si.moveStartWordForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[hi,"start"].concat(n))},si.moveStartTo=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveStartTo"].concat(n))},si.moveStartToEndOfBlock=function(e){e.command(ci,"start","end","block")},si.moveStartToEndOfDocument=function(e){e.moveStartToEndOfNode(e.value.document).moveToStart()},si.moveStartToEndOfInline=function(e){e.command(ci,"start","end","inline")},si.moveStartToEndOfNextBlock=function(e){e.command(li,"start","end","next","block")},si.moveStartToEndOfNextInline=function(e){e.command(li,"start","end","next","inline")},si.moveStartToEndOfNextText=function(e){e.command(li,"start","end","next","text")},si.moveStartToEndOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveStartToEndOfNode"].concat(n))},si.moveStartToEndOfPreviousBlock=function(e){e.command(li,"start","end","previous","block")},si.moveStartToEndOfPreviousInline=function(e){e.command(li,"start","end","previous","inline")},si.moveStartToEndOfPreviousText=function(e){e.command(li,"start","end","previous","text")},si.moveStartToEndOfText=function(e){e.command(ci,"start","end","text")},si.moveStartToStartOfBlock=function(e){e.command(ci,"start","start","block")},si.moveStartToStartOfDocument=function(e){e.moveStartToStartOfNode(e.value.document).moveToStart()},si.moveStartToStartOfInline=function(e){e.command(ci,"start","start","inline")},si.moveStartToStartOfNextBlock=function(e){e.command(li,"start","start","next","block")},si.moveStartToStartOfNextInline=function(e){e.command(li,"start","start","next","inline")},si.moveStartToStartOfNextText=function(e){e.command(li,"start","start","next","text")},si.moveStartToStartOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveStartToStartOfNode"].concat(n))},si.moveStartToStartOfPreviousBlock=function(e){e.command(li,"start","start","previous","block")},si.moveStartToStartOfPreviousInline=function(e){e.command(li,"start","start","previous","inline")},si.moveStartToStartOfPreviousText=function(e){e.command(li,"start","start","previous","text")},si.moveStartToStartOfText=function(e){e.command(ci,"start","start","text")},si.moveTo=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveTo"].concat(n))},si.moveToAnchor=function(e){e.command(ui,"moveToAnchor")},si.moveToEnd=function(e){e.command(ui,"moveToEnd")},si.moveToEndOfBlock=function(e){e.moveEndToEndOfBlock().moveToEnd()},si.moveToEndOfDocument=function(e){e.moveEndToEndOfNode(e.value.document).moveToEnd()},si.moveToEndOfInline=function(e){e.moveEndToEndOfInline().moveToEnd()},si.moveToEndOfNextBlock=function(e){e.moveEndToEndOfNextBlock().moveToEnd()},si.moveToEndOfNextInline=function(e){e.moveEndToEndOfNextInline().moveToEnd()},si.moveToEndOfNextText=function(e){e.moveEndToEndOfNextText().moveToEnd()},si.moveToEndOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveToEndOfNode"].concat(n))},si.moveToEndOfPreviousBlock=function(e){e.moveStartToEndOfPreviousBlock().moveToStart()},si.moveToEndOfPreviousInline=function(e){e.moveStartToEndOfPreviousInline().moveToStart()},si.moveToEndOfPreviousText=function(e){e.moveStartToEndOfPreviousText().moveToStart()},si.moveToEndOfText=function(e){e.moveEndToEndOfText().moveToEnd()},si.moveToFocus=function(e){e.command(ui,"moveToFocus")},si.moveToRangeOfDocument=function(e){e.moveToRangeOfNode(e.value.document)},si.moveToRangeOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveToRangeOfNode"].concat(n))},si.moveToStart=function(e){e.command(ui,"moveToStart")},si.moveToStartOfBlock=function(e){e.moveStartToStartOfBlock().moveToStart()},si.moveToStartOfDocument=function(e){e.moveStartToStartOfNode(e.value.document).moveToStart()},si.moveToStartOfInline=function(e){e.moveStartToStartOfInline().moveToStart()},si.moveToStartOfNextBlock=function(e){e.moveEndToStartOfNextBlock().moveToEnd()},si.moveToStartOfNextInline=function(e){e.moveEndToStartOfNextInline().moveToEnd()},si.moveToStartOfNextText=function(e){e.moveEndToStartOfNextText().moveToEnd()},si.moveToStartOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveToStartOfNode"].concat(n))},si.moveToStartOfPreviousBlock=function(e){e.moveStartToStartOfPreviousBlock().moveToStart()},si.moveToStartOfPreviousInline=function(e){e.moveStartToStartOfPreviousInline().moveToStart()},si.moveToStartOfPreviousText=function(e){e.moveStartToStartOfPreviousText().moveToStart()},si.moveToStartOfText=function(e){e.moveStartToStartOfText().moveToStart()},si.select=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=z.createProperties(n);var o=r.snapshot,a=void 0!==o&&o,i=e.value,s=i.document,u=i.selection,c={},l=u.setProperties(n);for(var f in l=s.resolveSelection(l),n=Cr(l,Object.keys(n)))!0!==a&&t.is(n[f],u[f])||(c[f]=n[f]);if(u.marks&&!c.marks&&(c.anchor||c.focus)&&(c.marks=null),0!==Object.keys(c).length){var d=Cr(u.toJSON(),Object.keys(c));e.applyOperation({type:"set_selection",value:i,properties:d,newProperties:c},a?{skip:!1,merge:!1}:{})}},si.setAnchor=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"setAnchor"].concat(n))},si.setEnd=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"setEnd"].concat(n))},si.setFocus=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"setFocus"].concat(n))},si.setStart=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"setStart"].concat(n))},si.snapshotSelection=function(e){e.withoutMerging(function(){e.select(e.value.selection,{snapshot:!0})})};var yi={};function pi(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{onConstruct:function(t,n){for(var r in e)t.registerQuery(r);return n()},onQuery:function(t,n,r){var o=t.type,a=t.args,i=e[o];if(!i)return r();var s=i.apply(void 0,[n].concat(g(a)));return void 0===s?r():s}}}yi.setData=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.value,r=re.createProperties({data:t}),o=Cr(n,Object.keys(r));e.applyOperation({type:"set_value",properties:o,newProperties:r})},yi.addAnnotation=function(e,t){t=q.create(t),e.applyOperation({type:"add_annotation",annotation:t})},yi.removeAnnotation=function(e,t){t=q.create(t),e.applyOperation({type:"remove_annotation",annotation:t})},yi.setAnnotation=function(e,t,n){t=q.create(t),n=q.createProperties(n),e.applyOperation({type:"set_annotation",properties:t,newProperties:n})},yi.setAnnotations=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.value,r=re.createProperties({annotations:t}),o=Cr(n,Object.keys(r));e.applyOperation({type:"set_value",properties:o,newProperties:r})};var mi=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));for(var o in r.code=e,n)r[o]=n[o];return Error.captureStackTrace?Error.captureStackTrace(r,r.constructor):r.stack=(new Error).stack,r}return y(t,e),t}(Error);function ki(e){var t=e.rules,n=e.document,r=e.blocks,o=e.inlines,a=e.marks,i=e.annotations,s=e.decorations,u=[];if(t&&(u=u.concat(t)),n&&u.push(h({match:[{object:"document"}]},n)),r)for(var c in r)u.push(h({match:[{object:"block",type:c}]},r[c]));if(o)for(var l in o)u.push(h({match:[{object:"inline",type:l}]},o[l]));if(a)for(var f in a)u.push(h({match:[{object:"mark",type:f}]},a[f]));if(i)for(var d in i)u.push(h({match:[{object:"annotation",type:d}]},i[d]));if(s)for(var v in s)u.push(h({match:[{object:"decoration",type:v}]},s[v]));function y(e,t,n){var r=u.filter(function(t){return gi(e,t.match)}),o=bi(e,r,u,{every:!0});return o?new mi(o.code,o):n()}return[{normalizeNode:function(e,t,n){var r=y(e,0,function(){});return r?function(){var e=r.rule,n=t.operations.size;e.normalize&&e.normalize(t,r),t.operations.size===n&&function(e,t){var n=t.code,r=t.node,o=t.child,a=t.next,i=t.previous,s=t.key,u=t.mark;switch(n){case"child_max_invalid":case"child_object_invalid":case"child_type_invalid":case"child_unknown":case"first_child_object_invalid":case"first_child_type_invalid":case"last_child_object_invalid":case"last_child_type_invalid":return"text"===o.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key):e.removeNodeByKey(o.key);case"previous_sibling_object_invalid":case"previous_sibling_type_invalid":return"text"===i.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key):e.removeNodeByKey(i.key);case"next_sibling_object_invalid":case"next_sibling_type_invalid":return"text"===a.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key):e.removeNodeByKey(a.key);case"child_min_invalid":case"node_text_invalid":case"parent_object_invalid":case"parent_type_invalid":return"document"===r.object?r.nodes.forEach(function(t){return e.removeNodeByKey(t.key)}):e.removeNodeByKey(r.key);case"node_data_invalid":return void 0===r.data.get(s)&&"document"!==r.object?e.removeNodeByKey(r.key):e.setNodeByKey(r.key,{data:r.data.delete(s)});case"node_mark_invalid":return r.getTexts().forEach(function(t){return e.removeMarkByKey(t.key,0,t.text.length,u)});default:e.removeNodeByKey(r.key)}}(t,r)}:n()},validateNode:y},pi({isAtomic:function(e,t){var n=u.find(function(e){return"isAtomic"in e&&gi(t,e.match)});return n&&n.isAtomic},isVoid:function(e,t){var n=u.find(function(e){return"isVoid"in e&&gi(t,e.match)});return n&&n.isVoid}})]}function gi(e,t){return!bi(e,t)}function bi(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.every,a=void 0!==o&&o,i=r.match;if("function"==typeof t)return t(e,void 0===i?null:i)?null:Oi("node_invalid",{rule:t,node:e});if(Array.isArray(t)){var s=t.length?t:[{}],u=void 0,c=!0,f=!1,d=void 0;try{for(var v,h=s[Symbol.iterator]();!(c=(v=h.next()).done);c=!0){var y=bi(e,v.value,n);if(u=u||y,a&&y)return y;if(!a&&!y)return}}catch(e){f=!0,d=e}finally{try{!c&&h.return&&h.return()}finally{if(f)throw d}}return u}return function(e,t){if(null==t.object)return;if(t.object===e.object)return;if("function"==typeof t.object&&t.object(e.object))return;return Oi("node_object_invalid",{rule:t,node:e})}(e,t)||function(e,t){if(null==t.type)return;if(t.type===e.type)return;if("function"==typeof t.type&&t.type(e.type))return;return Oi("node_type_invalid",{rule:t,node:e})}(e,t)||function(e,t){if(null==t.data)return;if(null==e.data)return;if("function"==typeof t.data){if(t.data(e.data))return;return Oi("node_data_invalid",{rule:t,node:e})}for(var n in t.data){var r=t.data[n],o=e.data&&e.data.get(n),a="function"==typeof r?r(o):r===o;if(!a)return Oi("node_data_invalid",{rule:t,node:e,key:n,value:o})}}(e,t)||function(e,t){if(null==t.marks)return;var n="text"===e.object?e.marks.toArray():e.getMarks().toArray(),r=function(n){var r=t.marks.some(function(e){return"function"==typeof e.type?e.type(n.type):e.type===n.type});return r?"continue":{v:Oi("node_mark_invalid",{rule:t,node:e,mark:n})}},o=!0,a=!1,i=void 0;try{for(var s,u=n[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value,f=r(c);switch(f){case"continue":continue;default:if("object"===(void 0===f?"undefined":l(f)))return f.v}}}catch(e){a=!0,i=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw i}}}(e,t)||function(e,t){if(null==t.text)return;var n=e.text;if("function"==typeof t.text?t.text(n):t.text.test(n))return;return Oi("node_text_invalid",{rule:t,node:e,text:n})}(e,t)||function(e,t){if(null==t.first)return;var n=e.nodes.first();if(!n)return;var r=bi(n,t.first);if(!r)return;return r.rule=t,r.node=e,r.child=n,r.code=r.code.replace("node_","first_child_"),r}(e,t)||function(e,t){if(null==t.last)return;var n=e.nodes.last();if(!n)return;var r=bi(n,t.last);if(!r)return;return r.rule=t,r.node=e,r.child=n,r.code=r.code.replace("node_","last_child_"),r}(e,t)||function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(null==e.nodes)return;var r=e.nodes,o=null!=t.nodes?t.nodes.slice():[],a=0,i=0,s=null,u=-1,c=null,l=null,f=null,d=null,v=null;function h(){return 0!==o.length&&(c=o.shift(),i=a,a=0,s=c.min||null,l=c.max||null,!0)}function y(){return d=(u+=1)?r.get(u-1):null,f=r.get(u),v=r.get(u+1),!!f&&(i=a,a+=1,!0)}function p(){u>0&&(u-=1,a=i)}null!=t.nodes&&h();for(;y();){var m=Ai(e,f,n)||xi(e,f,d,u,n)||wi(e,f,v,u,n);if(m)return m;if(null!=t.nodes){if(!c)return Oi("child_unknown",{rule:t,node:e,child:f,index:u});if(c.match){var k=bi(f,c.match);if(k){if(null!=l&&a-1>l)return p(),Oi("child_max_invalid",{rule:t,node:e,index:u,child:r.get(u),count:a,limit:l});var g=s;if(h()){if(i-1>=g){u-=1;continue}return null==bi(f,c.match)?(p(),Oi("child_min_invalid",{rule:t,node:e,index:u,count:i-1,limit:g})):(k.rule=t,k.node=e,k.child=f,k.index=u,k.code=k.code.replace("node_","child_"),k)}return null!=l&&a>l?Oi("child_unknown",{rule:t,node:e,child:f,index:u}):(k.rule=t,k.node=e,k.child=f,k.index=u,k.code=k.code.replace("node_","child_"),k)}}}}if(null!=l&&a>l)return Oi("child_max_invalid",{rule:t,node:e,index:u-1,count:a,child:r.get(u-1),limit:l});if(null!=t.nodes)do{if(a<s)return Oi("child_min_invalid",{rule:t,node:e,index:u,count:a,limit:s})}while(h())}(e,t,n)}function Ai(e,t,n){var r=!0,o=!1,a=void 0;try{for(var i,s=n[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var u=i.value;if(null!=u.parent&&gi(t,u.match)){var c=bi(e,u.parent);if(c)return c.rule=u,c.parent=e,c.node=t,c.code=c.code.replace("node_","parent_"),c}}}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}}function xi(e,t,n,r,o){if(n){var a=!0,i=!1,s=void 0;try{for(var u,c=o[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var l=u.value;if(null!=l.previous&&gi(t,l.match)){var f=bi(n,l.previous);if(f)return f.rule=l,f.node=e,f.child=t,f.index=r,f.previous=n,f.code=f.code.replace("node_","previous_sibling_"),f}}}catch(e){i=!0,s=e}finally{try{!a&&c.return&&c.return()}finally{if(i)throw s}}}}function wi(e,t,n,r,o){if(n){var a=!0,i=!1,s=void 0;try{for(var u,c=o[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var l=u.value;if(null!=l.next&&gi(t,l.match)){var f=bi(n,l.next,[],{match:t});if(f)return f.rule=l,f.node=e,f.child=t,f.index=r,f.next=n,f.code=f.code.replace("node_","next_sibling_"),f}}}catch(e){i=!0,s=e}finally{try{!a&&c.return&&c.return()}finally{if(i)throw s}}}}function Oi(e,t){return h({code:e},t)}function Ni(e){e.value.selection.isExpanded&&e.delete()}var Ti={};Ti.addMark=function(e,t){t=C.create(t);var n=e.value,r=n.document,o=n.selection;if(o.isExpanded)e.addMarkAtRange(o,t);else if(o.marks){var a=o.marks.add(t),i=o.set("marks",a);e.select(i)}else{var s=r.getActiveMarksAtRange(o).add(t),u=o.set("marks",s);e.select(u)}},Ti.addMarks=function(e,t){t.forEach(function(t){return e.addMark(t)})},Ti.delete=function(e){var t=e.value.selection;e.deleteAtRange(t),e.moveToFocus()},Ti.deleteBackward=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=e.value.selection;n.isExpanded?e.delete():e.deleteBackwardAtRange(n,t)},Ti.deleteCharBackward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteCharBackwardAtRange(t)},Ti.deleteLineBackward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteLineBackwardAtRange(t)},Ti.deleteWordBackward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteWordBackwardAtRange(t)},Ti.deleteForward=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=e.value.selection;n.isExpanded?e.delete():e.deleteForwardAtRange(n,t)},Ti.deleteCharForward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteCharForwardAtRange(t)},Ti.deleteLineForward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteLineForwardAtRange(t)},Ti.deleteWordForward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteWordForwardAtRange(t)},Ti.insertBlock=function(e,t){Ni(e),t=te.create(t);var n=e.value.selection;e.insertBlockAtRange(n,t);var r=e.value.document.getNode(t.key);r&&e.moveToEndOfNode(r)},Ti.insertFragment=function(e,t){if(t.nodes.size){Ni(e);var n=e.value,r=n,o=r.document,a=r.selection,i=a.start,s=Array.from(o.texts(),function(e){return k(e,1)[0].key});e.insertFragmentAtRange(a,t);var u=(o=(n=e.value).document).getTexts().filter(function(e){return!s.includes(e.key)});if(0!==u.size){var c=t.text.length,l=o.getNode(i.key)||u.first(),f=u.last()||l;if(l!==f){var d=o.getCommonAncestor(l.key,f.key),v=d.getOffset(l.key)+(i.key===l.key?i.offset:0);f=d.getTextAtOffset(v+c-1)||f,e.moveTo(f.key,v+c-d.getOffset(f.key))}else e.moveTo(f.key,c)}}},Ti.insertInline=function(e,t){Ni(e),t=G.create(t);var n=e.value.selection;e.insertInlineAtRange(n,t);var r=e.value.document.getNode(t.key);r&&e.moveToEndOfNode(r)},Ti.insertText=function(e,t,n){Ni(e);var r=e.value,o=r.document,a=r.selection;n=n||a.marks||o.getInsertMarksAtRange(a),e.withoutNormalizing(function(){e.insertTextAtRange(a,t,n),a.marks&&o!==e.value.document&&e.select({marks:null})})},Ti.removeMark=function(e,t){t=C.create(t);var n=e.value,r=n.document,o=n.selection;if(o.isExpanded)e.removeMarkAtRange(o,t);else if(o.marks){var a=o.marks.remove(t),i=o.set("marks",a);e.select(i)}else{var s=r.getActiveMarksAtRange(o).remove(t),u=o.set("marks",s);e.select(u)}},Ti.replaceMark=function(e,t,n){e.removeMark(t),e.addMark(n)},Ti.setBlocks=function(e,t){var n=e.value.selection;e.setBlocksAtRange(n,t)},Ti.setInlines=function(e,t){var n=e.value.selection;e.setInlinesAtRange(n,t)},Ti.splitBlock=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;Ni(e);var n=e.value,r=n.selection,o=n.document,a=r.marks||o.getInsertMarksAtRange(r);e.splitBlockAtRange(r,t).moveToEnd(),a&&0!==a.size&&e.select({marks:a})},Ti.splitInline=function(e,t){Ni(e);var n=e.value.selection;e.splitInlineAtRange(n,t)},Ti.toggleMark=function(e,t){t=C.create(t),e.value.activeMarks.has(t)?e.removeMark(t):e.addMark(t)},Ti.unwrapBlock=function(e,t){var n=e.value.selection;e.unwrapBlockAtRange(n,t)},Ti.unwrapInline=function(e,t){var n=e.value.selection;e.unwrapInlineAtRange(n,t)},Ti.wrapBlock=function(e,t){var n=e.value.selection;e.wrapBlockAtRange(n,t)},Ti.wrapInline=function(e,t){var n=e.value.selection;e.wrapInlineAtRange(n,t)},Ti.wrapText=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=e.value.selection;e.wrapTextAtRange(r,t,n),r.isCollapsed&&e.moveStartBackward(t.length),e.moveEndBackward(n.length),r.isForward!==e.value.selection.isForward&&e.flip()};var _i=Me("slate:editor"),Si=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f(this,e);var o=r.controller,a=void 0===o?this:o,i=r.construct,s=void 0===i||i,u=n.onChange,c=void 0===u?function(){}:u,l=n.plugins,d=void 0===l?[]:l,v=n.readOnly,y=void 0!==v&&v,m=n.value,k=void 0===m?re.create():m;this.controller=a,this.middleware={},this.onChange=c,this.operations=t.List(),this.readOnly=null,this.value=null,this.tmp={dirty:[],flushing:!1,merge:null,normalize:!0,save:!0},function e(t,n){if(Array.isArray(n))return void n.forEach(function(n){return e(t,n)});if(null==n)return;var r=n.commands,o=n.queries,a=n.schema,i=p(n,["commands","queries","schema"]);if(r){var s=Qe(r);e(t,s)}if(o){var u=pi(o);e(t,u)}if(a){var c=ki(a);e(t,c)}for(var l in i){var f=i[l],d=t.middleware[l]=t.middleware[l]||[];d.push(f)}}(this,function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).plugins,t=void 0===e?[]:e,n=Qe(h({},ct,Rr,ii,si,yi,Ti)),r=pi({isAtomic:function(){return!1},isVoid:function(){return!1}});return[ki({rules:[{match:{object:"document"},nodes:[{match:{object:"block"}}]},{match:{object:"block",first:{object:"block"}},nodes:[{match:{object:"block"}}]},{match:{object:"block",first:[{object:"inline"},{object:"text"}]},nodes:[{match:[{object:"inline"},{object:"text"}]}]},{match:{object:"inline"},nodes:[{match:[{object:"inline"},{object:"text"}]}]},{match:[{object:"block"},{object:"inline"}],nodes:[{min:1}],normalize:function(e,t){var n=t.code,r=t.node;"child_min_invalid"===n&&r.nodes.isEmpty()&&e.insertNodeByKey(r.key,0,H.create())}},{match:{object:"block"},first:[{object:"block"},{object:"text"}],last:[{object:"block"},{object:"text"}],normalize:function(e,t){var n=t.code,r=t.node,o=H.create(),a=void 0;if("first_child_object_invalid"===n)a=0;else{if("last_child_object_invalid"!==n)return;a=r.nodes.size}e.insertNodeByKey(r.key,a,o)}},{match:{object:"inline"},first:[{object:"block"},{object:"text"}],last:[{object:"block"},{object:"text"}],previous:[{object:"block"},{object:"text"}],next:[{object:"block"},{object:"text"}],normalize:function(e,t){var n=t.code,r=t.node,o=t.index,a=H.create(),i=void 0;if("first_child_object_invalid"===n)i=0;else if("last_child_object_invalid"===n)i=r.nodes.size;else if("previous_sibling_object_invalid"===n)i=o;else{if("next_sibling_object_invalid"!==n)return;i=o+1}e.insertNodeByKey(r.key,i,a)}},{match:{object:"text"},next:function(e,t){return"text"!==e.object||!t.marks.equals(e.marks)},normalize:function(e,t){var n=t.code,r=t.next;"next_sibling_invalid"===n&&e.mergeNodeByKey(r.key)}},{match:{object:"text"},previous:function(e){return"text"!==e.object||""!==e.text},next:function(e){return"text"!==e.object||""!==e.text},normalize:function(e,t){var n=t.code,r=t.next,o=t.previous;"next_sibling_invalid"===n?e.removeNodeByKey(r.key):"previous_sibling_invalid"===n&&e.removeNodeByKey(o.key)}}]})].concat(g(t),[n,r])}({plugins:d})),s&&(this.run("onConstruct"),this.setReadOnly(y),this.setValue(k,r))}return d(e,[{key:"applyOperation",value:function(e){var t=this,n=this.operations,r=this.controller,a=this.value;o(e)&&(e=h({},e,{value:a})),e=We.create(e),this.withoutNormalizing(function(){r.save(e),a=t.value}),_i("apply",{operation:e}),this.value=e.apply(a),this.operations=n.push(e);var i=function(e){var t=e.type,n=e.node,r=e.path,o=e.newPath;switch(t){case"add_mark":case"insert_text":case"remove_mark":case"remove_text":case"set_mark":case"set_node":var a=P.getAncestors(r).toArray();return[].concat(g(a),[r]);case"insert_node":var i=n.getKeysToPathsTable(),s=Object.values(i).map(function(e){return r.concat(e)}),u=P.getAncestors(r).toArray();return[].concat(g(u),[r],g(s));case"split_node":var c=P.getAncestors(r).toArray(),l=P.increment(r);return[].concat(g(c),[r,l]);case"merge_node":var f=P.getAncestors(r).toArray(),d=P.decrement(r);return[].concat(g(f),[d]);case"move_node":if(P.isEqual(r,o))return[];var v=P.getAncestors(r).reduce(function(t,n){return t.push.apply(t,g(P.transform(n,e).toArray())),t},[]),h=P.getAncestors(o).reduce(function(t,n){return t.push.apply(t,g(P.transform(n,e).toArray())),t},[]);return[].concat(g(v),g(h));case"remove_node":var y=P.getAncestors(r).toArray();return[].concat(g(y));default:return[]}}(e),s=this.tmp.dirty.map(function(t){return t=P.create(t),P.transform(t,e).toArray()}),u={},c=Array.prototype.concat.apply(i,s);return this.tmp.dirty=[],c.forEach(function(e){var n=e.join(",");u[n]||t.tmp.dirty.push(e),u[n]=!0}),this.tmp.flushing||(this.tmp.flushing=!0,Promise.resolve().then(function(){return t.flush()})),r}},{key:"flush",value:function(){this.run("onChange");var e=this.value,n=this.operations,r=this.controller,o={value:e,operations:n};return this.operations=t.List(),this.tmp.flushing=!1,this.onChange(o),r}},{key:"command",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=this.controller;if("function"==typeof e)return e.apply(void 0,[o].concat(n)),Pi(this),o;_i("command",{type:e,args:n});var a={type:e,args:n};return this.run("onCommand",a),Pi(this),o}},{key:"hasCommand",value:function(e){var t=this.controller;return e in t&&t[e].__command}},{key:"hasQuery",value:function(e){var t=this.controller;return e in t&&t[e].__query}},{key:"normalize",value:function(){var e=this.value,t=this.controller,n=e.document,r=n.getKeysToPathsTable(),o=Object.values(r).map(P.create);this.tmp.dirty=this.tmp.dirty.concat(o),Pi(this);var a=e.selection;return n=e.document,a.isUnset&&n.nodes.size&&t.moveToStartOfDocument(),t}},{key:"query",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=this.controller;if("function"==typeof e)return e.apply(void 0,[o].concat(n));_i("query",{type:e,args:n});var a={type:e,args:n};return this.run("onQuery",a)}},{key:"registerCommand",value:function(e){var t=this,n=this.controller;if(e in n&&n[e].__command)return n;Q(!(e in n));var r=function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.command.apply(t,[e].concat(r))};return n[e]=r,r.__command=!0,n}},{key:"registerQuery",value:function(e){var t=this,n=this.controller;if(e in n&&n[e].__query)return n;Q(!(e in n));var r=function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.query.apply(t,[e].concat(r))};return n[e]=r,r.__query=!0,n}},{key:"run",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=this.controller,a=this.middleware[e]||[],i=0;function s(){var e=a[i++];if(e){for(var t=arguments.length,r=Array(t),u=0;u<t;u++)r[u]=arguments[u];return r.length&&(n=r),e.apply(void 0,g(n).concat([o,s]))}}return Object.defineProperty(s,"change",{get:function(){Q(!1)}}),Object.defineProperty(s,"onChange",{get:function(){Q(!1)}}),Object.defineProperty(s,"props",{get:function(){Q(!1)}}),Object.defineProperty(s,"schema",{get:function(){Q(!1)}}),Object.defineProperty(s,"stack",{get:function(){Q(!1)}}),s()}},{key:"setReadOnly",value:function(e){return this.readOnly=e,this}},{key:"setValue",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).normalize,n=void 0===t?e!==this.value:t;return this.value=e,n&&this.normalize(),this}},{key:"withoutNormalizing",value:function(e){var t=this.controller,n=this.tmp.normalize;return this.tmp.normalize=!1,e(t),this.tmp.normalize=n,Pi(this),t}},{key:"change",value:function(e){a();for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.apply(void 0,[this.controller].concat(n))}},{key:"call",value:function(e){a();for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,[this.controller].concat(n)),this.controller}},{key:"applyOperations",value:function(e){var t=this;return a(),e.forEach(function(e){return t.applyOperation(e)}),this.controller}},{key:"setOperationFlag",value:function(e,t){return a(),this.tmp[e]=t,this}},{key:"getFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(),void 0!==t[e]?t[e]:this.tmp[e]}},{key:"unsetOperationFlag",value:function(e){return a(),delete this.tmp[e],this}},{key:"withoutNormalization",value:function(e){return a(),this.withoutNormalizing(e)}},{key:"editor",get:function(){return a(),this.controller}}]),e}();function Pi(e){e.tmp.normalize&&e.tmp.dirty.length&&e.withoutNormalizing(function(){for(;e.tmp.dirty.length;){var t=e.tmp.dirty.pop();Bi(e,t)}})}function Bi(e,t){for(var n=e.controller,r=e.value,o=r.document,a=o.assertNode(t),i=0,s=100+("text"===a.object?1:a.nodes.size);a;){var u=a.normalize(n);if(!u)break;u(n),o=(r=e.value).document;var c=a.key,l=o.getDescendant(t);if(l&&l.key===c)a=l;else{if(!(l=o.getDescendant(c)))break;a=l,t=o.getPath(c)}if(++i>s)throw new Error("A schema rule could not be normalized after sufficient iterations. This is usually due to a `rule.normalize` or `plugin.normalizeNode` function of a schema being incorrectly written, causing an infinite loop.")}}var Fi={marks:void 0,text:void 0},Ei=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"updateMark",value:function(e,t){var n=this.marks;if(t.equals(e))return this;if(!n.has(e))return this;var r=n.withMutations(function(n){n.remove(e).add(t)});return this.set("marks",r)}},{key:"addMark",value:function(e){var t=this.marks;return this.set("marks",t.add(e))}},{key:"addMarks",value:function(e){var t=this.marks;return this.set("marks",t.union(e))}},{key:"insertText",value:function(e,t){var n=this.text,r=n.slice(0,e)+t+n.slice(e);return this.set("text",r)}},{key:"removeMark",value:function(e){var t=this.marks;return this.set("marks",t.remove(e))}},{key:"toJSON",value:function(){return{object:this.object,text:this.text,marks:this.marks.toArray().map(function(e){return e.toJSON()})}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(a(),n.isLeaf(e))return e;if("string"==typeof e&&(e={text:e}),o(e))return n.fromJSON(e);throw new Error("`Leaf.create` only accepts objects, strings or leaves, but you passed it: "+e)}},{key:"createLeaves",value:function(e){if(e.size<=1)return e;var n=!1,r=t.List().withMutations(function(t){e.findLast(function(e,r){var o=t.first();if(o){if(o.marks.equals(e.marks))return n=!0,void t.set(0,o.set("text",""+e.text+o.text));if(""===o.text)return n=!0,void t.set(0,e);if(""===e.text)return void(n=!0)}t.unshift(e)})});return n?r:e}},{key:"splitLeaves",value:function(e,n){if(n<0)return[t.List(),e];if(0===e.size)return[t.List(),t.List()];var r=0,o=-1,a=void 0,i=void 0;return e.find(function(e){o++;var t=r,s=e.text;if((r+=s.length)<n)return!1;if(t>n)return!1;var u=n-t;return a=e.set("text",s.slice(0,u)),i=e.set("text",s.slice(u)),!0}),a?""===a.text?0===o?[t.List.of(a),e]:[e.take(o),e.skip(o)]:""===i.text?o===e.size-1?[e,t.List.of(i)]:[e.take(o+1),e.skip(o+1)]:[e.take(o).push(a),e.skip(o+1).unshift(i)]:[e,t.List()]}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Leaf.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.text,o=void 0===r?"":r,a=e.marks,i=void 0===a?[]:a;return new n({text:o,marks:t.Set(i.map(C.fromJSON))})}},{key:"isLeafList",value:function(e){return t.List.isList(e)&&e.every(function(e){return n.isLeaf(e)})}}]),n}(t.Record(Fi));function ji(e,t){var n=!0,r=!1,o=void 0;try{for(var a,i=t[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value,u=!0,c=!1,l=void 0;try{for(var f,d=Object.getOwnPropertyNames(e)[Symbol.iterator]();!(u=(f=d.next()).done);u=!0){var v=f.value;if(!s.hasOwnProperty(v)){var h=Object.getOwnPropertyDescriptor(e,v);Object.defineProperty(s,v,h)}}}catch(e){c=!0,l=e}finally{try{!u&&d.return&&d.return()}finally{if(c)throw l}}var y=!0,p=!1,m=void 0;try{for(var k,g=Object.getOwnPropertyNames(e.prototype)[Symbol.iterator]();!(y=(k=g.next()).done);y=!0){var b=k.value;if(!s.prototype.hasOwnProperty(b)){h=Object.getOwnPropertyDescriptor(e.prototype,b);Object.defineProperty(s.prototype,b,h)}}}catch(e){p=!0,m=e}finally{try{!y&&g.return&&g.return()}finally{if(p)throw m}}}}catch(e){r=!0,o=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}}Object.entries({Annotation:q,Block:te,Change:Ge,Decoration:L,Document:W,Editor:Si,Inline:G,Leaf:Ei,Mark:C,Node:X,Operation:We,Point:F,Range:K,Selection:z,Text:H,Value:re}).forEach(function(e){var t,n,r,o,a=k(e,2),i=a[0],s=a[1];return ji((t=i.toLowerCase(),n=M[t],r="is"+t.charAt(0).toUpperCase()+t.slice(1),(o=function(){function e(){f(this,e)}return d(e,[{key:"object",get:function(){return t}}]),e}())[r]=I.bind(null,t),o.prototype[n]=!0,o),[s])}),ji(function(){function e(){f(this,e)}return d(e,[{key:"toJS",value:function(){return this.toJSON.apply(this,arguments)}}],[{key:"fromJS",value:function(){return this.fromJSON.apply(this,arguments)}}]),e}(),[q,te,L,W,G,Ei,C,X,We,F,K,z,H,re]);var Ci=!0,Ri=Symbol("LEAF"),Li=Symbol("STORE_KEY"),Di=Symbol("undefined"),zi=Symbol("null"),Mi=void 0,Ii=new WeakMap;function Ji(e,t){var n=function(t){var n=e[t];if(!n)throw new Error('Object does not have a property named "'+t+'".');e[t]=function(){for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];if(!Ci)return n.apply(this,r);Ii.has(this)||Ii.set(this,{noArgs:{},hasArgs:{}});var a=Ii.get(this),i=a.noArgs,s=a.hasArgs,u=0!==r.length,c=void 0,f=void 0;if((c=u?function(e,t){var n=!0,r=!1,o=void 0;try{for(var a,i=t[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value;if(void 0===s?s=Di:null==s&&(s=zi),(e="object"===(void 0===s?"undefined":l(s))?e[Li]&&e[Li].get(s):e[s])===Mi)return Mi}}catch(e){r=!0,o=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}return e[Ri]}(s,f=[t].concat(r)):i[t])!==Mi)return c===Di?void 0:c;var d=n.apply(this,r),v=void 0===d?Di:d;return u?function(e,t,n){var r=e,o=!0,a=!1,i=void 0;try{for(var s,u=t[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value;if(void 0===c?c=Di:null==c&&(c=zi),"object"===(void 0===c?"undefined":l(c)))if(r[Li]||(r[Li]=new WeakMap),r[Li].has(c))r=r[Li].get(c);else{var f={};r[Li].set(c,f),r=f}else r[c]||(r[c]={}),r=r[c]}}catch(e){a=!0,i=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw i}}r[Ri]=n}(s,f,v):i[t]=v,d}},r=!0,o=!1,a=void 0;try{for(var i,s=t[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){n(i.value)}}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}}function Ki(){Ii=new WeakMap}function Ui(e){Ci=e}var qi,Vi,Wi=function(){function e(){f(this,e)}return d(e,[{key:"getFirstText",value:function(){if("text"===this.object)return this;var e=null,t=this.nodes.find(function(t){return"text"===t.object||!!(e=t.getFirstText())});return e||t}},{key:"getKeysToPathsTable",value:function(){var e=v({},this.key,[]);return this.nodes&&this.nodes.forEach(function(t,n){var r=t.getKeysToPathsTable();for(var o in r){var i=r[o];a(),e[o]=[n].concat(g(i))}}),e}},{key:"getLastText",value:function(){if("text"===this.object)return this;var e=null,t=this.nodes.findLast(function(t){return"text"===t.object||(e=t.getLastText())});return e||t}},{key:"getNode",value:function(e){return(e=this.resolvePath(e))?"text"===this.object&&e.size?null:e.size?this.getDescendant(e):this:null}},{key:"getPath",value:function(e){if(t.List.isList(e))return e;if(X.isNode(e)&&this.descendants){var n=!0,r=!1,o=void 0;try{for(var a,i=this.descendants()[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value,u=k(s,2),c=u[0],l=u[1];if(e===c)return l}}catch(e){r=!0,o=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}}var f=this.getKeysToPathsTable()[e];return f?t.List(f):null}},{key:"getText",value:function(){return"text"===this.object?this.text:this.nodes.reduce(function(e,t){return e+t.text},"")}},{key:"hasNode",value:function(e){return!!this.getNode(e)}},{key:"normalize",value:function(e){return e.run("normalizeNode",this)}},{key:"regenerateKey",value:function(){var e=c.create();return this.set("key",e)}},{key:"resolvePath",value:function(e,t){return"string"==typeof e?(e=this.getPath(e),null!=t&&(e=e.concat(t))):e=P.create(e),e}},{key:"validate",value:function(e){return e.run("validateNode",this)}}]),e}();Ji(Wi.prototype,["getFirstText","getKeysToPathsTable","getLastText","getText","normalize","validate"]),ji(Wi,[te,W,G,H]),qi=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]"),Vi=new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]*[֑-߿יִ-﷽ﹰ-ﻼ]");var $i=function(e){return e=e.toString(),Vi.test(e)?"rtl":qi.test(e)?"ltr":"neutral"};function Gi(){return!0}var Qi=function(){function e(){f(this,e)}return d(e,[{key:"addMark",value:function(e,t){e=this.resolvePath(e);var n=this.assertDescendant(e);return n=n.addMark(t),this.replaceNode(e,n)}},{key:"ancestors",value:function(e){return this.createIterable({path:e,direction:null,downward:!1,includeTargetAncestors:!0,includeRoot:!0})}},{key:"blocks",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onlyLeaves,n=e.onlyRoots,r=e.onlyTypes,o=e.match,a=p(e,["onlyLeaves","onlyRoots","onlyTypes","match"]);return this.descendants(h({includeDocument:!1,includeInlines:!1,includeTexts:!1},a,{match:function(e,a){return!(r&&!r.includes(e.type))&&((!n||1===a.size)&&(!(t&&!e.isLeafBlock())&&!(o&&!o(e,a))))}}))}},{key:"createAnnotation",value:function(e){return e=q.createProperties(e),this.resolveAnnotation(e)}},{key:"createDecoration",value:function(e){return e=L.createProperties(e),this.resolveDecoration(e)}},{key:"createIterable",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.direction,n=void 0===t?"forward":t,r=e.downward,o=void 0===r||r,a=e.upward,i=void 0===a||a,s=e.includeBlocks,u=void 0===s||s,c=e.includeDocument,l=void 0===c||c,f=e.includeInlines,d=void 0===f||f,h=e.includeRoot,y=void 0!==h&&h,p=e.includeTarget,m=void 0===p?!!e.range:p,k=e.includeTargetAncestors,g=void 0!==k&&k,b=e.includeTexts,A=void 0===b||b,x=e.match,w=void 0===x?null:x,O=this,N=null,T=null;e.range?(T=O.resolveRange(e.range),N=O.resolvePath(T.start.path)):e.path&&(N=O.resolvePath(e.path));var _=N&&O.assertNode(N),S="undefined"==typeof window?oe.Set:window.Set;return v({},Symbol.iterator,function(){var e=new S,t=T&&T.start.path,r=T&&T.end.path,a=N,s=_,c=!1,f=!1,v=!1,h=function(){return a&&s?(y||s!==O)&&(u||"block"!==s.object)&&(l||"document"!==s.object)&&(d||"inline"!==s.object)&&(A||"text"!==s.object)?w&&!w(s,a)?p():{value:[s,a],done:!1}:p():{done:!0}},p=function u(){if(!a||!s)return h();if(t&&!f)return v?a.size===t.size-1?(f=!0,a=N,s=_,u()):(a=t.slice(0,a.size+1),s=O.assertNode(a),h()):(v=!0,a=P.create([]),s=O,h());if(m&&!c)return c=!0,h();if(r&&a.equals(r))return s=null,a=null,u();if(o&&s.nodes&&s.nodes.size&&!e.has(s)){e.add(s);var l="forward"===n?0:s.nodes.size-1;return a=a.push(l),s=O.assertNode(a),h()}if("forward"===n){var d=P.increment(a),y=O.getNode(d);if(y)return a=d,s=y,h()}if("backward"===n&&0!==a.last()){var p=P.decrement(a),k=O.getNode(p);if(k)return a=p,s=k,h()}return i&&a.size?(a=P.lift(a),s=O.assertNode(a),e.has(s)?u():(e.add(s),g?h():u())):(a=null,s=null,u())};return{next:p}})}},{key:"createPoint",value:function(e){return e=F.createProperties(e),this.resolvePoint(e)}},{key:"createRange",value:function(e){return e=K.createProperties(e),this.resolveRange(e)}},{key:"createSelection",value:function(e){return e=z.createProperties(e),this.resolveSelection(e)}},{key:"descendants",value:function(e){return this.createIterable(h({path:[]},e))}},{key:"filterDescendants",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gi,n=[],r=!0,o=!1,a=void 0;try{for(var i,s=this.descendants()[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var u=i.value,c=k(u,2),l=c[0];e(l,c[1])&&n.push(l)}}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}return t.List(n)}},{key:"findDescendant",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gi,t=!0,n=!1,r=void 0;try{for(var o,a=this.descendants()[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=o.value,s=k(i,2),u=s[0];if(e(u,s[1]))return u}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}return null}},{key:"forEachDescendant",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gi,t=!0,n=!1,r=void 0;try{for(var o,a=this.descendants()[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=o.value;if(!1===e.apply(void 0,g(i)))return}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}}},{key:"getActiveMarksAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)return t.Set();if(e.isCollapsed){var n=e.start;return this.getInsertMarksAtPoint(n)}var r=e,o=r.start,a=r.end,i=o.path,s=o.offset,u=a.path,c=a.offset,l=this.getDescendant(i),f=this.getDescendant(u);if(!i.equals(u)){for(;!i.equals(u)&&0===c;){var d=this.texts({path:u,direction:"backward"}),v=k(d,1),h=k(v[0],2);f=h[0],u=h[1],c=f.text.length}for(;!i.equals(u)&&s===l.text.length;){var y=this.texts({path:i}),p=k(y,1),m=k(p[0],2);l=m[0],i=m[1],s=0}}if(i.equals(u))return l.marks;var g=l.marks;if(0===g.size)return t.Set();var b=f.marks,A=g.intersect(b);if(0===A.size)return A;var x=this.texts({path:i}),w=k(x,1),O=k(w[0],2);for(l=O[0],i=O[1];!i.equals(u);){if(0!==l.text.length&&0===(A=A.intersect(l.marks)).size)return t.Set();var N=this.texts({path:i}),T=k(N,1),_=k(T[0],2);l=_[0],i=_[1]}return A}},{key:"getAncestors",value:function(e){var n=this.ancestors(e),r=Array.from(n,function(e){return k(e,1)[0]}).reverse();return t.List(r)}},{key:"getBlocks",value:function(){var e=this.blocks({onlyLeaves:!0}),n=Array.from(e,function(e){return k(e,1)[0]});return t.List(n)}},{key:"getBlocksByType",value:function(e){var n=this.blocks({onlyLeaves:!0,onlyTypes:[e]}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getChild",value:function(e){return!(e=this.resolvePath(e))||e.size>1?null:this.nodes.get(e.first())}},{key:"getClosest",value:function(e,t){var n=!0,r=!1,o=void 0;try{for(var a,i=this.ancestors(e)[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value,u=k(s,2),c=u[0];if(t(c,u[1]))return c}}catch(e){r=!0,o=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}return null}},{key:"getClosestBlock",value:function(e){return this.getClosest(e,function(e){return"block"===e.object})}},{key:"getClosestInline",value:function(e){return this.getClosest(e,function(e){return"inline"===e.object})}},{key:"getClosestVoid",value:function(e,t){return Q(!re.isValue(t)),this.getClosest(e,function(e){return t.isVoid(e)})}},{key:"getCommonAncestor",value:function(e,t){if(e=this.resolvePath(e),t=this.resolvePath(t),!e||!t)return null;var n=P.relate(e,t);return this.getNode(n)}},{key:"getDecorations",value:function(e){var t=e.run("decorateNode",this);return t=L.createList(t)}},{key:"getDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(e=this.resolvePath(e))&&this.getNode(e)?e.size-1+t:null}},{key:"getDescendant",value:function(e){if(!(e=this.resolvePath(e))||!e.size)return null;var t=this;return e.forEach(function(e){return!!(t=t.getIn(["nodes",e]))}),t}},{key:"getDescendantsAtRange",value:function(e){var n=this.descendants({range:e}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getFragmentAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)return W.create();for(var t=e,n=t.start,r=t.end,o=this,a=r.path,i=r.offset,s="end";a.size;){var u=a.last();o=o.splitNode(a,i),i=u+1,(a=P.lift(a)).size||"end"!==s||(a=n.path,i=n.offset,s="start")}var c=n.path.first()+1,l=r.path.first()+2,f=o.nodes.slice(c,l);return W.create({nodes:f})}},{key:"getFurthest",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gi,n=this.ancestors(e),r=Array.from(n).reverse(),o=!0,a=!1,i=void 0;try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value,l=k(c,2),f=l[0];if(t(f,l[1]))return f}}catch(e){a=!0,i=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw i}}return null}},{key:"getFurthestBlock",value:function(e){return this.getFurthest(e,function(e){return"block"===e.object})}},{key:"getFurthestChild",value:function(e){return(e=this.resolvePath(e))&&e.size?this.nodes.get(e.first()):null}},{key:"getFurthestInline",value:function(e){return this.getFurthest(e,function(e){return"inline"===e.object})}},{key:"getInlines",value:function(){var e=this.inlines({onlyLeaves:!0}),n=Array.from(e,function(e){return k(e,1)[0]});return t.List(n)}},{key:"getInlinesByType",value:function(e){var n=this.inlines({onlyLeaves:!0,onlyTypes:[e]}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getInsertMarksAtPoint",value:function(e){var t=e=this.resolvePoint(e),n=t.path,r=t.offset,o=this.getDescendant(n);if(0!==r)return o.marks;var a=void 0,i=void 0,s=!0,u=!1,c=void 0;try{for(var l,f=this.ancestors(n)[Symbol.iterator]();!(s=(l=f.next()).done);s=!0){var d=l.value,v=k(d,2),h=v[0],y=v[1];"block"===h.object&&(a=h,i=y)}}catch(e){u=!0,c=e}finally{try{!s&&f.return&&f.return()}finally{if(u)throw c}}var p=P.drop(n,i.size),m=a.texts({path:p,direction:"backward"}),g=k(m,1)[0];return g?k(g,1)[0].marks:o.marks}},{key:"getInsertMarksAtRange",value:function(e){var n=(e=this.resolveRange(e)).start;return e.isUnset?t.Set():e.isCollapsed?this.getInsertMarksAtPoint(n):this.getDescendant(n.path).marks}},{key:"getLeafBlocksAtRange",value:function(e){var n=this.blocks({range:e,onlyLeaves:!0}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getLeafInlinesAtRange",value:function(e){var n=this.inlines({range:e,onlyLeaves:!0}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getNodesToPathsMap",value:function(){var e="undefined"==typeof window?new oe.Map:new window.Map;return e.set(this,P.create([])),this.forEachDescendant(function(t,n){e.set(t,n)}),e}},{key:"getMarks",value:function(){var e=this.marks(),n=Array.from(e,function(e){return k(e,1)[0]});return t.OrderedSet(n)}},{key:"getMarksAtRange",value:function(e){var n=this.marks({range:e}),r=Array.from(n,function(e){return k(e,1)[0]});return t.OrderedSet(r)}},{key:"getMarksByType",value:function(e){var n=this.marks({onlyTypes:[e]}),r=Array.from(n,function(e){return k(e,1)[0]});return t.OrderedSet(r)}},{key:"getNextBlock",value:function(e){var t=this.blocks({path:e,onlyLeaves:!0}),n=k(t,1)[0];return n?n[0]:null}},{key:"getNextNode",value:function(e){var t=this.createIterable({path:e,downward:!1}),n=k(t,1)[0];return n?n[0]:null}},{key:"getNextSibling",value:function(e){var t=this.siblings(e),n=k(t,1)[0];return n?n[0]:null}},{key:"getNextText",value:function(e){var t=this.texts({path:e}),n=k(t,1)[0];return n?n[0]:null}},{key:"getOffset",value:function(e){e=this.resolvePath(e),this.assertDescendant(e);var t=e.first(),n=this.nodes.slice(0,t).reduce(function(e,t){return e+t.text.length},0);return 1===e.size?n:n+this.nodes.get(t).getOffset(P.drop(e))}},{key:"getOffsetAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)throw new Error("The range cannot be unset to calculcate its offset.");if(e.isExpanded)throw new Error("The range must be collapsed to calculcate its offset.");var t=e.start;return this.getOffset(t.path)+t.offset}},{key:"getParent",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=P.lift(e);return this.getNode(t)}},{key:"getPreviousBlock",value:function(e){var t=this.blocks({path:e,onlyLeaves:!0,direction:"backward"}),n=k(t,1)[0];return n?n[0]:null}},{key:"getPreviousNode",value:function(e){var t=this.createIterable({path:e,downward:!1,direction:"backward"}),n=k(t,1)[0];return n?n[0]:null}},{key:"getPreviousSibling",value:function(e){var t=this.siblings(e,{direction:"backward"}),n=k(t,1)[0];return n?n[0]:null}},{key:"getPreviousText",value:function(e){var t=this.texts({path:e,direction:"backward"}),n=k(t,1)[0];return n?n[0]:null}},{key:"getRootBlocksAtRange",value:function(e){var n=this.blocks({range:e,onlyRoots:!0}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getRootInlinesAtRange",value:function(e){var n=this.inlines({range:e,onlyRoots:!0}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getTextAtOffset",value:function(e){if(0===e)return this.getFirstText();if(e===this.text.length)return this.getLastText();if(e<0||e>this.text.length)return null;var t=0,n=!0,r=!1,o=void 0;try{for(var a,i=this.texts()[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value,u=k(s,1)[0];if((t+=u.text.length)>e)return u}}catch(e){r=!0,o=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}return null}},{key:"getTextDirection",value:function(){var e=$i(this.text);return"neutral"===e?null:e}},{key:"getTexts",value:function(){var e=this.texts(),n=Array.from(e,function(e){return k(e,1)[0]});return t.List(n)}},{key:"getTextsAtRange",value:function(e){var n=this.texts({range:e}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"hasBlockChildren",value:function(){return!(!this.nodes||!this.nodes.find(function(e){return"block"===e.object}))}},{key:"hasChild",value:function(e){return!!this.getChild(e)}},{key:"hasInlineChildren",value:function(){return!(!this.nodes||!this.nodes.find(function(e){return"inline"===e.object||"text"===e.object}))}},{key:"hasDescendant",value:function(e){return!!this.getDescendant(e)}},{key:"hasVoidParent",value:function(e,t){return Q(!re.isValue(t)),!!this.getClosestVoid(e,t)}},{key:"inlines",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onlyLeaves,r=t.onlyRoots,o=t.onlyTypes,a=t.match,i=p(t,["onlyLeaves","onlyRoots","onlyTypes","match"]);return this.descendants(h({includeBlocks:!1,includeTexts:!1,includeDocument:!1},i,{match:function(t,i){return!(o&&!o.includes(t.type))&&(!(n&&!t.isLeafInline())&&((!r||"block"===e.getParent(i).object)&&!(a&&!a(t,i))))}}))}},{key:"insertNode",value:function(e,t){var n=(e=this.resolvePath(e)).last(),r=P.lift(e),o=this.assertNode(r),a=o.nodes.splice(n,0,t);return o=o.set("nodes",a),this.replaceNode(r,o)}},{key:"insertText",value:function(e,t,n){e=this.resolvePath(e);var r=this.assertDescendant(e);return r=r.insertText(t,n),this.replaceNode(e,r)}},{key:"isLeafBlock",value:function(){return"block"===this.object&&!this.nodes.some(function(e){return"block"===e.object})}},{key:"isLeafInline",value:function(){return"inline"===this.object&&!this.nodes.some(function(e){return"inline"===e.object})}},{key:"isInRange",value:function(e,t){if(e=this.resolvePath(e),(t=this.resolveRange(t)).isUnset)return!1;var n=P.compare(e,t.start.path),r=P.compare(e,t.end.path),o=-1!==n&&1!==r;return o}},{key:"mapChildren",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gi,n=this.nodes;return n.forEach(function(r,o){var a=t(r,o,e.nodes);a!==r&&(n=n.set(a.key,a))}),this.set("nodes",n)}},{key:"mapDescendants",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gi,n=this.nodes;return n.forEach(function(r,o){var a=r;"text"!==a.object&&(a=a.mapDescendants(t)),(a=t(a,o,e.nodes))!==r&&(n=n.set(o,a))}),this.set("nodes",n)}},{key:"marks",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onlyTypes,n=void 0===t?null:t,r=e.match,o=p(e,["onlyTypes","match"]),a=this.texts(o);return v({},Symbol.iterator,function(){var e=a[Symbol.iterator](),t=null,o=null,i=[];return{next:function a(){if(i.length){var s=i.shift();return n&&!n.includes(s.type)?a():r&&!r(s,t,o)?a():{value:[s,t,o],done:!1}}var u=e.next(),c=u.value;if(u.done)return{done:!0};var l=k(c,2);return t=l[0],o=l[1],i=t.marks.toArray(),a()}}})}},{key:"mergeNode",value:function(e){var t=this.assertNode(e);if(0===(e=this.resolvePath(e)).last())throw new Error("Unable to merge node because it has no previous sibling: "+t);var n=P.decrement(e),r=this.assertNode(n);if(r.object!==t.object)throw new Error("Unable to merge two different kinds of nodes: "+r+" and "+t);var o="text"===r.object?r.mergeText(t):r.set("nodes",r.nodes.concat(t.nodes)),a=this;return a=(a=(a=a.removeNode(e)).removeNode(n)).insertNode(n,o)}},{key:"moveNode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.assertNode(e);e=this.resolvePath(e),t=this.resolvePath(t,n);var o=P.lift(t);this.assertNode(o);var a=We.create({type:"move_node",path:e,newPath:t});t=P.transform(e,a).first();var i=this;return i=(i=i.removeNode(e)).insertNode(t,r)}},{key:"removeMark",value:function(e,t){e=this.resolvePath(e);var n=this.assertDescendant(e);return n=n.removeMark(t),this.replaceNode(e,n)}},{key:"removeNode",value:function(e){this.assertDescendant(e);var t=(e=this.resolvePath(e)).flatMap(function(e){return["nodes",e]});return this.deleteIn(t)}},{key:"removeText",value:function(e,t,n){var r=this.assertDescendant(e);return r=r.removeText(t,n.length),this.replaceNode(e,r)}},{key:"replaceNode",value:function(e,t){if(!(e=this.resolvePath(e)))throw new Error("Unable to replace a node because it could not be found in the first place: "+e);if(!e.size)return t;this.assertNode(e);var n=e.flatMap(function(e){return["nodes",e]});return this.setIn(n,t)}},{key:"resolveAnnotation",value:function(e){return e=(e=q.create(e)).normalize(this)}},{key:"resolveDecoration",value:function(e){return e=(e=L.create(e)).normalize(this)}},{key:"resolvePoint",value:function(e){return e=(e=F.create(e)).normalize(this)}},{key:"resolveRange",value:function(e){return e=(e=K.create(e)).normalize(this)}},{key:"resolveSelection",value:function(e){return e=(e=z.create(e)).normalize(this)}},{key:"setNode",value:function(e,t){var n=this.assertNode(e);return n=n.merge(t),this.replaceNode(e,n)}},{key:"setMark",value:function(e,t,n){e=this.resolvePath(e);var r=this.assertDescendant(e);return r=r.setMark(t,n),this.replaceNode(e,r)}},{key:"siblings",value:function(e,t){return this.createIterable(h({path:e,upward:!1,downward:!1},t))}},{key:"splitNode",value:function(e,t,n){var r=this.assertNode(e);e=this.resolvePath(e);var o=void 0,a=void 0;if("text"===r.object){var i=r.splitText(t),s=k(i,2);o=s[0],a=s[1]}else{var u=r.nodes.take(t),c=r.nodes.skip(t);o=r.set("nodes",u),a=r.set("nodes",c).regenerateKey()}n&&"text"!==r.object&&(a=a.merge(n));var l=this;return l=(l=(l=l.removeNode(e)).insertNode(e,a)).insertNode(e,o)}},{key:"texts",value:function(e){return this.descendants(h({includeBlocks:!1,includeInlines:!1,includeDocument:!1},e))}},{key:"getBlocksAtRange",value:function(e){return a(),this.getLeafBlocksAtRange(e)}},{key:"getBlocksAtRangeAsArray",value:function(e){return a(),this.getLeafBlocksAtRangeAsArray(e)}},{key:"getInlinesAtRange",value:function(e){return a(),this.getLeafInlinesAtRange(e)}},{key:"getInlinesAtRangeAsArray",value:function(e){return a(),this.getLeafInlinesAtRangeAsArray(e)}},{key:"getNextTextAndPath",value:function(e){return a(),this.getNextTextEntry(e)}},{key:"getNextDeepMatchingNodeAndPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};a();var n=this.getNextMatchingNodeAndPath(e);if(!n)return null;for(var r=k(n,2),o=r[0],i=r[1],s=void 0;s="text"!==o.object&&o.findFirstDescendantAndPath(t,i);){var u=k(s,2);o=u[0],i=u[1]}return o?t(o)?[o,i]:this.getNextDeepMatchingNodeAndPath(n[1],t):null}},{key:"getPreviousTextAndPath",value:function(e){return a(),this.getPreviousTextEntry(e)}},{key:"findFirstDescendantAndPath",value:function(e,t){return a(),this.findDescendantAndPath(e,t,!1)}},{key:"getPreviousMatchingNodeAndPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(a(),!e)return null;for(var n=e.size;n>0;n--){var r=e.slice(0,n);if(0!==r.last()){for(var o=P.decrement(r),i=this.getNode(o);i&&!t(i);)o=P.decrement(o),i=this.getNode(o);if(i)return[i,o]}}return null}},{key:"getPreviousDeepMatchingNodeAndPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};a();var n=this.getPreviousMatchingNodeAndPath(e);if(!n)return null;for(var r=k(n,2),o=r[0],i=r[1],s=void 0;s="text"!==o.object&&o.findLastDescendantAndPath(t,i);){var u=k(s,2);o=u[0],i=u[1]}return o?t(o)?[o,i]:this.getPreviousDeepMatchingNodeAndPath(n[1],t):null}},{key:"findLastDescendantAndPath",value:function(e,t){return a(),this.findDescendantAndPath(e,t,!0)}},{key:"findDescendantAndPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:P.create([]),n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];a();var r=void 0,o=void 0;return this.forEachDescendantWithPath(function(t,n,a){if(e(t,n,a))return r=t,o=n,!1},t,n),r?[r,o]:null}},{key:"forEachDescendantWithPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:P.create([]),n=arguments[2];a();var r=this.nodes,o=void 0;return n&&(r=r.reverse()),r.forEach(function(a,i){var s=t.concat(i);return!1===e(a,s,r)?(o=!1,!1):"text"!==a.object?o=a.forEachDescendantWithPath(e,s,n):void 0}),o}},{key:"getNextMatchingNodeAndPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(a(),!e)return null;for(var n=e.size;n>0;n--){for(var r=e.slice(0,n),o=P.increment(r),i=this.getNode(o);i&&!t(i);)o=P.increment(o),i=this.getNode(o);if(i)return[i,o]}return null}},{key:"getSelectionIndexes",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];a();var n=e.start,r=e.end;if(!t)return null;if(e.isUnset)return null;if(n.path.equals(r.path)){var o=this.getFurthestAncestor(n.path),i=o?this.nodes.indexOf(o):null;return{start:i,end:i+1}}var s=null,u=null;return this.nodes.forEach(function(e,t){return"text"===e.object?(null==s&&e.key===n.key&&(s=t),null==u&&e.key===r.key&&(u=t+1)):(null==s&&e.hasDescendant(n.key)&&(s=t),null==u&&e.hasDescendant(r.key)&&(u=t+1)),null==s||null==u}),t&&null==s&&(s=0),t&&null==u&&(u=this.nodes.size),null==s?null:{start:s,end:u}}},{key:"getTextsBetweenPositionsAsArray",value:function(e,t){return a(),e=this.resolvePath(e),t=this.resolvePath(t),this.getTextsBetweenPathPositionsAsArray(e,t)}},{key:"getOrderedMarksBetweenPositions",value:function(e,n,r,o){a(),e=this.resolvePath(e),r=this.resolvePath(r);var i=this.getDescendant(e);if(P.isEqual(e,r))return i.marks;var s=this.getTextsBetweenPathPositionsAsArray(e,r);return t.OrderedSet().withMutations(function(e){s.forEach(function(t){e.union(t.marks)})})}},{key:"getTextsBetweenPathPositionsAsArray",value:function(e,t){if(a(),e&&t&&P.isEqual(e,t))return[this.getDescendant(e)];if(!e&&!t)return this.getTextsAsArray();var n=e?e.get(0,0):0,r=t?t.get(0,this.nodes.size-1):this.nodes.size-1,o=[];return this.nodes.slice(n,r+1).forEach(function(a,i){if("text"===a.object)o.push(a);else{var s=e&&0===i?P.drop(e):null,u=t&&i===r-n?P.drop(t):null;o=o.concat(a.getTextsBetweenPathPositionsAsArray(s,u))}}),o}},{key:"getFurthestAncestor",value:function(e){return a(),this.getFurthestChild(e)}},{key:"getLeafBlocksAtRangeAsArray",value:function(e){if(a(),(e=this.resolveRange(e)).isUnset)return[];var t=e,n=t.start,r=t.end;return this.getLeafBlocksBetweenPathPositionsAsArray(n.path,r.path)}},{key:"getLeafBlocksBetweenPathPositionsAsArray",value:function(e,t){if(a(),e&&t&&P.isEqual(e,t))return[this.getClosestBlock(e)];if(!e&&!t)return this.getBlocksAsArray();var n=e?e.get(0,0):0,r=t?t.get(0,this.nodes.size-1):this.nodes.size-1,o=[];return this.nodes.slice(n,r+1).forEach(function(a,i){if("block"===a.object)if(a.isLeafBlock())o.push(a);else{var s=e&&0===i?P.drop(e):null,u=t&&i===r-n?P.drop(t):null;o=o.concat(a.getLeafBlocksBetweenPathPositionsAsArray(s,u))}}),o}},{key:"getBlocksAsArray",value:function(){a();var e=this.blocks({onlyLeaves:!0});return Array.from(e,function(e){return k(e,1)[0]})}},{key:"getBlocksByTypeAsArray",value:function(e){a();var t=this.blocks({onlyLeaves:!0,onlyTypes:[e]});return Array.from(t,function(e){return k(e,1)[0]})}},{key:"getFurthestOnlyChildAncestor",value:function(e){a();var t=this.getAncestors(e);return t&&t.rest().reverse().takeUntil(function(e){return e.nodes.size>1}).last()||null}},{key:"getInlinesAsArray",value:function(){return a(),Array.from(this.inlines({onlyLeaves:!0}),function(e){return k(e,1)[0]})}},{key:"getInlinesByTypeAsArray",value:function(e){return a(),Array.from(this.inlines({onlyLeaves:!0,onlyTypes:[e]}),function(e){return k(e,1)[0]})}},{key:"getLeafInlinesAtRangeAsArray",value:function(e){var t=this;return a(),(e=this.resolveRange(e)).isUnset?[]:this.getTextsAtRangeAsArray(e).map(function(e){return t.getClosestInline(e.key)}).filter(function(e){return e})}},{key:"getOrderedMarks",value:function(){return a(),this.getMarks()}},{key:"getOrderedMarksAtRange",value:function(e){return a(),this.getMarksAtRange(e)}},{key:"getOrderedMarksByType",value:function(e){return a(),this.getMarksByType(e)}},{key:"getMarksByTypeAsArray",value:function(e){return a(),this.nodes.reduce(function(t,n){return"text"===n.object?t.concat(n.marks.filter(function(t){return t.type===e})):t.concat(n.getMarksByTypeAsArray(e))},[])}},{key:"getMarksAsArray",value:function(){var e;a();var t=[],n=!0,r=!1,o=void 0;try{for(var i,s=this.texts()[Symbol.iterator]();!(n=(i=s.next()).done);n=!0){var u=i.value,c=k(u,1)[0];t.push(c.marks.toArray())}}catch(e){r=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(r)throw o}}return(e=[]).concat.apply(e,t)}},{key:"getRootInlinesAtRangeAsArray",value:function(e){var n=this;return a(),(e=this.resolveRange(e)).isUnset?t.List():this.getTextsAtRangeAsArray(e).map(function(e){return n.getFurthestInline(e.key)}).filter(function(e){return e})}},{key:"getTextsAsArray",value:function(){a();var e=this.texts();return Array.from(e,function(e){return k(e,1)[0]})}},{key:"getTextsAtRangeAsArray",value:function(e){a();var t=this.texts({range:e});return Array.from(t,function(e){return k(e,1)[0]})}},{key:"getMarksAtPosition",value:function(e,n){a(),e=this.resolvePath(e);var r=this.getDescendant(e).marks;if(0!==n)return t.OrderedSet(r);var o=this.getClosestBlock(e);if(""===o.text)return t.OrderedSet(r);var i=this.texts({path:e,direction:"backward"}),s=k(i,1)[0];if(!s)return t.OrderedSet();var u=k(s,2),c=u[0],l=u[1];return o.hasDescendant(l)?t.OrderedSet(c.marks):t.OrderedSet(r)}},{key:"getNodesAtRange",value:function(e){a();var n=this.descendants({range:e}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"isNodeInRange",value:function(e,t){return a(),this.isInRange(e,t)}},{key:"text",get:function(){return this.getText()}}]),e}(),Zi=function(e){Qi.prototype["assert"+e]=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var a=this["get"+e].apply(this,[t].concat(r));if(null==a)throw new Error("`Node.assert"+e+"` could not find node with path or key: "+t);return a}},Yi=!0,Hi=!1,Xi=void 0;try{for(var es,ts=["Child","Depth","Descendant","Node","Parent","Path"][Symbol.iterator]();!(Yi=(es=ts.next()).done);Yi=!0){Zi(es.value)}}catch(e){Hi=!0,Xi=e}finally{try{!Yi&&ts.return&&ts.return()}finally{if(Hi)throw Xi}}Ji(Qi.prototype,["getBlocksAsArray","getBlocksByTypeAsArray","getDecorations","getFragmentAtRange","getInlinesAsArray","getInlinesByTypeAsArray","getInsertMarksAtRange","getLeafBlocksAtRangeAsArray","getLeafBlocksAtRangeAsArray","getLeafInlinesAtRangeAsArray","getMarksAsArray","getMarksAtPosition","getMarksByTypeAsArray","getNextBlock","getNodesAtRange","getNodesToPathsMap","getOffset","getOffsetAtRange","getOrderedMarksBetweenPositions","getPreviousBlock","getRootBlocksAtRange","getRootInlinesAtRangeAsArray","getTextAtOffset","getTextDirection","getTextsAsArray","getTextsBetweenPathPositionsAsArray"]),ji(Qi,[te,W,G]),ji(function(){function e(){f(this,e)}return d(e,[{key:"flip",value:function(){return this.setPoints([this.focus,this.anchor])}},{key:"moveForward",value:function(e){return this.updatePoints(function(t){return t.moveForward(e)})}},{key:"moveBackward",value:function(e){return this.updatePoints(function(t){return t.moveBackward(e)})}},{key:"moveAnchorBackward",value:function(e){return this.setAnchor(this.anchor.moveBackward(e))}},{key:"moveAnchorForward",value:function(e){return this.setAnchor(this.anchor.moveForward(e))}},{key:"moveAnchorTo",value:function(e,t){return this.setAnchor(this.anchor.moveTo(e,t))}},{key:"moveAnchorToStartOfNode",value:function(e){return this.setAnchor(this.anchor.moveToStartOfNode(e))}},{key:"moveAnchorToEndOfNode",value:function(e){return this.setAnchor(this.anchor.moveToEndOfNode(e))}},{key:"moveEndBackward",value:function(e){return this.setEnd(this.end.moveBackward(e))}},{key:"moveEndForward",value:function(e){return this.setEnd(this.end.moveForward(e))}},{key:"moveEndTo",value:function(e,t){return this.setEnd(this.end.moveTo(e,t))}},{key:"moveEndToStartOfNode",value:function(e){return this.setEnd(this.end.moveToStartOfNode(e))}},{key:"moveEndToEndOfNode",value:function(e){return this.setEnd(this.end.moveToEndOfNode(e))}},{key:"moveFocusBackward",value:function(e){return this.setFocus(this.focus.moveBackward(e))}},{key:"moveFocusForward",value:function(e){return this.setFocus(this.focus.moveForward(e))}},{key:"moveFocusTo",value:function(e,t){return this.setFocus(this.focus.moveTo(e,t))}},{key:"moveFocusToStartOfNode",value:function(e){return this.setFocus(this.focus.moveToStartOfNode(e))}},{key:"moveFocusToEndOfNode",value:function(e){return this.setFocus(this.focus.moveToEndOfNode(e))}},{key:"moveStartBackward",value:function(e){return this.setStart(this.start.moveBackward(e))}},{key:"moveStartForward",value:function(e){return this.setStart(this.start.moveForward(e))}},{key:"moveStartTo",value:function(e,t){return this.setStart(this.start.moveTo(e,t))}},{key:"moveStartToStartOfNode",value:function(e){return this.setStart(this.start.moveToStartOfNode(e))}},{key:"moveStartToEndOfNode",value:function(e){return this.setStart(this.start.moveToEndOfNode(e))}},{key:"moveTo",value:function(e,t){return this.updatePoints(function(n){return n.moveTo(e,t)})}},{key:"moveToAnchor",value:function(){return this.setFocus(this.anchor)}},{key:"moveToEnd",value:function(){return this.setStart(this.end)}},{key:"moveToEndOfNode",value:function(e){return this.updatePoints(function(t){return t.moveToEndOfNode(e)})}},{key:"moveToFocus",value:function(){return this.setAnchor(this.focus)}},{key:"moveToRangeOfNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.setPoints([this.anchor.moveToStartOfNode(e),this.focus.moveToEndOfNode(t)])}},{key:"moveToStart",value:function(){return this.setEnd(this.start)}},{key:"moveToStartOfNode",value:function(e){return this.updatePoints(function(t){return t.moveToStartOfNode(e)})}},{key:"normalize",value:function(e){return this.updatePoints(function(t){return t.normalize(e)})}},{key:"setAnchor",value:function(e){return this.set("anchor",e)}},{key:"setEnd",value:function(e){return this.isBackward?this.setAnchor(e):this.setFocus(e)}},{key:"setFocus",value:function(e){return this.set("focus",e)}},{key:"setPoints",value:function(e){var t=k(e,2),n=t[0],r=t[1];return this.set("anchor",n).set("focus",r)}},{key:"updatePoints",value:function(e){var t=this.anchor,n=this.focus;return t=e(t),n=e(n),this.merge({anchor:t,focus:n})}},{key:"setStart",value:function(e){return this.isBackward?this.setFocus(e):this.setAnchor(e)}},{key:"setProperties",value:function(e){var t=e=K.createProperties(e),n=t.anchor,r=t.focus,o=p(t,["anchor","focus"]);return n&&(o.anchor=F.create(n)),r&&(o.focus=F.create(r)),this.merge(o)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}},{key:"toRange",value:function(){var e=K.createProperties(this);return K.create(e)}},{key:"unset",value:function(){return this.updatePoints(function(e){return e.unset()})}},{key:"isCollapsed",get:function(){return this.anchor===this.focus||this.anchor.key===this.focus.key&&this.anchor.offset===this.focus.offset}},{key:"isExpanded",get:function(){return!this.isCollapsed}},{key:"isBackward",get:function(){var e=this.isUnset,t=this.anchor,n=this.focus;return e?null:t.key===n.key?t.offset>n.offset:P.isBefore(n.path,t.path)}},{key:"isForward",get:function(){var e=this.isBackward;return null==e?null:!e}},{key:"isUnset",get:function(){var e=this.anchor,t=this.focus;return e.isUnset||t.isUnset}},{key:"isSet",get:function(){return!this.isUnset}},{key:"start",get:function(){return this.isBackward?this.focus:this.anchor}},{key:"end",get:function(){return this.isBackward?this.anchor:this.focus}}]),e}(),[q,L,K,z]);var ns={Annotation:q,Block:te,Change:Ge,Data:E,Decoration:L,Document:W,Editor:Si,Inline:G,KeyUtils:c,Leaf:Ei,Mark:C,Node:X,Operation:We,PathUtils:P,Point:F,Range:K,resetMemoization:Ki,Selection:z,Text:H,TextUtils:st,useMemoization:Ui,Value:re};e.Annotation=q,e.Block=te,e.Change=Ge,e.Data=E,e.Decoration=L,e.Document=W,e.Editor=Si,e.Inline=G,e.KeyUtils=c,e.Leaf=Ei,e.Mark=C,e.Node=X,e.Operation=We,e.PathUtils=P,e.Point=F,e.Range=K,e.resetMemoization=Ki,e.Selection=z,e.Text=H,e.TextUtils=st,e.useMemoization=Ui,e.Value=re,e.default=ns,Object.defineProperty(e,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("immutable")):"function"==typeof define&&define.amd?define(["exports","immutable"],t):t(e.Slate={},e.Immutable)}(this,function(e,t){"use strict";var n=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function r(e){return!0===n(e)&&"[object Object]"===Object.prototype.toString.call(e)}var o=function(e){var t,n;return!1!==r(e)&&("function"==typeof(t=e.constructor)&&(!1!==r(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")))},a=function(e,t){0},i=void 0,s=void 0;function u(){i=0,s=function(){return""+i++}}u();var c={create:function(e){if(null==e)return s();if("string"==typeof e)return e;throw new Error("Keys must be strings, but you passed: "+e)},setGenerator:function(e){s=e},resetGenerator:u},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},d=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),v=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},y=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},p=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},m=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},k=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),g=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)};function b(e,t){for(var n=S(e,t),r=0;r<n;r++){var o=e.get(r),a=t.get(r);if(o<a)return-1;if(o>a)return 1}return e.size===t.size?0:null}function A(e){if(null==e)return null;if(t.List.isList(e))return e;if(Array.isArray(e))return t.List(e);throw new Error("Paths can only be created from arrays or lists, but you passed: "+e)}function x(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:S(e,t);return[e.slice(0,n),t.slice(0,n)]}function w(e){return O(e,0-(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1)}function O(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1,r=e.get(n)+t;return e.set(n,r)}function N(e,t){var n=x(e,t),r=k(n,2),o=r[0],a=r[1];return e.size<t.size&&0===b(o,a)}function T(e,t){return e.equals(t)}function _(e,t){var n=e.size-1,r=x(e,t,n),o=k(r,2),a=o[0],i=o[1],s=e.get(n),u=t.get(n);return T(a,i)&&s<u}function S(e,t){return Math.min(e.size,t.size)}var P={compare:b,create:A,crop:x,decrement:w,getAncestors:function(e){return t.List().withMutations(function(t){for(var n=0;n<e.size;n++)t.push(e.slice(0,n))})},increment:O,isAbove:N,isAfter:function(e,t){var n=x(e,t),r=k(n,2);return 1===b(r[0],r[1])},isBefore:function(e,t){var n=x(e,t),r=k(n,2);return-1===b(r[0],r[1])},isEqual:T,isOlder:function(e,t){var n=e.size-1,r=x(e,t,n),o=k(r,2),a=o[0],i=o[1],s=e.get(n),u=t.get(n);return T(a,i)&&s>u},isPath:function(e){return(t.List.isList(e)||Array.isArray(e))&&e.every(function(e){return"number"==typeof e})},isSibling:function(e,t){if(e.size!==t.size)return!1;var n=e.butLast(),r=t.butLast();return n.equals(r)},isYounger:_,lift:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.slice(0,-1*t)},drop:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.slice(t)},max:function(e,t){return Math.max(e.size,t.size)},min:S,relate:function(e,t){for(var n=[],r=0;r<e.size&&r<t.size;r++){var o=e.get(r);if(o!==t.get(r))break;n.push(o)}return A(n)},transform:function(e,n){var r=n.type,o=n.position,a=n.path;if("add_mark"===r||"insert_text"===r||"remove_mark"===r||"remove_text"===r||"set_mark"===r||"set_node"===r||"set_selection"===r||"set_value"===r||"add_annotation"===r||"remove_annotation"===r||"set_annotation"===r||0===e.size)return t.List([e]);var i=a.size-1,s=T(a,e),u=_(a,e),c=N(a,e);if("insert_node"===r&&(s||u||c)&&(e=O(e,1,i)),"remove_node"===r&&(u?e=w(e,1,i):(s||c)&&(e=[])),"merge_node"===r&&(s||u?e=w(e,1,i):c&&(e=O(e=w(e,1,i),o,i+1))),"split_node"===r&&(s?e=[e,O(e)]:u?e=O(e,1,i):c&&e.get(i+1)>=o&&(e=w(e=O(e,1,i),o,i+1))),"move_node"===r){var l=n.newPath;if(T(a,l))return t.List([e]);c||s?e=_(a,l)&&a.size<l.size?w(l,1,S(l,a)-1).concat(e.slice(a.size)):l.concat(e.slice(a.size)):(u&&(e=w(e,1,i)),(_(l,e)||T(l,e)||N(l,e))&&(e=O(e,1,l.size-1)))}var f=Array.isArray(e)?e:[e];return t.List(f)}},B={key:void 0,offset:void 0,path:void 0},F=function(e){function t(){return f(this,t),m(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return y(t,e),d(t,[{key:"isAfterPoint",value:function(e){return!this.isUnset&&(this.key===e.key&&this.offset>e.offset||1===P.compare(this.path,e.path))}},{key:"isAfterRange",value:function(e){return!this.isUnset&&this.isAfterPoint(e.end)}},{key:"isAtEndOfRange",value:function(e){return!this.isUnset&&this.equals(e.end)}},{key:"isAtStartOfRange",value:function(e){return!this.isUnset&&this.equals(e.start)}},{key:"isBeforePoint",value:function(e){return!this.isUnset&&(this.key===e.key&&this.offset<e.offset||-1===P.compare(this.path,e.path))}},{key:"isBeforeRange",value:function(e){return!this.isUnset&&this.isBeforePoint(e.start)}},{key:"isInRange",value:function(e){return!this.isUnset&&(this.equals(e.start)||this.equals(e.end)||this.isAfterPoint(e.start)&&this.isBeforePoint(e.end))}},{key:"isAtEndOfNode",value:function(e){if(this.isUnset)return!1;var t=e.getLastText();return this.key===t.key&&this.offset===t.text.length}},{key:"isAtStartOfNode",value:function(e){if(this.isUnset)return!1;if(0!==this.offset)return!1;var t=e.getFirstText();return this.key===t.key}},{key:"isInNode",value:function(e){return!this.isUnset&&("text"===e.object&&e.key===this.key||!!e.hasNode(this.key))}},{key:"moveBackward",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return 0===e?this:e<0?this.moveForward(-e):this.setOffset(this.offset-e)}},{key:"moveForward",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return 0===e?this:e<0?this.moveBackward(-e):this.setOffset(this.offset+e)}},{key:"moveTo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.key;return"number"==typeof e?(t=e,e=this.path):"string"==typeof e?e=(n=e)===this.key?this.path:null:n=e.equals(this.path)?this.key:null,this.merge({key:n,path:e,offset:t})}},{key:"moveToStartOfNode",value:function(e){var t=e.getFirstText();return this.moveTo(t.key,0)}},{key:"moveToEndOfNode",value:function(e){var t=e.getLastText();return this.moveTo(t.key,t.text.length)}},{key:"normalize",value:function(e){if(null==this.key&&null==this.path)return this.setOffset(null);var n=this.key,r=this.offset,o=this.path,i=o&&e.getNode(o);if(!i&&(i=e.getNode(n)))return this.merge({path:e.getPath(n)});if(!i){a();var s=e.getFirstText();return s?this.merge({key:s.key,offset:0,path:e.getPath(s.key)}):t.create()}if("text"!==i.object){a();var u=i.getTextAtOffset(r),c=i.getOffset(u.key);return this.merge({offset:r-c,key:u.key,path:e.getPath(u.key)})}i&&o&&n&&n!==i.key&&a();var l=this.merge({key:i.key,path:null==o?e.getPath(i.key):o,offset:null==r?0:Math.min(r,i.text.length)});if(l.offset===i.text.length){var f=e.getClosestBlock(l.path).getNextText();f&&(l=l.merge({key:f.key,path:e.getPath(f.key),offset:0}))}return l}},{key:"setKey",value:function(e){return null!=e&&(e=c.create(e)),this.set("key",e)}},{key:"setOffset",value:function(e){return this.set("offset",e)}},{key:"setPath",value:function(e){return null!=e&&(e=P.create(e)),this.set("path",e)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,key:this.key,offset:this.offset,path:this.path&&this.path.toArray()};return e.preserveKeys||delete t.key,t}},{key:"unset",value:function(){return this.merge({key:null,offset:null,path:null})}},{key:"isSet",get:function(){return null!=this.key&&null!=this.offset&&null!=this.path}},{key:"isUnset",get:function(){return!this.isSet}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isPoint(e))return e;if(o(e))return t.fromJSON(e);throw new Error("`Point.create` only accepts objects or points, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isPoint(e))return{key:e.key,offset:e.offset,path:e.path};if(o(e)){var n={};return"key"in e&&(n.key=e.key),"offset"in e&&(n.offset=e.offset),"path"in e&&(n.path=P.create(e.path)),"path"in e&&!("key"in e)&&(n.key=null),"key"in e&&!("path"in e)&&(n.path=null),n}throw new Error("`Point.createProperties` only accepts objects or points, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.key,r=void 0===n?null:n,o=e.offset,a=void 0===o?null:o,i=e.path,s=void 0===i?null:i;return new t({key:r,offset:a,path:P.create(s)})}}]),t}(t.Record(B)),E=function(){function e(){f(this,e)}return d(e,null,[{key:"create",value:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.Map.isMap(n))return n;if(o(n))return e.fromJSON(n);throw new Error("`Data.create` only accepts objects or maps, but you passed it: "+n)}},{key:"fromJSON",value:function(e){return new t.Map(e)}}]),e}();E.fromJS=E.fromJSON;var j={data:void 0,type:void 0},C=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"toJSON",value:function(){return{object:this.object,type:this.type,data:this.data.toJSON()}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isMark(e))return e;if("string"==typeof e&&(e={type:e}),o(e))return n.fromJSON(e);throw new Error("`Mark.create` only accepts objects, strings or marks, but you passed it: "+e)}},{key:"createSet",value:function(e){if(t.Set.isSet(e)||Array.isArray(e))return new t.Set(e.map(n.create));if(null==e)return t.Set();throw new Error("`Mark.createSet` only accepts sets, arrays or null, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isMark(e))return{data:e.data,type:e.type};if("string"==typeof e)return{type:e};if(o(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=E.create(e.data)),t}throw new Error("`Mark.createProperties` only accepts objects, strings or marks, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.data,o=void 0===r?{}:r,a=e.type;if("string"!=typeof a)throw new Error("`Mark.fromJS` requires a `type` string.");return new n({type:a,data:new t.Map(o)})}},{key:"isMarkSet",value:function(e){return t.Set.isSet(e)&&e.every(function(e){return n.isMark(e)})}}]),n}(t.Record(j)),R={type:void 0,data:void 0,anchor:void 0,focus:void 0},L=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"setProperties",value:function(e){return e=n.createProperties(e),this.merge(e)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,type:this.type,data:this.data.toJSON(),anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isDecoration(e))return e;if(K.isRange(e))return n.fromJSON(K.createProperties(e));if(o(e))return n.fromJSON(e);throw new Error("`Decoration.create` only accepts objects or decorations, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Decoration.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isDecoration(e))return{type:e.type,data:e.data,anchor:F.createProperties(e.anchor),focus:F.createProperties(e.focus),mark:C.create(e.mark)};if(o(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=E.create(e.data)),"anchor"in e&&(t.anchor=F.create(e.anchor)),"focus"in e&&(t.focus=F.create(e.focus)),t}throw new Error("`Decoration.createProperties` only accepts objects or decorations, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.anchor,r=e.focus,o=e.type,i=e.data;if(e.mark&&!o&&(a(),o=e.mark.type,i=e.mark.data),!o)throw new Error("Decorations must be created with a `type`, but you passed: "+JSON.stringify(e));return new n({type:o,data:E.create(i||{}),anchor:F.fromJSON(t||{}),focus:F.fromJSON(r||{})})}}]),n}(t.Record(R)),D={anchor:void 0,focus:void 0,isFocused:void 0,marks:void 0},z=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"setIsFocused",value:function(e){return this.set("isFocused",e)}},{key:"setMarks",value:function(e){return this.set("marks",e)}},{key:"setProperties",value:function(e){var t=e=n.createProperties(e),r=t.anchor,o=t.focus,a=p(t,["anchor","focus"]);return r&&(a.anchor=F.create(r)),o&&(a.focus=F.create(o)),this.merge(a)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e),isFocused:this.isFocused,marks:null==this.marks?null:this.marks.toArray().map(function(e){return e.toJSON()})}}},{key:"isBlurred",get:function(){return!this.isFocused}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isSelection(e))return e;if(K.isRange(e))return n.fromJSON(K.createProperties(e));if(o(e))return n.fromJSON(e);throw new Error("`Selection.create` only accepts objects, ranges or selections, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isSelection(e))return{anchor:F.createProperties(e.anchor),focus:F.createProperties(e.focus),isFocused:e.isFocused,marks:e.marks};if(K.isRange(e))return{anchor:F.createProperties(e.anchor),focus:F.createProperties(e.focus)};if(o(e)){var t={};return"anchor"in e&&(t.anchor=F.create(e.anchor)),"focus"in e&&(t.focus=F.create(e.focus)),"isFocused"in e&&(t.isFocused=e.isFocused),"marks"in e&&(t.marks=null==e.marks?null:C.createSet(e.marks)),t}throw new Error("`Selection.createProperties` only accepts objects, ranges or selections, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.anchor,o=e.focus,a=e.isFocused,i=void 0!==a&&a,s=e.marks,u=void 0===s?null:s;return new n({anchor:F.fromJSON(r||{}),focus:F.fromJSON(o||{}),isFocused:i,marks:null==u?null:new t.Set(u.map(C.fromJSON))})}}]),n}(t.Record(D)),M={annotation:"@@__SLATE_ANNOTATION__@@",block:"@@__SLATE_BLOCK__@@",change:"@@__SLATE_CHANGE__@@",decoration:"@@__SLATE_DECORATION__@@",document:"@@__SLATE_DOCUMENT__@@",editor:"@@__SLATE_EDITOR__@@",inline:"@@__SLATE_INLINE__@@",leaf:"@@__SLATE_LEAF__@@",mark:"@@__SLATE_MARK__@@",operation:"@@__SLATE_OPERATION__@@",point:"@@__SLATE_POINT__@@",range:"@@__SLATE_RANGE__@@",selection:"@@__SLATE_SELECTION__@@",text:"@@__SLATE_TEXT__@@",value:"@@__SLATE_VALUE__@@"};function I(e,t){return!(!t||!t[M[e]])}var J={anchor:void 0,focus:void 0},K=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isRange(e))return"range"===e.object?e:n.fromJSON(n.createProperties(e));if(o(e))return n.fromJSON(e);throw new Error("`Range.create` only accepts objects or ranges, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Range.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isRange(e))return{anchor:F.createProperties(e.anchor),focus:F.createProperties(e.focus)};if(o(e)){var t={};return"anchor"in e&&(t.anchor=F.create(e.anchor)),"focus"in e&&(t.focus=F.create(e.focus)),t}throw new Error("`Range.createProperties` only accepts objects, annotations, decorations, ranges or selections, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.anchor,r=e.focus;return new n({anchor:F.fromJSON(t||{}),focus:F.fromJSON(r||{})})}},{key:"isRange",value:function(e){return I("range",e)||L.isDecoration(e)||z.isSelection(e)}}]),n}(t.Record(J)),U={key:void 0,type:void 0,data:void 0,anchor:void 0,focus:void 0},q=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"setProperties",value:function(e){return e=n.createProperties(e),this.merge(e)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,key:this.key,type:this.type,data:this.data.toJSON(),anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isAnnotation(e))return e;if(K.isRange(e))return n.fromJSON(K.createProperties(e));if(o(e))return n.fromJSON(e);throw new Error("`Annotation.create` only accepts objects or annotations, but you passed it: "+e)}},{key:"createMap",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.Map.isMap(e))return e;if(o(e)){var r={};for(var a in e){var i=e[a],s=n.create(i);r[a]=s}return t.Map(r)}throw new Error("`Annotation.createMap` only accepts arrays or lists, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isAnnotation(e))return{key:e.key,type:e.type,data:e.data,anchor:F.createProperties(e.anchor),focus:F.createProperties(e.focus)};if(o(e)){var t={};return"key"in e&&(t.key=e.key),"type"in e&&(t.type=e.type),"data"in e&&(t.data=E.create(e.data)),"anchor"in e&&(t.anchor=F.create(e.anchor)),"focus"in e&&(t.focus=F.create(e.focus)),t}throw new Error("`Annotation.createProperties` only accepts objects or annotations, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.key,r=e.type,o=e.data,a=e.anchor,i=e.focus;if(!t)throw new Error("Annotations must be created with a `key`, but you passed: "+JSON.stringify(e));if(!r)throw new Error("Annotations must be created with a `type`, but you passed: "+JSON.stringify(e));return new n({key:t,type:r,data:E.create(o||{}),anchor:F.fromJSON(a||{}),focus:F.fromJSON(i||{})})}}]),n}(t.Record(U)),V={data:void 0,key:void 0,nodes:void 0},W=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isDocument(e))return e;if((t.List.isList(e)||Array.isArray(e))&&(e={nodes:e}),o(e))return n.fromJSON(e);throw new Error("`Document.create` only accepts objects, arrays, lists or documents, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(n.isDocument(e))return e;var r=e.data,o=void 0===r?{}:r,a=e.key,i=void 0===a?c.create():a,s=e.nodes,u=void 0===s?[]:s;return new n({key:i,data:new t.Map(o),nodes:X.createList(u)})}}]),n}(t.Record(V)),$={data:void 0,key:void 0,nodes:void 0,type:void 0},G=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isInline(e))return e;if("string"==typeof e&&(e={type:e}),o(e))return n.fromJSON(e);throw new Error("`Inline.create` only accepts objects, strings or inlines, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Inline.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(n.isInline(e))return e;var r=e.data,o=void 0===r?{}:r,a=e.key,i=void 0===a?c.create():a,s=e.nodes,u=void 0===s?[]:s,l=e.type;if("string"!=typeof l)throw new Error("`Inline.fromJS` requires a `type` string.");return new n({key:i,type:l,data:new t.Map(o),nodes:X.createList(u)})}},{key:"isInlineList",value:function(e){return t.List.isList(e)&&e.every(function(e){return n.isInline(e)})}}]),n}(t.Record($)),Q=function(e,t){if(!e)throw new Error("Invariant failed")},Z={key:void 0,marks:void 0,text:void 0},Y=t.Record({text:void 0,marks:void 0,annotations:void 0,decorations:void 0}),H=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"addMark",value:function(e){e=C.create(e);var t=this.marks.add(e);return this.set("marks",t)}},{key:"addMarks",value:function(e){return e=C.createSet(e),this.set("marks",this.marks.union(e))}},{key:"getLeaves",value:function(e,n){var r=[{text:this.text,marks:this.marks,annotations:[],decorations:[]}],o=function(e,t){return[{text:e.text.slice(0,t),marks:e.marks,annotations:[].concat(g(e.annotations)),decorations:[].concat(g(e.decorations))},{text:e.text.slice(t),marks:e.marks,annotations:[].concat(g(e.annotations)),decorations:[].concat(g(e.decorations))}]},a=function(t){var a="annotations"===t?e.values():n,i=!0,s=!1,u=void 0;try{for(var c,l=a[Symbol.iterator]();!(i=(c=l.next()).done);i=!0){var f=c.value,d=f.start,v=f.end,h=[],y=0,p=!0,m=!1,g=void 0;try{for(var b,A=r[Symbol.iterator]();!(p=(b=A.next()).done);p=!0){var x=b.value,w=x.text.length,O=y;if(y+=w,d.offset<=O&&v.offset>=O+w)x[t].push(f),h.push(x);else if(d.offset>O+w||v.offset<O||v.offset===O&&0!==O)h.push(x);else{var N=x,T=void 0,_=void 0;if(v.offset<O+w){var S=o(N,v.offset-O),P=k(S,2);N=P[0],_=P[1]}if(d.offset>O){var B=o(N,d.offset-O),F=k(B,2);T=F[0],N=F[1]}N[t].push(f),T&&h.push(T),h.push(N),_&&h.push(_)}}}catch(e){m=!0,g=e}finally{try{!p&&A.return&&A.return()}finally{if(m)throw g}}r=h}}catch(e){s=!0,u=e}finally{try{!i&&l.return&&l.return()}finally{if(s)throw u}}};return a("annotations"),a("decorations"),r=r.map(function(e){return new Y(h({},e,{annotations:t.List(e.annotations),decorations:t.List(e.decorations)}))}),t.List(r)}},{key:"insertText",value:function(e,t){var n=this.text,r=n.slice(0,e)+t+n.slice(e);return this.set("text",r)}},{key:"removeMark",value:function(e){e=C.create(e);var t=this.marks.remove(e);return this.set("marks",t)}},{key:"removeText",value:function(e,t){var n=this.text,r=n.slice(0,e)+n.slice(e+t);return this.set("text",r)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,text:this.text,marks:this.marks.toArray().map(function(e){return e.toJSON()})};return e.preserveKeys&&(t.key=this.key),t}},{key:"setMark",value:function(e,t){var n=this.marks,r=C.create(e),o=r.merge(t),a=n.remove(r).add(o);return this.set("marks",a)}},{key:"splitText",value:function(e){var t=this.text;return[this.set("text",t.slice(0,e)),this.set("text",t.slice(e)).regenerateKey()]}},{key:"mergeText",value:function(e){var t=this.text+e.text;return this.set("text",t)}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(n.isText(e))return e;if("string"==typeof e&&(e={text:e}),o(e))return n.fromJSON(e);throw new Error("`Text.create` only accepts objects, arrays, strings or texts, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Text.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(n.isText(e))return e;Q(null==e.leaves);var t=e.text,r=void 0===t?"":t,o=e.marks,a=void 0===o?[]:o,i=e.key;return new n({key:void 0===i?c.create():i,text:r,marks:C.createSet(a)})}},{key:"isTextList",value:function(e){return t.List.isList(e)&&e.every(function(e){return n.isText(e)})}}]),n}(t.Record(Z)),X=function(){function e(){f(this,e)}return d(e,null,[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.isNode(t))return t;if(o(t)){var n=t.object;switch(!n&&t.kind&&(a(),n=t.kind),n){case"block":return te.create(t);case"document":return W.create(t);case"inline":return G.create(t);case"text":return H.create(t);default:throw new Error("`Node.create` requires a `object` string.")}}throw new Error("`Node.create` only accepts objects or nodes but you passed it: "+t)}},{key:"createList",value:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(n)||Array.isArray(n)){var r=[];return n.forEach(function(t){if(t&&"text"===t.object&&t.leaves&&Array.isArray(t.leaves)){a();var n=H.createList(t.leaves).toArray();r=r.concat(n)}else{var o=e.create(t);r.push(o)}}),t.List(r)}throw new Error("`Node.createList` only accepts lists or arrays, but you passed it: "+n)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(te.isBlock(e)||G.isInline(e))return{data:e.data,type:e.type};if("string"==typeof e)return{type:e};if(o(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=E.create(e.data)),t}throw new Error("`Node.createProperties` only accepts objects, strings, blocks or inlines, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.object;switch(!t&&e.kind&&(a(),t=e.kind),t){case"block":return te.fromJSON(e);case"document":return W.fromJSON(e);case"inline":return G.fromJSON(e);case"text":return H.fromJSON(e);default:throw new Error("`Node.fromJSON` requires an `object` of either 'block', 'document', 'inline' or 'text', but you passed: "+e)}}},{key:"isNode",value:function(e){return te.isBlock(e)||W.isDocument(e)||G.isInline(e)||H.isText(e)}},{key:"isNodeList",value:function(n){return t.List.isList(n)&&n.every(function(t){return e.isNode(t)})}}]),e}(),ee={data:void 0,key:void 0,nodes:void 0,type:void 0},te=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isBlock(e))return e;if("string"==typeof e&&(e={type:e}),o(e))return n.fromJSON(e);throw new Error("`Block.create` only accepts objects, strings or blocks, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Block.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(n.isBlock(e))return e;var r=e.data,o=void 0===r?{}:r,a=e.key,i=void 0===a?c.create():a,s=e.nodes,u=void 0===s?[]:s,l=e.type;if("string"!=typeof l)throw new Error("`Block.fromJSON` requires a `type` string.");return new n({key:i,type:l,data:t.Map(o),nodes:X.createList(u)})}},{key:"isBlockList",value:function(e){return t.List.isList(e)&&e.every(function(e){return n.isBlock(e)})}}]),n}(t.Record(ee)),ne={annotations:void 0,data:void 0,document:void 0,selection:void 0},re=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"addAnnotation",value:function(e){e=q.create(e);var t=this,n=t,r=n.annotations,o=n.document,a=e.key;return e=e.updatePoints(function(e){return e.normalize(o)}),r=r.set(a,e),t=t.set("annotations",r)}},{key:"addMark",value:function(e,t){t=C.create(t);var n=this,r=n.document;return r=r.addMark(e,t),n=n.set("document",r)}},{key:"insertNode",value:function(e,t){var n=this,r=n.document;return r=r.insertNode(e,t),n=(n=n.set("document",r)).mapRanges(function(e){return e.updatePoints(function(e){return e.setPath(null)})})}},{key:"insertText",value:function(e,t,n){var r=this,o=r.document,a=o.assertNode(e);return o=o.insertText(e,t,n),a=o.assertNode(e),r=(r=r.set("document",o)).mapPoints(function(e){return e.key===a.key&&e.offset>=t?e.setOffset(e.offset+n.length):e})}},{key:"mergeNode",value:function(e){var t=this,n=t.document,r=n.mergeNode(e);e=n.resolvePath(e);var o=P.decrement(e),a=n.getNode(o),i=n.getNode(e);return t=(t=t.set("document",r)).mapRanges(function(e){if("text"===i.object){var t=a.text.length;e.anchor.key===i.key&&(e=e.moveAnchorTo(a.key,t+e.anchor.offset)),e.focus.key===i.key&&(e=e.moveFocusTo(a.key,t+e.focus.offset))}return e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"moveNode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this,o=r.document;return P.isEqual(e,t)?r:(o=o.moveNode(e,t,n),r=(r=r.set("document",o)).mapPoints(function(e){return e.setPath(null)}))}},{key:"removeAnnotation",value:function(e){e=q.create(e);var t=this,n=t.annotations,r=e.key;return n=n.delete(r),t=t.set("annotations",n)}},{key:"removeMark",value:function(e,t){t=C.create(t);var n=this,r=n.document;return r=r.removeMark(e,t),n=n.set("document",r)}},{key:"removeNode",value:function(e){var t=this,n=t.document,r=n.assertNode(e),o="text"===r.object?r:r.getFirstText()||r,a="text"===r.object?r:r.getLastText()||r,i=n.getPreviousText(o.key),s=n.getNextText(a.key);return n=n.removeNode(e),t=(t=t.set("document",n)).mapRanges(function(e){var t=e,n=t.anchor,o=t.focus;return r.hasNode(n.key)&&(e=i?e.moveAnchorTo(i.key,i.text.length):s?e.moveAnchorTo(s.key,0):e.unset()),r.hasNode(o.key)&&(e=i?e.moveFocusTo(i.key,i.text.length):s?e.moveFocusTo(s.key,0):e.unset()),e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"removeText",value:function(e,t,n){var r=this,o=r.document,a=o.assertNode(e);o=o.removeText(e,t,n),r=r.set("document",o);var i=n.length,s=t,u=t+i;return r=r.mapPoints(function(e){return e.key!==a.key?e:e.offset>=u?e.setOffset(e.offset-i):e.offset>s?e.setOffset(s):e})}},{key:"setAnnotation",value:function(e,t){t=q.createProperties(t);var n=q.create(e),r=n.merge(t),o=this,a=o.annotations,i=n.key;return a=a.set(i,r),o=o.set("annotations",a)}},{key:"setNode",value:function(e,t){var n=this,r=n.document;return r=r.setNode(e,t),n=n.set("document",r)}},{key:"setMark",value:function(e,t,n){var r=this,o=r.document;return o=o.setMark(e,t,n),r=r.set("document",o)}},{key:"setProperties",value:function(e){var t=this,n=t.document,r=e.data,o=e.annotations,a={};return r&&(a.data=r),o&&(a.annotations=o.map(function(e){return e.isSet?e:n.resolveAnnotation(e)})),t=t.merge(a)}},{key:"setSelection",value:function(e){var t=this,n=t,r=n.document,o=n.selection,a=o.setProperties(e);return o=r.resolveSelection(a),t=t.set("selection",o)}},{key:"splitNode",value:function(e,t,n){var r=this,o=r.document,a=o.splitNode(e,t,n),i=o.assertNode(e);return r=(r=r.set("document",a)).mapRanges(function(e){var n=a.getNextText(i.key),r=e,o=r.anchor,s=r.focus;return i.key===o.key&&t<=o.offset&&(e=e.moveAnchorTo(n.key,o.offset-t)),i.key===s.key&&t<=s.offset&&(e=e.moveFocusTo(n.key,s.offset-t)),e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"mapRanges",value:function(e){var t=this,n=t,r=n.document,o=n.selection,a=n.annotations,i=o.isSet?e(o):o;i||(i=o.unset()),i!==o&&(i=r.createSelection(i)),t=t.set("selection",i);var s=a.map(function(t){var n=t.isSet?e(t):t;return n&&n!==t&&(n=r.createAnnotation(n)),n});return s=s.filter(function(e){return!!e}),t=t.set("annotations",s)}},{key:"mapPoints",value:function(e){return this.mapRanges(function(t){return t.updatePoints(e)})}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,document:this.document.toJSON(e)};return e.preserveData&&(t.data=this.data.toJSON(e)),e.preserveAnnotations&&(t.annotations=this.annotations.map(function(t){return t.toJSON(e)}).toObject()),e.preserveSelection&&(t.selection=this.selection.toJSON(e)),t}},{key:"change",value:function(){Q(!1)}},{key:"startBlock",get:function(){return this.selection.start.key&&this.document.getClosestBlock(this.selection.start.key)}},{key:"endBlock",get:function(){return this.selection.end.key&&this.document.getClosestBlock(this.selection.end.key)}},{key:"anchorBlock",get:function(){return this.selection.anchor.key&&this.document.getClosestBlock(this.selection.anchor.key)}},{key:"focusBlock",get:function(){return this.selection.focus.key&&this.document.getClosestBlock(this.selection.focus.key)}},{key:"startInline",get:function(){return this.selection.start.key&&this.document.getClosestInline(this.selection.start.key)}},{key:"endInline",get:function(){return this.selection.end.key&&this.document.getClosestInline(this.selection.end.key)}},{key:"anchorInline",get:function(){return this.selection.anchor.key&&this.document.getClosestInline(this.selection.anchor.key)}},{key:"focusInline",get:function(){return this.selection.focus.key&&this.document.getClosestInline(this.selection.focus.key)}},{key:"startText",get:function(){return this.selection.start.key&&this.document.getDescendant(this.selection.start.key)}},{key:"endText",get:function(){return this.selection.end.key&&this.document.getDescendant(this.selection.end.key)}},{key:"anchorText",get:function(){return this.selection.anchor.key&&this.document.getDescendant(this.selection.anchor.key)}},{key:"focusText",get:function(){return this.selection.focus.key&&this.document.getDescendant(this.selection.focus.key)}},{key:"nextBlock",get:function(){return this.selection.end.key&&this.document.getNextBlock(this.selection.end.key)}},{key:"previousBlock",get:function(){return this.selection.start.key&&this.document.getPreviousBlock(this.selection.start.key)}},{key:"nextInline",get:function(){return this.selection.end.key&&this.document.getNextInline(this.selection.end.key)}},{key:"previousInline",get:function(){return this.selection.start.key&&this.document.getPreviousInline(this.selection.start.key)}},{key:"nextText",get:function(){return this.selection.end.key&&this.document.getNextText(this.selection.end.key)}},{key:"previousText",get:function(){return this.selection.start.key&&this.document.getPreviousText(this.selection.start.key)}},{key:"marks",get:function(){return this.selection.isUnset?new t.Set:this.selection.marks||this.document.getMarksAtRange(this.selection)}},{key:"activeMarks",get:function(){return this.selection.isUnset?new t.Set:this.selection.marks||this.document.getActiveMarksAtRange(this.selection)}},{key:"blocks",get:function(){return this.selection.isUnset?new t.List:this.document.getLeafBlocksAtRange(this.selection)}},{key:"fragment",get:function(){return this.selection.isUnset?W.create():this.document.getFragmentAtRange(this.selection)}},{key:"inlines",get:function(){return this.selection.isUnset?new t.List:this.document.getLeafInlinesAtRange(this.selection)}},{key:"texts",get:function(){return this.selection.isUnset?new t.List:this.document.getTextsAtRange(this.selection)}},{key:"history",get:function(){Q(!1)}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n.isValue(e))return e;if(o(e))return n.fromJSON(e,t);throw new Error("`Value.create` only accepts objects or values, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isValue(e))return{annotations:e.annotations,data:e.data};if(o(e)){var t={};return"annotations"in e&&(t.annotations=q.createMap(e.annotations)),"data"in e&&(t.data=E.create(e.data)),t}throw new Error("`Value.createProperties` only accepts objects or values, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.data,r=void 0===t?{}:t,o=e.annotations,a=void 0===o?{}:o,i=e.document,s=void 0===i?{}:i,u=e.selection,c=void 0===u?{}:u;if(r=E.fromJSON(r),c=(s=W.fromJSON(s)).createSelection(c),a=q.createMap(a),c.isUnset){var l=s.getFirstText();l&&(c=c.moveToStartOfNode(l)),c=s.createSelection(c)}return new n({annotations:a,data:r,document:s,selection:c})}}]),n}(t.Record(ne)),oe="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function ae(){throw new Error("setTimeout has not been defined")}function ie(){throw new Error("clearTimeout has not been defined")}var se=ae,ue=ie;function ce(e){if(se===setTimeout)return setTimeout(e,0);if((se===ae||!se)&&setTimeout)return se=setTimeout,setTimeout(e,0);try{return se(e,0)}catch(t){try{return se.call(null,e,0)}catch(t){return se.call(this,e,0)}}}"function"==typeof oe.setTimeout&&(se=setTimeout),"function"==typeof oe.clearTimeout&&(ue=clearTimeout);var le,fe=[],de=!1,ve=-1;function he(){de&&le&&(de=!1,le.length?fe=le.concat(fe):ve=-1,fe.length&&ye())}function ye(){if(!de){var e=ce(he);de=!0;for(var t=fe.length;t;){for(le=fe,fe=[];++ve<t;)le&&le[ve].run();ve=-1,t=fe.length}le=null,de=!1,function(e){if(ue===clearTimeout)return clearTimeout(e);if((ue===ie||!ue)&&clearTimeout)return ue=clearTimeout,clearTimeout(e);try{ue(e)}catch(t){try{return ue.call(null,e)}catch(t){return ue.call(this,e)}}}(e)}}function pe(e,t){this.fun=e,this.array=t}pe.prototype.run=function(){this.fun.apply(null,this.array)};function me(){}var ke=me,ge=me,be=me,Ae=me,xe=me,we=me,Oe=me;var Ne=oe.performance||{},Te=Ne.now||Ne.mozNow||Ne.msNow||Ne.oNow||Ne.webkitNow||function(){return(new Date).getTime()};var _e=new Date;var Se={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];fe.push(new pe(e,t)),1!==fe.length||de||ce(ye)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ke,addListener:ge,once:be,off:Ae,removeListener:xe,removeAllListeners:we,emit:Oe,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Te.call(Ne),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-_e)/1e3}},Pe="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Be(e,t){return e(t={exports:{}},t.exports),t.exports}var Fe=1e3,Ee=60*Fe,je=60*Ee,Ce=24*je,Re=365.25*Ce,Le=function(e,t){t=t||{};var n,r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Re;case"days":case"day":case"d":return n*Ce;case"hours":case"hour":case"hrs":case"hr":case"h":return n*je;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ee;case"seconds":case"second":case"secs":case"sec":case"s":return n*Fe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===r&&!1===isNaN(e))return t.long?De(n=e,Ce,"day")||De(n,je,"hour")||De(n,Ee,"minute")||De(n,Fe,"second")||n+" ms":function(e){if(e>=Ce)return Math.round(e/Ce)+"d";if(e>=je)return Math.round(e/je)+"h";if(e>=Ee)return Math.round(e/Ee)+"m";if(e>=Fe)return Math.round(e/Fe)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function De(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var ze=Be(function(e,t){function n(e){var n;function o(){if(o.enabled){var e=o,r=+new Date,a=r-(n||r);e.diff=a,e.prev=n,e.curr=r,n=r;for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];i[0]=t.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var u=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;u++;var o=t.formatters[r];if("function"==typeof o){var a=i[u];n=o.call(e,a),i.splice(u,1),u--}return n}),t.formatArgs.call(e,i),(o.log||t.log||console.log.bind(console)).apply(e,i)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),o.destroy=r,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function r(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=n.debug=n.default=n).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var a=t.instances[n];a.enabled=t.enabled(a.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=Le,t.instances=[],t.names=[],t.skips=[],t.formatters={}}),Me=(ze.coerce,ze.disable,ze.enable,ze.enabled,ze.humanize,ze.instances,ze.names,ze.skips,ze.formatters,Be(function(e,t){function n(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==Se&&"env"in Se&&(e=Se.env.DEBUG),e}(t=e.exports=ze).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var o=0,a=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&"%c"===e&&(a=++o)}),e.splice(a,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=n,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(n())})),Ie=(Me.log,Me.formatArgs,Me.save,Me.load,Me.useColors,Me.storage,Me.colors,Me("slate:operation:apply"));function Je(e,t){var n=(t=We.create(t)).type;switch(Ie(n,t),n){case"add_annotation":var r=t.annotation;return e.addAnnotation(r);case"add_mark":var o=t,a=o.path,i=o.mark;return e.addMark(a,i);case"insert_node":var s=t,u=s.path,c=s.node;return e.insertNode(u,c);case"insert_text":var l=t,f=l.path,d=l.offset,v=l.text,h=l.marks;return e.insertText(f,d,v,h);case"merge_node":var y=t.path;return e.mergeNode(y);case"move_node":var p=t,m=p.path,k=p.newPath;return e.moveNode(m,k);case"remove_annotation":var g=t.annotation;return e.removeAnnotation(g);case"remove_mark":var b=t,A=b.path,x=b.mark;return e.removeMark(A,x);case"remove_node":var w=t.path;return e.removeNode(w);case"remove_text":var O=t,N=O.path,T=O.offset,_=O.text;return e.removeText(N,T,_);case"set_annotation":var S=t,P=S.properties,B=S.newProperties;return e.setAnnotation(P,B);case"set_mark":var F=t,E=F.path,j=F.properties,C=F.newProperties;return e.setMark(E,j,C);case"set_node":var R=t,L=R.path,D=R.newProperties;return e.setNode(L,D);case"set_selection":var z=t.newProperties;return e.setSelection(z);case"set_value":var M=t.newProperties;return e.setProperties(M);case"split_node":var I=t,J=I.path,K=I.position,U=I.properties;return e.splitNode(J,K,U);default:throw new Error('Unknown operation type: "'+n+'".')}}var Ke=Me("slate:operation:invert");function Ue(e){var t=(e=We.create(e)).type;switch(Ke(t,e),t){case"move_node":var n=e,r=n.newPath,o=n.path;if(P.isEqual(r,o))return e;var a=P.transform(o,e).first(),i=P.transform(P.increment(o),e).first();return e.set("path",a).set("newPath",i);case"merge_node":var s=e.path,u=P.decrement(s);return e.set("type","split_node").set("path",u);case"split_node":var c=e.path,l=P.increment(c);return e.set("type","merge_node").set("path",l);case"set_annotation":case"set_node":case"set_value":case"set_selection":case"set_mark":var f=e,d=f.properties,v=f.newProperties;return e.set("properties",v).set("newProperties",d);case"insert_node":case"insert_text":return e.set("type",t.replace("insert_","remove_"));case"remove_node":case"remove_text":return e.set("type",t.replace("remove_","insert_"));case"add_annotation":case"add_mark":return e.set("type",t.replace("add_","remove_"));case"remove_annotation":case"remove_mark":return e.set("type",t.replace("remove_","add_"));default:throw new Error('Unknown operation type: "'+t+'".')}}var qe={add_mark:["path","mark","data"],add_annotation:["annotation","data"],insert_node:["path","node","data"],insert_text:["path","offset","text","data"],merge_node:["path","position","properties","target","data"],move_node:["path","newPath","data"],remove_annotation:["annotation","data"],remove_mark:["path","mark","data"],remove_node:["path","node","data"],remove_text:["path","offset","text","data"],set_annotation:["properties","newProperties","data"],set_mark:["path","properties","newProperties","data"],set_node:["path","properties","newProperties","data"],set_selection:["properties","newProperties","data"],set_value:["properties","newProperties","data"],split_node:["path","position","properties","target","data"]},Ve={annotation:void 0,data:void 0,length:void 0,mark:void 0,marks:void 0,newPath:void 0,newProperties:void 0,node:void 0,offset:void 0,path:void 0,position:void 0,properties:void 0,target:void 0,text:void 0,type:void 0},We=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"apply",value:function(e){return Je(e,this)}},{key:"invert",value:function(){return Ue(this)}},{key:"toJSON",value:function(){var e=this.object,t=this.type,n={object:e,type:t},r=qe[t],o=!0,a=!1,i=void 0;try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value,l=this[c];if("annotation"!==c&&"mark"!==c&&"marks"!==c&&"node"!==c&&"path"!==c&&"newPath"!==c||(l=l.toJSON()),"properties"===c&&"merge_node"===t){var f={};"data"in l&&(f.data=l.data.toJS()),"type"in l&&(f.type=l.type),l=f}if(("properties"===c||"newProperties"===c)&&"set_annotation"===t){var d={};"anchor"in l&&(d.anchor=l.anchor.toJS()),"focus"in l&&(d.focus=l.focus.toJS()),"key"in l&&(d.key=l.key),"mark"in l&&(d.mark=l.mark.toJS()),l=d}if(("properties"===c||"newProperties"===c)&&"set_mark"===t){var v={};"data"in l&&(v.data=l.data.toJS()),"type"in l&&(v.type=l.type),l=v}if(("properties"===c||"newProperties"===c)&&"set_node"===t){var h={};"data"in l&&(h.data=l.data.toJS()),"type"in l&&(h.type=l.type),l=h}if(("properties"===c||"newProperties"===c)&&"set_selection"===t){var y={};"anchor"in l&&(y.anchor=l.anchor.toJSON()),"focus"in l&&(y.focus=l.focus.toJSON()),"isFocused"in l&&(y.isFocused=l.isFocused),"marks"in l&&(y.marks=l.marks&&l.marks.toJSON()),l=y}if(("properties"===c||"newProperties"===c)&&"set_value"===t){var p={};"data"in l&&(p.data=l.data.toJS()),l=p}if("properties"===c&&"split_node"===t){var m={};"data"in l&&(m.data=l.data.toJS()),"type"in l&&(m.type=l.type),l=m}"data"===c&&(l=l.toJSON()),n[c]=l}}catch(e){a=!0,i=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw i}}return n}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.isOperation(e))return e;if(o(e))return n.fromJSON(e);throw new Error("`Operation.create` only accepts objects or operations, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Operation.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(n.isOperation(e))return e;var r=e.type,o=qe[r],a={type:r};if(!o)throw new Error('`Operation.fromJSON` was passed an unrecognized operation type: "'+r+'"');var i=!0,s=!1,u=void 0;try{for(var c,l=o[Symbol.iterator]();!(i=(c=l.next()).done);i=!0){var f=c.value,d=e[f];if("data"===f&&void 0===d&&(d={}),void 0===d)throw new Error('`Operation.fromJSON` was passed a "'+r+'" operation without the required "'+f+'" attribute.');"annotation"===f&&(d=q.create(d)),"path"!==f&&"newPath"!==f||(d=P.create(d)),"mark"===f&&(d=C.create(d)),"node"===f&&(d=X.create(d)),"properties"!==f&&"newProperties"!==f||"set_annotation"!==r||(d=q.createProperties(d)),"properties"!==f&&"newProperties"!==f||"set_mark"!==r||(d=C.createProperties(d)),"properties"!==f&&"newProperties"!==f||"set_node"!==r&&"merge_node"!==r&&"split_node"!==r||(d=X.createProperties(d)),"properties"!==f&&"newProperties"!==f||"set_selection"!==r||(d=z.createProperties(d)),"properties"!==f&&"newProperties"!==f||"set_value"!==r||(d=re.createProperties(d)),"data"===f&&(d=t.Map(d)),a[f]=d}}catch(e){s=!0,u=e}finally{try{!i&&l.return&&l.return()}finally{if(s)throw u}}return new n(a)}},{key:"isOperationList",value:function(e){return t.List.isList(e)&&e.every(function(e){return n.isOperation(e)})}}]),n}(t.Record(Ve)),$e={operations:void 0,value:void 0},Ge=function(e){function t(){return f(this,t),m(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return y(t,e),d(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,value:this.value.toJSON(e),operations:this.operations.toArray().map(function(t){return t.toJSON(e)})}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isChange(e))return e;if(o(e))return t.fromJSON(e);throw new Error("`Change.create` only accepts objects or changes, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.value,r=e.operations,o=void 0===r?[]:r;return new t({value:re.create(n),operations:We.createList(o)})}}]),t}(t.Record($e));function Qe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{onCommand:function(t,n,r){var o=t.type,a=t.args,i=e[o];if(!i)return r();n.command.apply(n,[i].concat(g(a)))},onConstruct:function(t,n){for(var r in e)t.registerCommand(r);return n()}}}var Ze=Be(function(e,t){!function(n){var r=t,o=e&&e.exports==r&&e,a="object"==typeof Pe&&Pe;a.global!==a&&a.window!==a||(n=a);var i=/([\0-\u02FF\u0370-\u1AAF\u1B00-\u1DBF\u1E00-\u20CF\u2100-\uD7FF\uE000-\uFE1F\uFE30-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])([\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]+)/g,s=/([\uD800-\uDBFF])([\uDC00-\uDFFF])/g,u=function(e){for(var t="",n=(e=e.replace(i,function(e,t,n){return u(n)+t}).replace(s,"$2$1")).length;n--;)t+=e.charAt(n);return t},c={version:"0.2.0",reverse:u};if(r&&!r.nodeType)if(o)o.exports=c;else for(var l in c)c.hasOwnProperty(l)&&(r[l]=c[l]);else n.esrever=c}(Pe)}).reverse,Ye=55296,He=57343,Xe=/\s/,et=/['\u2018\u2019]/,tt=/[\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;function nt(e){return Ye<=e&&e<=He}function rt(e,t){if(Xe.test(e))return!1;if(et.test(e)){var n=t.charAt(0),r=ot(n);if(rt(n=t.slice(0,r),t.slice(r)))return!0}return!tt.test(e)}function ot(e){return nt(e.charCodeAt(0))?2:1}function at(e){return ot(e.charAt(0))}function it(e){for(var t=0,n=0,r=!1,o=void 0;o=e.charAt(n);){var a=ot(o);if(rt(o=e.slice(n,n+a),e.slice(n+a)))r=!0,t+=a;else{if(r)break;t+=a}n+=a}return t}var st={getCharLength:ot,getCharOffset:at,getCharOffsetBackward:function(e,t){return e=e.slice(0,t),at(e=Ze(e))},getCharOffsetForward:function(e,t){return at(e=e.slice(t))},getWordOffset:it,getWordOffsetBackward:function(e,t){return e=e.slice(0,t),it(e=Ze(e))},getWordOffsetForward:function(e,t){return it(e=e.slice(t))},isSurrogate:nt,isWord:rt};function ut(e,t){t.isExpanded&&e.deleteAtRange(t);var n=e.value.document,r=t,o=r.start,a=r.end;return t=n.hasDescendant(o.path)?t.moveToStart():t.moveTo(a.path,0).normalize(n)}var ct={addMarkAtRange:function(e,t,n){if(!t.isCollapsed){var r=e.value.document,o=t.start,a=t.end,i=r.getTextsAtRange(t);e.withoutNormalizing(function(){i.forEach(function(t){var r=t.key,i=0,s=t.text.length;r===o.key&&(i=o.offset),r===a.key&&(s=a.offset),r===o.key&&r===a.key&&(s=a.offset-o.offset),e.addMarkByKey(r,i,s,n)})})}},addMarksAtRange:function(e,t,n){n.forEach(function(n){return e.addMarkAtRange(t,n)})},deleteAtRange:function(e,t){e.snapshotSelection();var n=e.value,r=t.start,o=t.end,a=r.key,i=r.offset,s=o.key,u=o.offset,c=n.document,l=c.hasVoidParent(a,e),f=c.hasVoidParent(s,e),d=c.getClosestBlock(a),v=c.getClosestBlock(s),h=0===i&&0===u&&!1===l&&a===d.getFirstText().key&&s===v.getFirstText().key&&a!==s;if(h&&f){var y=c.getPreviousText(s);s=y.key,u=y.text.length,f=c.hasVoidParent(s,e)}e.withoutNormalizing(function(){for(;l;){var t=c.getClosestVoid(a,e),n=c.getNextText(a);if(e.removeNodeByKey(t.key),a===s)return;if(!n)return;c=e.value.document,a=n.key,i=0,l=c.hasVoidParent(a,e)}for(;f;){var r=c.getClosestVoid(s,e),o=c.getPreviousText(s);e.removeNodeByKey(r.key),c=e.value.document,s=o.key,u=o.text.length,f=c.hasVoidParent(s,e)}if(a===s&&h)e.removeNodeByKey(d.key);else if(a!==s){d=c.getClosestBlock(a),v=c.getClosestBlock(s);var y=c.getNode(a),p=c.getNode(s),m=y.text.length-i,g=u,b=c.getCommonAncestor(a,s),A=b.getFurthestChild(a),x=b.getFurthestChild(s),w=c.getParent(d.key),O=w.nodes.indexOf(d),N=w.nodes.indexOf(v),T=void 0;for(T=y;T.key!==A.key;){var _=c.getParent(T.key),S=_.nodes.indexOf(T);_.nodes.slice(S+1).reverse().forEach(function(t){e.removeNodeByKey(t.key)}),T=_}var P=b.nodes.indexOf(A),B=b.nodes.indexOf(x);for(b.nodes.slice(P+1,B).reverse().forEach(function(t){e.removeNodeByKey(t.key)}),T=p;T.key!==x.key;){var F=c.getParent(T.key),E=F.nodes.indexOf(T);F.nodes.slice(0,E).reverse().forEach(function(t){e.removeNodeByKey(t.key)}),T=F}if(0!==m&&e.removeTextByKey(a,i,m),0!==g&&e.removeTextByKey(s,0,u),d.key!==v.key){c=e.value.document;var j=void 0,C=!0,R=!1,L=void 0;try{for(var D,z=c.ancestors(v.key)[Symbol.iterator]();!(C=(D=z.next()).done);C=!0){var M=D.value,I=k(M,1)[0];if(I.nodes.size>1)break;j=I}}catch(e){R=!0,L=e}finally{try{!C&&z.return&&z.return()}finally{if(R)throw L}}N!==O+1&&e.moveNodeByKey(v.key,w.key,O+1),h?e.removeNodeByKey(d.key):e.mergeNodeByKey(v.key),j&&e.removeNodeByKey(j.key)}}else{var J=i,K=u-i;e.removeTextByKey(a,J,K)}})},deleteBackwardAtRange:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){var r=e.value.document,o=t,a=o.start,i=o.focus;if(t.isExpanded)e.deleteAtRange(t);else{var s=r.getClosestVoid(a.path,e);if(s)e.removeNodeByKey(s.key);else if(!a.isAtStartOfNode(r)){var u=r.getClosestBlock(a.path);if(1!==r.nodes.size&&u&&""===u.text&&1===u.nodes.size)e.removeNodeByKey(u.key);else{var c=r.getDescendant(a.path);if(a.isAtStartOfNode(c)){var l=r.getPreviousText(c.key);r.getClosestInline(c.key)&&""===l.text&&(l=r.getPreviousText(l.key));var f=r.getClosestBlock(l.key),d=r.getClosestVoid(l.key,e);if(d)return void e.removeNodeByKey(d.key);if(1===n&&f!==u)return t=t.moveAnchorTo(l.key,l.text.length),void e.deleteAtRange(t)}if(n<=i.offset)return t=t.moveFocusBackward(n),void e.deleteAtRange(t);for(var v=c,h=0,y=i.offset;n>y;){var p=y+(v=r.getPreviousText(v.key)).text.length;if(n<=p){h=p-n;break}y=p}t=t.moveAnchorTo(v.key,h),e.deleteAtRange(t)}}}}},deleteCharBackwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path),a=o.getOffset(r.key)+r.offset,i=o.text,s=st.getCharOffsetBackward(i,a);e.deleteBackwardAtRange(t,s)}},deleteCharForwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path),a=o.getOffset(r.key)+r.offset,i=o.text,s=st.getCharOffsetForward(i,a);e.deleteForwardAtRange(t,s)}},deleteForwardAtRange:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){var r=e.value.document,o=t,a=o.start,i=o.focus;if(t.isExpanded)e.deleteAtRange(t);else{var s=r.getClosestVoid(a.path,e);if(s)e.removeNodeByKey(s.key);else{var u=r.getClosestBlock(a.path);if(u&&!e.isVoid(u)&&""===u.text&&1!==r.nodes.size){var c=r.getNextBlock(u.key);return e.removeNodeByKey(u.key),void(c&&c.key&&e.moveToStartOfNode(c))}if(!a.isAtEndOfNode(r)){var l=r.getDescendant(a.path);if(a.isAtEndOfNode(l)){var f=r.getNextText(l.key),d=r.getClosestBlock(f.key),v=r.getClosestVoid(f.key,e);if(v)return void e.removeNodeByKey(v.key);if(1===n&&d!==u)return t=t.moveFocusTo(f.key,0),void e.deleteAtRange(t)}if(n<=l.text.length-i.offset)return t=t.moveFocusForward(n),void e.deleteAtRange(t);for(var h=l,y=i.offset,p=l.text.length-i.offset;n>p;){var m=p+(h=r.getNextText(h.key)).text.length;if(n<=m){y=n-p;break}p=m}t=t.moveFocusTo(h.key,y),e.deleteAtRange(t)}}}}},deleteLineBackwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path).getOffset(r.key)+r.offset;e.deleteBackwardAtRange(t,o)}},deleteLineForwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path),a=o.getOffset(r.key)+r.offset;e.deleteForwardAtRange(t,o.text.length-a)}},deleteWordBackwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path),a=o.getOffset(r.key)+r.offset,i=o.text,s=0===a?1:st.getWordOffsetBackward(i,a);e.deleteBackwardAtRange(t,s)}},deleteWordForwardAtRange:function(e,t){if(t.isExpanded)e.deleteAtRange(t);else{var n=e.value.document,r=t.start,o=n.getClosestBlock(r.path),a=o.getOffset(r.key)+r.offset,i=o.text,s=st.getWordOffsetForward(i,a),u=0===s?1:s;e.deleteForwardAtRange(t,u)}},insertBlockAtRange:function(e,t,n){t=ut(e,t),n=te.create(n);var r=e.value.document,o=t.start,a=o.key,i=o.offset,s=r.getClosestBlock(a),u=r.getClosestInline(a),c=r.getParent(s.key),l=c.nodes.indexOf(s),f=lt(e,t);if("before"===f)e.insertNodeByKey(c.key,l,n);else if("behind"===f)e.insertNodeByKey(c.key,l+1,n);else{if(u&&e.isVoid(u)){var d=o.isAtEndOfNode(u),v=d?r.getNextText(a):r.getPreviousText(a),h=d?t.moveToStartOfNode(v):t.moveToEndOfNode(v);a=h.start.key,i=h.start.offset}e.withoutNormalizing(function(){e.splitDescendantsByKey(s.key,a,i),e.insertNodeByKey(c.key,l+1,n)})}}},lt=function(e,t){var n=e.value.document,r=t.start,o=r.key,a=n.getClosestBlock(o),i=n.getClosestInline(o);return e.isVoid(a)?r.isAtEndOfNode(a)?"behind":"before":i||""!==a.text?r.isAtStartOfNode(a)?"before":r.isAtEndOfNode(a)?"behind":"split":"behind"};ct.insertFragmentAtRange=function(e,n,r){e.withoutNormalizing(function(){if(n=ut(e,n),r.nodes.size){r=r.mapDescendants(function(e){return e.regenerateKey()});var o=n.start,a=e.value.document,i=a.getDescendant(o.path),s=a.getClosestBlock(i.key),u=s.getFurthestChild(i.key),c=o.isAtStartOfNode(s),l=a.getParent(s.key),f=l.nodes.indexOf(s),d=r.getBlocks(),v=r.nodes.first(),h=r.nodes.last(),y=d.first(),p=d.last(),m=ft(r,a,s.key);if(y===p&&e.isVoid(y))e.insertBlockAtRange(n,y);else if(m!==r||!v.hasBlockChildren()&&!h.hasBlockChildren()){if(y!==p){var k=m.getFurthest(y.key,function(e){return 1===e.nodes.size})||y,g=l.nodes.indexOf(s);m.removeNode(k.key).nodes.forEach(function(t,n){var r=g+n+1;e.insertNodeByKey(l.key,r,t)})}if(0!==o.offset&&e.splitDescendantsByKey(u.key,o.key,o.offset),i=(a=e.value.document).getDescendant(o.key),u=(s=a.getClosestBlock(o.key)).getFurthestChild(i.key),y!==p){var b=c?u:s.getNextSibling(u.key),A=b?s.nodes.skipUntil(function(e){return e.key===b.key}):t.List(),x=p.nodes.size;A.forEach(function(t,n){var r=x+n;e.moveNodeByKey(t.key,p.key,r)})}if(e.isVoid(s)||""!==s.text||s.findDescendant(function(t){return e.isVoid(t)})){var w=s.getFurthestChild(i.key),O=s.nodes.indexOf(w);y.nodes.forEach(function(t,n){var r=0===o.offset?0:1,a=O+n+r;e.insertNodeByKey(s.key,a,t)})}else e.removeNodeByKey(s.key),e.insertNodeByKey(l.key,f,y)}else{("before"===lt(e,n)?r.nodes:r.nodes.reverse()).forEach(function(t){e.insertBlockAtRange(n,t)})}}})};var ft=function(e,t,n){var r=function(e){if(e&&"text"!==e.object)return 1===e.nodes.size},o=function(e){return e&&e.nodes.first()},a=e;if(r(e)){var i=o(e),s=t.getFurthest(n,function(e){return e.type===i.type});for(s===t.getParent(n)&&(a=i);r(i)&&r(s)&&(i=o(i),s=o(s),i.type===s.type);)a=i}return a};ct.insertInlineAtRange=function(e,t,n){n=G.create(n),e.withoutNormalizing(function(){t=ut(e,t);var r=e.value.document,o=t.start,a=r.getParent(o.path),i=r.assertDescendant(o.path),s=a.nodes.indexOf(i);e.isVoid(a)||(e.splitNodeByPath(o.path,o.offset),e.insertNodeByKey(a.key,s+1,n))})},ct.insertTextAtRange=function(e,t,n,r){e.withoutNormalizing(function(){t=ut(e,t);var o=e.value.document,a=t.start,i=a.offset,s=o.getParent(a.path);e.isVoid(s)||e.insertTextByPath(a.path,i,n,r)})},ct.removeMarkAtRange=function(e,t,n){if(!t.isCollapsed){var r=e.value.document.getTextsAtRange(t),o=t.start,a=t.end;e.withoutNormalizing(function(){r.forEach(function(t){var r=t.key,i=0,s=t.text.length;r===o.key&&(i=o.offset),r===a.key&&(s=a.offset),r===o.key&&r===a.key&&(s=a.offset-o.offset),e.removeMarkByKey(r,i,s,n)})})}},ct.setBlocksAtRange=function(e,t,n){var r=e.value.document,o=r.getLeafBlocksAtRange(t),a=t.start,i=t.end,s=t.isCollapsed,u=r.hasVoidParent(a.path,e),c=r.getClosestBlock(a.path),l=r.getClosestBlock(i.key),f=!1===s&&0===a.offset&&0===i.offset&&!1===u&&a.key===c.getFirstText().key&&i.key===l.getFirstText().key?o.slice(0,-1):o;e.withoutNormalizing(function(){f.forEach(function(t){e.setNodeByKey(t.key,n)})})},ct.setInlinesAtRange=function(e,t,n){var r=e.value.document.getLeafInlinesAtRange(t);e.withoutNormalizing(function(){r.forEach(function(t){e.setNodeByKey(t.key,n)})})},ct.splitBlockAtRange=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t=ut(e,t),o=r.start,a=r.end,i=e.value,s=i.document,u=s.assertDescendant(o.path),c=s.getClosestBlock(u.key),l=0;c&&"block"===c.object&&l<n;)u=c,c=s.getClosestBlock(c.key),l++;e.withoutNormalizing(function(){if(e.splitDescendantsByKey(u.key,o.path,o.offset),i=e.value,s=i.document,t.isExpanded){t.isBackward&&(t=t.flip());var n=s.getNextBlock(u.key);t=(t=t.moveAnchorToStartOfNode(n)).setFocus(t.focus.setPath(null)),o.path.equals(a.path)&&(t=t.moveFocusTo(t.anchor.key,a.offset-o.offset)),t=s.resolveRange(t),e.deleteAtRange(t)}})},ct.splitInlineAtRange=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,r=(t=ut(e,t)).start,o=e.value.document,a=o.assertDescendant(r.path),i=o.getClosestInline(a.key),s=0;i&&"inline"===i.object&&s<n;)a=i,i=o.getClosestInline(i.key),s++;e.splitDescendantsByKey(a.key,r.path,r.offset)},ct.toggleMarkAtRange=function(e,t,n){t.isCollapsed||(n=C.create(n),e.value.document.getActiveMarksAtRange(t).some(function(e){return e.equals(n)})?e.removeMarkAtRange(t,n):e.addMarkAtRange(t,n))},ct.unwrapBlockAtRange=function(e,t,n){n=X.createProperties(n);var r=e.value.document,o=r.getLeafBlocksAtRange(t),a=o.map(function(e){return r.getClosest(e.key,function(e){return"block"===e.object&&((null==n.type||e.type===n.type)&&!(null!=n.data&&!e.data.isSuperset(n.data)))})}).filter(function(e){return e}).toOrderedSet().toList();e.withoutNormalizing(function(){a.forEach(function(t){var n=t.nodes.first(),a=t.nodes.last(),i=e.value.document.getParent(t.key),s=i.nodes.indexOf(t),u=t.nodes.filter(function(e){return o.some(function(t){return e===t||e.hasDescendant(t.key)})}),c=u.first(),l=u.last();if(n===c&&a===l)t.nodes.forEach(function(t,n){e.moveNodeByKey(t.key,i.key,s+n)}),e.removeNodeByKey(t.key);else if(a===l)t.nodes.skipUntil(function(e){return e===c}).forEach(function(t,n){e.moveNodeByKey(t.key,i.key,s+1+n)});else if(n===c)t.nodes.takeUntil(function(e){return e===l}).push(l).forEach(function(t,n){e.moveNodeByKey(t.key,i.key,s+n)});else{var f=c.getFirstText();e.splitDescendantsByKey(t.key,f.key,0),r=e.value.document,u.forEach(function(t,n){if(0===n){var o=t;t=r.getNextBlock(t.key),e.removeNodeByKey(o.key)}e.moveNodeByKey(t.key,i.key,s+1+n)})}})})},ct.unwrapInlineAtRange=function(e,t,n){n=X.createProperties(n);var r=e.value.document,o=r.getTextsAtRange(t).map(function(e){return r.getClosest(e.key,function(e){return"inline"===e.object&&((null==n.type||e.type===n.type)&&!(null!=n.data&&!e.data.isSuperset(n.data)))})}).filter(function(e){return e}).toOrderedSet().toList();e.withoutNormalizing(function(){o.forEach(function(t){var n=e.value.document.getParent(t.key),r=n.nodes.indexOf(t);t.nodes.forEach(function(t,o){e.moveNodeByKey(t.key,n.key,r+o)}),e.removeNodeByKey(t.key)})})},ct.wrapBlockAtRange=function(e,t,n){n=(n=te.create(n)).set("nodes",n.nodes.clear());var r=e.value.document,o=r.getLeafBlocksAtRange(t),a=o.first(),i=o.last(),s=void 0,u=void 0,c=void 0;if(1===o.length?(s=r.getParent(a.key),u=o):s=r.getClosest(a.key,function(e){return!!r.getClosest(i.key,function(t){return e===t})}),null==s&&(s=r),null==u){var l=s.nodes.reduce(function(e,t,n){return(t===a||t.hasDescendant(a.key))&&(e[0]=n),(t===i||t.hasDescendant(i.key))&&(e[1]=n),e},[]);c=l[0],u=s.nodes.slice(l[0],l[1]+1)}null==c&&(c=s.nodes.indexOf(u.first())),e.withoutNormalizing(function(){e.insertNodeByKey(s.key,c,n),u.forEach(function(t,r){e.moveNodeByKey(t.key,n.key,r)})})},ct.wrapInlineAtRange=function(e,t,n){var r=e.value.document,o=t.start,a=t.end;if(t.isCollapsed){var i=r.getClosestInline(o.path);if(!i)return;if(!e.isVoid(i))return;return e.wrapInlineByKey(i.key,n)}n=(n=G.create(n)).set("nodes",n.nodes.clear());var s=r.getLeafBlocksAtRange(t),u=r.getClosestBlock(o.path),c=r.getClosestBlock(a.path),l=r.getClosestInline(o.path),f=r.getClosestInline(a.path),d=u.getFurthestChild(o.key),v=c.getFurthestChild(a.key);e.withoutNormalizing(function(){l&&l===f||(e.splitDescendantsByKey(v.key,a.key,a.offset),e.splitDescendantsByKey(d.key,o.key,o.offset)),r=e.value.document,u=r.getDescendant(u.key),c=r.getDescendant(c.key),d=u.getFurthestChild(o.key),v=c.getFurthestChild(a.key);var i=u.nodes.indexOf(d),h=c.nodes.indexOf(v);if(l&&l===f){var y=u.getTextsAtRange(t).map(function(e){return o.key===e.key&&a.key===e.key?e.splitText(o.offset)[1].splitText(a.offset-o.offset)[0].regenerateKey():o.key===e.key?e.splitText(o.offset)[1].regenerateKey():a.key===e.key?e.splitText(a.offset)[0].regenerateKey():e.regenerateKey()});n=n.set("nodes",y),e.insertInlineAtRange(t,n)}else if(u===c){r=e.value.document,u=r.getClosestBlock(o.key),d=u.getFurthestChild(o.key);var p=r.getNextSibling(d.key),m=u.nodes.indexOf(p),k=o.key===a.key?p:u.getFurthestChild(a.key),g=u.nodes.skipUntil(function(e){return e===p}).takeUntil(function(e){return e===k}).push(k),b=n.regenerateKey();e.insertNodeByKey(u.key,m,b),g.forEach(function(t,n){e.moveNodeByKey(t.key,b.key,n)})}else{var A=u.nodes.slice(i+1),x=c.nodes.slice(0,h+1),w=n.regenerateKey(),O=n.regenerateKey();e.insertNodeByKey(u.key,i+1,w),e.insertNodeByKey(c.key,h,O),A.forEach(function(t,n){e.moveNodeByKey(t.key,w.key,n)}),x.forEach(function(t,n){e.moveNodeByKey(t.key,O.key,n)}),s.slice(1,-1).forEach(function(t){var r=n.regenerateKey();e.insertNodeByKey(t.key,0,r),t.nodes.forEach(function(t,n){e.moveNodeByKey(t.key,r.key,n)})})}})},ct.wrapTextAtRange=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n,o=t.start,a=t.end,i=t.moveToStart(),s=t.moveToEnd();o.path.equals(a.path)&&(s=s.moveForward(n.length)),e.withoutNormalizing(function(){e.insertTextAtRange(i,n),e.insertTextAtRange(s,r)})};var dt=Array.isArray,vt="object"==typeof Pe&&Pe&&Pe.Object===Object&&Pe,ht="object"==typeof self&&self&&self.Object===Object&&self,yt=vt||ht||Function("return this")(),pt=yt.Symbol,mt=Object.prototype,kt=mt.hasOwnProperty,gt=mt.toString,bt=pt?pt.toStringTag:void 0;var At=function(e){var t=kt.call(e,bt),n=e[bt];try{e[bt]=void 0;var r=!0}catch(e){}var o=gt.call(e);return r&&(t?e[bt]=n:delete e[bt]),o},xt=Object.prototype.toString;var wt=function(e){return xt.call(e)},Ot="[object Null]",Nt="[object Undefined]",Tt=pt?pt.toStringTag:void 0;var _t=function(e){return null==e?void 0===e?Nt:Ot:Tt&&Tt in Object(e)?At(e):wt(e)};var St=function(e){return null!=e&&"object"==typeof e},Pt="[object Symbol]";var Bt=function(e){return"symbol"==typeof e||St(e)&&_t(e)==Pt},Ft=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Et=/^\w*$/;var jt=function(e,t){if(dt(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Bt(e))||Et.test(e)||!Ft.test(e)||null!=t&&e in Object(t)};var Ct=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Rt="[object AsyncFunction]",Lt="[object Function]",Dt="[object GeneratorFunction]",zt="[object Proxy]";var Mt,It=function(e){if(!Ct(e))return!1;var t=_t(e);return t==Lt||t==Dt||t==Rt||t==zt},Jt=yt["__core-js_shared__"],Kt=(Mt=/[^.]+$/.exec(Jt&&Jt.keys&&Jt.keys.IE_PROTO||""))?"Symbol(src)_1."+Mt:"";var Ut=function(e){return!!Kt&&Kt in e},qt=Function.prototype.toString;var Vt=function(e){if(null!=e){try{return qt.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Wt=/^\[object .+?Constructor\]$/,$t=Function.prototype,Gt=Object.prototype,Qt=$t.toString,Zt=Gt.hasOwnProperty,Yt=RegExp("^"+Qt.call(Zt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Ht=function(e){return!(!Ct(e)||Ut(e))&&(It(e)?Yt:Wt).test(Vt(e))};var Xt=function(e,t){return null==e?void 0:e[t]};var en=function(e,t){var n=Xt(e,t);return Ht(n)?n:void 0},tn=en(Object,"create");var nn=function(){this.__data__=tn?tn(null):{},this.size=0};var rn=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},on="__lodash_hash_undefined__",an=Object.prototype.hasOwnProperty;var sn=function(e){var t=this.__data__;if(tn){var n=t[e];return n===on?void 0:n}return an.call(t,e)?t[e]:void 0},un=Object.prototype.hasOwnProperty;var cn=function(e){var t=this.__data__;return tn?void 0!==t[e]:un.call(t,e)},ln="__lodash_hash_undefined__";var fn=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=tn&&void 0===t?ln:t,this};function dn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}dn.prototype.clear=nn,dn.prototype.delete=rn,dn.prototype.get=sn,dn.prototype.has=cn,dn.prototype.set=fn;var vn=dn;var hn=function(){this.__data__=[],this.size=0};var yn=function(e,t){return e===t||e!=e&&t!=t};var pn=function(e,t){for(var n=e.length;n--;)if(yn(e[n][0],t))return n;return-1},mn=Array.prototype.splice;var kn=function(e){var t=this.__data__,n=pn(t,e);return!(n<0||(n==t.length-1?t.pop():mn.call(t,n,1),--this.size,0))};var gn=function(e){var t=this.__data__,n=pn(t,e);return n<0?void 0:t[n][1]};var bn=function(e){return pn(this.__data__,e)>-1};var An=function(e,t){var n=this.__data__,r=pn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function xn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}xn.prototype.clear=hn,xn.prototype.delete=kn,xn.prototype.get=gn,xn.prototype.has=bn,xn.prototype.set=An;var wn=xn,On=en(yt,"Map");var Nn=function(){this.size=0,this.__data__={hash:new vn,map:new(On||wn),string:new vn}};var Tn=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var _n=function(e,t){var n=e.__data__;return Tn(t)?n["string"==typeof t?"string":"hash"]:n.map};var Sn=function(e){var t=_n(this,e).delete(e);return this.size-=t?1:0,t};var Pn=function(e){return _n(this,e).get(e)};var Bn=function(e){return _n(this,e).has(e)};var Fn=function(e,t){var n=_n(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function En(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}En.prototype.clear=Nn,En.prototype.delete=Sn,En.prototype.get=Pn,En.prototype.has=Bn,En.prototype.set=Fn;var jn=En,Cn="Expected a function";function Rn(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Cn);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var i=e.apply(this,r);return n.cache=a.set(o,i)||a,i};return n.cache=new(Rn.Cache||jn),n}Rn.Cache=jn;var Ln=Rn,Dn=500;var zn=/^\./,Mn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,In=/\\(\\)?/g,Jn=function(e){var t=Ln(e,function(e){return n.size===Dn&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return zn.test(e)&&t.push(""),e.replace(Mn,function(e,n,r,o){t.push(r?o.replace(In,"$1"):n||e)}),t});var Kn=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o},Un=1/0,qn=pt?pt.prototype:void 0,Vn=qn?qn.toString:void 0;var Wn=function e(t){if("string"==typeof t)return t;if(dt(t))return Kn(t,e)+"";if(Bt(t))return Vn?Vn.call(t):"";var n=t+"";return"0"==n&&1/t==-Un?"-0":n};var $n=function(e){return null==e?"":Wn(e)};var Gn=function(e,t){return dt(e)?e:jt(e,t)?[e]:Jn($n(e))},Qn=1/0;var Zn=function(e){if("string"==typeof e||Bt(e))return e;var t=e+"";return"0"==t&&1/e==-Qn?"-0":t};var Yn=function(e,t){for(var n=0,r=(t=Gn(t,e)).length;null!=e&&n<r;)e=e[Zn(t[n++])];return n&&n==r?e:void 0},Hn=function(){try{var e=en(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Xn=function(e,t,n){"__proto__"==t&&Hn?Hn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},er=Object.prototype.hasOwnProperty;var tr=function(e,t,n){var r=e[t];er.call(e,t)&&yn(r,n)&&(void 0!==n||t in e)||Xn(e,t,n)},nr=9007199254740991,rr=/^(?:0|[1-9]\d*)$/;var or=function(e,t){return!!(t=null==t?nr:t)&&("number"==typeof e||rr.test(e))&&e>-1&&e%1==0&&e<t};var ar=function(e,t,n,r){if(!Ct(e))return e;for(var o=-1,a=(t=Gn(t,e)).length,i=a-1,s=e;null!=s&&++o<a;){var u=Zn(t[o]),c=n;if(o!=i){var l=s[u];void 0===(c=r?r(l,u,s):void 0)&&(c=Ct(l)?l:or(t[o+1])?[]:{})}tr(s,u,c),s=s[u]}return e};var ir=function(e,t,n){for(var r=-1,o=t.length,a={};++r<o;){var i=t[r],s=Yn(e,i);n(s,i)&&ar(a,Gn(i,e),s)}return a};var sr=function(e,t){return null!=e&&t in Object(e)},ur="[object Arguments]";var cr=function(e){return St(e)&&_t(e)==ur},lr=Object.prototype,fr=lr.hasOwnProperty,dr=lr.propertyIsEnumerable,vr=cr(function(){return arguments}())?cr:function(e){return St(e)&&fr.call(e,"callee")&&!dr.call(e,"callee")},hr=9007199254740991;var yr=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=hr};var pr=function(e,t,n){for(var r=-1,o=(t=Gn(t,e)).length,a=!1;++r<o;){var i=Zn(t[r]);if(!(a=null!=e&&n(e,i)))break;e=e[i]}return a||++r!=o?a:!!(o=null==e?0:e.length)&&yr(o)&&or(i,o)&&(dt(e)||vr(e))};var mr=function(e,t){return null!=e&&pr(e,t,sr)};var kr=function(e,t){return ir(e,t,function(t,n){return mr(e,n)})};var gr=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e},br=pt?pt.isConcatSpreadable:void 0;var Ar=function(e){return dt(e)||vr(e)||!!(br&&e&&e[br])};var xr=function e(t,n,r,o,a){var i=-1,s=t.length;for(r||(r=Ar),a||(a=[]);++i<s;){var u=t[i];n>0&&r(u)?n>1?e(u,n-1,r,o,a):gr(a,u):o||(a[a.length]=u)}return a};var wr=function(e){return null!=e&&e.length?xr(e,1):[]};var Or=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},Nr=Math.max;var Tr=function(e,t,n){return t=Nr(void 0===t?e.length-1:t,0),function(){for(var r=arguments,o=-1,a=Nr(r.length-t,0),i=Array(a);++o<a;)i[o]=r[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=r[o];return s[t]=n(i),Or(e,this,s)}};var _r=function(e){return function(){return e}};var Sr=Hn?function(e,t){return Hn(e,"toString",{configurable:!0,enumerable:!1,value:_r(t),writable:!0})}:function(e){return e},Pr=800,Br=16,Fr=Date.now;var Er=function(e){var t=0,n=0;return function(){var r=Fr(),o=Br-(r-n);if(n=r,o>0){if(++t>=Pr)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Sr);var jr=function(e){return Er(Tr(e,void 0,wr),e+"")},Cr=jr(function(e,t){return null==e?{}:kr(e,t)}),Rr={addMarkByPath:function(e,t,n,r,o){o=C.create(o),e.addMarksByPath(t,n,r,[o])},addMarksByPath:function(e,t,n,r,o){if((o=C.createSet(o)).size){var a=e.value.document.assertNode(t);e.withoutNormalizing(function(){n+r<a.text.length&&e.splitNodeByPath(t,n+r),n>0&&(e.splitNodeByPath(t,n),t=P.increment(t),n=0),o.forEach(function(n){e.applyOperation({type:"add_mark",path:t,mark:C.create(n)})})})}},replaceMarksByPath:function(e,t,n,r,o){var a=C.createSet(o),i=e.value.document.assertNode(t);i.marks.equals(a)||e.withoutNormalizing(function(){n+r<i.text.length&&e.splitNodeByPath(t,n+r),n>0&&(e.splitNodeByPath(t,n),t=P.increment(t),n=0);var o=a.subtract(i.marks);i.marks.subtract(a).forEach(function(n){e.applyOperation({type:"remove_mark",path:t,mark:C.create(n)})}),o.forEach(function(n){e.applyOperation({type:"add_mark",path:t,mark:C.create(n)})})})},insertFragmentByPath:function(e,t,n,r){r.nodes.forEach(function(r,o){e.insertNodeByPath(t,n+o,r)})},insertNodeByPath:function(e,t,n,r){e.applyOperation({type:"insert_node",path:t.concat(n),node:r})},insertTextByPath:function(e,t,n,r,o){var a=e.value,i=a.annotations;a.document.assertNode(t),e.withoutNormalizing(function(){var a=!0,s=!1,u=void 0;try{for(var c,l=i.values()[Symbol.iterator]();!(a=(c=l.next()).done);a=!0){var f=c.value,d=f.start,v=f.end;e.isAtomic(f)&&(d.path.equals(t)&&d.offset<n&&(!v.path.equals(t)||v.offset>n)&&e.removeAnnotation(f))}}catch(e){s=!0,u=e}finally{try{!a&&l.return&&l.return()}finally{if(s)throw u}}e.applyOperation({type:"insert_text",path:t,offset:n,text:r}),o&&e.replaceMarksByPath(t,n,r.length,o)})},mergeNodeByPath:function(e,t){var n=e.value.document,r=n.getDescendant(t),o=n.getPreviousSibling(t);if(!o)throw new Error('Unable to merge node with path "'+t+'", because it has no previous sibling.');var a="text"===o.object?o.text.length:o.nodes.size;e.applyOperation({type:"merge_node",path:t,position:a,properties:{type:r.type,data:r.data},target:null})},moveNodeByPath:function(e,t,n,r){if(P.isEqual(t,n))return e;var o=n.concat(r);if(P.isEqual(t,o))return e;e.applyOperation({type:"move_node",path:t,newPath:o})},removeMarkByPath:function(e,t,n,r,o){o=C.create(o),e.removeMarksByPath(t,n,r,[o])},removeMarksByPath:function(e,t,n,r,o){if((o=C.createSet(o)).size){var a=e.value.document.assertNode(t);o.intersect(a.marks).isEmpty()||e.withoutNormalizing(function(){n+r<a.text.length&&e.splitNodeByPath(t,n+r),n>0&&(e.splitNodeByPath(t,n),t=P.increment(t),n=0),o.forEach(function(o){e.applyOperation({type:"remove_mark",path:t,offset:n,length:r,mark:o})})})}},removeAllMarksByPath:function(e,t){var n=e.state.document.assertNode(t);e.withoutNormalizing(function(){if("text"!==n.object){var r=!0,o=!1,a=void 0;try{for(var i,s=n.texts()[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var u=i.value,c=k(u,2),l=c[0],f=c[1],d=t.concat(f);e.removeMarksByPath(d,0,l.text.length,l.marks)}}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}}else e.removeMarksByPath(t,0,n.text.length,n.marks)})},removeNodeByPath:function(e,t){var n=e.value.document.assertNode(t);e.applyOperation({type:"remove_node",path:t,node:n})},removeTextByPath:function(e,t,n,r){var o=e.value,a=o.document,i=o.annotations,s=a.assertNode(t).text.slice(n,n+r);e.withoutNormalizing(function(){var r=!0,o=!1,a=void 0;try{for(var u,c=i.values()[Symbol.iterator]();!(r=(u=c.next()).done);r=!0){var l=u.value,f=l.start,d=l.end;e.isAtomic(l)&&(f.path.equals(t)&&f.offset<n&&(!d.path.equals(t)||d.offset>n)&&e.removeAnnotation(l))}}catch(e){o=!0,a=e}finally{try{!r&&c.return&&c.return()}finally{if(o)throw a}}e.applyOperation({type:"remove_text",path:t,offset:n,text:s})})},replaceNodeByPath:function(e,t,n){n=X.create(n);var r=t.last(),o=P.lift(t);e.withoutNormalizing(function(){e.removeNodeByPath(t),e.insertNodeByPath(o,r,n)})},replaceTextByPath:function(e,t,n,r,o,a){e.withoutNormalizing(function(){e.removeTextByPath(t,n,r),e.insertTextByPath(t,n,o,a)})},setMarkByPath:function(e,t,n,r,o,a){o=C.create(o),a=C.createProperties(a);var i=e.value.document.assertNode(t);e.withoutNormalizing(function(){n+r<i.text.length&&e.splitNodeByPath(t,n+r),n>0&&(e.splitNodeByPath(t,n),t=P.increment(t),n=0),e.applyOperation({type:"set_mark",path:t,properties:o,newProperties:a})})},setNodeByPath:function(e,t,n){var r=e.value.document.assertNode(t);n=X.createProperties(n);var o=Cr(r,Object.keys(n));e.applyOperation({type:"set_node",path:t,properties:o,newProperties:n})},setTextByPath:function(e,t,n,r){var o=e.value.document.assertNode(t).text.length;e.replaceTextByPath(t,0,o,n,r)},splitNodeByPath:function(e,t,n){var r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).target,o=void 0===r?null:r,a=e.value.document.getDescendant(t);e.applyOperation({type:"split_node",path:t,position:n,target:o,properties:{type:a.type,data:a.data}})},splitDescendantsByPath:function(e,t,n,r){if(t.equals(n))e.splitNodeByPath(n,r);else{var o=e.value.document,a=r,i=n;e.withoutNormalizing(function(){e.splitNodeByKey(n,r);var s=!0,u=!1,c=void 0;try{for(var l,f=o.ancestors(n)[Symbol.iterator]();!(s=(l=f.next()).done);s=!0){var d=l.value,v=k(d,2)[1],h=a;if(a=i.last()+1,i=v,e.splitNodeByPath(v,a,{target:h}),v.equals(t))break}}catch(e){u=!0,c=e}finally{try{!s&&f.return&&f.return()}finally{if(u)throw c}}})}},unwrapInlineByPath:function(e,t,n){var r=e.value,o=r.document,a=r.selection,i=o.assertNode(t),s=i.getFirstText(),u=i.getLastText(),c=a.moveToRangeOfNode(s,u);e.unwrapInlineAtRange(c,n)},unwrapBlockByPath:function(e,t,n){var r=e.value,o=r.document,a=r.selection,i=o.assertNode(t),s=i.getFirstText(),u=i.getLastText(),c=a.moveToRangeOfNode(s,u);e.unwrapBlockAtRange(c,n)},unwrapNodeByPath:function(e,t){var n=e.value.document;n.assertNode(t);var r=P.lift(t),o=n.assertNode(r),a=t.last(),i=r.last(),s=P.lift(r),u=0===a,c=a===o.nodes.size-1;e.withoutNormalizing(function(){if(1===o.nodes.size)e.moveNodeByPath(t,s,i+1),e.removeNodeByPath(r);else if(u)e.moveNodeByPath(t,s,i);else if(c)e.moveNodeByPath(t,s,i+1);else{var n=P.increment(t,1,r.size-1);n=n.set(n.size-1,0),e.splitNodeByPath(r,a),e.moveNodeByPath(n,s,i+1)}})},unwrapChildrenByPath:function(e,t){t=P.create(t);var n=e.value.document.assertNode(t),r=P.lift(t),o=t.last(),a=n.nodes;e.withoutNormalizing(function(){a.reverse().forEach(function(n,i){var s=a.size-i-1,u=t.push(s);e.moveNodeByPath(u,r,o+1)}),e.removeNodeByPath(t)})},wrapBlockByPath:function(e,t,n){n=(n=te.create(n)).set("nodes",n.nodes.clear());var r=P.lift(t),o=t.last(),a=P.increment(t);e.withoutNormalizing(function(){e.insertNodeByPath(r,o,n),e.moveNodeByPath(a,t,0)})},wrapInlineByPath:function(e,t,n){n=(n=G.create(n)).set("nodes",n.nodes.clear());var r=P.lift(t),o=t.last(),a=P.increment(t);e.withoutNormalizing(function(){e.insertNodeByPath(r,o,n),e.moveNodeByPath(a,t,0)})},wrapNodeByPath:function(e,t,n){"block"===(n=X.create(n)).object?e.wrapBlockByPath(t,n):"inline"===n.object&&e.wrapInlineByPath(t,n)}},Lr=function(e){Rr[e+"ByKey"]=function(t,n){for(var r=arguments.length,o=Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];var i=t.value.document.assertPath(n);t[e+"ByPath"].apply(t,[i].concat(o))}},Dr=!0,zr=!1,Mr=void 0;try{for(var Ir,Jr=["addMark","insertFragment","insertNode","insertText","mergeNode","removeAllMarks","removeMark","removeNode","removeText","replaceMarks","replaceNode","replaceText","setMark","setNode","setText","splitNode","unwrapBlock","unwrapChildren","unwrapInline","unwrapNode","wrapBlock","wrapInline","wrapNode"][Symbol.iterator]();!(Dr=(Ir=Jr.next()).done);Dr=!0){Lr(Ir.value)}}catch(e){zr=!0,Mr=e}finally{try{!Dr&&Jr.return&&Jr.return()}finally{if(zr)throw Mr}}Rr.moveNodeByKey=function(e,t,n){for(var r=arguments.length,o=Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];var i=e.value.document,s=i.assertPath(t),u=i.assertPath(n);e.moveNodeByPath.apply(e,[s,u].concat(o))},Rr.splitDescendantsByKey=function(e,t,n){for(var r=arguments.length,o=Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];var i=e.value.document,s=i.assertPath(t),u=i.assertPath(n);e.splitDescendantsByPath.apply(e,[s,u].concat(o))};var Kr=function(){this.__data__=new wn,this.size=0};var Ur=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var qr=function(e){return this.__data__.get(e)};var Vr=function(e){return this.__data__.has(e)},Wr=200;var $r=function(e,t){var n=this.__data__;if(n instanceof wn){var r=n.__data__;if(!On||r.length<Wr-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new jn(r)}return n.set(e,t),this.size=n.size,this};function Gr(e){var t=this.__data__=new wn(e);this.size=t.size}Gr.prototype.clear=Kr,Gr.prototype.delete=Ur,Gr.prototype.get=qr,Gr.prototype.has=Vr,Gr.prototype.set=$r;var Qr=Gr;var Zr=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e};var Yr=function(e,t,n,r){var o=!n;n||(n={});for(var a=-1,i=t.length;++a<i;){var s=t[a],u=r?r(n[s],e[s],s,n,e):void 0;void 0===u&&(u=e[s]),o?Xn(n,s,u):tr(n,s,u)}return n};var Hr=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};var Xr=function(){return!1},eo=Be(function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,o=r&&r.exports===n?yt.Buffer:void 0,a=(o?o.isBuffer:void 0)||Xr;e.exports=a}),to={};to["[object Float32Array]"]=to["[object Float64Array]"]=to["[object Int8Array]"]=to["[object Int16Array]"]=to["[object Int32Array]"]=to["[object Uint8Array]"]=to["[object Uint8ClampedArray]"]=to["[object Uint16Array]"]=to["[object Uint32Array]"]=!0,to["[object Arguments]"]=to["[object Array]"]=to["[object ArrayBuffer]"]=to["[object Boolean]"]=to["[object DataView]"]=to["[object Date]"]=to["[object Error]"]=to["[object Function]"]=to["[object Map]"]=to["[object Number]"]=to["[object Object]"]=to["[object RegExp]"]=to["[object Set]"]=to["[object String]"]=to["[object WeakMap]"]=!1;var no=function(e){return St(e)&&yr(e.length)&&!!to[_t(e)]};var ro=function(e){return function(t){return e(t)}},oo=Be(function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,o=r&&r.exports===n&&vt.process,a=function(){try{return o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}),ao=oo&&oo.isTypedArray,io=ao?ro(ao):no,so=Object.prototype.hasOwnProperty;var uo=function(e,t){var n=dt(e),r=!n&&vr(e),o=!n&&!r&&eo(e),a=!n&&!r&&!o&&io(e),i=n||r||o||a,s=i?Hr(e.length,String):[],u=s.length;for(var c in e)!t&&!so.call(e,c)||i&&("length"==c||o&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||or(c,u))||s.push(c);return s},co=Object.prototype;var lo=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||co)};var fo=function(e,t){return function(n){return e(t(n))}},vo=fo(Object.keys,Object),ho=Object.prototype.hasOwnProperty;var yo=function(e){if(!lo(e))return vo(e);var t=[];for(var n in Object(e))ho.call(e,n)&&"constructor"!=n&&t.push(n);return t};var po=function(e){return null!=e&&yr(e.length)&&!It(e)};var mo=function(e){return po(e)?uo(e):yo(e)};var ko=function(e,t){return e&&Yr(t,mo(t),e)};var go=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},bo=Object.prototype.hasOwnProperty;var Ao=function(e){if(!Ct(e))return go(e);var t=lo(e),n=[];for(var r in e)("constructor"!=r||!t&&bo.call(e,r))&&n.push(r);return n};var xo=function(e){return po(e)?uo(e,!0):Ao(e)};var wo=function(e,t){return e&&Yr(t,xo(t),e)},Oo=Be(function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,o=r&&r.exports===n?yt.Buffer:void 0,a=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=a?a(n):new e.constructor(n);return e.copy(r),r}});var No=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var To=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,a=[];++n<r;){var i=e[n];t(i,n,e)&&(a[o++]=i)}return a};var _o=function(){return[]},So=Object.prototype.propertyIsEnumerable,Po=Object.getOwnPropertySymbols,Bo=Po?function(e){return null==e?[]:(e=Object(e),To(Po(e),function(t){return So.call(e,t)}))}:_o;var Fo=function(e,t){return Yr(e,Bo(e),t)},Eo=fo(Object.getPrototypeOf,Object),jo=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)gr(t,Bo(e)),e=Eo(e);return t}:_o;var Co=function(e,t){return Yr(e,jo(e),t)};var Ro=function(e,t,n){var r=t(e);return dt(e)?r:gr(r,n(e))};var Lo=function(e){return Ro(e,mo,Bo)};var Do=function(e){return Ro(e,xo,jo)},zo=en(yt,"DataView"),Mo=en(yt,"Promise"),Io=en(yt,"Set"),Jo=en(yt,"WeakMap"),Ko=Vt(zo),Uo=Vt(On),qo=Vt(Mo),Vo=Vt(Io),Wo=Vt(Jo),$o=_t;(zo&&"[object DataView]"!=$o(new zo(new ArrayBuffer(1)))||On&&"[object Map]"!=$o(new On)||Mo&&"[object Promise]"!=$o(Mo.resolve())||Io&&"[object Set]"!=$o(new Io)||Jo&&"[object WeakMap]"!=$o(new Jo))&&($o=function(e){var t=_t(e),n="[object Object]"==t?e.constructor:void 0,r=n?Vt(n):"";if(r)switch(r){case Ko:return"[object DataView]";case Uo:return"[object Map]";case qo:return"[object Promise]";case Vo:return"[object Set]";case Wo:return"[object WeakMap]"}return t});var Go=$o,Qo=Object.prototype.hasOwnProperty;var Zo=function(e){var t=e.length,n=e.constructor(t);return t&&"string"==typeof e[0]&&Qo.call(e,"index")&&(n.index=e.index,n.input=e.input),n},Yo=yt.Uint8Array;var Ho=function(e){var t=new e.constructor(e.byteLength);return new Yo(t).set(new Yo(e)),t};var Xo=function(e,t){var n=t?Ho(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)};var ea=function(e,t){return e.set(t[0],t[1]),e};var ta=function(e,t,n,r){var o=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++o]);++o<a;)n=t(n,e[o],o,e);return n};var na=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n},ra=1;var oa=function(e,t,n){var r=t?n(na(e),ra):na(e);return ta(r,ea,new e.constructor)},aa=/\w*$/;var ia=function(e){var t=new e.constructor(e.source,aa.exec(e));return t.lastIndex=e.lastIndex,t};var sa=function(e,t){return e.add(t),e};var ua=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n},ca=1;var la=function(e,t,n){var r=t?n(ua(e),ca):ua(e);return ta(r,sa,new e.constructor)},fa=pt?pt.prototype:void 0,da=fa?fa.valueOf:void 0;var va=function(e){return da?Object(da.call(e)):{}};var ha=function(e,t){var n=t?Ho(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)},ya="[object Boolean]",pa="[object Date]",ma="[object Map]",ka="[object Number]",ga="[object RegExp]",ba="[object Set]",Aa="[object String]",xa="[object Symbol]",wa="[object ArrayBuffer]",Oa="[object DataView]",Na="[object Float32Array]",Ta="[object Float64Array]",_a="[object Int8Array]",Sa="[object Int16Array]",Pa="[object Int32Array]",Ba="[object Uint8Array]",Fa="[object Uint8ClampedArray]",Ea="[object Uint16Array]",ja="[object Uint32Array]";var Ca=function(e,t,n,r){var o=e.constructor;switch(t){case wa:return Ho(e);case ya:case pa:return new o(+e);case Oa:return Xo(e,r);case Na:case Ta:case _a:case Sa:case Pa:case Ba:case Fa:case Ea:case ja:return ha(e,r);case ma:return oa(e,r,n);case ka:case Aa:return new o(e);case ga:return ia(e);case ba:return la(e,r,n);case xa:return va(e)}},Ra=Object.create,La=function(){function e(){}return function(t){if(!Ct(t))return{};if(Ra)return Ra(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Da=function(e){return"function"!=typeof e.constructor||lo(e)?{}:La(Eo(e))},za=1,Ma=2,Ia=4,Ja="[object Arguments]",Ka="[object Function]",Ua="[object GeneratorFunction]",qa="[object Object]",Va={};Va[Ja]=Va["[object Array]"]=Va["[object ArrayBuffer]"]=Va["[object DataView]"]=Va["[object Boolean]"]=Va["[object Date]"]=Va["[object Float32Array]"]=Va["[object Float64Array]"]=Va["[object Int8Array]"]=Va["[object Int16Array]"]=Va["[object Int32Array]"]=Va["[object Map]"]=Va["[object Number]"]=Va[qa]=Va["[object RegExp]"]=Va["[object Set]"]=Va["[object String]"]=Va["[object Symbol]"]=Va["[object Uint8Array]"]=Va["[object Uint8ClampedArray]"]=Va["[object Uint16Array]"]=Va["[object Uint32Array]"]=!0,Va["[object Error]"]=Va[Ka]=Va["[object WeakMap]"]=!1;var Wa=function e(t,n,r,o,a,i){var s,u=n&za,c=n&Ma,l=n&Ia;if(r&&(s=a?r(t,o,a,i):r(t)),void 0!==s)return s;if(!Ct(t))return t;var f=dt(t);if(f){if(s=Zo(t),!u)return No(t,s)}else{var d=Go(t),v=d==Ka||d==Ua;if(eo(t))return Oo(t,u);if(d==qa||d==Ja||v&&!a){if(s=c||v?{}:Da(t),!u)return c?Co(t,wo(s,t)):Fo(t,ko(s,t))}else{if(!Va[d])return a?t:{};s=Ca(t,d,e,u)}}i||(i=new Qr);var h=i.get(t);if(h)return h;i.set(t,s);var y=l?c?Do:Lo:c?keysIn:mo,p=f?void 0:y(t);return Zr(p||t,function(o,a){p&&(o=t[a=o]),tr(s,a,e(o,n,r,a,t,i))}),s};var $a=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var Ga=function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(o);++r<o;)a[r]=e[r+t];return a};var Qa=function(e,t){return t.length<2?e:Yn(e,Ga(t,0,-1))};var Za=function(e,t){return t=Gn(t,e),null==(e=Qa(e,t))||delete e[Zn($a(t))]},Ya="[object Object]",Ha=Function.prototype,Xa=Object.prototype,ei=Ha.toString,ti=Xa.hasOwnProperty,ni=ei.call(Object);var ri=function(e){if(!St(e)||_t(e)!=Ya)return!1;var t=Eo(e);if(null===t)return!0;var n=ti.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ei.call(n)==ni};var oi=function(e){return ri(e)?void 0:e},ai=jr(function(e,t){var n={};if(null==e)return n;var r=!1;t=Kn(t,function(t){return t=Gn(t,e),r||(r=t.length>1),t}),Yr(e,Do(e),n),r&&(n=Wa(n,7,oi));for(var o=t.length;o--;)Za(n,t[o]);return n}),ii={};ii.save=function(e,n){var r=e.operations,o=e.value.data,a=e.tmp,i=a.save,s=a.merge;if(!1!==i&&function(e){if("set_selection"===e.type){var t=e.newProperties,n=t.isFocused,r=t.anchor,o=t.focus;if(void 0!==n&&!r&&!o)return!1}return!0}(n)){var u,c,l=o.get("undos")||t.List(),f=l.last(),d=f&&f.last();if(null==s&&(0!==r.size?s=!0:(u=n,s=!!(c=d)&&("set_selection"===u.type&&"set_selection"===c.type||"insert_text"===u.type&&"insert_text"===c.type&&u.offset===c.offset+c.text.length&&u.path.equals(c.path)||"remove_text"===u.type&&"remove_text"===c.type&&u.offset+u.text.length===c.offset&&u.path.equals(c.path)))),s&&f){var v=f.push(n);l=(l=l.pop()).push(v)}else{var h=t.List([n]);l=l.push(h)}l.size>100&&(l=l.takeLast(100)),e.withoutSaving(function(){var n=t.List(),r=o.set("undos",l).set("redos",n);e.setData(r)})}},ii.redo=function(e){var n=e.value.data,r=n.get("redos")||t.List(),o=n.get("undos")||t.List(),a=r.last();a&&e.withoutSaving(function(){e.withoutNormalizing(function(){a.forEach(function(t){var n=t,r=n.type,o=n.newProperties;"set_selection"===r&&(t=t.set("newProperties",ai(o,"isFocused"))),e.applyOperation(t)}),r=r.pop(),o=o.push(a);var t=n.set("undos",o).set("redos",r);e.setData(t)})})},ii.undo=function(e){var n=e.value.data,r=n.get("redos")||t.List(),o=n.get("undos")||t.List(),a=o.last();a&&e.withoutSaving(function(){e.withoutNormalizing(function(){a.slice().reverse().map(function(e){return e.invert()}).forEach(function(t){var n=t,r=n.type,o=n.newProperties;"set_selection"===r&&(t=t.set("newProperties",ai(o,"isFocused"))),e.applyOperation(t)}),r=r.push(a),o=o.pop();var t=n.set("undos",o).set("redos",r);e.setData(t)})})},ii.withoutMerging=function(e,t){var n=e.tmp.merge;e.tmp.merge=!1,t(e),e.tmp.merge=n},ii.withoutSaving=function(e,t){var n=e.tmp.save;e.tmp.save=!1,t(e),e.tmp.save=n};var si={};function ui(e,t){for(var n,r=arguments.length,o=Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];var i=(n=e.value.selection)[t].apply(n,o);e.select(i)}function ci(e,t,n,r){var o=t.slice(0,1).toUpperCase()+t.slice(1),a=n.slice(0,1).toUpperCase()+n.slice(1),i=r.slice(0,1).toUpperCase()+r.slice(1),s="move"+o+"To"+a+"OfNode",u="text"===r?"getNode":"getClosest"+i,c=e.value,l=c.document,f=c.selection[t],d=l[u](f.key);d&&e[s](d)}function li(e,t,n,r,o){var a=t.slice(0,1).toUpperCase()+t.slice(1),i=n.slice(0,1).toUpperCase()+n.slice(1),s=r.slice(0,1).toUpperCase()+r.slice(1),u=o.slice(0,1).toUpperCase()+o.slice(1),c="move"+a+"To"+i+"OfNode",l="text"===o?"getNode":"getClosest"+u,f="get"+s+u,d=e.value,v=d.document,h=d.selection[t],y=v[l](h.key);if(y){var p=v[f](y.key);p&&e[c](p)}}function fi(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){if(n<0)return di(e,t,-n);var r=t.slice(0,1).toUpperCase()+t.slice(1),o=e.value,a=o.document,i=o.selection,s=i[t],u=a.hasVoidParent(s.path,e);if(!u&&s.offset-n>=0){var c=i["move"+r+"Backward"](n);e.select(c)}else{var l=a.getPreviousText(s.path);if(l){var f=a.getClosestBlock(s.path).hasNode(l.key),d=l&&a.hasVoidParent(l.key,e);if(e["move"+r+"ToEndOfNode"](l),!u&&!d&&f){var v=e.value.selection["move"+r+"Backward"](n);e.select(v)}}}}}function di(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){if(n<0)return fi(e,t,-n);var r=t.slice(0,1).toUpperCase()+t.slice(1),o=e.value,a=o.document,i=o.selection,s=i[t],u=a.getNode(s.path),c=a.hasVoidParent(s.path,e);if(!c&&s.offset+n<=u.text.length){var l=i["move"+r+"Forward"](n);e.select(l)}else{var f=a.getNextText(s.path);if(f){var d=a.getClosestBlock(s.path).hasNode(f.key),v=a.hasVoidParent(f.key,e);if(e["move"+r+"ToStartOfNode"](f),!c&&!v&&d){var h=e.value.selection["move"+r+"Forward"](n);e.select(h)}}}}}function vi(e,t){var n=e.value,r=n.document,o=n.selection[t],a=r.getClosestBlock(o.key),i=a.getOffset(o.key)+o.offset,s=a.text,u=st.getWordOffsetBackward(s,i);e.command(fi,t,u>0?u:1)}function hi(e,t){var n=e.value,r=n.document,o=n.selection[t],a=r.getClosestBlock(o.key),i=a.getOffset(o.key)+o.offset,s=a.text,u=st.getWordOffsetForward(s,i);e.command(di,t,u>0?u:1)}si.blur=function(e){e.select({isFocused:!1})},si.deselect=function(e){var t=z.create();e.select(t)},si.focus=function(e){e.select({isFocused:!0})},si.flip=function(e){e.command(ui,"flip")},si.moveAnchorBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[fi,"anchor"].concat(n))},si.moveAnchorWordBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[vi,"anchor"].concat(n))},si.moveAnchorForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[di,"anchor"].concat(n))},si.moveAnchorWordForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[hi,"anchor"].concat(n))},si.moveAnchorTo=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveAnchorTo"].concat(n))},si.moveAnchorToEndOfBlock=function(e){e.command(ci,"anchor","end","block")},si.moveAnchorToEndOfInline=function(e){e.command(ci,"anchor","end","inline")},si.moveAnchorToEndOfDocument=function(e){e.moveAnchorToEndOfNode(e.value.document).moveToAnchor()},si.moveAnchorToEndOfNextBlock=function(e){e.command(li,"anchor","end","next","block")},si.moveAnchorToEndOfNextInline=function(e){e.command(li,"anchor","end","next","inline")},si.moveAnchorToEndOfNextText=function(e){e.command(li,"anchor","end","next","text")},si.moveAnchorToEndOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveAnchorToEndOfNode"].concat(n))},si.moveAnchorToEndOfPreviousBlock=function(e){e.command(li,"anchor","end","previous","block")},si.moveAnchorToEndOfPreviousInline=function(e){e.command(li,"anchor","end","previous","inline")},si.moveAnchorToEndOfPreviousText=function(e){e.command(li,"anchor","end","previous","text")},si.moveAnchorToEndOfText=function(e){e.command(ci,"anchor","end","text")},si.moveAnchorToStartOfBlock=function(e){e.command(ci,"anchor","start","block")},si.moveAnchorToStartOfDocument=function(e){e.moveAnchorToStartOfNode(e.value.document).moveToAnchor()},si.moveAnchorToStartOfInline=function(e){e.command(ci,"anchor","start","inline")},si.moveAnchorToStartOfNextBlock=function(e){e.command(li,"anchor","start","next","block")},si.moveAnchorToStartOfNextInline=function(e){e.command(li,"anchor","start","next","inline")},si.moveAnchorToStartOfNextText=function(e){e.command(li,"anchor","start","next","text")},si.moveAnchorToStartOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveAnchorToStartOfNode"].concat(n))},si.moveAnchorToStartOfPreviousBlock=function(e){e.command(li,"anchor","start","previous","block")},si.moveAnchorToStartOfPreviousInline=function(e){e.command(li,"anchor","start","previous","inline")},si.moveAnchorToStartOfPreviousText=function(e){e.command(li,"anchor","start","previous","text")},si.moveAnchorToStartOfText=function(e){e.command(ci,"anchor","start","text")},si.moveBackward=function(e){for(var t,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=e.moveAnchorBackward.apply(e,r)).moveFocusBackward.apply(t,r)},si.moveWordBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.moveFocusWordBackward.apply(e,n).moveToFocus()},si.moveEndBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[fi,"end"].concat(n))},si.moveEndWordBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[vi,"end"].concat(n))},si.moveEndForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[di,"end"].concat(n))},si.moveEndWordForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[hi,"end"].concat(n))},si.moveEndTo=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveEndTo"].concat(n))},si.moveEndToEndOfBlock=function(e){e.command(ci,"end","end","block")},si.moveEndToEndOfDocument=function(e){e.moveEndToEndOfNode(e.value.document).moveToEnd()},si.moveEndToEndOfInline=function(e){e.command(ci,"end","end","inline")},si.moveEndToEndOfNextBlock=function(e){e.command(li,"end","end","next","block")},si.moveEndToEndOfNextInline=function(e){e.command(li,"end","end","next","inline")},si.moveEndToEndOfNextText=function(e){e.command(li,"end","end","next","text")},si.moveEndToEndOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveEndToEndOfNode"].concat(n))},si.moveEndToEndOfPreviousBlock=function(e){e.command(li,"end","end","previous","block")},si.moveEndToEndOfPreviousInline=function(e){e.command(li,"end","end","previous","inline")},si.moveEndToEndOfPreviousText=function(e){e.command(li,"end","end","previous","text")},si.moveEndToEndOfText=function(e){e.command(ci,"end","end","text")},si.moveEndToStartOfBlock=function(e){e.command(ci,"end","start","block")},si.moveEndToStartOfDocument=function(e){e.moveEndToStartOfNode(e.value.document).moveToEnd()},si.moveEndToStartOfInline=function(e){e.command(ci,"end","start","inline")},si.moveEndToStartOfNextBlock=function(e){e.command(li,"end","start","next","block")},si.moveEndToStartOfNextInline=function(e){e.command(li,"end","start","next","inline")},si.moveEndToStartOfNextText=function(e){e.command(li,"end","start","next","text")},si.moveEndToStartOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveEndToStartOfNode"].concat(n))},si.moveEndToStartOfPreviousBlock=function(e){e.command(li,"end","start","previous","block")},si.moveEndToStartOfPreviousInline=function(e){e.command(li,"end","start","previous","inline")},si.moveEndToStartOfPreviousText=function(e){e.command(li,"end","start","previous","text")},si.moveEndToStartOfText=function(e){e.command(ci,"end","start","text")},si.moveFocusBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[fi,"focus"].concat(n))},si.moveFocusWordBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[vi,"focus"].concat(n))},si.moveFocusForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[di,"focus"].concat(n))},si.moveFocusWordForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[hi,"focus"].concat(n))},si.moveFocusTo=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveFocusTo"].concat(n))},si.moveFocusToEndOfBlock=function(e){e.command(ci,"focus","end","block")},si.moveFocusToEndOfDocument=function(e){e.moveFocusToEndOfNode(e.value.document).moveToFocus()},si.moveFocusToEndOfInline=function(e){e.command(ci,"focus","end","inline")},si.moveFocusToEndOfNextBlock=function(e){e.command(li,"focus","end","next","block")},si.moveFocusToEndOfNextInline=function(e){e.command(li,"focus","end","next","inline")},si.moveFocusToEndOfNextText=function(e){e.command(li,"focus","end","next","text")},si.moveFocusToEndOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveFocusToEndOfNode"].concat(n))},si.moveFocusToEndOfPreviousBlock=function(e){e.command(li,"focus","end","previous","block")},si.moveFocusToEndOfPreviousInline=function(e){e.command(li,"focus","end","previous","inline")},si.moveFocusToEndOfPreviousText=function(e){e.command(li,"focus","end","previous","text")},si.moveFocusToEndOfText=function(e){e.command(ci,"focus","end","text")},si.moveFocusToStartOfBlock=function(e){e.command(ci,"focus","start","block")},si.moveFocusToStartOfDocument=function(e){e.moveFocusToStartOfNode(e.value.document).moveToFocus()},si.moveFocusToStartOfInline=function(e){e.command(ci,"focus","start","inline")},si.moveFocusToStartOfNextBlock=function(e){e.command(li,"focus","start","next","block")},si.moveFocusToStartOfNextInline=function(e){e.command(li,"focus","start","next","inline")},si.moveFocusToStartOfNextText=function(e){e.command(li,"focus","start","next","text")},si.moveFocusToStartOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveFocusToStartOfNode"].concat(n))},si.moveFocusToStartOfPreviousBlock=function(e){e.command(li,"focus","start","previous","block")},si.moveFocusToStartOfPreviousInline=function(e){e.command(li,"focus","start","previous","inline")},si.moveFocusToStartOfPreviousText=function(e){e.command(li,"focus","start","previous","text")},si.moveFocusToStartOfText=function(e){e.command(ci,"focus","start","text")},si.moveForward=function(e){for(var t,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=e.moveAnchorForward.apply(e,r)).moveFocusForward.apply(t,r)},si.moveWordForward=function(e){for(var t,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(t=e.moveFocusWordForward.apply(e,r)).moveToFocus.apply(t,r)},si.moveStartBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[fi,"start"].concat(n))},si.moveStartWordBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[vi,"start"].concat(n))},si.moveStartForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[di,"start"].concat(n))},si.moveStartWordForward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[hi,"start"].concat(n))},si.moveStartTo=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveStartTo"].concat(n))},si.moveStartToEndOfBlock=function(e){e.command(ci,"start","end","block")},si.moveStartToEndOfDocument=function(e){e.moveStartToEndOfNode(e.value.document).moveToStart()},si.moveStartToEndOfInline=function(e){e.command(ci,"start","end","inline")},si.moveStartToEndOfNextBlock=function(e){e.command(li,"start","end","next","block")},si.moveStartToEndOfNextInline=function(e){e.command(li,"start","end","next","inline")},si.moveStartToEndOfNextText=function(e){e.command(li,"start","end","next","text")},si.moveStartToEndOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveStartToEndOfNode"].concat(n))},si.moveStartToEndOfPreviousBlock=function(e){e.command(li,"start","end","previous","block")},si.moveStartToEndOfPreviousInline=function(e){e.command(li,"start","end","previous","inline")},si.moveStartToEndOfPreviousText=function(e){e.command(li,"start","end","previous","text")},si.moveStartToEndOfText=function(e){e.command(ci,"start","end","text")},si.moveStartToStartOfBlock=function(e){e.command(ci,"start","start","block")},si.moveStartToStartOfDocument=function(e){e.moveStartToStartOfNode(e.value.document).moveToStart()},si.moveStartToStartOfInline=function(e){e.command(ci,"start","start","inline")},si.moveStartToStartOfNextBlock=function(e){e.command(li,"start","start","next","block")},si.moveStartToStartOfNextInline=function(e){e.command(li,"start","start","next","inline")},si.moveStartToStartOfNextText=function(e){e.command(li,"start","start","next","text")},si.moveStartToStartOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveStartToStartOfNode"].concat(n))},si.moveStartToStartOfPreviousBlock=function(e){e.command(li,"start","start","previous","block")},si.moveStartToStartOfPreviousInline=function(e){e.command(li,"start","start","previous","inline")},si.moveStartToStartOfPreviousText=function(e){e.command(li,"start","start","previous","text")},si.moveStartToStartOfText=function(e){e.command(ci,"start","start","text")},si.moveTo=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveTo"].concat(n))},si.moveToAnchor=function(e){e.command(ui,"moveToAnchor")},si.moveToEnd=function(e){e.command(ui,"moveToEnd")},si.moveToEndOfBlock=function(e){e.moveEndToEndOfBlock().moveToEnd()},si.moveToEndOfDocument=function(e){e.moveEndToEndOfNode(e.value.document).moveToEnd()},si.moveToEndOfInline=function(e){e.moveEndToEndOfInline().moveToEnd()},si.moveToEndOfNextBlock=function(e){e.moveEndToEndOfNextBlock().moveToEnd()},si.moveToEndOfNextInline=function(e){e.moveEndToEndOfNextInline().moveToEnd()},si.moveToEndOfNextText=function(e){e.moveEndToEndOfNextText().moveToEnd()},si.moveToEndOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveToEndOfNode"].concat(n))},si.moveToEndOfPreviousBlock=function(e){e.moveStartToEndOfPreviousBlock().moveToStart()},si.moveToEndOfPreviousInline=function(e){e.moveStartToEndOfPreviousInline().moveToStart()},si.moveToEndOfPreviousText=function(e){e.moveStartToEndOfPreviousText().moveToStart()},si.moveToEndOfText=function(e){e.moveEndToEndOfText().moveToEnd()},si.moveToFocus=function(e){e.command(ui,"moveToFocus")},si.moveToRangeOfDocument=function(e){e.moveToRangeOfNode(e.value.document)},si.moveToRangeOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveToRangeOfNode"].concat(n))},si.moveToStart=function(e){e.command(ui,"moveToStart")},si.moveToStartOfBlock=function(e){e.moveStartToStartOfBlock().moveToStart()},si.moveToStartOfDocument=function(e){e.moveStartToStartOfNode(e.value.document).moveToStart()},si.moveToStartOfInline=function(e){e.moveStartToStartOfInline().moveToStart()},si.moveToStartOfNextBlock=function(e){e.moveEndToStartOfNextBlock().moveToEnd()},si.moveToStartOfNextInline=function(e){e.moveEndToStartOfNextInline().moveToEnd()},si.moveToStartOfNextText=function(e){e.moveEndToStartOfNextText().moveToEnd()},si.moveToStartOfNode=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"moveToStartOfNode"].concat(n))},si.moveToStartOfPreviousBlock=function(e){e.moveStartToStartOfPreviousBlock().moveToStart()},si.moveToStartOfPreviousInline=function(e){e.moveStartToStartOfPreviousInline().moveToStart()},si.moveToStartOfPreviousText=function(e){e.moveStartToStartOfPreviousText().moveToStart()},si.moveToStartOfText=function(e){e.moveStartToStartOfText().moveToStart()},si.select=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=z.createProperties(n);var o=r.snapshot,a=void 0!==o&&o,i=e.value,s=i.document,u=i.selection,c={},l=u.setProperties(n);for(var f in l=s.resolveSelection(l),n=Cr(l,Object.keys(n)))!0!==a&&t.is(n[f],u[f])||(c[f]=n[f]);if(u.marks&&!c.marks&&(c.anchor||c.focus)&&(c.marks=null),0!==Object.keys(c).length){var d=Cr(u.toJSON(),Object.keys(c));e.applyOperation({type:"set_selection",value:i,properties:d,newProperties:c},a?{skip:!1,merge:!1}:{})}},si.setAnchor=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"setAnchor"].concat(n))},si.setEnd=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"setEnd"].concat(n))},si.setFocus=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"setFocus"].concat(n))},si.setStart=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.command.apply(e,[ui,"setStart"].concat(n))},si.snapshotSelection=function(e){e.withoutMerging(function(){e.select(e.value.selection,{snapshot:!0})})};var yi={};function pi(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{onConstruct:function(t,n){for(var r in e)t.registerQuery(r);return n()},onQuery:function(t,n,r){var o=t.type,a=t.args,i=e[o];if(!i)return r();var s=i.apply(void 0,[n].concat(g(a)));return void 0===s?r():s}}}yi.setData=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.value,r=re.createProperties({data:t}),o=Cr(n,Object.keys(r));e.applyOperation({type:"set_value",properties:o,newProperties:r})},yi.addAnnotation=function(e,t){t=q.create(t),e.applyOperation({type:"add_annotation",annotation:t})},yi.removeAnnotation=function(e,t){t=q.create(t),e.applyOperation({type:"remove_annotation",annotation:t})},yi.setAnnotation=function(e,t,n){t=q.create(t),n=q.createProperties(n),e.applyOperation({type:"set_annotation",properties:t,newProperties:n})},yi.setAnnotations=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.value,r=re.createProperties({annotations:t}),o=Cr(n,Object.keys(r));e.applyOperation({type:"set_value",properties:o,newProperties:r})};var mi=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));for(var o in r.code=e,n)r[o]=n[o];return Error.captureStackTrace?Error.captureStackTrace(r,r.constructor):r.stack=(new Error).stack,r}return y(t,e),t}(Error);function ki(e){var t=e.rules,n=e.document,r=e.blocks,o=e.inlines,a=e.marks,i=e.annotations,s=e.decorations,u=[];if(t&&(u=u.concat(t)),n&&u.push(h({match:[{object:"document"}]},n)),r)for(var c in r)u.push(h({match:[{object:"block",type:c}]},r[c]));if(o)for(var l in o)u.push(h({match:[{object:"inline",type:l}]},o[l]));if(a)for(var f in a)u.push(h({match:[{object:"mark",type:f}]},a[f]));if(i)for(var d in i)u.push(h({match:[{object:"annotation",type:d}]},i[d]));if(s)for(var v in s)u.push(h({match:[{object:"decoration",type:v}]},s[v]));function y(e,t,n){var r=u.filter(function(t){return gi(e,t.match)}),o=bi(e,r,u,{every:!0});return o?new mi(o.code,o):n()}return[{normalizeNode:function(e,t,n){var r=y(e,0,function(){});return r?function(){var e=r.rule,n=t.operations.size;e.normalize&&e.normalize(t,r),t.operations.size===n&&function(e,t){var n=t.code,r=t.node,o=t.child,a=t.next,i=t.previous,s=t.key,u=t.mark;switch(n){case"child_max_invalid":case"child_object_invalid":case"child_type_invalid":case"child_unknown":case"first_child_object_invalid":case"first_child_type_invalid":case"last_child_object_invalid":case"last_child_type_invalid":return"text"===o.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key):e.removeNodeByKey(o.key);case"previous_sibling_object_invalid":case"previous_sibling_type_invalid":return"text"===i.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key):e.removeNodeByKey(i.key);case"next_sibling_object_invalid":case"next_sibling_type_invalid":return"text"===a.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key):e.removeNodeByKey(a.key);case"child_min_invalid":case"node_text_invalid":case"parent_object_invalid":case"parent_type_invalid":return"document"===r.object?r.nodes.forEach(function(t){return e.removeNodeByKey(t.key)}):e.removeNodeByKey(r.key);case"node_data_invalid":return void 0===r.data.get(s)&&"document"!==r.object?e.removeNodeByKey(r.key):e.setNodeByKey(r.key,{data:r.data.delete(s)});case"node_mark_invalid":return r.getTexts().forEach(function(t){return e.removeMarkByKey(t.key,0,t.text.length,u)});default:e.removeNodeByKey(r.key)}}(t,r)}:n()},validateNode:y},pi({isAtomic:function(e,t){var n=u.find(function(e){return"isAtomic"in e&&gi(t,e.match)});return n&&n.isAtomic},isVoid:function(e,t){var n=u.find(function(e){return"isVoid"in e&&gi(t,e.match)});return n&&n.isVoid}})]}function gi(e,t){return!bi(e,t)}function bi(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.every,a=void 0!==o&&o,i=r.match;if("function"==typeof t)return t(e,void 0===i?null:i)?null:Oi("node_invalid",{rule:t,node:e});if(Array.isArray(t)){var s=t.length?t:[{}],u=void 0,c=!0,f=!1,d=void 0;try{for(var v,h=s[Symbol.iterator]();!(c=(v=h.next()).done);c=!0){var y=bi(e,v.value,n);if(u=u||y,a&&y)return y;if(!a&&!y)return}}catch(e){f=!0,d=e}finally{try{!c&&h.return&&h.return()}finally{if(f)throw d}}return u}return function(e,t){if(null==t.object)return;if(t.object===e.object)return;if("function"==typeof t.object&&t.object(e.object))return;return Oi("node_object_invalid",{rule:t,node:e})}(e,t)||function(e,t){if(null==t.type)return;if(t.type===e.type)return;if("function"==typeof t.type&&t.type(e.type))return;return Oi("node_type_invalid",{rule:t,node:e})}(e,t)||function(e,t){if(null==t.data)return;if(null==e.data)return;if("function"==typeof t.data){if(t.data(e.data))return;return Oi("node_data_invalid",{rule:t,node:e})}for(var n in t.data){var r=t.data[n],o=e.data&&e.data.get(n),a="function"==typeof r?r(o):r===o;if(!a)return Oi("node_data_invalid",{rule:t,node:e,key:n,value:o})}}(e,t)||function(e,t){if(null==t.marks)return;var n="text"===e.object?e.marks.toArray():e.getMarks().toArray(),r=function(n){var r=t.marks.some(function(e){return"function"==typeof e.type?e.type(n.type):e.type===n.type});return r?"continue":{v:Oi("node_mark_invalid",{rule:t,node:e,mark:n})}},o=!0,a=!1,i=void 0;try{for(var s,u=n[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value,f=r(c);switch(f){case"continue":continue;default:if("object"===(void 0===f?"undefined":l(f)))return f.v}}}catch(e){a=!0,i=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw i}}}(e,t)||function(e,t){if(null==t.text)return;var n=e.text;if("function"==typeof t.text?t.text(n):t.text.test(n))return;return Oi("node_text_invalid",{rule:t,node:e,text:n})}(e,t)||function(e,t){if(null==t.first)return;var n=e.nodes.first();if(!n)return;var r=bi(n,t.first);if(!r)return;return r.rule=t,r.node=e,r.child=n,r.code=r.code.replace("node_","first_child_"),r}(e,t)||function(e,t){if(null==t.last)return;var n=e.nodes.last();if(!n)return;var r=bi(n,t.last);if(!r)return;return r.rule=t,r.node=e,r.child=n,r.code=r.code.replace("node_","last_child_"),r}(e,t)||function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(null==e.nodes)return;var r=e.nodes,o=null!=t.nodes?t.nodes.slice():[],a=0,i=0,s=null,u=-1,c=null,l=null,f=null,d=null,v=null;function h(){return 0!==o.length&&(c=o.shift(),i=a,a=0,s=c.min||null,l=c.max||null,!0)}function y(){return d=(u+=1)?r.get(u-1):null,f=r.get(u),v=r.get(u+1),!!f&&(i=a,a+=1,!0)}function p(){u>0&&(u-=1,a=i)}null!=t.nodes&&h();for(;y();){var m=Ai(e,f,n)||xi(e,f,d,u,n)||wi(e,f,v,u,n);if(m)return m;if(null!=t.nodes){if(!c)return Oi("child_unknown",{rule:t,node:e,child:f,index:u});if(c.match){var k=bi(f,c.match);if(k){if(null!=l&&a-1>l)return p(),Oi("child_max_invalid",{rule:t,node:e,index:u,child:r.get(u),count:a,limit:l});var g=s;if(h()){if(i-1>=g){u-=1;continue}return null==bi(f,c.match)?(p(),Oi("child_min_invalid",{rule:t,node:e,index:u,count:i-1,limit:g})):(k.rule=t,k.node=e,k.child=f,k.index=u,k.code=k.code.replace("node_","child_"),k)}return null!=l&&a>l?Oi("child_unknown",{rule:t,node:e,child:f,index:u}):(k.rule=t,k.node=e,k.child=f,k.index=u,k.code=k.code.replace("node_","child_"),k)}}}}if(null!=l&&a>l)return Oi("child_max_invalid",{rule:t,node:e,index:u-1,count:a,child:r.get(u-1),limit:l});if(null!=t.nodes)do{if(a<s)return Oi("child_min_invalid",{rule:t,node:e,index:u,count:a,limit:s})}while(h())}(e,t,n)}function Ai(e,t,n){var r=!0,o=!1,a=void 0;try{for(var i,s=n[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var u=i.value;if(null!=u.parent&&gi(t,u.match)){var c=bi(e,u.parent);if(c)return c.rule=u,c.parent=e,c.node=t,c.code=c.code.replace("node_","parent_"),c}}}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}}function xi(e,t,n,r,o){if(n){var a=!0,i=!1,s=void 0;try{for(var u,c=o[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var l=u.value;if(null!=l.previous&&gi(t,l.match)){var f=bi(n,l.previous);if(f)return f.rule=l,f.node=e,f.child=t,f.index=r,f.previous=n,f.code=f.code.replace("node_","previous_sibling_"),f}}}catch(e){i=!0,s=e}finally{try{!a&&c.return&&c.return()}finally{if(i)throw s}}}}function wi(e,t,n,r,o){if(n){var a=!0,i=!1,s=void 0;try{for(var u,c=o[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var l=u.value;if(null!=l.next&&gi(t,l.match)){var f=bi(n,l.next,[],{match:t});if(f)return f.rule=l,f.node=e,f.child=t,f.index=r,f.next=n,f.code=f.code.replace("node_","next_sibling_"),f}}}catch(e){i=!0,s=e}finally{try{!a&&c.return&&c.return()}finally{if(i)throw s}}}}function Oi(e,t){return h({code:e},t)}function Ni(e){e.value.selection.isExpanded&&e.delete()}var Ti={};Ti.addMark=function(e,t){t=C.create(t);var n=e.value,r=n.document,o=n.selection;if(o.isExpanded)e.addMarkAtRange(o,t);else if(o.marks){var a=o.marks.add(t),i=o.set("marks",a);e.select(i)}else{var s=r.getActiveMarksAtRange(o).add(t),u=o.set("marks",s);e.select(u)}},Ti.addMarks=function(e,t){t.forEach(function(t){return e.addMark(t)})},Ti.delete=function(e){var t=e.value.selection;e.deleteAtRange(t),e.moveToFocus()},Ti.deleteBackward=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=e.value.selection;n.isExpanded?e.delete():e.deleteBackwardAtRange(n,t)},Ti.deleteCharBackward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteCharBackwardAtRange(t)},Ti.deleteLineBackward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteLineBackwardAtRange(t)},Ti.deleteWordBackward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteWordBackwardAtRange(t)},Ti.deleteForward=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=e.value.selection;n.isExpanded?e.delete():e.deleteForwardAtRange(n,t)},Ti.deleteCharForward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteCharForwardAtRange(t)},Ti.deleteLineForward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteLineForwardAtRange(t)},Ti.deleteWordForward=function(e){var t=e.value.selection;t.isExpanded?e.delete():e.deleteWordForwardAtRange(t)},Ti.insertBlock=function(e,t){Ni(e),t=te.create(t);var n=e.value.selection;e.insertBlockAtRange(n,t);var r=e.value.document.getNode(t.key);r&&e.moveToEndOfNode(r)},Ti.insertFragment=function(e,t){if(t.nodes.size){Ni(e);var n=e.value,r=n,o=r.document,a=r.selection,i=a.start,s=Array.from(o.texts(),function(e){return k(e,1)[0].key});e.insertFragmentAtRange(a,t);var u=(o=(n=e.value).document).getTexts().filter(function(e){return!s.includes(e.key)});if(0!==u.size){var c=t.text.length,l=o.getNode(i.key)||u.first(),f=u.last()||l;if(l!==f){var d=o.getCommonAncestor(l.key,f.key),v=d.getOffset(l.key)+(i.key===l.key?i.offset:0);f=d.getTextAtOffset(v+c-1)||f,e.moveTo(f.key,v+c-d.getOffset(f.key))}else e.moveTo(f.key,c)}}},Ti.insertInline=function(e,t){Ni(e),t=G.create(t);var n=e.value.selection;e.insertInlineAtRange(n,t);var r=e.value.document.getNode(t.key);r&&e.moveToEndOfNode(r)},Ti.insertText=function(e,t,n){Ni(e);var r=e.value,o=r.document,a=r.selection;n=n||a.marks||o.getInsertMarksAtRange(a),e.withoutNormalizing(function(){e.insertTextAtRange(a,t,n),a.marks&&o!==e.value.document&&e.select({marks:null})})},Ti.removeMark=function(e,t){t=C.create(t);var n=e.value,r=n.document,o=n.selection;if(o.isExpanded)e.removeMarkAtRange(o,t);else if(o.marks){var a=o.marks.remove(t),i=o.set("marks",a);e.select(i)}else{var s=r.getActiveMarksAtRange(o).remove(t),u=o.set("marks",s);e.select(u)}},Ti.replaceMark=function(e,t,n){e.removeMark(t),e.addMark(n)},Ti.setBlocks=function(e,t){var n=e.value.selection;e.setBlocksAtRange(n,t)},Ti.setInlines=function(e,t){var n=e.value.selection;e.setInlinesAtRange(n,t)},Ti.splitBlock=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;Ni(e);var n=e.value,r=n.selection,o=n.document,a=r.marks||o.getInsertMarksAtRange(r);e.splitBlockAtRange(r,t).moveToEnd(),a&&0!==a.size&&e.select({marks:a})},Ti.splitInline=function(e,t){Ni(e);var n=e.value.selection;e.splitInlineAtRange(n,t)},Ti.toggleMark=function(e,t){t=C.create(t),e.value.activeMarks.has(t)?e.removeMark(t):e.addMark(t)},Ti.unwrapBlock=function(e,t){var n=e.value.selection;e.unwrapBlockAtRange(n,t)},Ti.unwrapInline=function(e,t){var n=e.value.selection;e.unwrapInlineAtRange(n,t)},Ti.wrapBlock=function(e,t){var n=e.value.selection;e.wrapBlockAtRange(n,t)},Ti.wrapInline=function(e,t){var n=e.value.selection;e.wrapInlineAtRange(n,t)},Ti.wrapText=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=e.value.selection;e.wrapTextAtRange(r,t,n),r.isCollapsed&&e.moveStartBackward(t.length),e.moveEndBackward(n.length),r.isForward!==e.value.selection.isForward&&e.flip()};var _i=Me("slate:editor"),Si=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f(this,e);var o=r.controller,a=void 0===o?this:o,i=r.construct,s=void 0===i||i,u=n.onChange,c=void 0===u?function(){}:u,l=n.plugins,d=void 0===l?[]:l,v=n.readOnly,y=void 0!==v&&v,m=n.value,k=void 0===m?re.create():m;this.controller=a,this.middleware={},this.onChange=c,this.operations=t.List(),this.readOnly=null,this.value=null,this.tmp={dirty:[],flushing:!1,merge:null,normalize:!0,save:!0},function e(t,n){if(Array.isArray(n))return void n.forEach(function(n){return e(t,n)});if(null==n)return;var r=n.commands,o=n.queries,a=n.schema,i=p(n,["commands","queries","schema"]);if(r){var s=Qe(r);e(t,s)}if(o){var u=pi(o);e(t,u)}if(a){var c=ki(a);e(t,c)}for(var l in i){var f=i[l],d=t.middleware[l]=t.middleware[l]||[];d.push(f)}}(this,function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).plugins,t=void 0===e?[]:e,n=Qe(h({},ct,Rr,ii,si,yi,Ti)),r=pi({isAtomic:function(){return!1},isVoid:function(){return!1}});return[ki({rules:[{match:{object:"document"},nodes:[{match:{object:"block"}}]},{match:{object:"block",first:{object:"block"}},nodes:[{match:{object:"block"}}]},{match:{object:"block",first:[{object:"inline"},{object:"text"}]},nodes:[{match:[{object:"inline"},{object:"text"}]}]},{match:{object:"inline"},nodes:[{match:[{object:"inline"},{object:"text"}]}]},{match:[{object:"block"},{object:"inline"}],nodes:[{min:1}],normalize:function(e,t){var n=t.code,r=t.node;"child_min_invalid"===n&&r.nodes.isEmpty()&&e.insertNodeByKey(r.key,0,H.create())}},{match:{object:"block"},first:[{object:"block"},{object:"text"}],last:[{object:"block"},{object:"text"}],normalize:function(e,t){var n=t.code,r=t.node,o=H.create(),a=void 0;if("first_child_object_invalid"===n)a=0;else{if("last_child_object_invalid"!==n)return;a=r.nodes.size}e.insertNodeByKey(r.key,a,o)}},{match:{object:"inline"},first:[{object:"block"},{object:"text"}],last:[{object:"block"},{object:"text"}],previous:[{object:"block"},{object:"text"}],next:[{object:"block"},{object:"text"}],normalize:function(e,t){var n=t.code,r=t.node,o=t.index,a=H.create(),i=void 0;if("first_child_object_invalid"===n)i=0;else if("last_child_object_invalid"===n)i=r.nodes.size;else if("previous_sibling_object_invalid"===n)i=o;else{if("next_sibling_object_invalid"!==n)return;i=o+1}e.insertNodeByKey(r.key,i,a)}},{match:{object:"text"},next:function(e,t){return"text"!==e.object||!t.marks.equals(e.marks)},normalize:function(e,t){var n=t.code,r=t.next;"next_sibling_invalid"===n&&e.mergeNodeByKey(r.key)}},{match:{object:"text"},previous:function(e){return"text"!==e.object||""!==e.text},next:function(e){return"text"!==e.object||""!==e.text},normalize:function(e,t){var n=t.code,r=t.next,o=t.previous;"next_sibling_invalid"===n?e.removeNodeByKey(r.key):"previous_sibling_invalid"===n&&e.removeNodeByKey(o.key)}}]})].concat(g(t),[n,r])}({plugins:d})),s&&(this.run("onConstruct"),this.setReadOnly(y),this.setValue(k,r))}return d(e,[{key:"applyOperation",value:function(e){var t=this,n=this.operations,r=this.controller,a=this.value;o(e)&&(e=h({},e,{value:a})),e=We.create(e),this.withoutNormalizing(function(){r.save(e),a=t.value}),_i("apply",{operation:e}),this.value=e.apply(a),this.operations=n.push(e);var i=function(e){var t=e.type,n=e.node,r=e.path,o=e.newPath;switch(t){case"add_mark":case"insert_text":case"remove_mark":case"remove_text":case"set_mark":case"set_node":var a=P.getAncestors(r).toArray();return[].concat(g(a),[r]);case"insert_node":var i=n.getKeysToPathsTable(),s=Object.values(i).map(function(e){return r.concat(e)}),u=P.getAncestors(r).toArray();return[].concat(g(u),[r],g(s));case"split_node":var c=P.getAncestors(r).toArray(),l=P.increment(r);return[].concat(g(c),[r,l]);case"merge_node":var f=P.getAncestors(r).toArray(),d=P.decrement(r);return[].concat(g(f),[d]);case"move_node":if(P.isEqual(r,o))return[];var v=P.getAncestors(r).reduce(function(t,n){return t.push.apply(t,g(P.transform(n,e).toArray())),t},[]),h=P.getAncestors(o).reduce(function(t,n){return t.push.apply(t,g(P.transform(n,e).toArray())),t},[]);return[].concat(g(v),g(h));case"remove_node":var y=P.getAncestors(r).toArray();return[].concat(g(y));default:return[]}}(e),s=this.tmp.dirty.map(function(t){return t=P.create(t),P.transform(t,e).toArray()}),u={},c=Array.prototype.concat.apply(i,s);return this.tmp.dirty=[],c.forEach(function(e){var n=e.join(",");u[n]||t.tmp.dirty.push(e),u[n]=!0}),this.tmp.flushing||(this.tmp.flushing=!0,Promise.resolve().then(function(){return t.flush()})),r}},{key:"flush",value:function(){this.run("onChange");var e=this.value,n=this.operations,r=this.controller,o={value:e,operations:n};return this.operations=t.List(),this.tmp.flushing=!1,this.onChange(o),r}},{key:"command",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=this.controller;if("function"==typeof e)return e.apply(void 0,[o].concat(n)),Pi(this),o;_i("command",{type:e,args:n});var a={type:e,args:n};return this.run("onCommand",a),Pi(this),o}},{key:"hasCommand",value:function(e){var t=this.controller;return e in t&&t[e].__command}},{key:"hasQuery",value:function(e){var t=this.controller;return e in t&&t[e].__query}},{key:"normalize",value:function(){var e=this.value,t=this.controller,n=e.document,r=n.getKeysToPathsTable(),o=Object.values(r).map(P.create);this.tmp.dirty=this.tmp.dirty.concat(o),Pi(this);var a=e.selection;return n=e.document,a.isUnset&&n.nodes.size&&t.moveToStartOfDocument(),t}},{key:"query",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=this.controller;if("function"==typeof e)return e.apply(void 0,[o].concat(n));_i("query",{type:e,args:n});var a={type:e,args:n};return this.run("onQuery",a)}},{key:"registerCommand",value:function(e){var t=this,n=this.controller;if(e in n&&n[e].__command)return n;Q(!(e in n));var r=function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.command.apply(t,[e].concat(r))};return n[e]=r,r.__command=!0,n}},{key:"registerQuery",value:function(e){var t=this,n=this.controller;if(e in n&&n[e].__query)return n;Q(!(e in n));var r=function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.query.apply(t,[e].concat(r))};return n[e]=r,r.__query=!0,n}},{key:"run",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=this.controller,a=this.middleware[e]||[],i=0;function s(){var e=a[i++];if(e){for(var t=arguments.length,r=Array(t),u=0;u<t;u++)r[u]=arguments[u];return r.length&&(n=r),e.apply(void 0,g(n).concat([o,s]))}}return Object.defineProperty(s,"change",{get:function(){Q(!1)}}),Object.defineProperty(s,"onChange",{get:function(){Q(!1)}}),Object.defineProperty(s,"props",{get:function(){Q(!1)}}),Object.defineProperty(s,"schema",{get:function(){Q(!1)}}),Object.defineProperty(s,"stack",{get:function(){Q(!1)}}),s()}},{key:"setReadOnly",value:function(e){return this.readOnly=e,this}},{key:"setValue",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).normalize,n=void 0===t?e!==this.value:t;return this.value=e,n&&this.normalize(),this}},{key:"withoutNormalizing",value:function(e){var t=this.controller,n=this.tmp.normalize;return this.tmp.normalize=!1,e(t),this.tmp.normalize=n,Pi(this),t}},{key:"change",value:function(e){a();for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e.apply(void 0,[this.controller].concat(n))}},{key:"call",value:function(e){a();for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,[this.controller].concat(n)),this.controller}},{key:"applyOperations",value:function(e){var t=this;return a(),e.forEach(function(e){return t.applyOperation(e)}),this.controller}},{key:"setOperationFlag",value:function(e,t){return a(),this.tmp[e]=t,this}},{key:"getFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(),void 0!==t[e]?t[e]:this.tmp[e]}},{key:"unsetOperationFlag",value:function(e){return a(),delete this.tmp[e],this}},{key:"withoutNormalization",value:function(e){return a(),this.withoutNormalizing(e)}},{key:"editor",get:function(){return a(),this.controller}}]),e}();function Pi(e){e.tmp.normalize&&e.tmp.dirty.length&&e.withoutNormalizing(function(){for(;e.tmp.dirty.length;){var t=e.tmp.dirty.pop();Bi(e,t)}})}function Bi(e,t){for(var n=e.controller,r=e.value,o=r.document,a=o.assertNode(t),i=0,s=100+("text"===a.object?1:a.nodes.size);a;){var u=a.normalize(n);if(!u)break;u(n),o=(r=e.value).document;var c=a.key,l=o.getDescendant(t);if(l&&l.key===c)a=l;else{if(!(l=o.getDescendant(c)))break;a=l,t=o.getPath(c)}if(++i>s)throw new Error("A schema rule could not be normalized after sufficient iterations. This is usually due to a `rule.normalize` or `plugin.normalizeNode` function of a schema being incorrectly written, causing an infinite loop.")}}var Fi={marks:void 0,text:void 0},Ei=function(e){function n(){return f(this,n),m(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return y(n,e),d(n,[{key:"updateMark",value:function(e,t){var n=this.marks;if(t.equals(e))return this;if(!n.has(e))return this;var r=n.withMutations(function(n){n.remove(e).add(t)});return this.set("marks",r)}},{key:"addMark",value:function(e){var t=this.marks;return this.set("marks",t.add(e))}},{key:"addMarks",value:function(e){var t=this.marks;return this.set("marks",t.union(e))}},{key:"insertText",value:function(e,t){var n=this.text,r=n.slice(0,e)+t+n.slice(e);return this.set("text",r)}},{key:"removeMark",value:function(e){var t=this.marks;return this.set("marks",t.remove(e))}},{key:"toJSON",value:function(){return{object:this.object,text:this.text,marks:this.marks.toArray().map(function(e){return e.toJSON()})}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(a(),n.isLeaf(e))return e;if("string"==typeof e&&(e={text:e}),o(e))return n.fromJSON(e);throw new Error("`Leaf.create` only accepts objects, strings or leaves, but you passed it: "+e)}},{key:"createLeaves",value:function(e){if(e.size<=1)return e;var n=!1,r=t.List().withMutations(function(t){e.findLast(function(e,r){var o=t.first();if(o){if(o.marks.equals(e.marks))return n=!0,void t.set(0,o.set("text",""+e.text+o.text));if(""===o.text)return n=!0,void t.set(0,e);if(""===e.text)return void(n=!0)}t.unshift(e)})});return n?r:e}},{key:"splitLeaves",value:function(e,n){if(n<0)return[t.List(),e];if(0===e.size)return[t.List(),t.List()];var r=0,o=-1,a=void 0,i=void 0;return e.find(function(e){o++;var t=r,s=e.text;if((r+=s.length)<n)return!1;if(t>n)return!1;var u=n-t;return a=e.set("text",s.slice(0,u)),i=e.set("text",s.slice(u)),!0}),a?""===a.text?0===o?[t.List.of(a),e]:[e.take(o),e.skip(o)]:""===i.text?o===e.size-1?[e,t.List.of(i)]:[e.take(o+1),e.skip(o+1)]:[e.take(o).push(a),e.skip(o+1).unshift(i)]:[e,t.List()]}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.List.isList(e)||Array.isArray(e))return new t.List(e.map(n.create));throw new Error("`Leaf.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.text,o=void 0===r?"":r,a=e.marks,i=void 0===a?[]:a;return new n({text:o,marks:t.Set(i.map(C.fromJSON))})}},{key:"isLeafList",value:function(e){return t.List.isList(e)&&e.every(function(e){return n.isLeaf(e)})}}]),n}(t.Record(Fi));function ji(e,t){var n=!0,r=!1,o=void 0;try{for(var a,i=t[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value,u=!0,c=!1,l=void 0;try{for(var f,d=Object.getOwnPropertyNames(e)[Symbol.iterator]();!(u=(f=d.next()).done);u=!0){var v=f.value;if(!s.hasOwnProperty(v)){var h=Object.getOwnPropertyDescriptor(e,v);Object.defineProperty(s,v,h)}}}catch(e){c=!0,l=e}finally{try{!u&&d.return&&d.return()}finally{if(c)throw l}}var y=!0,p=!1,m=void 0;try{for(var k,g=Object.getOwnPropertyNames(e.prototype)[Symbol.iterator]();!(y=(k=g.next()).done);y=!0){var b=k.value;if(!s.prototype.hasOwnProperty(b)){h=Object.getOwnPropertyDescriptor(e.prototype,b);Object.defineProperty(s.prototype,b,h)}}}catch(e){p=!0,m=e}finally{try{!y&&g.return&&g.return()}finally{if(p)throw m}}}}catch(e){r=!0,o=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}}Object.entries({Annotation:q,Block:te,Change:Ge,Decoration:L,Document:W,Editor:Si,Inline:G,Leaf:Ei,Mark:C,Node:X,Operation:We,Point:F,Range:K,Selection:z,Text:H,Value:re}).forEach(function(e){var t,n,r,o,a=k(e,2),i=a[0],s=a[1];return ji((t=i.toLowerCase(),n=M[t],r="is"+t.charAt(0).toUpperCase()+t.slice(1),(o=function(){function e(){f(this,e)}return d(e,[{key:"object",get:function(){return t}}]),e}())[r]=I.bind(null,t),o.prototype[n]=!0,o),[s])}),ji(function(){function e(){f(this,e)}return d(e,[{key:"toJS",value:function(){return this.toJSON.apply(this,arguments)}}],[{key:"fromJS",value:function(){return this.fromJSON.apply(this,arguments)}}]),e}(),[q,te,L,W,G,Ei,C,X,We,F,K,z,H,re]);var Ci=!0,Ri=Symbol("LEAF"),Li=Symbol("STORE_KEY"),Di=Symbol("undefined"),zi=Symbol("null"),Mi=void 0,Ii=new WeakMap;function Ji(e,t){var n=function(t){var n=e[t];if(!n)throw new Error('Object does not have a property named "'+t+'".');e[t]=function(){for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];if(!Ci)return n.apply(this,r);Ii.has(this)||Ii.set(this,{noArgs:{},hasArgs:{}});var a=Ii.get(this),i=a.noArgs,s=a.hasArgs,u=0!==r.length,c=void 0,f=void 0;if((c=u?function(e,t){var n=!0,r=!1,o=void 0;try{for(var a,i=t[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value;if(void 0===s?s=Di:null==s&&(s=zi),(e="object"===(void 0===s?"undefined":l(s))?e[Li]&&e[Li].get(s):e[s])===Mi)return Mi}}catch(e){r=!0,o=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}return e[Ri]}(s,f=[t].concat(r)):i[t])!==Mi)return c===Di?void 0:c;var d=n.apply(this,r),v=void 0===d?Di:d;return u?function(e,t,n){var r=e,o=!0,a=!1,i=void 0;try{for(var s,u=t[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value;if(void 0===c?c=Di:null==c&&(c=zi),"object"===(void 0===c?"undefined":l(c)))if(r[Li]||(r[Li]=new WeakMap),r[Li].has(c))r=r[Li].get(c);else{var f={};r[Li].set(c,f),r=f}else r[c]||(r[c]={}),r=r[c]}}catch(e){a=!0,i=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw i}}r[Ri]=n}(s,f,v):i[t]=v,d}},r=!0,o=!1,a=void 0;try{for(var i,s=t[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){n(i.value)}}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}}function Ki(){Ii=new WeakMap}function Ui(e){Ci=e}var qi,Vi,Wi=function(){function e(){f(this,e)}return d(e,[{key:"getFirstText",value:function(){if("text"===this.object)return this;var e=null,t=this.nodes.find(function(t){return"text"===t.object||!!(e=t.getFirstText())});return e||t}},{key:"getKeysToPathsTable",value:function(){var e=v({},this.key,[]);return this.nodes&&this.nodes.forEach(function(t,n){var r=t.getKeysToPathsTable();for(var o in r){var i=r[o];a(),e[o]=[n].concat(g(i))}}),e}},{key:"getLastText",value:function(){if("text"===this.object)return this;var e=null,t=this.nodes.findLast(function(t){return"text"===t.object||(e=t.getLastText())});return e||t}},{key:"getNode",value:function(e){return(e=this.resolvePath(e))?"text"===this.object&&e.size?null:e.size?this.getDescendant(e):this:null}},{key:"getPath",value:function(e){if(t.List.isList(e))return e;if(X.isNode(e)&&this.descendants){var n=!0,r=!1,o=void 0;try{for(var a,i=this.descendants()[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value,u=k(s,2),c=u[0],l=u[1];if(e===c)return l}}catch(e){r=!0,o=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}}var f=this.getKeysToPathsTable()[e];return f?t.List(f):null}},{key:"getText",value:function(){return"text"===this.object?this.text:this.nodes.reduce(function(e,t){return e+t.text},"")}},{key:"hasNode",value:function(e){return!!this.getNode(e)}},{key:"normalize",value:function(e){return e.run("normalizeNode",this)}},{key:"regenerateKey",value:function(){var e=c.create();return this.set("key",e)}},{key:"resolvePath",value:function(e,t){return"string"==typeof e?(e=this.getPath(e),null!=t&&(e=e.concat(t))):e=P.create(e),e}},{key:"validate",value:function(e){return e.run("validateNode",this)}}]),e}();Ji(Wi.prototype,["getFirstText","getKeysToPathsTable","getLastText","getText","normalize","validate"]),ji(Wi,[te,W,G,H]),qi=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]"),Vi=new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]*[֑-߿יִ-﷽ﹰ-ﻼ]");var $i=function(e){return e=e.toString(),Vi.test(e)?"rtl":qi.test(e)?"ltr":"neutral"};function Gi(){return!0}var Qi=function(){function e(){f(this,e)}return d(e,[{key:"addMark",value:function(e,t){e=this.resolvePath(e);var n=this.assertDescendant(e);return n=n.addMark(t),this.replaceNode(e,n)}},{key:"ancestors",value:function(e){return this.createIterable({path:e,direction:null,downward:!1,includeTargetAncestors:!0,includeRoot:!0})}},{key:"blocks",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onlyLeaves,n=e.onlyRoots,r=e.onlyTypes,o=e.match,a=p(e,["onlyLeaves","onlyRoots","onlyTypes","match"]);return this.descendants(h({includeDocument:!1,includeInlines:!1,includeTexts:!1},a,{match:function(e,a){return!(r&&!r.includes(e.type))&&((!n||1===a.size)&&(!(t&&!e.isLeafBlock())&&!(o&&!o(e,a))))}}))}},{key:"createAnnotation",value:function(e){return e=q.createProperties(e),this.resolveAnnotation(e)}},{key:"createDecoration",value:function(e){return e=L.createProperties(e),this.resolveDecoration(e)}},{key:"createIterable",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.direction,n=void 0===t?"forward":t,r=e.downward,o=void 0===r||r,a=e.upward,i=void 0===a||a,s=e.includeBlocks,u=void 0===s||s,c=e.includeDocument,l=void 0===c||c,f=e.includeInlines,d=void 0===f||f,h=e.includeRoot,y=void 0!==h&&h,p=e.includeTarget,m=void 0===p?!!e.range:p,k=e.includeTargetAncestors,g=void 0!==k&&k,b=e.includeTexts,A=void 0===b||b,x=e.match,w=void 0===x?null:x,O=this,N=null,T=null;e.range?(T=O.resolveRange(e.range),N=O.resolvePath(T.start.path)):e.path&&(N=O.resolvePath(e.path));var _=N&&O.assertNode(N),S="undefined"==typeof window?oe.Set:window.Set;return v({},Symbol.iterator,function(){var e=new S,t=T&&T.start.path,r=T&&T.end.path,a=N,s=_,c=!1,f=!1,v=!1,h=function(){return a&&s?(y||s!==O)&&(u||"block"!==s.object)&&(l||"document"!==s.object)&&(d||"inline"!==s.object)&&(A||"text"!==s.object)?w&&!w(s,a)?p():{value:[s,a],done:!1}:p():{done:!0}},p=function u(){if(!a||!s)return h();if(t&&!f)return v?a.size===t.size-1?(f=!0,a=N,s=_,u()):(a=t.slice(0,a.size+1),s=O.assertNode(a),h()):(v=!0,a=P.create([]),s=O,h());if(m&&!c)return c=!0,h();if(r&&a.equals(r))return s=null,a=null,u();if(o&&s.nodes&&s.nodes.size&&!e.has(s)){e.add(s);var l="forward"===n?0:s.nodes.size-1;return a=a.push(l),s=O.assertNode(a),h()}if("forward"===n){var d=P.increment(a),y=O.getNode(d);if(y)return a=d,s=y,h()}if("backward"===n&&0!==a.last()){var p=P.decrement(a),k=O.getNode(p);if(k)return a=p,s=k,h()}return i&&a.size?(a=P.lift(a),s=O.assertNode(a),e.has(s)?u():(e.add(s),g?h():u())):(a=null,s=null,u())};return{next:p}})}},{key:"createPoint",value:function(e){return e=F.createProperties(e),this.resolvePoint(e)}},{key:"createRange",value:function(e){return e=K.createProperties(e),this.resolveRange(e)}},{key:"createSelection",value:function(e){return e=z.createProperties(e),this.resolveSelection(e)}},{key:"descendants",value:function(e){return this.createIterable(h({path:[]},e))}},{key:"filterDescendants",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gi,n=[],r=!0,o=!1,a=void 0;try{for(var i,s=this.descendants()[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var u=i.value,c=k(u,2),l=c[0];e(l,c[1])&&n.push(l)}}catch(e){o=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw a}}return t.List(n)}},{key:"findDescendant",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gi,t=!0,n=!1,r=void 0;try{for(var o,a=this.descendants()[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=o.value,s=k(i,2),u=s[0];if(e(u,s[1]))return u}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}return null}},{key:"forEachDescendant",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gi,t=!0,n=!1,r=void 0;try{for(var o,a=this.descendants()[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=o.value;if(!1===e.apply(void 0,g(i)))return}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}}},{key:"getActiveMarksAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)return t.Set();if(e.isCollapsed){var n=e.start;return this.getInsertMarksAtPoint(n)}var r=e,o=r.start,a=r.end,i=o.path,s=o.offset,u=a.path,c=a.offset,l=this.getDescendant(i),f=this.getDescendant(u);if(!i.equals(u)){for(;!i.equals(u)&&0===c;){var d=this.texts({path:u,direction:"backward"}),v=k(d,1),h=k(v[0],2);f=h[0],u=h[1],c=f.text.length}for(;!i.equals(u)&&s===l.text.length;){var y=this.texts({path:i}),p=k(y,1),m=k(p[0],2);l=m[0],i=m[1],s=0}}if(i.equals(u))return l.marks;var g=l.marks;if(0===g.size)return t.Set();var b=f.marks,A=g.intersect(b);if(0===A.size)return A;var x=this.texts({path:i}),w=k(x,1),O=k(w[0],2);for(l=O[0],i=O[1];!i.equals(u);){if(0!==l.text.length&&0===(A=A.intersect(l.marks)).size)return t.Set();var N=this.texts({path:i}),T=k(N,1),_=k(T[0],2);l=_[0],i=_[1]}return A}},{key:"getAncestors",value:function(e){var n=this.ancestors(e),r=Array.from(n,function(e){return k(e,1)[0]}).reverse();return t.List(r)}},{key:"getBlocks",value:function(){var e=this.blocks({onlyLeaves:!0}),n=Array.from(e,function(e){return k(e,1)[0]});return t.List(n)}},{key:"getBlocksByType",value:function(e){var n=this.blocks({onlyLeaves:!0,onlyTypes:[e]}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getChild",value:function(e){return!(e=this.resolvePath(e))||e.size>1?null:this.nodes.get(e.first())}},{key:"getClosest",value:function(e,t){var n=!0,r=!1,o=void 0;try{for(var a,i=this.ancestors(e)[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value,u=k(s,2),c=u[0];if(t(c,u[1]))return c}}catch(e){r=!0,o=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}return null}},{key:"getClosestBlock",value:function(e){return this.getClosest(e,function(e){return"block"===e.object})}},{key:"getClosestInline",value:function(e){return this.getClosest(e,function(e){return"inline"===e.object})}},{key:"getClosestVoid",value:function(e,t){return Q(!re.isValue(t)),this.getClosest(e,function(e){return t.isVoid(e)})}},{key:"getCommonAncestor",value:function(e,t){if(e=this.resolvePath(e),t=this.resolvePath(t),!e||!t)return null;var n=P.relate(e,t);return this.getNode(n)}},{key:"getDecorations",value:function(e){var t=e.run("decorateNode",this);return t=L.createList(t)}},{key:"getDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(e=this.resolvePath(e))&&this.getNode(e)?e.size-1+t:null}},{key:"getDescendant",value:function(e){if(!(e=this.resolvePath(e))||!e.size)return null;var t=this;return e.forEach(function(e){return!!(t=t.getIn(["nodes",e]))}),t}},{key:"getDescendantsAtRange",value:function(e){var n=this.descendants({range:e}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getFragmentAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)return W.create();for(var t=e,n=t.start,r=t.end,o=this,a=r.path,i=r.offset,s="end";a.size;){var u=a.last();o=o.splitNode(a,i),i=u+1,(a=P.lift(a)).size||"end"!==s||(a=n.path,i=n.offset,s="start")}var c=n.path.first()+1,l=r.path.first()+2,f=o.nodes.slice(c,l);return W.create({nodes:f})}},{key:"getFurthest",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gi,n=this.ancestors(e),r=Array.from(n).reverse(),o=!0,a=!1,i=void 0;try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value,l=k(c,2),f=l[0];if(t(f,l[1]))return f}}catch(e){a=!0,i=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw i}}return null}},{key:"getFurthestBlock",value:function(e){return this.getFurthest(e,function(e){return"block"===e.object})}},{key:"getFurthestChild",value:function(e){return(e=this.resolvePath(e))&&e.size?this.nodes.get(e.first()):null}},{key:"getFurthestInline",value:function(e){return this.getFurthest(e,function(e){return"inline"===e.object})}},{key:"getInlines",value:function(){var e=this.inlines({onlyLeaves:!0}),n=Array.from(e,function(e){return k(e,1)[0]});return t.List(n)}},{key:"getInlinesByType",value:function(e){var n=this.inlines({onlyLeaves:!0,onlyTypes:[e]}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getInsertMarksAtPoint",value:function(e){var t=e=this.resolvePoint(e),n=t.path,r=t.offset,o=this.getDescendant(n);if(0!==r)return o.marks;var a=void 0,i=void 0,s=!0,u=!1,c=void 0;try{for(var l,f=this.ancestors(n)[Symbol.iterator]();!(s=(l=f.next()).done);s=!0){var d=l.value,v=k(d,2),h=v[0],y=v[1];"block"===h.object&&(a=h,i=y)}}catch(e){u=!0,c=e}finally{try{!s&&f.return&&f.return()}finally{if(u)throw c}}var p=P.drop(n,i.size),m=a.texts({path:p,direction:"backward"}),g=k(m,1)[0];return g?k(g,1)[0].marks:o.marks}},{key:"getInsertMarksAtRange",value:function(e){var n=(e=this.resolveRange(e)).start;return e.isUnset?t.Set():e.isCollapsed?this.getInsertMarksAtPoint(n):this.getDescendant(n.path).marks}},{key:"getLeafBlocksAtRange",value:function(e){var n=this.blocks({range:e,onlyLeaves:!0}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getLeafInlinesAtRange",value:function(e){var n=this.inlines({range:e,onlyLeaves:!0}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getNodesToPathsMap",value:function(){var e="undefined"==typeof window?new oe.Map:new window.Map;return e.set(this,P.create([])),this.forEachDescendant(function(t,n){e.set(t,n)}),e}},{key:"getMarks",value:function(){var e=this.marks(),n=Array.from(e,function(e){return k(e,1)[0]});return t.OrderedSet(n)}},{key:"getMarksAtRange",value:function(e){var n=this.marks({range:e}),r=Array.from(n,function(e){return k(e,1)[0]});return t.OrderedSet(r)}},{key:"getMarksByType",value:function(e){var n=this.marks({onlyTypes:[e]}),r=Array.from(n,function(e){return k(e,1)[0]});return t.OrderedSet(r)}},{key:"getNextBlock",value:function(e){var t=this.blocks({path:e,onlyLeaves:!0}),n=k(t,1)[0];return n?n[0]:null}},{key:"getNextNode",value:function(e){var t=this.createIterable({path:e,downward:!1}),n=k(t,1)[0];return n?n[0]:null}},{key:"getNextSibling",value:function(e){var t=this.siblings(e),n=k(t,1)[0];return n?n[0]:null}},{key:"getNextText",value:function(e){var t=this.texts({path:e}),n=k(t,1)[0];return n?n[0]:null}},{key:"getOffset",value:function(e){e=this.resolvePath(e),this.assertDescendant(e);var t=e.first(),n=this.nodes.slice(0,t).reduce(function(e,t){return e+t.text.length},0);return 1===e.size?n:n+this.nodes.get(t).getOffset(P.drop(e))}},{key:"getOffsetAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)throw new Error("The range cannot be unset to calculcate its offset.");if(e.isExpanded)throw new Error("The range must be collapsed to calculcate its offset.");var t=e.start;return this.getOffset(t.path)+t.offset}},{key:"getParent",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=P.lift(e);return this.getNode(t)}},{key:"getPreviousBlock",value:function(e){var t=this.blocks({path:e,onlyLeaves:!0,direction:"backward"}),n=k(t,1)[0];return n?n[0]:null}},{key:"getPreviousNode",value:function(e){var t=this.createIterable({path:e,downward:!1,direction:"backward"}),n=k(t,1)[0];return n?n[0]:null}},{key:"getPreviousSibling",value:function(e){var t=this.siblings(e,{direction:"backward"}),n=k(t,1)[0];return n?n[0]:null}},{key:"getPreviousText",value:function(e){var t=this.texts({path:e,direction:"backward"}),n=k(t,1)[0];return n?n[0]:null}},{key:"getRootBlocksAtRange",value:function(e){var n=this.blocks({range:e,onlyRoots:!0}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getRootInlinesAtRange",value:function(e){var n=this.inlines({range:e,onlyRoots:!0}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"getTextAtOffset",value:function(e){if(0===e)return this.getFirstText();if(e===this.text.length)return this.getLastText();if(e<0||e>this.text.length)return null;var t=0,n=!0,r=!1,o=void 0;try{for(var a,i=this.texts()[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var s=a.value,u=k(s,1)[0];if((t+=u.text.length)>e)return u}}catch(e){r=!0,o=e}finally{try{!n&&i.return&&i.return()}finally{if(r)throw o}}return null}},{key:"getTextDirection",value:function(){var e=$i(this.text);return"neutral"===e?null:e}},{key:"getTexts",value:function(){var e=this.texts(),n=Array.from(e,function(e){return k(e,1)[0]});return t.List(n)}},{key:"getTextsAtRange",value:function(e){var n=this.texts({range:e}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"hasBlockChildren",value:function(){return!(!this.nodes||!this.nodes.find(function(e){return"block"===e.object}))}},{key:"hasChild",value:function(e){return!!this.getChild(e)}},{key:"hasInlineChildren",value:function(){return!(!this.nodes||!this.nodes.find(function(e){return"inline"===e.object||"text"===e.object}))}},{key:"hasDescendant",value:function(e){return!!this.getDescendant(e)}},{key:"hasVoidParent",value:function(e,t){return Q(!re.isValue(t)),!!this.getClosestVoid(e,t)}},{key:"inlines",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.onlyLeaves,r=t.onlyRoots,o=t.onlyTypes,a=t.match,i=p(t,["onlyLeaves","onlyRoots","onlyTypes","match"]);return this.descendants(h({includeBlocks:!1,includeTexts:!1,includeDocument:!1},i,{match:function(t,i){return!(o&&!o.includes(t.type))&&(!(n&&!t.isLeafInline())&&((!r||"block"===e.getParent(i).object)&&!(a&&!a(t,i))))}}))}},{key:"insertNode",value:function(e,t){var n=(e=this.resolvePath(e)).last(),r=P.lift(e),o=this.assertNode(r),a=o.nodes.splice(n,0,t);return o=o.set("nodes",a),this.replaceNode(r,o)}},{key:"insertText",value:function(e,t,n){e=this.resolvePath(e);var r=this.assertDescendant(e);return r=r.insertText(t,n),this.replaceNode(e,r)}},{key:"isLeafBlock",value:function(){return"block"===this.object&&!this.nodes.some(function(e){return"block"===e.object})}},{key:"isLeafInline",value:function(){return"inline"===this.object&&!this.nodes.some(function(e){return"inline"===e.object})}},{key:"isInRange",value:function(e,t){if(e=this.resolvePath(e),(t=this.resolveRange(t)).isUnset)return!1;var n=P.compare(e,t.start.path),r=P.compare(e,t.end.path),o=-1!==n&&1!==r;return o}},{key:"mapChildren",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gi,n=this.nodes;return n.forEach(function(r,o){var a=t(r,o,e.nodes);a!==r&&(n=n.set(a.key,a))}),this.set("nodes",n)}},{key:"mapDescendants",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gi,n=this.nodes;return n.forEach(function(r,o){var a=r;"text"!==a.object&&(a=a.mapDescendants(t)),(a=t(a,o,e.nodes))!==r&&(n=n.set(o,a))}),this.set("nodes",n)}},{key:"marks",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onlyTypes,n=void 0===t?null:t,r=e.match,o=p(e,["onlyTypes","match"]),a=this.texts(o);return v({},Symbol.iterator,function(){var e=a[Symbol.iterator](),t=null,o=null,i=[];return{next:function a(){if(i.length){var s=i.shift();return n&&!n.includes(s.type)?a():r&&!r(s,t,o)?a():{value:[s,t,o],done:!1}}var u=e.next(),c=u.value;if(u.done)return{done:!0};var l=k(c,2);return t=l[0],o=l[1],i=t.marks.toArray(),a()}}})}},{key:"mergeNode",value:function(e){var t=this.assertNode(e);if(0===(e=this.resolvePath(e)).last())throw new Error("Unable to merge node because it has no previous sibling: "+t);var n=P.decrement(e),r=this.assertNode(n);if(r.object!==t.object)throw new Error("Unable to merge two different kinds of nodes: "+r+" and "+t);var o="text"===r.object?r.mergeText(t):r.set("nodes",r.nodes.concat(t.nodes)),a=this;return a=(a=(a=a.removeNode(e)).removeNode(n)).insertNode(n,o)}},{key:"moveNode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.assertNode(e);e=this.resolvePath(e),t=this.resolvePath(t,n);var o=P.lift(t);this.assertNode(o);var a=We.create({type:"move_node",path:e,newPath:t});t=P.transform(e,a).first();var i=this;return i=(i=i.removeNode(e)).insertNode(t,r)}},{key:"removeMark",value:function(e,t){e=this.resolvePath(e);var n=this.assertDescendant(e);return n=n.removeMark(t),this.replaceNode(e,n)}},{key:"removeNode",value:function(e){this.assertDescendant(e);var t=(e=this.resolvePath(e)).flatMap(function(e){return["nodes",e]});return this.deleteIn(t)}},{key:"removeText",value:function(e,t,n){var r=this.assertDescendant(e);return r=r.removeText(t,n.length),this.replaceNode(e,r)}},{key:"replaceNode",value:function(e,t){if(!(e=this.resolvePath(e)))throw new Error("Unable to replace a node because it could not be found in the first place: "+e);if(!e.size)return t;this.assertNode(e);var n=e.flatMap(function(e){return["nodes",e]});return this.setIn(n,t)}},{key:"resolveAnnotation",value:function(e){return e=(e=q.create(e)).normalize(this)}},{key:"resolveDecoration",value:function(e){return e=(e=L.create(e)).normalize(this)}},{key:"resolvePoint",value:function(e){return e=(e=F.create(e)).normalize(this)}},{key:"resolveRange",value:function(e){return e=(e=K.create(e)).normalize(this)}},{key:"resolveSelection",value:function(e){return e=(e=z.create(e)).normalize(this)}},{key:"setNode",value:function(e,t){var n=this.assertNode(e);return n=n.merge(t),this.replaceNode(e,n)}},{key:"setMark",value:function(e,t,n){e=this.resolvePath(e);var r=this.assertDescendant(e);return r=r.setMark(t,n),this.replaceNode(e,r)}},{key:"siblings",value:function(e,t){return this.createIterable(h({path:e,upward:!1,downward:!1},t))}},{key:"splitNode",value:function(e,t,n){var r=this.assertNode(e);e=this.resolvePath(e);var o=void 0,a=void 0;if("text"===r.object){var i=r.splitText(t),s=k(i,2);o=s[0],a=s[1]}else{var u=r.nodes.take(t),c=r.nodes.skip(t);o=r.set("nodes",u),a=r.set("nodes",c).regenerateKey()}n&&"text"!==r.object&&(a=a.merge(n));var l=this;return l=(l=(l=l.removeNode(e)).insertNode(e,a)).insertNode(e,o)}},{key:"texts",value:function(e){return this.descendants(h({includeBlocks:!1,includeInlines:!1,includeDocument:!1},e))}},{key:"getBlocksAtRange",value:function(e){return a(),this.getLeafBlocksAtRange(e)}},{key:"getBlocksAtRangeAsArray",value:function(e){return a(),this.getLeafBlocksAtRangeAsArray(e)}},{key:"getInlinesAtRange",value:function(e){return a(),this.getLeafInlinesAtRange(e)}},{key:"getInlinesAtRangeAsArray",value:function(e){return a(),this.getLeafInlinesAtRangeAsArray(e)}},{key:"getNextTextAndPath",value:function(e){return a(),this.getNextTextEntry(e)}},{key:"getNextDeepMatchingNodeAndPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};a();var n=this.getNextMatchingNodeAndPath(e);if(!n)return null;for(var r=k(n,2),o=r[0],i=r[1],s=void 0;s="text"!==o.object&&o.findFirstDescendantAndPath(t,i);){var u=k(s,2);o=u[0],i=u[1]}return o?t(o)?[o,i]:this.getNextDeepMatchingNodeAndPath(n[1],t):null}},{key:"getPreviousTextAndPath",value:function(e){return a(),this.getPreviousTextEntry(e)}},{key:"findFirstDescendantAndPath",value:function(e,t){return a(),this.findDescendantAndPath(e,t,!1)}},{key:"getPreviousMatchingNodeAndPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(a(),!e)return null;for(var n=e.size;n>0;n--){var r=e.slice(0,n);if(0!==r.last()){for(var o=P.decrement(r),i=this.getNode(o);i&&!t(i);)o=P.decrement(o),i=this.getNode(o);if(i)return[i,o]}}return null}},{key:"getPreviousDeepMatchingNodeAndPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};a();var n=this.getPreviousMatchingNodeAndPath(e);if(!n)return null;for(var r=k(n,2),o=r[0],i=r[1],s=void 0;s="text"!==o.object&&o.findLastDescendantAndPath(t,i);){var u=k(s,2);o=u[0],i=u[1]}return o?t(o)?[o,i]:this.getPreviousDeepMatchingNodeAndPath(n[1],t):null}},{key:"findLastDescendantAndPath",value:function(e,t){return a(),this.findDescendantAndPath(e,t,!0)}},{key:"findDescendantAndPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:P.create([]),n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];a();var r=void 0,o=void 0;return this.forEachDescendantWithPath(function(t,n,a){if(e(t,n,a))return r=t,o=n,!1},t,n),r?[r,o]:null}},{key:"forEachDescendantWithPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:P.create([]),n=arguments[2];a();var r=this.nodes,o=void 0;return n&&(r=r.reverse()),r.forEach(function(a,i){var s=t.concat(i);return!1===e(a,s,r)?(o=!1,!1):"text"!==a.object?o=a.forEachDescendantWithPath(e,s,n):void 0}),o}},{key:"getNextMatchingNodeAndPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(a(),!e)return null;for(var n=e.size;n>0;n--){for(var r=e.slice(0,n),o=P.increment(r),i=this.getNode(o);i&&!t(i);)o=P.increment(o),i=this.getNode(o);if(i)return[i,o]}return null}},{key:"getSelectionIndexes",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];a();var n=e.start,r=e.end;if(!t)return null;if(e.isUnset)return null;if(n.path.equals(r.path)){var o=this.getFurthestAncestor(n.path),i=o?this.nodes.indexOf(o):null;return{start:i,end:i+1}}var s=null,u=null;return this.nodes.forEach(function(e,t){return"text"===e.object?(null==s&&e.key===n.key&&(s=t),null==u&&e.key===r.key&&(u=t+1)):(null==s&&e.hasDescendant(n.key)&&(s=t),null==u&&e.hasDescendant(r.key)&&(u=t+1)),null==s||null==u}),t&&null==s&&(s=0),t&&null==u&&(u=this.nodes.size),null==s?null:{start:s,end:u}}},{key:"getTextsBetweenPositionsAsArray",value:function(e,t){return a(),e=this.resolvePath(e),t=this.resolvePath(t),this.getTextsBetweenPathPositionsAsArray(e,t)}},{key:"getOrderedMarksBetweenPositions",value:function(e,n,r,o){a(),e=this.resolvePath(e),r=this.resolvePath(r);var i=this.getDescendant(e);if(P.isEqual(e,r))return i.marks;var s=this.getTextsBetweenPathPositionsAsArray(e,r);return t.OrderedSet().withMutations(function(e){s.forEach(function(t){e.union(t.marks)})})}},{key:"getTextsBetweenPathPositionsAsArray",value:function(e,t){if(a(),e&&t&&P.isEqual(e,t))return[this.getDescendant(e)];if(!e&&!t)return this.getTextsAsArray();var n=e?e.get(0,0):0,r=t?t.get(0,this.nodes.size-1):this.nodes.size-1,o=[];return this.nodes.slice(n,r+1).forEach(function(a,i){if("text"===a.object)o.push(a);else{var s=e&&0===i?P.drop(e):null,u=t&&i===r-n?P.drop(t):null;o=o.concat(a.getTextsBetweenPathPositionsAsArray(s,u))}}),o}},{key:"getFurthestAncestor",value:function(e){return a(),this.getFurthestChild(e)}},{key:"getLeafBlocksAtRangeAsArray",value:function(e){if(a(),(e=this.resolveRange(e)).isUnset)return[];var t=e,n=t.start,r=t.end;return this.getLeafBlocksBetweenPathPositionsAsArray(n.path,r.path)}},{key:"getLeafBlocksBetweenPathPositionsAsArray",value:function(e,t){if(a(),e&&t&&P.isEqual(e,t))return[this.getClosestBlock(e)];if(!e&&!t)return this.getBlocksAsArray();var n=e?e.get(0,0):0,r=t?t.get(0,this.nodes.size-1):this.nodes.size-1,o=[];return this.nodes.slice(n,r+1).forEach(function(a,i){if("block"===a.object)if(a.isLeafBlock())o.push(a);else{var s=e&&0===i?P.drop(e):null,u=t&&i===r-n?P.drop(t):null;o=o.concat(a.getLeafBlocksBetweenPathPositionsAsArray(s,u))}}),o}},{key:"getBlocksAsArray",value:function(){a();var e=this.blocks({onlyLeaves:!0});return Array.from(e,function(e){return k(e,1)[0]})}},{key:"getBlocksByTypeAsArray",value:function(e){a();var t=this.blocks({onlyLeaves:!0,onlyTypes:[e]});return Array.from(t,function(e){return k(e,1)[0]})}},{key:"getFurthestOnlyChildAncestor",value:function(e){a();var t=this.getAncestors(e);return t&&t.rest().reverse().takeUntil(function(e){return e.nodes.size>1}).last()||null}},{key:"getInlinesAsArray",value:function(){return a(),Array.from(this.inlines({onlyLeaves:!0}),function(e){return k(e,1)[0]})}},{key:"getInlinesByTypeAsArray",value:function(e){return a(),Array.from(this.inlines({onlyLeaves:!0,onlyTypes:[e]}),function(e){return k(e,1)[0]})}},{key:"getLeafInlinesAtRangeAsArray",value:function(e){var t=this;return a(),(e=this.resolveRange(e)).isUnset?[]:this.getTextsAtRangeAsArray(e).map(function(e){return t.getClosestInline(e.key)}).filter(function(e){return e})}},{key:"getOrderedMarks",value:function(){return a(),this.getMarks()}},{key:"getOrderedMarksAtRange",value:function(e){return a(),this.getMarksAtRange(e)}},{key:"getOrderedMarksByType",value:function(e){return a(),this.getMarksByType(e)}},{key:"getMarksByTypeAsArray",value:function(e){return a(),this.nodes.reduce(function(t,n){return"text"===n.object?t.concat(n.marks.filter(function(t){return t.type===e})):t.concat(n.getMarksByTypeAsArray(e))},[])}},{key:"getMarksAsArray",value:function(){var e;a();var t=[],n=!0,r=!1,o=void 0;try{for(var i,s=this.texts()[Symbol.iterator]();!(n=(i=s.next()).done);n=!0){var u=i.value,c=k(u,1)[0];t.push(c.marks.toArray())}}catch(e){r=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(r)throw o}}return(e=[]).concat.apply(e,t)}},{key:"getRootInlinesAtRangeAsArray",value:function(e){var n=this;return a(),(e=this.resolveRange(e)).isUnset?t.List():this.getTextsAtRangeAsArray(e).map(function(e){return n.getFurthestInline(e.key)}).filter(function(e){return e})}},{key:"getTextsAsArray",value:function(){a();var e=this.texts();return Array.from(e,function(e){return k(e,1)[0]})}},{key:"getTextsAtRangeAsArray",value:function(e){a();var t=this.texts({range:e});return Array.from(t,function(e){return k(e,1)[0]})}},{key:"getMarksAtPosition",value:function(e,n){a(),e=this.resolvePath(e);var r=this.getDescendant(e).marks;if(0!==n)return t.OrderedSet(r);var o=this.getClosestBlock(e);if(""===o.text)return t.OrderedSet(r);var i=this.texts({path:e,direction:"backward"}),s=k(i,1)[0];if(!s)return t.OrderedSet();var u=k(s,2),c=u[0],l=u[1];return o.hasDescendant(l)?t.OrderedSet(c.marks):t.OrderedSet(r)}},{key:"getNodesAtRange",value:function(e){a();var n=this.descendants({range:e}),r=Array.from(n,function(e){return k(e,1)[0]});return t.List(r)}},{key:"isNodeInRange",value:function(e,t){return a(),this.isInRange(e,t)}},{key:"text",get:function(){return this.getText()}}]),e}(),Zi=function(e){Qi.prototype["assert"+e]=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var a=this["get"+e].apply(this,[t].concat(r));if(null==a)throw new Error("`Node.assert"+e+"` could not find node with path or key: "+t);return a}},Yi=!0,Hi=!1,Xi=void 0;try{for(var es,ts=["Child","Depth","Descendant","Node","Parent","Path"][Symbol.iterator]();!(Yi=(es=ts.next()).done);Yi=!0){Zi(es.value)}}catch(e){Hi=!0,Xi=e}finally{try{!Yi&&ts.return&&ts.return()}finally{if(Hi)throw Xi}}Ji(Qi.prototype,["getBlocksAsArray","getBlocksByTypeAsArray","getDecorations","getFragmentAtRange","getInlinesAsArray","getInlinesByTypeAsArray","getInsertMarksAtRange","getLeafBlocksAtRangeAsArray","getLeafBlocksAtRangeAsArray","getLeafInlinesAtRangeAsArray","getMarksAsArray","getMarksAtPosition","getMarksByTypeAsArray","getNextBlock","getNodesAtRange","getNodesToPathsMap","getOffset","getOffsetAtRange","getOrderedMarksBetweenPositions","getPreviousBlock","getRootBlocksAtRange","getRootInlinesAtRangeAsArray","getTextAtOffset","getTextDirection","getTextsAsArray","getTextsBetweenPathPositionsAsArray"]),ji(Qi,[te,W,G]),ji(function(){function e(){f(this,e)}return d(e,[{key:"flip",value:function(){return this.setPoints([this.focus,this.anchor])}},{key:"moveForward",value:function(e){return this.updatePoints(function(t){return t.moveForward(e)})}},{key:"moveBackward",value:function(e){return this.updatePoints(function(t){return t.moveBackward(e)})}},{key:"moveAnchorBackward",value:function(e){return this.setAnchor(this.anchor.moveBackward(e))}},{key:"moveAnchorForward",value:function(e){return this.setAnchor(this.anchor.moveForward(e))}},{key:"moveAnchorTo",value:function(e,t){return this.setAnchor(this.anchor.moveTo(e,t))}},{key:"moveAnchorToStartOfNode",value:function(e){return this.setAnchor(this.anchor.moveToStartOfNode(e))}},{key:"moveAnchorToEndOfNode",value:function(e){return this.setAnchor(this.anchor.moveToEndOfNode(e))}},{key:"moveEndBackward",value:function(e){return this.setEnd(this.end.moveBackward(e))}},{key:"moveEndForward",value:function(e){return this.setEnd(this.end.moveForward(e))}},{key:"moveEndTo",value:function(e,t){return this.setEnd(this.end.moveTo(e,t))}},{key:"moveEndToStartOfNode",value:function(e){return this.setEnd(this.end.moveToStartOfNode(e))}},{key:"moveEndToEndOfNode",value:function(e){return this.setEnd(this.end.moveToEndOfNode(e))}},{key:"moveFocusBackward",value:function(e){return this.setFocus(this.focus.moveBackward(e))}},{key:"moveFocusForward",value:function(e){return this.setFocus(this.focus.moveForward(e))}},{key:"moveFocusTo",value:function(e,t){return this.setFocus(this.focus.moveTo(e,t))}},{key:"moveFocusToStartOfNode",value:function(e){return this.setFocus(this.focus.moveToStartOfNode(e))}},{key:"moveFocusToEndOfNode",value:function(e){return this.setFocus(this.focus.moveToEndOfNode(e))}},{key:"moveStartBackward",value:function(e){return this.setStart(this.start.moveBackward(e))}},{key:"moveStartForward",value:function(e){return this.setStart(this.start.moveForward(e))}},{key:"moveStartTo",value:function(e,t){return this.setStart(this.start.moveTo(e,t))}},{key:"moveStartToStartOfNode",value:function(e){return this.setStart(this.start.moveToStartOfNode(e))}},{key:"moveStartToEndOfNode",value:function(e){return this.setStart(this.start.moveToEndOfNode(e))}},{key:"moveTo",value:function(e,t){return this.updatePoints(function(n){return n.moveTo(e,t)})}},{key:"moveToAnchor",value:function(){return this.setFocus(this.anchor)}},{key:"moveToEnd",value:function(){return this.setStart(this.end)}},{key:"moveToEndOfNode",value:function(e){return this.updatePoints(function(t){return t.moveToEndOfNode(e)})}},{key:"moveToFocus",value:function(){return this.setAnchor(this.focus)}},{key:"moveToRangeOfNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.setPoints([this.anchor.moveToStartOfNode(e),this.focus.moveToEndOfNode(t)])}},{key:"moveToStart",value:function(){return this.setEnd(this.start)}},{key:"moveToStartOfNode",value:function(e){return this.updatePoints(function(t){return t.moveToStartOfNode(e)})}},{key:"normalize",value:function(e){return this.updatePoints(function(t){return t.normalize(e)})}},{key:"setAnchor",value:function(e){return this.set("anchor",e)}},{key:"setEnd",value:function(e){return this.isBackward?this.setAnchor(e):this.setFocus(e)}},{key:"setFocus",value:function(e){return this.set("focus",e)}},{key:"setPoints",value:function(e){var t=k(e,2),n=t[0],r=t[1];return this.set("anchor",n).set("focus",r)}},{key:"updatePoints",value:function(e){var t=this.anchor,n=this.focus;return t=e(t),n=e(n),this.merge({anchor:t,focus:n})}},{key:"setStart",value:function(e){return this.isBackward?this.setFocus(e):this.setAnchor(e)}},{key:"setProperties",value:function(e){var t=e=K.createProperties(e),n=t.anchor,r=t.focus,o=p(t,["anchor","focus"]);return n&&(o.anchor=F.create(n)),r&&(o.focus=F.create(r)),this.merge(o)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}},{key:"toRange",value:function(){var e=K.createProperties(this);return K.create(e)}},{key:"unset",value:function(){return this.updatePoints(function(e){return e.unset()})}},{key:"isCollapsed",get:function(){return this.anchor===this.focus||this.anchor.key===this.focus.key&&this.anchor.offset===this.focus.offset}},{key:"isExpanded",get:function(){return!this.isCollapsed}},{key:"isBackward",get:function(){var e=this.isUnset,t=this.anchor,n=this.focus;return e?null:t.key===n.key?t.offset>n.offset:P.isBefore(n.path,t.path)}},{key:"isForward",get:function(){var e=this.isBackward;return null==e?null:!e}},{key:"isUnset",get:function(){var e=this.anchor,t=this.focus;return e.isUnset||t.isUnset}},{key:"isSet",get:function(){return!this.isUnset}},{key:"start",get:function(){return this.isBackward?this.focus:this.anchor}},{key:"end",get:function(){return this.isBackward?this.anchor:this.focus}}]),e}(),[q,L,K,z]);var ns={Annotation:q,Block:te,Change:Ge,Data:E,Decoration:L,Document:W,Editor:Si,Inline:G,KeyUtils:c,Leaf:Ei,Mark:C,Node:X,Operation:We,PathUtils:P,Point:F,Range:K,resetMemoization:Ki,Selection:z,Text:H,TextUtils:st,useMemoization:Ui,Value:re};e.Annotation=q,e.Block=te,e.Change=Ge,e.Data=E,e.Decoration=L,e.Document=W,e.Editor=Si,e.Inline=G,e.KeyUtils=c,e.Leaf=Ei,e.Mark=C,e.Node=X,e.Operation=We,e.PathUtils=P,e.Point=F,e.Range=K,e.resetMemoization=Ki,e.Selection=z,e.Text=H,e.TextUtils=st,e.useMemoization=Ui,e.Value=re,e.default=ns,Object.defineProperty(e,"__esModule",{value:!0})});