@pie-element/math-templated 5.3.2-next.2 → 5.3.2
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/CHANGELOG.md +11 -0
- package/configure/CHANGELOG.md +11 -0
- package/configure/package.json +5 -5
- package/controller/CHANGELOG.md +11 -0
- package/controller/package.json +3 -3
- package/module/configure.js +1 -1
- package/module/element.js +1 -1
- package/module/manifest.json +5 -5
- package/module/print.js +1 -1
- package/package.json +7 -7
package/module/print.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_dll_debug as e,_dll_lodash as t,_dll_react as r,_dll_react_dom_server as n,_dll_prop_types as o,_dll_material_ui__core_styles as i,_dll_classnames as a,_dll_react_dom as s,_dll_material_ui__core as u,_dll_pie_lib__render_ui as c,_dll_material_ui__icons as l,_dll_pie_lib__correct_answer_toggle as f}from"../../../@pie-lib/shared-module@^1.17.2/module/index.js";import{_dll_pie_lib__math_rendering as h}from"../../../@pie-lib/math-rendering-module@^3.1.2/module/index.js";import{_dll_pie_lib__math_input as d,_dll_pie_framework__mathquill as p}from"../../../@pie-lib/math-edit-module@^2.8.2/module/index.js";import{_dll_pie_lib__drag as v}from"../../../@pie-lib/drag-module@^2.11.2/module/index.js";import{_dll_pie_lib__editable_html as y}from"../../../@pie-lib/editable-html-module@^5.9.2/module/index.js";var m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},g=Object.prototype.toString,k=function(e){switch(g.call(e)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}if("object"==typeof e&&e&&"number"==typeof e.length)try{if("function"==typeof e.callee)return"arguments"}catch(e){if(e instanceof TypeError)return"arguments"}return null===e?"null":void 0===e?"undefined":e&&1===e.nodeType?"element":e===Object(e)?"object":typeof e},_=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function b(e){return!0===_(e)&&"[object Object]"===Object.prototype.toString.call(e)}var w=function(e){var t,r;return!1!==b(e)&&("function"==typeof(t=e.constructor)&&(!1!==b(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))},x="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function A(){throw new Error("setTimeout has not been defined")}function O(){throw new Error("clearTimeout has not been defined")}var S=A,E=O;function T(e){if(S===setTimeout)return setTimeout(e,0);if((S===A||!S)&&setTimeout)return S=setTimeout,setTimeout(e,0);try{return S(e,0)}catch(t){try{return S.call(null,e,0)}catch(t){return S.call(this,e,0)}}}"function"==typeof x.setTimeout&&(S=setTimeout),"function"==typeof x.clearTimeout&&(E=clearTimeout);var N,B=[],z=!1,j=-1;function C(){z&&N&&(z=!1,N.length?B=N.concat(B):j=-1,B.length&&P())}function P(){if(!z){var e=T(C);z=!0;for(var t=B.length;t;){for(N=B,B=[];++j<t;)N&&N[j].run();j=-1,t=B.length}N=null,z=!1,function(e){if(E===clearTimeout)return clearTimeout(e);if((E===O||!E)&&clearTimeout)return E=clearTimeout,clearTimeout(e);try{E(e)}catch(t){try{return E.call(null,e)}catch(t){return E.call(this,e)}}}(e)}}function K(e,t){this.fun=e,this.array=t}K.prototype.run=function(){this.fun.apply(null,this.array)};function F(){}var I=F,M=F,R=F,D=F,L=F,J=F,q=F;var U=x.performance||{},V=U.now||U.mozNow||U.msNow||U.oNow||U.webkitNow||function(){return(new Date).getTime()};var W=new Date;var $={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];B.push(new K(e,t)),1!==B.length||z||T(P)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:I,addListener:M,once:R,off:D,removeListener:L,removeAllListeners:J,emit:q,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*V.call(U),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-W)/1e3}},H=$&&$.env&&$.env.FORBID_DEPRECATIONS,G=$&&$.env&&$.env.FORBID_WARNINGS,Q=void 0!==$&&$.env&&!0,Y="undefined"!=typeof console&&"function"==typeof console.log&&"function"==typeof console.warn&&"function"==typeof console.error;function X(e,t){if(Q&&Y){for(var r,n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];(r=console)[e].apply(r,[t].concat(o))}}function Z(e,t){throw new Error(t)}var ee={deprecate:function(e,t){for(var r=H?Z:X,n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];r.apply(void 0,["warn","Deprecation ("+e+"): "+t].concat(o))},error:function(e){if(Y){for(var t,r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(t=console).error.apply(t,[e].concat(n))}},warn:function(e){for(var t=G?Z:X,r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];t.apply(void 0,["warn","Warning: "+e].concat(n))}},te={};function re(e){e&&(e.value=!0)}function ne(){}function oe(e){return void 0===e.size&&(e.size=e.__iterate(ae)),e.size}function ie(e,t){if("number"!=typeof t){var r=t>>>0;if(""+r!==t||4294967295===r)return NaN;t=r}return t<0?oe(e)+t:t}function ae(){return!0}function se(e,t,r){return(0===e&&!fe(e)||void 0!==r&&e<=-r)&&(void 0===t||void 0!==r&&t>=r)}function ue(e,t){return le(e,t,0)}function ce(e,t){return le(e,t,t)}function le(e,t,r){return void 0===e?r:fe(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function fe(e){return e<0||0===e&&1/e==-1/0}function he(e){return Boolean(e&&e["@@__IMMUTABLE_ITERABLE__@@"])}function de(e){return Boolean(e&&e["@@__IMMUTABLE_KEYED__@@"])}function pe(e){return Boolean(e&&e["@@__IMMUTABLE_INDEXED__@@"])}function ve(e){return de(e)||pe(e)}var ye=function(e){return he(e)?e:Fe(e)},me=function(e){function t(e){return de(e)?e:Ie(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(ye),ge=function(e){function t(e){return pe(e)?e:Me(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(ye),ke=function(e){function t(e){return he(e)&&!ve(e)?e:Re(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(ye);ye.Keyed=me,ye.Indexed=ge,ye.Set=ke;function _e(e){return Boolean(e&&e["@@__IMMUTABLE_SEQ__@@"])}function be(e){return Boolean(e&&e["@@__IMMUTABLE_RECORD__@@"])}function we(e){return he(e)||be(e)}var xe="@@__IMMUTABLE_ORDERED__@@";function Ae(e){return Boolean(e&&e[xe])}var Oe="function"==typeof Symbol&&Symbol.iterator,Se=Oe||"@@iterator",Ee=function(e){this.next=e};function Te(e,t,r,n){var o=0===e?t:1===e?r:[t,r];return n?n.value=o:n={value:o,done:!1},n}function Ne(){return{value:void 0,done:!0}}function Be(e){return!!Array.isArray(e)||!!Ce(e)}function ze(e){return e&&"function"==typeof e.next}function je(e){var t=Ce(e);return t&&t.call(e)}function Ce(e){var t=e&&(Oe&&e[Oe]||e["@@iterator"]);if("function"==typeof t)return t}Ee.prototype.toString=function(){return"[Iterator]"},Ee.KEYS=0,Ee.VALUES=1,Ee.ENTRIES=2,Ee.prototype.inspect=Ee.prototype.toSource=function(){return this.toString()},Ee.prototype[Se]=function(){return this};var Pe=Object.prototype.hasOwnProperty;function Ke(e){return!(!Array.isArray(e)&&"string"!=typeof e)||e&&"object"==typeof e&&Number.isInteger(e.length)&&e.length>=0&&(0===e.length?1===Object.keys(e).length:e.hasOwnProperty(e.length-1))}var Fe=function(e){function t(e){return null==e?Ue():we(e)?e.toSeq():function(e){var t=$e(e);if(t)return(n=Ce(r=e))&&n===r.entries?t.fromEntrySeq():function(e){var t=Ce(e);return t&&t===e.keys}(e)?t.toSetSeq():t;var r,n;if("object"==typeof e)return new Le(e);throw new TypeError("Expected Array or collection object of values, or keyed object: "+e)}(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(e,t){var r=this._cache;if(r){for(var n=r.length,o=0;o!==n;){var i=r[t?n-++o:o++];if(!1===e(i[1],i[0],this))break}return o}return this.__iterateUncached(e,t)},t.prototype.__iterator=function(e,t){var r=this._cache;if(r){var n=r.length,o=0;return new Ee((function(){if(o===n)return{value:void 0,done:!0};var i=r[t?n-++o:o++];return Te(e,i[0],i[1])}))}return this.__iteratorUncached(e,t)},t}(ye),Ie=function(e){function t(e){return null==e?Ue().toKeyedSeq():he(e)?de(e)?e.toSeq():e.fromEntrySeq():be(e)?e.toSeq():Ve(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(Fe),Me=function(e){function t(e){return null==e?Ue():he(e)?de(e)?e.entrySeq():e.toIndexedSeq():be(e)?e.toSeq().entrySeq():We(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t}(Fe),Re=function(e){function t(e){return(he(e)&&!ve(e)?e:Me(e)).toSetSeq()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t}(Fe);Fe.isSeq=_e,Fe.Keyed=Ie,Fe.Set=Re,Fe.Indexed=Me,Fe.prototype["@@__IMMUTABLE_SEQ__@@"]=!0;var De=function(e){function t(e){this._array=e,this.size=e.length}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return this.has(e)?this._array[ie(this,e)]:t},t.prototype.__iterate=function(e,t){for(var r=this._array,n=r.length,o=0;o!==n;){var i=t?n-++o:o++;if(!1===e(r[i],i,this))break}return o},t.prototype.__iterator=function(e,t){var r=this._array,n=r.length,o=0;return new Ee((function(){if(o===n)return{value:void 0,done:!0};var i=t?n-++o:o++;return Te(e,i,r[i])}))},t}(Me),Le=function(e){function t(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},t.prototype.has=function(e){return Pe.call(this._object,e)},t.prototype.__iterate=function(e,t){for(var r=this._object,n=this._keys,o=n.length,i=0;i!==o;){var a=n[t?o-++i:i++];if(!1===e(r[a],a,this))break}return i},t.prototype.__iterator=function(e,t){var r=this._object,n=this._keys,o=n.length,i=0;return new Ee((function(){if(i===o)return{value:void 0,done:!0};var a=n[t?o-++i:i++];return Te(e,a,r[a])}))},t}(Ie);Le.prototype[xe]=!0;var Je,qe=function(e){function t(e){this._collection=e,this.size=e.length||e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var r=je(this._collection),n=0;if(ze(r))for(var o;!(o=r.next()).done&&!1!==e(o.value,n++,this););return n},t.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var r=je(this._collection);if(!ze(r))return new Ee(Ne);var n=0;return new Ee((function(){var t=r.next();return t.done?t:Te(e,n++,t.value)}))},t}(Me);function Ue(){return Je||(Je=new De([]))}function Ve(e){var t=$e(e);if(t)return t.fromEntrySeq();if("object"==typeof e)return new Le(e);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function We(e){var t=$e(e);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+e)}function $e(e){return Ke(e)?new De(e):Be(e)?new qe(e):void 0}function He(e){return Boolean(e&&e["@@__IMMUTABLE_MAP__@@"])}function Ge(e){return He(e)&&Ae(e)}function Qe(e){return Boolean(e&&"function"==typeof e.equals&&"function"==typeof e.hashCode)}function Ye(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!!(Qe(e)&&Qe(t)&&e.equals(t))}var Xe="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var r=65535&(e|=0),n=65535&(t|=0);return r*n+((e>>>16)*n+r*(t>>>16)<<16>>>0)|0};function Ze(e){return e>>>1&1073741824|3221225471&e}var et=Object.prototype.valueOf;function tt(e){if(null==e)return rt(e);if("function"==typeof e.hashCode)return Ze(e.hashCode(e));var t,r=(t=e).valueOf!==et&&"function"==typeof t.valueOf?t.valueOf(t):t;if(null==r)return rt(r);switch(typeof r){case"boolean":return r?1108378657:1108378656;case"number":return function(e){if(e!=e||e===1/0)return 0;var t=0|e;t!==e&&(t^=4294967295*e);for(;e>4294967295;)t^=e/=4294967295;return Ze(t)}(r);case"string":return r.length>ht?function(e){var t=vt[e];void 0===t&&(t=nt(e),pt===dt&&(pt=0,vt={}),pt++,vt[e]=t);return t}(r):nt(r);case"object":case"function":return function(e){var t;if(ut&&void 0!==(t=st.get(e)))return t;if(void 0!==(t=e[ft]))return t;if(!it){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[ft]))return t;if(void 0!==(t=function(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e)))return t}if(t=at(),ut)st.set(e,t);else{if(void 0!==ot&&!1===ot(e))throw new Error("Non-extensible objects are not allowed as keys.");if(it)Object.defineProperty(e,ft,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[ft]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[ft]=t}}return t}(r);case"symbol":return function(e){var t=ct[e];if(void 0!==t)return t;return t=at(),ct[e]=t,t}(r);default:if("function"==typeof r.toString)return nt(r.toString());throw new Error("Value type "+typeof r+" cannot be hashed.")}}function rt(e){return null===e?1108378658:1108378659}function nt(e){for(var t=0,r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)|0;return Ze(t)}var ot=Object.isExtensible,it=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}();function at(){var e=++lt;return 1073741824<&&(lt=0),e}var st,ut="function"==typeof WeakMap;ut&&(st=new WeakMap);var ct=Object.create(null),lt=0,ft="__immutablehash__";"function"==typeof Symbol&&(ft=Symbol(ft));var ht=16,dt=255,pt=0,vt={},yt=function(e){function t(e,t){this._iter=e,this._useKeys=t,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return this._iter.get(e,t)},t.prototype.has=function(e){return this._iter.has(e)},t.prototype.valueSeq=function(){return this._iter.valueSeq()},t.prototype.reverse=function(){var e=this,t=wt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},t.prototype.map=function(e,t){var r=this,n=bt(this,e,t);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(e,t)}),n},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t,n){return e(t,n,r)}),t)},t.prototype.__iterator=function(e,t){return this._iter.__iterator(e,t)},t}(Ie);yt.prototype[xe]=!0;var mt=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.includes=function(e){return this._iter.includes(e)},t.prototype.__iterate=function(e,t){var r=this,n=0;return t&&oe(this),this._iter.__iterate((function(o){return e(o,t?r.size-++n:n++,r)}),t)},t.prototype.__iterator=function(e,t){var r=this,n=this._iter.__iterator(1,t),o=0;return t&&oe(this),new Ee((function(){var i=n.next();return i.done?i:Te(e,t?r.size-++o:o++,i.value,i)}))},t}(Me),gt=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.has=function(e){return this._iter.includes(e)},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t){return e(t,t,r)}),t)},t.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t);return new Ee((function(){var t=r.next();return t.done?t:Te(e,t.value,t.value,t)}))},t}(Re),kt=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t){if(t){Ct(t);var n=he(t);return e(n?t.get(1):t[1],n?t.get(0):t[0],r)}}),t)},t.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t);return new Ee((function(){for(;;){var t=r.next();if(t.done)return t;var n=t.value;if(n){Ct(n);var o=he(n);return Te(e,o?n.get(0):n[0],o?n.get(1):n[1],t)}}}))},t}(Ie);function _t(e){var t=Kt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Ft,t.__iterateUncached=function(t,r){var n=this;return e.__iterate((function(e,r){return!1!==t(r,e,n)}),r)},t.__iteratorUncached=function(t,r){if(2===t){var n=e.__iterator(t,r);return new Ee((function(){var e=n.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e}))}return e.__iterator(1===t?0:1,r)},t}function bt(e,t,r){var n=Kt(e);return n.size=e.size,n.has=function(t){return e.has(t)},n.get=function(n,o){var i=e.get(n,te);return i===te?o:t.call(r,i,n,e)},n.__iterateUncached=function(n,o){var i=this;return e.__iterate((function(e,o,a){return!1!==n(t.call(r,e,o,a),o,i)}),o)},n.__iteratorUncached=function(n,o){var i=e.__iterator(2,o);return new Ee((function(){var o=i.next();if(o.done)return o;var a=o.value,s=a[0];return Te(n,s,t.call(r,a[1],s,e),o)}))},n}function wt(e,t){var r=this,n=Kt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=_t(e);return t.reverse=function(){return e.flip()},t}),n.get=function(r,n){return e.get(t?r:-1-r,n)},n.has=function(r){return e.has(t?r:-1-r)},n.includes=function(t){return e.includes(t)},n.cacheResult=Ft,n.__iterate=function(r,n){var o=this,i=0;return n&&oe(e),e.__iterate((function(e,a){return r(e,t?a:n?o.size-++i:i++,o)}),!n)},n.__iterator=function(n,o){var i=0;o&&oe(e);var a=e.__iterator(2,!o);return new Ee((function(){var e=a.next();if(e.done)return e;var s=e.value;return Te(n,t?s[0]:o?r.size-++i:i++,s[1],e)}))},n}function xt(e,t,r,n){var o=Kt(e);return n&&(o.has=function(n){var o=e.get(n,te);return o!==te&&!!t.call(r,o,n,e)},o.get=function(n,o){var i=e.get(n,te);return i!==te&&t.call(r,i,n,e)?i:o}),o.__iterateUncached=function(o,i){var a=this,s=0;return e.__iterate((function(e,i,u){if(t.call(r,e,i,u))return s++,o(e,n?i:s-1,a)}),i),s},o.__iteratorUncached=function(o,i){var a=e.__iterator(2,i),s=0;return new Ee((function(){for(;;){var i=a.next();if(i.done)return i;var u=i.value,c=u[0],l=u[1];if(t.call(r,l,c,e))return Te(o,n?c:s++,l,i)}}))},o}function At(e,t,r,n){var o=e.size;if(se(t,r,o))return e;var i=ue(t,o),a=ce(r,o);if(i!=i||a!=a)return At(e.toSeq().cacheResult(),t,r,n);var s,u=a-i;u==u&&(s=u<0?0:u);var c=Kt(e);return c.size=0===s?s:e.size&&s||void 0,!n&&_e(e)&&s>=0&&(c.get=function(t,r){return(t=ie(this,t))>=0&&t<s?e.get(t+i,r):r}),c.__iterateUncached=function(t,r){var o=this;if(0===s)return 0;if(r)return this.cacheResult().__iterate(t,r);var a=0,u=!0,c=0;return e.__iterate((function(e,r){if(!u||!(u=a++<i))return c++,!1!==t(e,n?r:c-1,o)&&c!==s})),c},c.__iteratorUncached=function(t,r){if(0!==s&&r)return this.cacheResult().__iterator(t,r);if(0===s)return new Ee(Ne);var o=e.__iterator(t,r),a=0,u=0;return new Ee((function(){for(;a++<i;)o.next();if(++u>s)return{value:void 0,done:!0};var e=o.next();return n||1===t||e.done?e:Te(t,u-1,0===t?void 0:e.value[1],e)}))},c}function Ot(e,t,r,n){var o=Kt(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var s=!0,u=0;return e.__iterate((function(e,i,c){if(!s||!(s=t.call(r,e,i,c)))return u++,o(e,n?i:u-1,a)})),u},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var s=e.__iterator(2,i),u=!0,c=0;return new Ee((function(){var e,i,l;do{if((e=s.next()).done)return n||1===o?e:Te(o,c++,0===o?void 0:e.value[1],e);var f=e.value;i=f[0],l=f[1],u&&(u=t.call(r,l,i,a))}while(u);return 2===o?e:Te(o,i,l,e)}))},o}function St(e,t){var r=de(e),n=[e].concat(t).map((function(e){return he(e)?r&&(e=me(e)):e=r?Ve(e):We(Array.isArray(e)?e:[e]),e})).filter((function(e){return 0!==e.size}));if(0===n.length)return e;if(1===n.length){var o=n[0];if(o===e||r&&de(o)||pe(e)&&pe(o))return o}var i=new De(n);return r?i=i.toKeyedSeq():pe(e)||(i=i.toSetSeq()),(i=i.flatten(!0)).size=n.reduce((function(e,t){if(void 0!==e){var r=t.size;if(void 0!==r)return e+r}}),0),i}function Et(e,t,r){var n=Kt(e);return n.__iterateUncached=function(o,i){if(i)return this.cacheResult().__iterate(o,i);var a=0,s=!1;return function e(u,c){u.__iterate((function(i,u){return(!t||c<t)&&he(i)?e(i,c+1):(a++,!1===o(i,r?u:a-1,n)&&(s=!0)),!s}),i)}(e,0),a},n.__iteratorUncached=function(n,o){if(o)return this.cacheResult().__iterator(n,o);var i=e.__iterator(n,o),a=[],s=0;return new Ee((function(){for(;i;){var e=i.next();if(!1===e.done){var u=e.value;if(2===n&&(u=u[1]),t&&!(a.length<t)||!he(u))return r?e:Te(n,s++,u,e);a.push(i),i=u.__iterator(n,o)}else i=a.pop()}return{value:void 0,done:!0}}))},n}function Tt(e,t,r){t||(t=It);var n=de(e),o=0,i=e.toSeq().map((function(t,n){return[n,t,o++,r?r(t,n,e):t]})).valueSeq().toArray();return i.sort((function(e,r){return t(e[3],r[3])||e[2]-r[2]})).forEach(n?function(e,t){i[t].length=2}:function(e,t){i[t]=e[1]}),n?Ie(i):pe(e)?Me(i):Re(i)}function Nt(e,t,r){if(t||(t=It),r){var n=e.toSeq().map((function(t,n){return[t,r(t,n,e)]})).reduce((function(e,r){return Bt(t,e[1],r[1])?r:e}));return n&&n[0]}return e.reduce((function(e,r){return Bt(t,e,r)?r:e}))}function Bt(e,t,r){var n=e(r,t);return 0===n&&r!==t&&(null==r||r!=r)||n>0}function zt(e,t,r,n){var o=Kt(e),i=new De(r).map((function(e){return e.size}));return o.size=n?i.max():i.min(),o.__iterate=function(e,t){for(var r,n=this.__iterator(1,t),o=0;!(r=n.next()).done&&!1!==e(r.value,o++,this););return o},o.__iteratorUncached=function(e,o){var i=r.map((function(e){return e=ye(e),je(o?e.reverse():e)})),a=0,s=!1;return new Ee((function(){var r;return s||(r=i.map((function(e){return e.next()})),s=n?r.every((function(e){return e.done})):r.some((function(e){return e.done}))),s?{value:void 0,done:!0}:Te(e,a++,t.apply(null,r.map((function(e){return e.value}))))}))},o}function jt(e,t){return e===t?e:_e(e)?t:e.constructor(t)}function Ct(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Pt(e){return de(e)?me:pe(e)?ge:ke}function Kt(e){return Object.create((de(e)?Ie:pe(e)?Me:Re).prototype)}function Ft(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):Fe.prototype.cacheResult.call(this)}function It(e,t){return void 0===e&&void 0===t?0:void 0===e?1:void 0===t?-1:e>t?1:e<t?-1:0}function Mt(e,t){t=t||0;for(var r=Math.max(0,e.length-t),n=new Array(r),o=0;o<r;o++)n[o]=e[o+t];return n}function Rt(e,t){if(!e)throw new Error(t)}function Dt(e){Rt(e!==1/0,"Cannot perform this action with an infinite size.")}function Lt(e){if(Ke(e)&&"string"!=typeof e)return e;if(Ae(e))return e.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+e)}mt.prototype.cacheResult=yt.prototype.cacheResult=gt.prototype.cacheResult=kt.prototype.cacheResult=Ft;var Jt=Object.prototype.toString;function qt(e){return"object"==typeof e&&(we(e)||Array.isArray(e)||function(e){if(!e||"object"!=typeof e||"[object Object]"!==Jt.call(e))return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var r=t,n=Object.getPrototypeOf(t);null!==n;)r=n,n=Object.getPrototypeOf(r);return r===t}(e))}function Ut(e){try{return"string"==typeof e?JSON.stringify(e):String(e)}catch(t){return JSON.stringify(e)}}function Vt(e,t,r){return we(e)?e.get(t,r):function(e,t){return we(e)?e.has(t):qt(e)&&Pe.call(e,t)}(e,t)?"function"==typeof e.get?e.get(t):e[t]:r}function Wt(e){if(Array.isArray(e))return Mt(e);var t={};for(var r in e)Pe.call(e,r)&&(t[r]=e[r]);return t}function $t(e,t,r,n){n||(n=r,r=void 0);var o=Ht(we(e),e,Lt(t),0,r,n);return o===te?r:o}function Ht(e,t,r,n,o,i){var a=t===te;if(n===r.length){var s=a?o:t,u=i(s);return u===s?t:u}if(!a&&!qt(t))throw new TypeError("Cannot update within non-data-structure value in path ["+r.slice(0,n).map(Ut)+"]: "+t);var c=r[n],l=a?te:Vt(t,c,te),f=Ht(l===te?e:we(l),l,r,n+1,o,i);return f===l?t:f===te?function(e,t){if(!qt(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(we(e)){if(!e.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+e);return e.remove(t)}if(!Pe.call(e,t))return e;var r=Wt(e);return Array.isArray(r)?r.splice(t,1):delete r[t],r}(t,c):function(e,t,r){if(!qt(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(we(e)){if(!e.set)throw new TypeError("Cannot update immutable value without .set() method: "+e);return e.set(t,r)}if(Pe.call(e,t)&&r===e[t])return e;var n=Wt(e);return n[t]=r,n}(a?e?Or():{}:t,c,f)}function Gt(e,t){return function(e,t,r){return $t(e,t,te,(function(){return r}))}(this,e,t)}function Qt(e){return function(e,t){return $t(e,t,(function(){return te}))}(this,e)}function Yt(e,t,r,n){return $t(e,[t],r,n)}function Xt(e,t,r){return 1===arguments.length?e(this):Yt(this,e,t,r)}function Zt(e,t,r){return $t(this,e,t,r)}function er(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return rr(this,e)}function tr(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if("function"!=typeof e)throw new TypeError("Invalid merger function: "+e);return rr(this,t,e)}function rr(e,t,r){for(var n=[],o=0;o<t.length;o++){var i=me(t[o]);0!==i.size&&n.push(i)}return 0===n.length?e:0!==e.toSeq().size||e.__ownerID||1!==n.length?e.withMutations((function(e){for(var t=r?function(t,n){Yt(e,n,te,(function(e){return e===te?t:r(e,t,n)}))}:function(t,r){e.set(r,t)},o=0;o<n.length;o++)n[o].forEach(t)})):e.constructor(n[0])}function nr(e,t,r){return or(e,t,function(e){function t(r,n,o){return qt(r)&&qt(n)&&(i=n,a=Fe(r),s=Fe(i),pe(a)===pe(s)&&de(a)===de(s))?or(r,[n],t):e?e(r,n,o):n;var i,a,s}return t}(r))}function or(e,t,r){if(!qt(e))throw new TypeError("Cannot merge into non-data-structure value: "+e);if(we(e))return"function"==typeof r&&e.mergeWith?e.mergeWith.apply(e,[r].concat(t)):e.merge?e.merge.apply(e,t):e.concat.apply(e,t);for(var n=Array.isArray(e),o=e,i=n?ge:me,a=n?function(t){o===e&&(o=Wt(o)),o.push(t)}:function(t,n){var i=Pe.call(o,n),a=i&&r?r(o[n],t,n):t;i&&a===o[n]||(o===e&&(o=Wt(o)),o[n]=a)},s=0;s<t.length;s++)i(t[s]).forEach(a);return o}function ir(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return nr(this,e)}function ar(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return nr(this,t,e)}function sr(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return $t(this,e,Or(),(function(e){return or(e,t)}))}function ur(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return $t(this,e,Or(),(function(e){return nr(e,t)}))}function cr(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function lr(){return this.__ownerID?this:this.__ensureOwner(new ne)}function fr(){return this.__ensureOwner()}function hr(){return this.__altered}var dr=function(e){function t(t){return null==t?Or():He(t)&&!Ae(t)?t:Or().withMutations((function(r){var n=e(t);Dt(n.size),n.forEach((function(e,t){return r.set(t,e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Or().withMutations((function(t){for(var r=0;r<e.length;r+=2){if(r+1>=e.length)throw new Error("Missing value for key: "+e[r]);t.set(e[r],e[r+1])}}))},t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},t.prototype.set=function(e,t){return Sr(this,e,t)},t.prototype.remove=function(e){return Sr(this,e,te)},t.prototype.deleteAll=function(e){var t=ye(e);return 0===t.size?this:this.withMutations((function(e){t.forEach((function(t){return e.remove(t)}))}))},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Or()},t.prototype.sort=function(e){return Qr(Tt(this,e))},t.prototype.sortBy=function(e,t){return Qr(Tt(this,t,e))},t.prototype.map=function(e,t){var r=this;return this.withMutations((function(n){n.forEach((function(o,i){n.set(i,e.call(t,o,i,r))}))}))},t.prototype.__iterator=function(e,t){return new br(this,e,t)},t.prototype.__iterate=function(e,t){var r=this,n=0;return this._root&&this._root.iterate((function(t){return n++,e(t[1],t[0],r)}),t),n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Ar(this.size,this._root,e,this.__hash):0===this.size?Or():(this.__ownerID=e,this.__altered=!1,this)},t}(me);dr.isMap=He;var pr=dr.prototype;pr["@@__IMMUTABLE_MAP__@@"]=!0,pr.delete=pr.remove,pr.removeAll=pr.deleteAll,pr.setIn=Gt,pr.removeIn=pr.deleteIn=Qt,pr.update=Xt,pr.updateIn=Zt,pr.merge=pr.concat=er,pr.mergeWith=tr,pr.mergeDeep=ir,pr.mergeDeepWith=ar,pr.mergeIn=sr,pr.mergeDeepIn=ur,pr.withMutations=cr,pr.wasAltered=hr,pr.asImmutable=fr,pr["@@transducer/init"]=pr.asMutable=lr,pr["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},pr["@@transducer/result"]=function(e){return e.asImmutable()};var vr=function(e,t){this.ownerID=e,this.entries=t};vr.prototype.get=function(e,t,r,n){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(Ye(r,o[i][0]))return o[i][1];return n},vr.prototype.update=function(e,t,r,n,o,i,a){for(var s=o===te,u=this.entries,c=0,l=u.length;c<l&&!Ye(n,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(re(a),(s||!f)&&re(i),!s||1!==u.length){if(!f&&!s&&u.length>=jr)return function(e,t,r,n){e||(e=new ne);for(var o=new kr(e,tt(r),[r,n]),i=0;i<t.length;i++){var a=t[i];o=o.update(e,0,void 0,a[0],a[1])}return o}(e,u,n,o);var h=e&&e===this.ownerID,d=h?u:Mt(u);return f?s?c===l-1?d.pop():d[c]=d.pop():d[c]=[n,o]:d.push([n,o]),h?(this.entries=d,this):new vr(e,d)}};var yr=function(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r};yr.prototype.get=function(e,t,r,n){void 0===t&&(t=tt(r));var o=1<<(31&(0===e?t:t>>>e)),i=this.bitmap;return 0==(i&o)?n:this.nodes[Br(i&o-1)].get(e+5,t,r,n)},yr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=tt(n));var s=31&(0===t?r:r>>>t),u=1<<s,c=this.bitmap,l=0!=(c&u);if(!l&&o===te)return this;var f=Br(c&u-1),h=this.nodes,d=l?h[f]:void 0,p=Er(d,e,t+5,r,n,o,i,a);if(p===d)return this;if(!l&&p&&h.length>=Cr)return function(e,t,r,n,o){for(var i=0,a=new Array(32),s=0;0!==r;s++,r>>>=1)a[s]=1&r?t[i++]:void 0;return a[n]=o,new mr(e,i+1,a)}(e,h,c,s,p);if(l&&!p&&2===h.length&&Tr(h[1^f]))return h[1^f];if(l&&p&&1===h.length&&Tr(p))return p;var v=e&&e===this.ownerID,y=l?p?c:c^u:c|u,m=l?p?zr(h,f,p,v):function(e,t,r){var n=e.length-1;if(r&&t===n)return e.pop(),e;for(var o=new Array(n),i=0,a=0;a<n;a++)a===t&&(i=1),o[a]=e[a+i];return o}(h,f,v):function(e,t,r,n){var o=e.length+1;if(n&&t+1===o)return e[t]=r,e;for(var i=new Array(o),a=0,s=0;s<o;s++)s===t?(i[s]=r,a=-1):i[s]=e[s+a];return i}(h,f,p,v);return v?(this.bitmap=y,this.nodes=m,this):new yr(e,y,m)};var mr=function(e,t,r){this.ownerID=e,this.count=t,this.nodes=r};mr.prototype.get=function(e,t,r,n){void 0===t&&(t=tt(r));var o=31&(0===e?t:t>>>e),i=this.nodes[o];return i?i.get(e+5,t,r,n):n},mr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=tt(n));var s=31&(0===t?r:r>>>t),u=o===te,c=this.nodes,l=c[s];if(u&&!l)return this;var f=Er(l,e,t+5,r,n,o,i,a);if(f===l)return this;var h=this.count;if(l){if(!f&&--h<Pr)return function(e,t,r,n){for(var o=0,i=0,a=new Array(r),s=0,u=1,c=t.length;s<c;s++,u<<=1){var l=t[s];void 0!==l&&s!==n&&(o|=u,a[i++]=l)}return new yr(e,o,a)}(e,c,h,s)}else h++;var d=e&&e===this.ownerID,p=zr(c,s,f,d);return d?(this.count=h,this.nodes=p,this):new mr(e,h,p)};var gr=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entries=r};gr.prototype.get=function(e,t,r,n){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(Ye(r,o[i][0]))return o[i][1];return n},gr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=tt(n));var s=o===te;if(r!==this.keyHash)return s?this:(re(a),re(i),Nr(this,e,t,r,[n,o]));for(var u=this.entries,c=0,l=u.length;c<l&&!Ye(n,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(re(a),(s||!f)&&re(i),s&&2===l)return new kr(e,this.keyHash,u[1^c]);var h=e&&e===this.ownerID,d=h?u:Mt(u);return f?s?c===l-1?d.pop():d[c]=d.pop():d[c]=[n,o]:d.push([n,o]),h?(this.entries=d,this):new gr(e,this.keyHash,d)};var kr=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entry=r};kr.prototype.get=function(e,t,r,n){return Ye(r,this.entry[0])?this.entry[1]:n},kr.prototype.update=function(e,t,r,n,o,i,a){var s=o===te,u=Ye(n,this.entry[0]);return(u?o===this.entry[1]:s)?this:(re(a),s?void re(i):u?e&&e===this.ownerID?(this.entry[1]=o,this):new kr(e,this.keyHash,[n,o]):(re(i),Nr(this,e,t,tt(n),[n,o])))},vr.prototype.iterate=gr.prototype.iterate=function(e,t){for(var r=this.entries,n=0,o=r.length-1;n<=o;n++)if(!1===e(r[t?o-n:n]))return!1},yr.prototype.iterate=mr.prototype.iterate=function(e,t){for(var r=this.nodes,n=0,o=r.length-1;n<=o;n++){var i=r[t?o-n:n];if(i&&!1===i.iterate(e,t))return!1}},kr.prototype.iterate=function(e,t){return e(this.entry)};var _r,br=function(e){function t(e,t,r){this._type=t,this._reverse=r,this._stack=e._root&&xr(e._root)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.next=function(){for(var e=this._type,t=this._stack;t;){var r=t.node,n=t.index++,o=void 0;if(r.entry){if(0===n)return wr(e,r.entry)}else if(r.entries){if(n<=(o=r.entries.length-1))return wr(e,r.entries[this._reverse?o-n:n])}else if(n<=(o=r.nodes.length-1)){var i=r.nodes[this._reverse?o-n:n];if(i){if(i.entry)return wr(e,i.entry);t=this._stack=xr(i,t)}continue}t=this._stack=this._stack.__prev}return{value:void 0,done:!0}},t}(Ee);function wr(e,t){return Te(e,t[0],t[1])}function xr(e,t){return{node:e,index:0,__prev:t}}function Ar(e,t,r,n){var o=Object.create(pr);return o.size=e,o._root=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function Or(){return _r||(_r=Ar(0))}function Sr(e,t,r){var n,o;if(e._root){var i={value:!1},a={value:!1};if(n=Er(e._root,e.__ownerID,0,void 0,t,r,i,a),!a.value)return e;o=e.size+(i.value?r===te?-1:1:0)}else{if(r===te)return e;o=1,n=new vr(e.__ownerID,[[t,r]])}return e.__ownerID?(e.size=o,e._root=n,e.__hash=void 0,e.__altered=!0,e):n?Ar(o,n):Or()}function Er(e,t,r,n,o,i,a,s){return e?e.update(t,r,n,o,i,a,s):i===te?e:(re(s),re(a),new kr(t,n,[o,i]))}function Tr(e){return e.constructor===kr||e.constructor===gr}function Nr(e,t,r,n,o){if(e.keyHash===n)return new gr(t,n,[e.entry,o]);var i,a=31&(0===r?e.keyHash:e.keyHash>>>r),s=31&(0===r?n:n>>>r),u=a===s?[Nr(e,t,r+5,n,o)]:(i=new kr(t,n,o),a<s?[e,i]:[i,e]);return new yr(t,1<<a|1<<s,u)}function Br(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function zr(e,t,r,n){var o=n?e:Mt(e);return o[t]=r,o}var jr=8,Cr=16,Pr=8;function Kr(e){return Boolean(e&&e["@@__IMMUTABLE_LIST__@@"])}var Fr=function(e){function t(t){var r=qr();if(null==t)return r;if(Kr(t))return t;var n=e(t),o=n.size;return 0===o?r:(Dt(o),o>0&&o<32?Jr(0,o,5,null,new Mr(n.toArray())):r.withMutations((function(e){e.setSize(o),n.forEach((function(t,r){return e.set(r,t)}))})))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("List [","]")},t.prototype.get=function(e,t){if((e=ie(this,e))>=0&&e<this.size){var r=Wr(this,e+=this._origin);return r&&r.array[31&e]}return t},t.prototype.set=function(e,t){return function(e,t,r){if((t=ie(e,t))!=t)return e;if(t>=e.size||t<0)return e.withMutations((function(e){t<0?$r(e,t).set(0,r):$r(e,0,t+1).set(t,r)}));t+=e._origin;var n=e._tail,o=e._root,i={value:!1};t>=Hr(e._capacity)?n=Ur(n,e.__ownerID,0,t,r,i):o=Ur(o,e.__ownerID,e._level,t,r,i);if(!i.value)return e;if(e.__ownerID)return e._root=o,e._tail=n,e.__hash=void 0,e.__altered=!0,e;return Jr(e._origin,e._capacity,e._level,o,n)}(this,e,t)},t.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},t.prototype.insert=function(e,t){return this.splice(e,0,t)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=5,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):qr()},t.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations((function(r){$r(r,0,t+e.length);for(var n=0;n<e.length;n++)r.set(t+n,e[n])}))},t.prototype.pop=function(){return $r(this,0,-1)},t.prototype.unshift=function(){var e=arguments;return this.withMutations((function(t){$r(t,-e.length);for(var r=0;r<e.length;r++)t.set(r,e[r])}))},t.prototype.shift=function(){return $r(this,1)},t.prototype.concat=function(){for(var t=arguments,r=[],n=0;n<arguments.length;n++){var o=t[n],i=e("string"!=typeof o&&Be(o)?o:[o]);0!==i.size&&r.push(i)}return 0===r.length?this:0!==this.size||this.__ownerID||1!==r.length?this.withMutations((function(e){r.forEach((function(t){return t.forEach((function(t){return e.push(t)}))}))})):this.constructor(r[0])},t.prototype.setSize=function(e){return $r(this,0,e)},t.prototype.map=function(e,t){var r=this;return this.withMutations((function(n){for(var o=0;o<r.size;o++)n.set(o,e.call(t,n.get(o),o,r))}))},t.prototype.slice=function(e,t){var r=this.size;return se(e,t,r)?this:$r(this,ue(e,r),ce(t,r))},t.prototype.__iterator=function(e,t){var r=t?this.size:0,n=Lr(this,t);return new Ee((function(){var o=n();return o===Dr?{value:void 0,done:!0}:Te(e,t?--r:r++,o)}))},t.prototype.__iterate=function(e,t){for(var r,n=t?this.size:0,o=Lr(this,t);(r=o())!==Dr&&!1!==e(r,t?--n:n++,this););return n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Jr(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):0===this.size?qr():(this.__ownerID=e,this.__altered=!1,this)},t}(ge);Fr.isList=Kr;var Ir=Fr.prototype;Ir["@@__IMMUTABLE_LIST__@@"]=!0,Ir.delete=Ir.remove,Ir.merge=Ir.concat,Ir.setIn=Gt,Ir.deleteIn=Ir.removeIn=Qt,Ir.update=Xt,Ir.updateIn=Zt,Ir.mergeIn=sr,Ir.mergeDeepIn=ur,Ir.withMutations=cr,Ir.wasAltered=hr,Ir.asImmutable=fr,Ir["@@transducer/init"]=Ir.asMutable=lr,Ir["@@transducer/step"]=function(e,t){return e.push(t)},Ir["@@transducer/result"]=function(e){return e.asImmutable()};var Mr=function(e,t){this.array=e,this.ownerID=t};Mr.prototype.removeBefore=function(e,t,r){if(r===t?1<<t:0===this.array.length)return this;var n=r>>>t&31;if(n>=this.array.length)return new Mr([],e);var o,i=0===n;if(t>0){var a=this.array[n];if((o=a&&a.removeBefore(e,t-5,r))===a&&i)return this}if(i&&!o)return this;var s=Vr(this,e);if(!i)for(var u=0;u<n;u++)s.array[u]=void 0;return o&&(s.array[n]=o),s},Mr.prototype.removeAfter=function(e,t,r){if(r===(t?1<<t:0)||0===this.array.length)return this;var n,o=r-1>>>t&31;if(o>=this.array.length)return this;if(t>0){var i=this.array[o];if((n=i&&i.removeAfter(e,t-5,r))===i&&o===this.array.length-1)return this}var a=Vr(this,e);return a.array.splice(o+1),n&&(a.array[o]=n),a};var Rr,Dr={};function Lr(e,t){var r=e._origin,n=e._capacity,o=Hr(n),i=e._tail;return a(e._root,e._level,0);function a(e,s,u){return 0===s?function(e,a){var s=a===o?i&&i.array:e&&e.array,u=a>r?0:r-a,c=n-a;c>32&&(c=32);return function(){if(u===c)return Dr;var e=t?--c:u++;return s&&s[e]}}(e,u):function(e,o,i){var s,u=e&&e.array,c=i>r?0:r-i>>o,l=1+(n-i>>o);l>32&&(l=32);return function(){for(;;){if(s){var e=s();if(e!==Dr)return e;s=null}if(c===l)return Dr;var r=t?--l:c++;s=a(u&&u[r],o-5,i+(r<<o))}}}(e,s,u)}}function Jr(e,t,r,n,o,i,a){var s=Object.create(Ir);return s.size=t-e,s._origin=e,s._capacity=t,s._level=r,s._root=n,s._tail=o,s.__ownerID=i,s.__hash=a,s.__altered=!1,s}function qr(){return Rr||(Rr=Jr(0,0,5))}function Ur(e,t,r,n,o,i){var a,s=n>>>r&31,u=e&&s<e.array.length;if(!u&&void 0===o)return e;if(r>0){var c=e&&e.array[s],l=Ur(c,t,r-5,n,o,i);return l===c?e:((a=Vr(e,t)).array[s]=l,a)}return u&&e.array[s]===o?e:(i&&re(i),a=Vr(e,t),void 0===o&&s===a.array.length-1?a.array.pop():a.array[s]=o,a)}function Vr(e,t){return t&&e&&t===e.ownerID?e:new Mr(e?e.array.slice():[],t)}function Wr(e,t){if(t>=Hr(e._capacity))return e._tail;if(t<1<<e._level+5){for(var r=e._root,n=e._level;r&&n>0;)r=r.array[t>>>n&31],n-=5;return r}}function $r(e,t,r){void 0!==t&&(t|=0),void 0!==r&&(r|=0);var n=e.__ownerID||new ne,o=e._origin,i=e._capacity,a=o+t,s=void 0===r?i:r<0?i+r:o+r;if(a===o&&s===i)return e;if(a>=s)return e.clear();for(var u=e._level,c=e._root,l=0;a+l<0;)c=new Mr(c&&c.array.length?[void 0,c]:[],n),l+=1<<(u+=5);l&&(a+=l,o+=l,s+=l,i+=l);for(var f=Hr(i),h=Hr(s);h>=1<<u+5;)c=new Mr(c&&c.array.length?[c]:[],n),u+=5;var d=e._tail,p=h<f?Wr(e,s-1):h>f?new Mr([],n):d;if(d&&h>f&&a<i&&d.array.length){for(var v=c=Vr(c,n),y=u;y>5;y-=5){var m=f>>>y&31;v=v.array[m]=Vr(v.array[m],n)}v.array[f>>>5&31]=d}if(s<i&&(p=p&&p.removeAfter(n,0,s)),a>=h)a-=h,s-=h,u=5,c=null,p=p&&p.removeBefore(n,0,a);else if(a>o||h<f){for(l=0;c;){var g=a>>>u&31;if(g!==h>>>u&31)break;g&&(l+=(1<<u)*g),u-=5,c=c.array[g]}c&&a>o&&(c=c.removeBefore(n,u,a-l)),c&&h<f&&(c=c.removeAfter(n,u,h-l)),l&&(a-=l,s-=l)}return e.__ownerID?(e.size=s-a,e._origin=a,e._capacity=s,e._level=u,e._root=c,e._tail=p,e.__hash=void 0,e.__altered=!0,e):Jr(a,s,u,c,p)}function Hr(e){return e<32?0:e-1>>>5<<5}var Gr,Qr=function(e){function t(e){return null==e?Xr():Ge(e)?e:Xr().withMutations((function(t){var r=me(e);Dt(r.size),r.forEach((function(e,r){return t.set(r,e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("OrderedMap {","}")},t.prototype.get=function(e,t){var r=this._map.get(e);return void 0!==r?this._list.get(r)[1]:t},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):Xr()},t.prototype.set=function(e,t){return Zr(this,e,t)},t.prototype.remove=function(e){return Zr(this,e,te)},t.prototype.__iterate=function(e,t){var r=this;return this._list.__iterate((function(t){return t&&e(t[1],t[0],r)}),t)},t.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},t.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),r=this._list.__ensureOwner(e);return e?Yr(t,r,e,this.__hash):0===this.size?Xr():(this.__ownerID=e,this.__altered=!1,this._map=t,this._list=r,this)},t}(dr);function Yr(e,t,r,n){var o=Object.create(Qr.prototype);return o.size=e?e.size:0,o._map=e,o._list=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function Xr(){return Gr||(Gr=Yr(Or(),qr()))}function Zr(e,t,r){var n,o,i=e._map,a=e._list,s=i.get(t),u=void 0!==s;if(r===te){if(!u)return e;a.size>=32&&a.size>=2*i.size?(n=(o=a.filter((function(e,t){return void 0!==e&&s!==t}))).toKeyedSeq().map((function(e){return e[0]})).flip().toMap(),e.__ownerID&&(n.__ownerID=o.__ownerID=e.__ownerID)):(n=i.remove(t),o=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(r===a.get(s)[1])return e;n=i,o=a.set(s,[t,r])}else n=i.set(t,a.size),o=a.set(a.size,[t,r]);return e.__ownerID?(e.size=n.size,e._map=n,e._list=o,e.__hash=void 0,e.__altered=!0,e):Yr(n,o)}Qr.isOrderedMap=Ge,Qr.prototype[xe]=!0,Qr.prototype.delete=Qr.prototype.remove;function en(e){return Boolean(e&&e["@@__IMMUTABLE_STACK__@@"])}var tn=function(e){function t(e){return null==e?an():en(e)?e:an().pushAll(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(e,t){var r=this._head;for(e=ie(this,e);r&&e--;)r=r.next;return r?r.value:t},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var e=arguments;if(0===arguments.length)return this;for(var t=this.size+arguments.length,r=this._head,n=arguments.length-1;n>=0;n--)r={value:e[n],next:r};return this.__ownerID?(this.size=t,this._head=r,this.__hash=void 0,this.__altered=!0,this):on(t,r)},t.prototype.pushAll=function(t){if(0===(t=e(t)).size)return this;if(0===this.size&&en(t))return t;Dt(t.size);var r=this.size,n=this._head;return t.__iterate((function(e){r++,n={value:e,next:n}}),!0),this.__ownerID?(this.size=r,this._head=n,this.__hash=void 0,this.__altered=!0,this):on(r,n)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):an()},t.prototype.slice=function(t,r){if(se(t,r,this.size))return this;var n=ue(t,this.size);if(ce(r,this.size)!==this.size)return e.prototype.slice.call(this,t,r);for(var o=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=o,this._head=i,this.__hash=void 0,this.__altered=!0,this):on(o,i)},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?on(this.size,this._head,e,this.__hash):0===this.size?an():(this.__ownerID=e,this.__altered=!1,this)},t.prototype.__iterate=function(e,t){var r=this;if(t)return new De(this.toArray()).__iterate((function(t,n){return e(t,n,r)}),t);for(var n=0,o=this._head;o&&!1!==e(o.value,n++,this);)o=o.next;return n},t.prototype.__iterator=function(e,t){if(t)return new De(this.toArray()).__iterator(e,t);var r=0,n=this._head;return new Ee((function(){if(n){var t=n.value;return n=n.next,Te(e,r++,t)}return{value:void 0,done:!0}}))},t}(ge);tn.isStack=en;var rn,nn=tn.prototype;function on(e,t,r,n){var o=Object.create(nn);return o.size=e,o._head=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function an(){return rn||(rn=on(0))}nn["@@__IMMUTABLE_STACK__@@"]=!0,nn.shift=nn.pop,nn.unshift=nn.push,nn.unshiftAll=nn.pushAll,nn.withMutations=cr,nn.wasAltered=hr,nn.asImmutable=fr,nn["@@transducer/init"]=nn.asMutable=lr,nn["@@transducer/step"]=function(e,t){return e.unshift(t)},nn["@@transducer/result"]=function(e){return e.asImmutable()};function sn(e){return Boolean(e&&e["@@__IMMUTABLE_SET__@@"])}function un(e){return sn(e)&&Ae(e)}function cn(e,t){if(e===t)return!0;if(!he(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||de(e)!==de(t)||pe(e)!==pe(t)||Ae(e)!==Ae(t))return!1;if(0===e.size&&0===t.size)return!0;var r=!ve(e);if(Ae(e)){var n=e.entries();return t.every((function(e,t){var o=n.next().value;return o&&Ye(o[1],e)&&(r||Ye(o[0],t))}))&&n.next().done}var o=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{o=!0;var i=e;e=t,t=i}var a=!0,s=t.__iterate((function(t,n){if(r?!e.has(t):o?!Ye(t,e.get(n,te)):!Ye(e.get(n,te),t))return a=!1,!1}));return a&&e.size===s}function ln(e,t){var r=function(r){e.prototype[r]=t[r]};return Object.keys(t).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(r),e}function fn(e){if(!e||"object"!=typeof e)return e;if(!he(e)){if(!qt(e))return e;e=Fe(e)}if(de(e)){var t={};return e.__iterate((function(e,r){t[r]=fn(e)})),t}var r=[];return e.__iterate((function(e){r.push(fn(e))})),r}var hn=function(e){function t(t){return null==t?mn():sn(t)&&!Ae(t)?t:mn().withMutations((function(r){var n=e(t);Dt(n.size),n.forEach((function(e){return r.add(e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(me(e).keySeq())},t.intersect=function(e){return(e=ye(e).toArray()).length?pn.intersect.apply(t(e.pop()),e):mn()},t.union=function(e){return(e=ye(e).toArray()).length?pn.union.apply(t(e.pop()),e):mn()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(e){return this._map.has(e)},t.prototype.add=function(e){return vn(this,this._map.set(e,e))},t.prototype.remove=function(e){return vn(this,this._map.remove(e))},t.prototype.clear=function(){return vn(this,this._map.clear())},t.prototype.map=function(e,t){var r=this,n=!1,o=vn(this,this._map.mapEntries((function(o){var i=o[1],a=e.call(t,i,i,r);return a!==i&&(n=!0),[a,a]}),t));return n?o:this},t.prototype.union=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return 0===(t=t.filter((function(e){return 0!==e.size}))).length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations((function(r){for(var n=0;n<t.length;n++)e(t[n]).forEach((function(e){return r.add(e)}))})):this.constructor(t[0])},t.prototype.intersect=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];if(0===t.length)return this;t=t.map((function(t){return e(t)}));var n=[];return this.forEach((function(e){t.every((function(t){return t.includes(e)}))||n.push(e)})),this.withMutations((function(e){n.forEach((function(t){e.remove(t)}))}))},t.prototype.subtract=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];if(0===t.length)return this;t=t.map((function(t){return e(t)}));var n=[];return this.forEach((function(e){t.some((function(t){return t.includes(e)}))&&n.push(e)})),this.withMutations((function(e){n.forEach((function(t){e.remove(t)}))}))},t.prototype.sort=function(e){return Kn(Tt(this,e))},t.prototype.sortBy=function(e,t){return Kn(Tt(this,t,e))},t.prototype.wasAltered=function(){return this._map.wasAltered()},t.prototype.__iterate=function(e,t){var r=this;return this._map.__iterate((function(t){return e(t,t,r)}),t)},t.prototype.__iterator=function(e,t){return this._map.__iterator(e,t)},t.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e);return e?this.__make(t,e):0===this.size?this.__empty():(this.__ownerID=e,this._map=t,this)},t}(ke);hn.isSet=sn;var dn,pn=hn.prototype;function vn(e,t){return e.__ownerID?(e.size=t.size,e._map=t,e):t===e._map?e:0===t.size?e.__empty():e.__make(t)}function yn(e,t){var r=Object.create(pn);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function mn(){return dn||(dn=yn(Or()))}pn["@@__IMMUTABLE_SET__@@"]=!0,pn.delete=pn.remove,pn.merge=pn.concat=pn.union,pn.withMutations=cr,pn.asImmutable=fr,pn["@@transducer/init"]=pn.asMutable=lr,pn["@@transducer/step"]=function(e,t){return e.add(t)},pn["@@transducer/result"]=function(e){return e.asImmutable()},pn.__empty=mn,pn.__make=yn;var gn,kn=function(e){function t(e,r,n){if(!(this instanceof t))return new t(e,r,n);if(Rt(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===r&&(r=1/0),n=void 0===n?1:Math.abs(n),r<e&&(n=-n),this._start=e,this._end=r,this._step=n,this.size=Math.max(0,Math.ceil((r-e)/n-1)+1),0===this.size){if(gn)return gn;gn=this}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},t.prototype.get=function(e,t){return this.has(e)?this._start+ie(this,e)*this._step:t},t.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t<this.size&&t===Math.floor(t)},t.prototype.slice=function(e,r){return se(e,r,this.size)?this:(e=ue(e,this.size),(r=ce(r,this.size))<=e?new t(0,0):new t(this.get(e,this._end),this.get(r,this._end),this._step))},t.prototype.indexOf=function(e){var t=e-this._start;if(t%this._step==0){var r=t/this._step;if(r>=0&&r<this.size)return r}return-1},t.prototype.lastIndexOf=function(e){return this.indexOf(e)},t.prototype.__iterate=function(e,t){for(var r=this.size,n=this._step,o=t?this._start+(r-1)*n:this._start,i=0;i!==r&&!1!==e(o,t?r-++i:i++,this);)o+=t?-n:n;return i},t.prototype.__iterator=function(e,t){var r=this.size,n=this._step,o=t?this._start+(r-1)*n:this._start,i=0;return new Ee((function(){if(i===r)return{value:void 0,done:!0};var a=o;return o+=t?-n:n,Te(e,t?r-++i:i++,a)}))},t.prototype.equals=function(e){return e instanceof t?this._start===e._start&&this._end===e._end&&this._step===e._step:cn(this,e)},t}(Me);function _n(e,t,r){for(var n=Lt(t),o=0;o!==n.length;)if((e=Vt(e,n[o++],te))===te)return r;return e}function bn(e,t){return _n(this,e,t)}function wn(){Dt(this.size);var e={};return this.__iterate((function(t,r){e[r]=t})),e}ye.isIterable=he,ye.isKeyed=de,ye.isIndexed=pe,ye.isAssociative=ve,ye.isOrdered=Ae,ye.Iterator=Ee,ln(ye,{toArray:function(){Dt(this.size);var e=new Array(this.size||0),t=de(this),r=0;return this.__iterate((function(n,o){e[r++]=t?[o,n]:n})),e},toIndexedSeq:function(){return new mt(this)},toJS:function(){return fn(this)},toKeyedSeq:function(){return new yt(this,!0)},toMap:function(){return dr(this.toKeyedSeq())},toObject:wn,toOrderedMap:function(){return Qr(this.toKeyedSeq())},toOrderedSet:function(){return Kn(de(this)?this.valueSeq():this)},toSet:function(){return hn(de(this)?this.valueSeq():this)},toSetSeq:function(){return new gt(this)},toSeq:function(){return pe(this)?this.toIndexedSeq():de(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return tn(de(this)?this.valueSeq():this)},toList:function(){return Fr(de(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return jt(this,St(this,e))},includes:function(e){return this.some((function(t){return Ye(t,e)}))},entries:function(){return this.__iterator(2)},every:function(e,t){Dt(this.size);var r=!0;return this.__iterate((function(n,o,i){if(!e.call(t,n,o,i))return r=!1,!1})),r},filter:function(e,t){return jt(this,xt(this,e,t,!0))},find:function(e,t,r){var n=this.findEntry(e,t);return n?n[1]:r},forEach:function(e,t){return Dt(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Dt(this.size),e=void 0!==e?""+e:",";var t="",r=!0;return this.__iterate((function(n){r?r=!1:t+=e,t+=null!=n?n.toString():""})),t},keys:function(){return this.__iterator(0)},map:function(e,t){return jt(this,bt(this,e,t))},reduce:function(e,t,r){return En(this,e,t,r,arguments.length<2,!1)},reduceRight:function(e,t,r){return En(this,e,t,r,arguments.length<2,!0)},reverse:function(){return jt(this,wt(this,!0))},slice:function(e,t){return jt(this,At(this,e,t,!0))},some:function(e,t){return!this.every(Bn(e),t)},sort:function(e){return jt(this,Tt(this,e))},values:function(){return this.__iterator(1)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(e,t){return oe(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,r){var n=dr().asMutable();return e.__iterate((function(o,i){n.update(t.call(r,o,i,e),0,(function(e){return e+1}))})),n.asImmutable()}(this,e,t)},equals:function(e){return cn(this,e)},entrySeq:function(){var e=this;if(e._cache)return new De(e._cache);var t=e.toSeq().map(Nn).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Bn(e),t)},findEntry:function(e,t,r){var n=r;return this.__iterate((function(r,o,i){if(e.call(t,r,o,i))return n=[o,r],!1})),n},findKey:function(e,t){var r=this.findEntry(e,t);return r&&r[0]},findLast:function(e,t,r){return this.toKeyedSeq().reverse().find(e,t,r)},findLastEntry:function(e,t,r){return this.toKeyedSeq().reverse().findEntry(e,t,r)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(e){return this.find(ae,null,e)},flatMap:function(e,t){return jt(this,function(e,t,r){var n=Pt(e);return e.toSeq().map((function(o,i){return n(t.call(r,o,i,e))})).flatten(!0)}(this,e,t))},flatten:function(e){return jt(this,Et(this,e,!0))},fromEntrySeq:function(){return new kt(this)},get:function(e,t){return this.find((function(t,r){return Ye(r,e)}),void 0,t)},getIn:bn,groupBy:function(e,t){return function(e,t,r){var n=de(e),o=(Ae(e)?Qr():dr()).asMutable();e.__iterate((function(i,a){o.update(t.call(r,i,a,e),(function(e){return(e=e||[]).push(n?[a,i]:i),e}))}));var i=Pt(e);return o.map((function(t){return jt(e,i(t))})).asImmutable()}(this,e,t)},has:function(e){return this.get(e,te)!==te},hasIn:function(e){return _n(this,e,te)!==te},isSubset:function(e){return e="function"==typeof e.includes?e:ye(e),this.every((function(t){return e.includes(t)}))},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:ye(e)).isSubset(this)},keyOf:function(e){return this.findKey((function(t){return Ye(t,e)}))},keySeq:function(){return this.toSeq().map(Tn).toIndexedSeq()},last:function(e){return this.toSeq().reverse().first(e)},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Nt(this,e)},maxBy:function(e,t){return Nt(this,t,e)},min:function(e){return Nt(this,e?zn(e):Cn)},minBy:function(e,t){return Nt(this,t?zn(t):Cn,e)},rest:function(){return this.slice(1)},skip:function(e){return 0===e?this:this.slice(Math.max(0,e))},skipLast:function(e){return 0===e?this:this.slice(0,-Math.max(0,e))},skipWhile:function(e,t){return jt(this,Ot(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Bn(e),t)},sortBy:function(e,t){return jt(this,Tt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return this.slice(-Math.max(0,e))},takeWhile:function(e,t){return jt(this,function(e,t,r){var n=Kt(e);return n.__iterateUncached=function(n,o){var i=this;if(o)return this.cacheResult().__iterate(n,o);var a=0;return e.__iterate((function(e,o,s){return t.call(r,e,o,s)&&++a&&n(e,o,i)})),a},n.__iteratorUncached=function(n,o){var i=this;if(o)return this.cacheResult().__iterator(n,o);var a=e.__iterator(2,o),s=!0;return new Ee((function(){if(!s)return{value:void 0,done:!0};var e=a.next();if(e.done)return e;var o=e.value,u=o[0],c=o[1];return t.call(r,c,u,i)?2===n?e:Te(n,u,c,e):(s=!1,{value:void 0,done:!0})}))},n}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Bn(e),t)},update:function(e){return e(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(e){if(e.size===1/0)return 0;var t=Ae(e),r=de(e),n=t?1:0;return function(e,t){return t=Xe(t,3432918353),t=Xe(t<<15|t>>>-15,461845907),t=Xe(t<<13|t>>>-13,5),t=Xe((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=Ze((t=Xe(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(r?t?function(e,t){n=31*n+Pn(tt(e),tt(t))|0}:function(e,t){n=n+Pn(tt(e),tt(t))|0}:t?function(e){n=31*n+tt(e)|0}:function(e){n=n+tt(e)|0}),n)}(this))}});var xn=ye.prototype;xn["@@__IMMUTABLE_ITERABLE__@@"]=!0,xn[Se]=xn.values,xn.toJSON=xn.toArray,xn.__toStringMapper=Ut,xn.inspect=xn.toSource=function(){return this.toString()},xn.chain=xn.flatMap,xn.contains=xn.includes,ln(me,{flip:function(){return jt(this,_t(this))},mapEntries:function(e,t){var r=this,n=0;return jt(this,this.toSeq().map((function(o,i){return e.call(t,[i,o],n++,r)})).fromEntrySeq())},mapKeys:function(e,t){var r=this;return jt(this,this.toSeq().flip().map((function(n,o){return e.call(t,n,o,r)})).flip())}});var An=me.prototype;An["@@__IMMUTABLE_KEYED__@@"]=!0,An[Se]=xn.entries,An.toJSON=wn,An.__toStringMapper=function(e,t){return Ut(t)+": "+Ut(e)},ln(ge,{toKeyedSeq:function(){return new yt(this,!1)},filter:function(e,t){return jt(this,xt(this,e,t,!1))},findIndex:function(e,t){var r=this.findEntry(e,t);return r?r[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return jt(this,wt(this,!1))},slice:function(e,t){return jt(this,At(this,e,t,!1))},splice:function(e,t){var r=arguments.length;if(t=Math.max(t||0,0),0===r||2===r&&!t)return this;e=ue(e,e<0?this.count():this.size);var n=this.slice(0,e);return jt(this,1===r?n:n.concat(Mt(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var r=this.findLastEntry(e,t);return r?r[0]:-1},first:function(e){return this.get(0,e)},flatten:function(e){return jt(this,Et(this,e,!1))},get:function(e,t){return(e=ie(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find((function(t,r){return r===e}),void 0,t)},has:function(e){return(e=ie(this,e))>=0&&(void 0!==this.size?this.size===1/0||e<this.size:-1!==this.indexOf(e))},interpose:function(e){return jt(this,function(e,t){var r=Kt(e);return r.size=e.size&&2*e.size-1,r.__iterateUncached=function(r,n){var o=this,i=0;return e.__iterate((function(e){return(!i||!1!==r(t,i++,o))&&!1!==r(e,i++,o)}),n),i},r.__iteratorUncached=function(r,n){var o,i=e.__iterator(1,n),a=0;return new Ee((function(){return(!o||a%2)&&(o=i.next()).done?o:a%2?Te(r,a++,t):Te(r,a++,o.value,o)}))},r}(this,e))},interleave:function(){var e=[this].concat(Mt(arguments)),t=zt(this.toSeq(),Me.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),jt(this,r)},keySeq:function(){return kn(0,this.size)},last:function(e){return this.get(-1,e)},skipWhile:function(e,t){return jt(this,Ot(this,e,t,!1))},zip:function(){var e=[this].concat(Mt(arguments));return jt(this,zt(this,jn,e))},zipAll:function(){var e=[this].concat(Mt(arguments));return jt(this,zt(this,jn,e,!0))},zipWith:function(e){var t=Mt(arguments);return t[0]=this,jt(this,zt(this,e,t))}});var On=ge.prototype;On["@@__IMMUTABLE_INDEXED__@@"]=!0,On[xe]=!0,ln(ke,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}});var Sn=ke.prototype;function En(e,t,r,n,o,i){return Dt(e.size),e.__iterate((function(e,i,a){o?(o=!1,r=e):r=t.call(n,r,e,i,a)}),i),r}function Tn(e,t){return t}function Nn(e,t){return[t,e]}function Bn(e){return function(){return!e.apply(this,arguments)}}function zn(e){return function(){return-e.apply(this,arguments)}}function jn(){return Mt(arguments)}function Cn(e,t){return e<t?1:e>t?-1:0}function Pn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}Sn.has=xn.includes,Sn.contains=Sn.includes,Sn.keys=Sn.values,ln(Ie,An),ln(Me,On),ln(Re,Sn);var Kn=function(e){function t(e){return null==e?Rn():un(e)?e:Rn().withMutations((function(t){var r=ke(e);Dt(r.size),r.forEach((function(e){return t.add(e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(me(e).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t}(hn);Kn.isOrderedSet=un;var Fn,In=Kn.prototype;function Mn(e,t){var r=Object.create(In);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function Rn(){return Fn||(Fn=Mn(Xr()))}In[xe]=!0,In.zip=On.zip,In.zipWith=On.zipWith,In.zipAll=On.zipAll,In.__empty=Rn,In.__make=Mn;var Dn=function(e,t){var r;!function(e){if(be(e))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(we(e))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(null===e||"object"!=typeof e)throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}(e);var n=function(i){var a=this;if(i instanceof n)return i;if(!(this instanceof n))return new n(i);if(!r){r=!0;var s=Object.keys(e),u=o._indices={};o._name=t,o._keys=s,o._defaultValues=e;for(var c=0;c<s.length;c++){var l=s[c];u[l]=c,o[l]?"object"==typeof console&&console.warn&&console.warn("Cannot define "+Wn(this)+' with property "'+l+'" since that property name is part of the Record API.'):Hn(o,l)}}return this.__ownerID=void 0,this._values=Fr().withMutations((function(e){e.setSize(a._keys.length),me(i).forEach((function(t,r){e.set(a._indices[r],t===a._defaultValues[r]?void 0:t)}))})),this},o=n.prototype=Object.create(Un);return o.constructor=n,t&&(n.displayName=t),n};Dn.prototype.toString=function(){for(var e,t=Wn(this)+" { ",r=this._keys,n=0,o=r.length;n!==o;n++)t+=(n?", ":"")+(e=r[n])+": "+Ut(this.get(e));return t+" }"},Dn.prototype.equals=function(e){return this===e||e&&$n(this).equals($n(e))},Dn.prototype.hashCode=function(){return $n(this).hashCode()},Dn.prototype.has=function(e){return this._indices.hasOwnProperty(e)},Dn.prototype.get=function(e,t){if(!this.has(e))return t;var r=this._indices[e],n=this._values.get(r);return void 0===n?this._defaultValues[e]:n},Dn.prototype.set=function(e,t){if(this.has(e)){var r=this._values.set(this._indices[e],t===this._defaultValues[e]?void 0:t);if(r!==this._values&&!this.__ownerID)return Vn(this,r)}return this},Dn.prototype.remove=function(e){return this.set(e)},Dn.prototype.clear=function(){var e=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Vn(this,e)},Dn.prototype.wasAltered=function(){return this._values.wasAltered()},Dn.prototype.toSeq=function(){return $n(this)},Dn.prototype.toJS=function(){return fn(this)},Dn.prototype.entries=function(){return this.__iterator(2)},Dn.prototype.__iterator=function(e,t){return $n(this).__iterator(e,t)},Dn.prototype.__iterate=function(e,t){return $n(this).__iterate(e,t)},Dn.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._values.__ensureOwner(e);return e?Vn(this,t,e):(this.__ownerID=e,this._values=t,this)},Dn.isRecord=be,Dn.getDescriptiveName=Wn;var Ln,Jn,qn,Un=Dn.prototype;function Vn(e,t,r){var n=Object.create(Object.getPrototypeOf(e));return n._values=t,n.__ownerID=r,n}function Wn(e){return e.constructor.displayName||e.constructor.name||"Record"}function $n(e){return Ve(e._keys.map((function(t){return[t,e.get(t)]})))}function Hn(e,t){try{Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){Rt(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch(e){}}Un["@@__IMMUTABLE_RECORD__@@"]=!0,Un.delete=Un.remove,Un.deleteIn=Un.removeIn=Qt,Un.getIn=bn,Un.hasIn=xn.hasIn,Un.merge=er,Un.mergeWith=tr,Un.mergeIn=sr,Un.mergeDeep=ir,Un.mergeDeepWith=ar,Un.mergeDeepIn=ur,Un.setIn=Gt,Un.update=Xt,Un.updateIn=Zt,Un.withMutations=cr,Un.asMutable=lr,Un.asImmutable=fr,Un[Se]=Un.entries,Un.toJSON=Un.toObject=xn.toObject,Un.inspect=Un.toSource=function(){return this.toString()},function(e){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this._value=e,this.size=void 0===r?1/0:Math.max(0,r),0===this.size){if(Ln)return Ln;Ln=this}}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},t.prototype.get=function(e,t){return this.has(e)?this._value:t},t.prototype.includes=function(e){return Ye(this._value,e)},t.prototype.slice=function(e,r){var n=this.size;return se(e,r,n)?this:new t(this._value,ce(r,n)-ue(e,n))},t.prototype.reverse=function(){return this},t.prototype.indexOf=function(e){return Ye(this._value,e)?0:-1},t.prototype.lastIndexOf=function(e){return Ye(this._value,e)?this.size:-1},t.prototype.__iterate=function(e,t){for(var r=this.size,n=0;n!==r&&!1!==e(this._value,t?r-++n:n++,this););return n},t.prototype.__iterator=function(e,t){var r=this,n=this.size,o=0;return new Ee((function(){return o===n?{value:void 0,done:!0}:Te(e,t?n-++o:o++,r._value)}))},t.prototype.equals=function(e){return e instanceof t?Ye(this._value,e._value):cn(e)}}(Me),Jn=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]"),qn=new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]*[֑-߿יִ-﷽ﹰ-ﻼ]");var Gn,Qn,Yn=function(e){return e=e.toString(),qn.test(e)?"rtl":Jn.test(e)?"ltr":"neutral"},Xn={exports:{}};Gn=Xn,Qn=Xn.exports,function(e){var t=Qn,r=Gn&&Gn.exports==t&&Gn,n="object"==typeof m&&m;n.global!==n&&n.window!==n||(e=n);var o=/([\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,i=/([\uD800-\uDBFF])([\uDC00-\uDFFF])/g,a=function(e){for(var t="",r=(e=e.replace(o,(function(e,t,r){return a(r)+t})).replace(i,"$2$1")).length;r--;)t+=e.charAt(r);return t},s={version:"0.2.0",reverse:a};if(t&&!t.nodeType)if(r)r.exports=s;else for(var u in s)s.hasOwnProperty(u)&&(t[u]=s[u]);else e.esrever=s}(m);var Zn=Object.prototype.hasOwnProperty,eo=Object.prototype.toString;var to=function(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(e.toString==eo)switch(e.toString()){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(var t in e)if(Zn.call(e,t))return!1;return!0}return!1};const ro=e,{isEqual:no}=t,{pick:oo}=t,{omit:io}=t;var ao={BLOCK:"@@__SLATE_BLOCK__@@",CHANGE:"@@__SLATE_CHANGE__@@",CHARACTER:"@@__SLATE_CHARACTER__@@",DOCUMENT:"@@__SLATE_DOCUMENT__@@",HISTORY:"@@__SLATE_HISTORY__@@",INLINE:"@@__SLATE_INLINE__@@",LEAF:"@@__SLATE_LEAF__@@",MARK:"@@__SLATE_MARK__@@",OPERATION:"@@__SLATE_OPERATION__@@",RANGE:"@@__SLATE_RANGE__@@",SCHEMA:"@@__SLATE_SCHEMA__@@",STACK:"@@__SLATE_STACK__@@",TEXT:"@@__SLATE_TEXT__@@",VALUE:"@@__SLATE_VALUE__@@"};function so(e,t){return!(!t||!t[ao[e]])}var uo=void 0,co=void 0;function lo(){uo=0,co=function(){return""+uo++}}lo();var fo={create:function(e){if(null==e)return co();if("string"==typeof e)return e;throw new Error("Keys must be strings, but you passed: "+e)},setGenerator:function(e){co=e},resetGenerator:lo},ho="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},po=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},vo=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),yo=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mo=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)},go=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},ko=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},_o=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},bo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,isVoid:this.isVoid,data:this.data.toJSON(),nodes:this.nodes.toArray().map((function(t){return t.toJSON(e)}))};return e.preserveKeys&&(t.key=this.key),t}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"block"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return!this.isVoid&&!this.nodes.some((function(e){return!e.isEmpty}))}},{key:"text",get:function(){return this.getText()}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isBlock(e))return e;if("string"==typeof e&&(e={type:e}),w(e))return t.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(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Block.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isBlock(e))return e;var r=e.data,n=void 0===r?{}:r,o=e.isVoid,i=void 0!==o&&o,a=e.key,s=void 0===a?fo.create():a,u=e.nodes,c=void 0===u?[]:u,l=e.type;if("string"!=typeof l)throw new Error("`Block.fromJSON` requires a `type` string.");return new t({key:s,type:l,isVoid:!!i,data:dr(n),nodes:t.createChildren(c)})}},{key:"isBlockList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isBlock(e)}))}}]),t}(Dn({data:new dr,isVoid:!1,key:void 0,nodes:new Fr,type:void 0}));bo.fromJS=bo.fromJSON,bo.isBlock=so.bind(null,"BLOCK"),bo.prototype[ao.BLOCK]=!0;var wo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,isVoid:this.isVoid,data:this.data.toJSON(),nodes:this.nodes.toArray().map((function(t){return t.toJSON(e)}))};return e.preserveKeys&&(t.key=this.key),t}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"inline"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return!this.isVoid&&!this.nodes.some((function(e){return!e.isEmpty}))}},{key:"text",get:function(){return this.getText()}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isInline(e))return e;if("string"==typeof e&&(e={type:e}),w(e))return t.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(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Inline.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isInline(e))return e;var r=e.data,n=void 0===r?{}:r,o=e.isVoid,i=void 0!==o&&o,a=e.key,s=void 0===a?fo.create():a,u=e.nodes,c=void 0===u?[]:u,l=e.type;if("string"!=typeof l)throw new Error("`Inline.fromJS` requires a `type` string.");return new t({key:s,type:l,isVoid:!!i,data:new dr(n),nodes:t.createChildren(c)})}},{key:"isInlineList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isInline(e)}))}}]),t}(Dn({data:new dr,isVoid:!1,key:void 0,nodes:new Fr,type:void 0}));wo.fromJS=wo.fromJSON,wo.isInline=so.bind(null,"INLINE"),wo.prototype[ao.INLINE]=!0;var xo=function(){function e(){po(this,e)}return vo(e,null,[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(dr.isMap(t))return t;if(w(t))return e.fromJSON(t);throw new Error("`Data.create` only accepts objects or maps, but you passed it: "+t)}},{key:"fromJSON",value:function(e){return new dr(e)}}]),e}();xo.fromJS=xo.fromJSON;var Ao={},Oo={};function So(e,t){var r=function(t){var r=e[t];if(!r)throw new Error('Object does not have a property named "'+t+'".');e[t]=function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];0!==this.__cache_key&&(this.__cache_key=0,this.__cache=new Map,this.__cache_no_args={}),this.__cache||(this.__cache=new Map),this.__cache_no_args||(this.__cache_no_args={});var i=0!==n.length,a=void 0,s=void 0;if(i?(s=[t].concat(n),a=Eo(this.__cache,s)):a=this.__cache_no_args[t],undefined!==a)return a===Oo?void 0:a;var u=r.apply(this,n),c=void 0===u?Oo:u;return i?this.__cache=To(this.__cache,s,c):this.__cache_no_args[t]=c,u}},n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){r(a.value)}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}}function Eo(e,t){var r=!0,n=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var s=i.value;if(undefined===(e=e.get(s)))return}}catch(e){n=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw o}}return e.get(Ao)}function To(e,t,r){var n=e,o=void 0,i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;undefined===(o=n.get(l))&&(o=new Map,n.set(l,o)),n=o}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}return o.set(Ao,r),e}var No=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"getComponent",value:function(e){return e.__getComponent(this)}},{key:"toJSON",value:function(){return{object:this.object,type:this.type,data:this.data.toJSON()}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"mark"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isMark(e))return e;if("string"==typeof e&&(e={type:e}),w(e))return t.fromJSON(e);throw new Error("`Mark.create` only accepts objects, strings or marks, but you passed it: "+e)}},{key:"createSet",value:function(e){if(hn.isSet(e)||Array.isArray(e))return new hn(e.map(t.create));if(null==e)return hn();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(t.isMark(e))return{data:e.data,type:e.type};if("string"==typeof e)return{type:e};if(w(e)){var r={};return"type"in e&&(r.type=e.type),"data"in e&&(r.data=xo.create(e.data)),r}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,n=void 0===r?{}:r,o=e.type;if("string"!=typeof o)throw new Error("`Mark.fromJS` requires a `type` string.");return new t({type:o,data:new dr(n)})}},{key:"isMarkSet",value:function(e){return hn.isSet(e)&&e.every((function(e){return t.isMark(e)}))}}]),t}(Dn({data:new dr,type:void 0}));No.fromJS=No.fromJSON,No.isMark=so.bind(null,"MARK"),No.prototype[ao.MARK]=!0,So(No.prototype,["getComponent"]);var Bo={};["deleteBackward","deleteCharBackward","deleteLineBackward","deleteWordBackward","deleteForward","deleteCharForward","deleteWordForward","deleteLineForward","setBlocks","setInlines","splitInline","unwrapBlock","unwrapInline","wrapBlock","wrapInline"].forEach((function(e){Bo[e]=function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=t.value,a=i.selection,s=e+"AtRange";t[s].apply(t,[a].concat(n)),e.match(/Backward$/)?t.collapseToStart():e.match(/Forward$/)&&t.collapseToEnd()}})),Bo.setBlock=function(){ee.deprecate("slate@0.33.0","The `setBlock` method of Slate changes has been renamed to `setBlocks`."),Bo.setBlocks.apply(Bo,arguments)},Bo.setInline=function(){ee.deprecate("slate@0.33.0","The `setInline` method of Slate changes has been renamed to `setInlines`."),Bo.setInlines.apply(Bo,arguments)},Bo.addMark=function(e,t){t=No.create(t);var r=e.value,n=r.document,o=r.selection;if(o.isExpanded)e.addMarkAtRange(o,t);else if(o.marks){var i=o.marks.add(t),a=o.set("marks",i);e.select(a)}else{var s=n.getActiveMarksAtRange(o).add(t),u=o.set("marks",s);e.select(u)}},Bo.addMarks=function(e,t){t.forEach((function(t){return e.addMark(t)}))},Bo.delete=function(e){var t=e.value.selection;e.deleteAtRange(t),e.collapseToStart()},Bo.insertBlock=function(e,t){t=bo.create(t);var r=e.value.selection;e.insertBlockAtRange(r,t);var n=e.value.document.getNode(t.key);n&&e.collapseToEndOf(n)},Bo.insertFragment=function(e,t){if(t.nodes.size){var r=e.value,n=r,o=n.document,i=n.selection,a=r,s=a.startText,u=a.endText,c=a.startInline,l=t.getLastText(),f=t.getClosestInline(l.key),h=t.nodes.first(),d=t.nodes.last(),p=o.getTexts().map((function(e){return e.key})),v=!c||i.hasEdgeAtStartOf(s)||i.hasEdgeAtEndOf(u),y=h.hasBlockChildren()||d.hasBlockChildren();e.insertFragmentAtRange(i,t);var m=(o=(r=e.value).document).getTexts().filter((function(e){return!p.includes(e.key)})),g=v?m.last():m.takeLast(2).first();g&&(f||y)?e.select(i.collapseToEndOf(g)):g?e.select(i.collapseToStartOf(g).move(l.text.length)):e.select(i.collapseToStart().move(l.text.length))}},Bo.insertInline=function(e,t){t=wo.create(t);var r=e.value.selection;e.insertInlineAtRange(r,t);var n=e.value.document.getNode(t.key);n&&e.collapseToEndOf(n)},Bo.insertText=function(e,t,r){var n=e.value,o=n.document,i=n.selection;r=r||i.marks||o.getInsertMarksAtRange(i),e.insertTextAtRange(i,t,r),i.marks&&o!=e.value.document&&e.select({marks:null})},Bo.splitBlock=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=e.value,n=r.selection,o=r.document,i=n.marks||o.getInsertMarksAtRange(n);e.splitBlockAtRange(n,t).collapseToEnd(),i&&0!==i.size&&e.select({marks:i})},Bo.removeMark=function(e,t){t=No.create(t);var r=e.value,n=r.document,o=r.selection;if(o.isExpanded)e.removeMarkAtRange(o,t);else if(o.marks){var i=o.marks.remove(t),a=o.set("marks",i);e.select(a)}else{var s=n.getActiveMarksAtRange(o).remove(t),u=o.set("marks",s);e.select(u)}},Bo.replaceMark=function(e,t,r){e.removeMark(t),e.addMark(r)},Bo.toggleMark=function(e,t){t=No.create(t),e.value.activeMarks.has(t)?e.removeMark(t):e.addMark(t)},Bo.wrapText=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,n=e.value,o=n.selection;e.wrapTextAtRange(o,t,r),o.isCollapsed&&e.moveStart(0-t.length),e.moveEnd(0-r.length),o.isForward!=e.value.selection.isForward&&e.flip()};var zo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{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:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"document"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return!this.nodes.some((function(e){return!e.isEmpty}))}},{key:"text",get:function(){return this.getText()}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isDocument(e))return e;if((Fr.isList(e)||Array.isArray(e))&&(e={nodes:e}),w(e))return t.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(t.isDocument(e))return e;var r=e.data,n=void 0===r?{}:r,o=e.key,i=void 0===o?fo.create():o,a=e.nodes,s=void 0===a?[]:a;return new t({key:i,data:new dr(n),nodes:t.createChildren(s)})}}]),t}(Dn({data:new dr,key:void 0,nodes:new Fr}));function jo(e,t){if(e.size!==t.size)return null;for(var r=0;r<e.size;r++){var n=e.get(r),o=t.get(r);if(n<o)return-1;if(n>o)return 1}return 0}function Co(e){if(null==e)return null;if(Fr.isList(e))return e;if(Array.isArray(e))return Fr(e);throw new Error("Paths can only be created from arrays or lists, but you passed: "+e)}function Po(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Fo(e,t),n=e.slice(0,r),o=t.slice(0,r);return[n,o]}function Ko(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1,n=e.get(r),o=n+t,i=e.set(r,o);return i}function Fo(e,t){return Math.min(e.size,t.size)}zo.fromJS=zo.fromJSON,zo.isDocument=so.bind(null,"DOCUMENT"),zo.prototype[ao.DOCUMENT]=!0;var Io={compare:jo,create:Co,crop:Po,decrement:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1;return Ko(e,0-t,r)},increment:Ko,isAbove:function(e,t){var r=Po(e,t),n=ko(r,2),o=n[0],i=n[1];return e.size<t.size&&0===jo(o,i)},isAfter:function(e,t){var r=Po(e,t),n=ko(r,2);return 1===jo(n[0],n[1])},isBefore:function(e,t){var r=Po(e,t),n=ko(r,2);return-1===jo(n[0],n[1])},lift:function(e){return e.slice(0,-1)},max:function(e,t){return Math.max(e.size,t.size)},min:Fo,relate:function(e,t){for(var r=[],n=0;n<e.size&&n<t.size;n++){var o=e.get(n);if(o!==t.get(n))break;r.push(o)}return Co(r)}},Mo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"hasAnchorAtStartOf",value:function(e){if(0!=this.anchorOffset)return!1;var t=Ro(e);return this.anchorKey==t.key}},{key:"hasAnchorAtEndOf",value:function(e){var t=Do(e);return this.anchorKey==t.key&&this.anchorOffset==t.text.length}},{key:"hasAnchorBetween",value:function(e,t,r){return this.anchorOffset<=r&&t<=this.anchorOffset&&this.hasAnchorIn(e)}},{key:"hasAnchorIn",value:function(e){return"text"==e.object?e.key==this.anchorKey:null!=this.anchorKey&&e.hasDescendant(this.anchorKey)}},{key:"hasFocusAtEndOf",value:function(e){var t=Do(e);return this.focusKey==t.key&&this.focusOffset==t.text.length}},{key:"hasFocusAtStartOf",value:function(e){if(0!=this.focusOffset)return!1;var t=Ro(e);return this.focusKey==t.key}},{key:"hasFocusBetween",value:function(e,t,r){return t<=this.focusOffset&&this.focusOffset<=r&&this.hasFocusIn(e)}},{key:"hasFocusIn",value:function(e){return"text"==e.object?e.key==this.focusKey:null!=this.focusKey&&e.hasDescendant(this.focusKey)}},{key:"isAtStartOf",value:function(e){return this.isCollapsed&&this.hasAnchorAtStartOf(e)}},{key:"isAtEndOf",value:function(e){return this.isCollapsed&&this.hasAnchorAtEndOf(e)}},{key:"focus",value:function(){return this.merge({isFocused:!0})}},{key:"blur",value:function(){return this.merge({isFocused:!1})}},{key:"deselect",value:function(){return this.merge({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isFocused:!1,isBackward:!1})}},{key:"flip",value:function(){return this.merge({anchorKey:this.focusKey,anchorOffset:this.focusOffset,anchorPath:this.focusPath,focusKey:this.anchorKey,focusOffset:this.anchorOffset,focusPath:this.anchorPath,isBackward:null==this.isBackward?null:!this.isBackward})}},{key:"moveAnchor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=this.anchorKey,r=this.focusKey,n=this.focusOffset,o=this.isBackward,i=this.anchorOffset+e;return this.merge({anchorOffset:i,isBackward:t==r?i>n:o})}},{key:"moveFocus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=this.anchorKey,r=this.anchorOffset,n=this.focusKey,o=this.isBackward,i=this.focusOffset+e;return this.merge({focusOffset:i,isBackward:n==t?r>i:o})}},{key:"moveAnchorTo",value:function(e,t){var r=this.anchorKey,n=this.focusKey,o=this.focusOffset,i=this.anchorPath,a=this.focusPath,s=this.isBackward;if("string"==typeof e){var u=e===r,c=e===n;return this.merge({anchorKey:e,anchorPath:c?a:u?i:null,anchorOffset:t,isBackward:c?t>o:u?s:null})}var l=e,f=l&&l.equals(i),h=l&&l.equals(a);return this.merge({anchorPath:l,anchorKey:f?r:h?n:null,anchorOffset:t,isBackward:h?t>o:f?s:null})}},{key:"moveFocusTo",value:function(e,t){var r=this.focusKey,n=this.anchorKey,o=this.anchorOffset,i=this.anchorPath,a=this.focusPath,s=this.isBackward;if("string"==typeof e){var u=e===n,c=e===r;return this.merge({focusKey:e,focusPath:u?i:c?a:null,focusOffset:t,isBackward:u?t<o:c?s:null})}var l=e,f=l&&l.equals(i),h=l&&l.equals(a);return this.merge({focusPath:l,focusKey:h?r:f?n:null,focusOffset:t,isBackward:f?t<o:h?s:null})}},{key:"moveAnchorOffsetTo",value:function(e){return this.merge({anchorOffset:e,isBackward:this.anchorKey==this.focusKey?e>this.focusOffset:this.isBackward})}},{key:"moveFocusOffsetTo",value:function(e){return this.merge({focusOffset:e,isBackward:this.anchorKey==this.focusKey?this.anchorOffset>e:this.isBackward})}},{key:"moveOffsetsTo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.moveAnchorOffsetTo(e).moveFocusOffsetTo(t)}},{key:"moveToAnchor",value:function(){return this.moveFocusTo(this.anchorKey,this.anchorOffset)}},{key:"moveToFocus",value:function(){return this.moveAnchorTo(this.focusKey,this.focusOffset)}},{key:"moveAnchorToStartOf",value:function(e){return e=Ro(e),this.moveAnchorTo(e.key,0)}},{key:"moveAnchorToEndOf",value:function(e){return e=Do(e),this.moveAnchorTo(e.key,e.text.length)}},{key:"moveFocusToStartOf",value:function(e){return e=Ro(e),this.moveFocusTo(e.key,0)}},{key:"moveFocusToEndOf",value:function(e){return e=Do(e),this.moveFocusTo(e.key,e.text.length)}},{key:"moveToRangeOf",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.isBackward?this.flip():this;return r.moveAnchorToStartOf(e).moveFocusToEndOf(t)}},{key:"normalize",value:function(e){var t=this,r=t.anchorKey,n=t.anchorOffset,o=t.anchorPath,i=t.focusKey,a=t.focusOffset,s=t.focusPath,u=t.isBackward,c=void 0===n?"undefined":ho(n),l=void 0===a?"undefined":ho(a);if("number"==c&&"number"==l||ee.warn('The range offsets should be numbers, but they were of type "'+c+'" and "'+l+'".'),null==r&&null==o||null==i&&null==s)return t.merge({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isBackward:!1});var f=e.getNode(r||o),h=e.getNode(i||s);if(!f||!h){ee.warn("The range was invalid and was reset. The range in question was:",t);var d=e.getFirstText(),p=d&&e.getPath(d.key);return t.merge({anchorKey:d?d.key:null,anchorOffset:0,anchorPath:d?p:null,focusKey:d?d.key:null,focusOffset:0,focusPath:d?p:null,isBackward:!1})}if("text"!=f.object){ee.warn("The range anchor was set to a Node that is not a Text node. This should not happen and can degrade performance. The node in question was:",f);var v=f.getTextAtOffset(n);n-=f.getOffset(v.key),f=v}if("text"!=h.object){ee.warn("The range focus was set to a Node that is not a Text node. This should not happen and can degrade performance. The node in question was:",h);var y=h.getTextAtOffset(a);a-=h.getOffset(y.key),h=y}if(r=f.key,i=h.key,o=e.getPath(r),s=e.getPath(i),null==u){var m=Io.compare(o,s);u=0===m?n>a:1===m}return t.merge({anchorKey:r,anchorOffset:n,anchorPath:o,focusKey:i,focusOffset:a,focusPath:s,isBackward:u})}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,anchorKey:this.anchorKey,anchorOffset:this.anchorOffset,anchorPath:this.anchorPath&&this.anchorPath.toArray(),focusKey:this.focusKey,focusOffset:this.focusOffset,focusPath:this.focusPath&&this.focusPath.toArray(),isAtomic:this.isAtomic,isBackward:this.isBackward,isFocused:this.isFocused,marks:null==this.marks?null:this.marks.toArray().map((function(e){return e.toJSON()}))};return e.preserveKeys||(delete t.anchorKey,delete t.focusKey),t}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"range"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isBlurred",get:function(){return!this.isFocused}},{key:"isCollapsed",get:function(){return this.anchorKey==this.focusKey&&this.anchorOffset==this.focusOffset}},{key:"isExpanded",get:function(){return!this.isCollapsed}},{key:"isForward",get:function(){return null==this.isBackward?null:!this.isBackward}},{key:"isSet",get:function(){return null!=this.anchorKey&&null!=this.focusKey||null!=this.anchorPath&&null!=this.focusPath}},{key:"isUnset",get:function(){return!this.isSet}},{key:"startKey",get:function(){return this.isBackward?this.focusKey:this.anchorKey}},{key:"startOffset",get:function(){return this.isBackward?this.focusOffset:this.anchorOffset}},{key:"startPath",get:function(){return this.isBackward?this.focusPath:this.anchorPath}},{key:"endKey",get:function(){return this.isBackward?this.anchorKey:this.focusKey}},{key:"endOffset",get:function(){return this.isBackward?this.anchorOffset:this.focusOffset}},{key:"endPath",get:function(){return this.isBackward?this.anchorPath:this.focusPath}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isRange(e))return e;if(w(e))return t.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(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}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(t.isRange(e))return{anchorKey:e.anchorKey,anchorOffset:e.anchorOffset,anchorPath:e.anchorPath,focusKey:e.focusKey,focusOffset:e.focusOffset,focusPath:e.focusPath,isAtomic:e.isAtomic,isBackward:e.isBackward,isFocused:e.isFocused,marks:e.marks};if(w(e)){var r={};return"anchorKey"in e&&(r.anchorKey=e.anchorKey),"anchorOffset"in e&&(r.anchorOffset=e.anchorOffset),"anchorPath"in e&&(r.anchorPath=Io.create(e.anchorPath)),"focusKey"in e&&(r.focusKey=e.focusKey),"focusOffset"in e&&(r.focusOffset=e.focusOffset),"focusPath"in e&&(r.focusPath=Io.create(e.focusPath)),"isAtomic"in e&&(r.isAtomic=e.isAtomic),"isBackward"in e&&(r.isBackward=e.isBackward),"isFocused"in e&&(r.isFocused=e.isFocused),"marks"in e&&(r.marks=null==e.marks?null:No.createSet(e.marks)),"anchorPath"in e&&!("anchorKey"in e)&&(r.anchorKey=null),"anchorKey"in e&&!("anchorPath"in e)&&(r.anchorPath=null),"focusPath"in e&&!("focusKey"in e)&&(r.focusKey=null),"focusKey"in e&&!("focusPath"in e)&&(r.focusPath=null),r}throw new Error("`Range.createProperties` only accepts objects or ranges, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.anchorKey,n=void 0===r?null:r,o=e.anchorOffset,i=void 0===o?0:o,a=e.anchorPath,s=void 0===a?null:a,u=e.focusKey,c=void 0===u?null:u,l=e.focusOffset,f=void 0===l?0:l,h=e.focusPath,d=void 0===h?null:h,p=e.isAtomic,v=void 0!==p&&p,y=e.isBackward,m=void 0===y?null:y,g=e.isFocused,k=void 0!==g&&g,_=e.marks,b=void 0===_?null:_;return new t({anchorKey:n,anchorOffset:i,anchorPath:Io.create(s),focusKey:c,focusOffset:f,focusPath:Io.create(d),isAtomic:v,isBackward:m,isFocused:k,marks:null==b?null:new hn(b.map(No.fromJSON))})}},{key:"isRange",value:function(e){return!(!e||!e[ao.RANGE])}}]),t}(Dn({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isAtomic:!1,isBackward:null,isFocused:!1,marks:null}));Mo.fromJS=Mo.fromJSON,Mo.prototype[ao.RANGE]=!0;[["move",""],["move","To"],["move","ToStartOf"],["move","ToEndOf"]].forEach((function(e){var t=ko(e,2),r=t[0],n=t[1];Mo.prototype[""+r+n]=function(){var e;return(e=this[r+"Anchor"+n].apply(this,arguments))[r+"Focus"+n].apply(e,arguments)}}));[["has","AtStartOf",!0],["has","AtEndOf",!0],["has","Between",!0],["has","In",!0],["collapseTo",""],["move",""],["moveTo",""],["move","To"],["move","OffsetTo"]].forEach((function(e){var t=ko(e,3),r=t[0],n=t[1],o=t[2],i=r+"Anchor"+n,a=r+"Focus"+n;Mo.prototype[r+"Start"+n]=function(){return this.isBackward?this[a].apply(this,arguments):this[i].apply(this,arguments)},Mo.prototype[r+"End"+n]=function(){return this.isBackward?this[i].apply(this,arguments):this[a].apply(this,arguments)},o&&(Mo.prototype[r+"Edge"+n]=function(){return this[i].apply(this,arguments)||this[a].apply(this,arguments)})}));function Ro(e){return"text"==e.object?e:e.getFirstText()}function Do(e){return"text"==e.object?e:e.getLastText()}[["collapseTo","moveTo"],["collapseToAnchor","moveToAnchor"],["collapseToFocus","moveToFocus"],["collapseToStart","moveToStart"],["collapseToEnd","moveToEnd"],["collapseToStartOf","moveToStartOf"],["collapseToEndOf","moveToEndOf"],["extend","moveFocus"],["extendTo","moveFocusTo"],["extendToStartOf","moveFocusToStartOf"],["extendToEndOf","moveFocusToEndOf"]].forEach((function(e){var t=ko(e,2),r=t[0],n=t[1];Mo.prototype[r]=function(){return this[n].apply(this,arguments)}}));var Lo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"toJSON",value:function(){return{object:this.object,text:this.text,marks:this.marks.toArray().map((function(e){return e.toJSON()}))}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"character"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isCharacter(e))return e;if("string"==typeof e&&(e={text:e}),w(e))return t.fromJSON(e);throw new Error("`Character.create` only accepts objects, strings or characters, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if("string"==typeof e&&(e=e.split("")),Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Block.createList` only accepts strings, arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.text,n=e.marks,o=void 0===n?[]:n;if("string"!=typeof r)throw new Error("`Character.fromJSON` requires a block `text` string.");return new t({text:r,marks:new hn(o)})}},{key:"isCharacterList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isCharacter(e)}))}}]),t}(Dn({marks:new hn,text:""}));Lo.fromJS=Lo.fromJSON,Lo.isCharacter=so.bind(null,"CHARACTER"),Lo.prototype[ao.CHARACTER]=!0;var Jo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"getCharacters",value:function(){ee.deprecate("slate@0.34.0","The `characters` property of Slate objects is deprecated");var e=this.marks;return Lo.createList(this.text.split("").map((function(t){return Lo.create({text:t,marks:e})})))}},{key:"updateMark",value:function(e,t){var r=this.marks;if(t.equals(e))return this;if(!r.has(e))return this;var n=r.withMutations((function(r){r.remove(e).add(t)}));return this.set("marks",n)}},{key:"addMarks",value:function(e){var t=this.marks;return this.set("marks",t.union(e))}},{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:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"leaf"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isLeaf(e))return e;if("string"==typeof e&&(e={text:e}),w(e))return t.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 t=!1,r=Fr().withMutations((function(r){e.findLast((function(e,n){var o=r.first();if(o){if(o.marks.equals(e.marks))return t=!0,void r.set(0,o.set("text",""+e.text+o.text));if(""===o.text)return t=!0,void r.set(0,e);if(""===e.text)return void(t=!0)}r.unshift(e)}))}));return t?r:e}},{key:"splitLeaves",value:function(e,t){if(t<0)return[Fr(),e];if(0===e.size)return[Fr(),Fr()];var r=0,n=-1,o=void 0,i=void 0;return e.find((function(e){n++;var a=r,s=e.text;if((r+=s.length)<t)return!1;if(a>t)return!1;var u=t-a;return o=e.set("text",s.slice(0,u)),i=e.set("text",s.slice(u)),!0})),o?""===o.text?0===n?[Fr.of(o),e]:[e.take(n),e.skip(n)]:""===i.text?n===e.size-1?[e,Fr.of(i)]:[e.take(n+1),e.skip(n+1)]:[e.take(n).push(o),e.skip(n+1).unshift(i)]:[e,Fr()]}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Leaf.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.text,n=void 0===r?"":r,o=e.marks;return new t({text:n,marks:hn((void 0===o?[]:o).map(No.fromJSON))})}},{key:"isLeafList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isLeaf(e)}))}}]),t}(Dn({marks:hn(),text:""}));Jo.fromJS=Jo.fromJSON,Jo.isLeaf=so.bind(null,"LEAF"),Jo.prototype[ao.LEAF]=!0;var qo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"getString",value:function(){return this.leaves.reduce((function(e,t){return e+t.text}),"")}},{key:"searchLeafAtOffset",value:function(e){var t=0,r=0,n=-1;return{leaf:this.leaves.find((function(o){return n++,(t=(r=t)+o.text.length)>=e})),endOffset:t,index:n,startOffset:r}}},{key:"addMark",value:function(e,t,r){var n=hn.of(r);return this.addMarks(e,t,n)}},{key:"addMarks",value:function(e,t,r){if(""===this.text&&0===t&&0===e){var n=this.leaves.first();if(!n)return this.set("leaves",Fr.of(Jo.fromJSON({text:"",marks:r})));var o=n.addMarks(r);return o===n?this:this.set("leaves",Fr.of(o))}if(""===this.text)return this;if(0===t)return this;if(e>=this.text.length)return this;var i=Jo.splitLeaves(this.leaves,e),a=ko(i,2),s=a[0],u=a[1],c=Jo.splitLeaves(u,t),l=ko(c,2),f=l[0],h=l[1],d=s.concat(f.map((function(e){return e.addMarks(r)})),h);return this.setLeaves(d)}},{key:"getDecorations",value:function(e){return e.__getDecorations(this)}},{key:"getLeaves",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.leaves;if(0===r.size)return Fr.of(Jo.create({}));if(!t||0===t.length)return r;if(0===this.text.length)return r;var n=this.key;return t.forEach((function(t){var o=t.startKey,i=t.endKey,a=t.startOffset,s=t.endOffset,u=t.marks,c=o==n,l=i==n;if(c&&l){var f=c?a:0,h=l?s-f:e.text.length-f;if(h<1)return;if(f>=e.text.length)return;if(0!==f||h<e.text.length){var d=Jo.splitLeaves(r,f),p=ko(d,2),v=p[0],y=p[1],m=Jo.splitLeaves(y,h),g=ko(m,2),k=g[0],_=g[1];return void(r=v.concat(k.map((function(e){return e.addMarks(u)})),_))}}r=r.map((function(e){return e.addMarks(u)}))})),r===this.leaves?r:Jo.createLeaves(r)}},{key:"getActiveMarksBetweenOffsets",value:function(e,t){if(e<=0&&t>=this.text.length)return this.getActiveMarks();if(e>=t)return hn();if(""===this.text)return this.getActiveMarks();var r=null,n=0;return this.leaves.forEach((function(o){var i=n;if(!((n=i+o.text.length)<=e)){if(i>=t)return!1;if(r)return(r=r.intersect(o.marks))&&r.size,!1;r=o.marks}})),r||hn()}},{key:"getActiveMarks",value:function(){var e=this;if(0===this.leaves.size)return hn();var t=this.leaves.first().marks;return 0===t.size?t:t.withMutations((function(t){e.leaves.forEach((function(e){if(t.intersect(e.marks),0===t.size)return!1}))}))}},{key:"getFirstText",value:function(){return this}},{key:"getLastText",value:function(){return this}},{key:"getMarksBetweenOffsets",value:function(e,t){if(e<=0&&t>=this.text.length)return this.getMarks();if(e>=t)return hn();if(""===this.text)return this.getActiveMarks();var r=null,n=0;return this.leaves.forEach((function(o){var i=n;if(!((n=i+o.text.length)<=e))return!(i>=t)&&void(r=r?r.union(o.marks):o.marks)})),r||hn()}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return new Kn(e)}},{key:"getMarksAsArray",value:function(){if(0===this.leaves.size)return[];var e=this.leaves.first().marks;if(1===this.leaves.size)return e.toArray();var t=[];return this.leaves.forEach((function(e){t.push(e.marks.toArray())})),Array.prototype.concat.apply(e.toArray(),t)}},{key:"getMarksAtIndex",value:function(e){var t=this.searchLeafAtOffset(e).leaf;return t?t.marks:hn()}},{key:"getNode",value:function(e){return this.key==e?this:null}},{key:"hasNode",value:function(e){return!!this.getNode(e)}},{key:"insertText",value:function(e,t,r){if(""===this.text)return this.set("leaves",Fr.of(Jo.create({text:t,marks:r})));if(0===t.length)return this;r||(r=hn());var n=this.searchLeafAtOffset(e),o=n.startOffset,i=n.leaf,a=n.index,s=e-o,u=i.text.slice(0,s),c=i.text.slice(s),l=this.leaves;if(i.marks.equals(r))return this.set("leaves",l.set(a,i.set("text",u+t+c)));var f=l.splice(a,1,i.set("text",u),Jo.create({text:t,marks:r}),i.set("text",c));return this.setLeaves(f)}},{key:"regenerateKey",value:function(){var e=fo.create();return this.set("key",e)}},{key:"removeMark",value:function(e,t,r){if(""===this.text&&0===e&&0===t){var n=this.leaves.first();if(!n)return this;var o=n.removeMark(r);return o===n?this:this.set("leaves",Fr.of(o))}if(t<=0)return this;if(e>=this.text.length)return this;var i=Jo.splitLeaves(this.leaves,e),a=ko(i,2),s=a[0],u=a[1],c=Jo.splitLeaves(u,t),l=ko(c,2),f=l[0],h=l[1],d=s.concat(f.map((function(e){return e.removeMark(r)})),h);return this.setLeaves(d)}},{key:"removeText",value:function(e,t){if(t<=0)return this;if(e>=this.text.length)return this;if(1===t){var r=this.searchLeafAtOffset(e+1),n=r.leaf,o=r.index,i=e-r.startOffset;if(n){if(1===n.text.length){var a=this.leaves.remove(o);return this.setLeaves(a)}var s=n.text.slice(0,i)+n.text.slice(i+t);if(s.length>0)return this.set("leaves",this.leaves.set(o,n.set("text",s)))}}var u=Jo.splitLeaves(this.leaves,e),c=ko(u,2),l=c[0],f=c[1],h=Jo.splitLeaves(f,t)[1],d=Jo.createLeaves(l.concat(h));if(1===d.size){var p=d.first();if(""===p.text)return this.set("leaves",Fr.of(p.set("marks",this.getActiveMarks())))}return this.set("leaves",d)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,leaves:this.getLeaves().toArray().map((function(e){return e.toJSON()}))};return e.preserveKeys&&(t.key=this.key),t}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"updateMark",value:function(e,t,r,n){var o=r.merge(n);if(""===this.text&&0===t&&0===e){var i=this.leaves.first();if(!i)return this;var a=i.updateMark(r,o);return a===i?this:this.set("leaves",Fr.of(a))}if(t<=0)return this;if(e>=this.text.length)return this;var s=Jo.splitLeaves(this.leaves,e),u=ko(s,2),c=u[0],l=u[1],f=Jo.splitLeaves(l,t),h=ko(f,2),d=h[0],p=h[1],v=c.concat(d.map((function(e){return e.updateMark(r,o)})),p);return this.setLeaves(v)}},{key:"splitText",value:function(e){var t=Jo.splitLeaves(this.leaves,e);return[this.set("leaves",t[0]),this.set("leaves",t[1]).regenerateKey()]}},{key:"mergeText",value:function(e){var t=this.leaves.concat(e.leaves);return this.setLeaves(t)}},{key:"normalize",value:function(e){return e.normalizeNode(this)}},{key:"validate",value:function(e){return e.validateNode(this)}},{key:"getFirstInvalidDescendant",value:function(e){return this.validate(e)?this:null}},{key:"setLeaves",value:function(e){var t=Jo.createLeaves(e);if(1===t.size){var r=t.first();if((!r.marks||0===r.marks.size)&&""===r.text)return this.set("leaves",Fr())}return this.set("leaves",Jo.createLeaves(e))}},{key:"object",get:function(){return"text"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return""==this.text}},{key:"text",get:function(){return this.getString()}},{key:"characters",get:function(){return this.leaves.flatMap((function(e){return e.getCharacters()}))}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(t.isText(e))return e;if("string"==typeof e&&(e={leaves:[{text:e}]}),w(e)){if(e.text){var r=e,n=r.text,o=r.marks,i=r.key;e={key:i,leaves:[{text:n,marks:o}]}}return t.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(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Text.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isText(e))return e;var r=e.key,n=void 0===r?fo.create():r,o=e.leaves;if(o||(e.ranges?(ee.deprecate("slate@0.27.0","The `ranges` property of Slate objects has been renamed to `leaves`."),o=e.ranges):o=Fr()),Array.isArray(o))o=Fr(o.map((function(e){return Jo.create(e)})));else{if(!Fr.isList(o))throw new Error("leaves must be either Array or Immutable.List");o=o.map((function(e){return Jo.create(e)}))}return new t({leaves:Jo.createLeaves(o),key:n})}},{key:"isTextList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isText(e)}))}}]),t}(Dn({leaves:Fr(),key:void 0}));qo.fromJS=qo.fromJSON,qo.isText=so.bind(null,"TEXT"),qo.prototype[ao.TEXT]=!0,So(qo.prototype,["getDecorations","getActiveMarks","getMarks","getMarksAsArray","normalize","validate","getString"]);var Uo=function(){function e(){po(this,e)}return vo(e,[{key:"addMark",value:function(e,t,r,n){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.addMark(t,r,n),this.replaceNode(e,o)}},{key:"filterDescendants",value:function(e){var t=[];return this.forEachDescendant((function(r,n,o){e(r,n,o)&&t.push(r)})),Fr(t)}},{key:"findDescendant",value:function(e){var t=null;return this.forEachDescendant((function(r,n,o){if(e(r,n,o))return t=r,!1})),t}},{key:"forEachDescendant",value:function(e){var t=void 0;return this.nodes.forEach((function(r,n,o){return!1===e(r,n,o)?(t=!1,!1):"text"!=r.object?t=r.forEachDescendant(e):void 0})),t}},{key:"getActiveMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return hn();if(e.isCollapsed){var t=e,r=t.startKey,n=t.startOffset;return this.getMarksAtPosition(r,n).toSet()}var o=e,i=o.startKey,a=o.endKey,s=o.startOffset,u=o.endOffset,c=this.getDescendant(i);if(i!==a){for(;i!==a&&0===u;){var l=this.getPreviousText(a);a=l.key,u=l.text.length}for(;i!==a&&s===c.text.length;)i=(c=this.getNextText(i)).key,s=0}if(i===a)return c.getActiveMarksBetweenOffsets(s,u);var f=c.getActiveMarksBetweenOffsets(s,c.text.length);if(0===f.size)return hn();var h=this.getDescendant(a).getActiveMarksBetweenOffsets(0,u),d=f.intersect(h);if(0===d.size)return d;for(var p=this.getNextText(i);p.key!==a;){if(0!==p.text.length&&0===(d=d.intersect(p.getActiveMarks())).size)return hn();p=this.getNextText(p.key)}return d}},{key:"getAncestors",value:function(e){var t=this;if(!(e=this.resolvePath(e)))return null;var r=[];return e.forEach((function(n,o){var i=e.slice(0,o),a=t.getNode(i);r.push(a)})),Fr(r)}},{key:"getBlocks",value:function(){var e=this.getBlocksAsArray();return new Fr(e)}},{key:"getBlocksAsArray",value:function(){return this.nodes.reduce((function(e,t){return"block"!=t.object?e:t.isLeafBlock()?(e.push(t),e):e.concat(t.getBlocksAsArray())}),[])}},{key:"getBlocksAtRange",value:function(e){var t=this.getBlocksAtRangeAsArray(e);return new Fr(new Kn(t))}},{key:"getBlocksAtRangeAsArray",value:function(e){if((e=e.normalize(this)).isUnset)return[];var t=e,r=t.startKey,n=t.endKey,o=this.getClosestBlock(r);if(r===n)return[o];var i=this.getClosestBlock(n),a=this.getBlocksAsArray(),s=a.indexOf(o),u=a.indexOf(i);return a.slice(s,u+1)}},{key:"getBlocksByType",value:function(e){var t=this.getBlocksByTypeAsArray(e);return new Fr(t)}},{key:"getBlocksByTypeAsArray",value:function(e){return this.nodes.reduce((function(t,r){return"block"!=r.object?t:r.isLeafBlock()&&r.type==e?(t.push(r),t):t.concat(r.getBlocksByTypeAsArray(e))}),[])}},{key:"getCharacters",value:function(){return this.getTexts().flatMap((function(e){return e.characters}))}},{key:"getCharactersAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return Fr();var t=e,r=t.startKey,n=t.endKey,o=t.startOffset,i=t.endOffset;return r===n?this.getDescendant(n).characters.slice(o,i):this.getTextsAtRange(e).flatMap((function(e){return e.key===r?e.characters.slice(o):e.key===n?e.characters.slice(0,i):e.characters}))}},{key:"getChild",value:function(e){return(e=this.resolvePath(e))&&1===e.size?this.nodes.get(e.first()):null}},{key:"getClosest",value:function(e,t){var r=this,n=this.getAncestors(e);if(!n)return null;var o=n.findLast((function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e!==r&&t.apply(void 0,[e].concat(o))}));return o||null}},{key:"getClosestBlock",value:function(e){var t=this.getClosest(e,(function(e){return"block"===e.object}));return t}},{key:"getClosestInline",value:function(e){var t=this.getClosest(e,(function(e){return"inline"===e.object}));return t}},{key:"getClosestVoid",value:function(e){return this.getClosest(e,(function(e){return e.isVoid}))}},{key:"getCommonAncestor",value:function(e,t){if(e=this.resolvePath(e),t=this.resolvePath(t),!e||!t)return null;var r=Io.relate(e,t);return this.getNode(r)}},{key:"getDecorations",value:function(e){var t=e.find("decorateNode",this);return Mo.createList(t||[])}},{key:"getDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!(e=this.resolvePath(e)))return null;var r=this.getNode(e),n=r?e.size-1+t:null;return n}},{key:"getDescendant",value:function(e){if(!(e=this.resolvePath(e)))return null;var t=e.toArray(),r=this,n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(!r)return null;if(!r.nodes)return null;r=r.nodes.get(u)}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}},{key:"getFirstInvalidDescendant",value:function(e){var t=null;return this.nodes.find((function(r){return t=r.validate(e)?r:r.getFirstInvalidDescendant(e)})),t}},{key:"getFirstText",value:function(){var e=null,t=this.nodes.find((function(t){return"text"===t.object||!!(e=t.getFirstText())}));return e||t}},{key:"getFragmentAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return zo.create();for(var t=e,r=t.startPath,n=t.startOffset,o=t.endPath,i=this,a=o,s=t.endOffset,u="end";a.size;){var c=a.last();i=i.splitNode(a,s),s=c+1,(a=Io.lift(a)).size||"end"!==u||(a=r,s=n,u="start")}var l=r.first()+1,f=o.first()+2,h=i.nodes.slice(l,f);return zo.create({nodes:h})}},{key:"getFurthest",value:function(e,t){var r=this,n=this.getAncestors(e);if(!n)return null;var o=n.find((function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e!==r&&t.apply(void 0,[e].concat(o))}));return o||null}},{key:"getFurthestAncestor",value:function(e){return(e=this.resolvePath(e))&&e.size?this.nodes.get(e.first()):null}},{key:"getFurthestBlock",value:function(e){var t=this.getFurthest(e,(function(e){return"block"===e.object}));return t}},{key:"getFurthestInline",value:function(e){var t=this.getFurthest(e,(function(e){return"inline"===e.object}));return t}},{key:"getFurthestOnlyChildAncestor",value:function(e){var t=this.getAncestors(e);return t&&t.rest().reverse().takeUntil((function(e){return e.nodes.size>1})).last()||null}},{key:"getInlines",value:function(){var e=this.getInlinesAsArray();return new Fr(e)}},{key:"getInlinesAsArray",value:function(){var e=[];return this.nodes.forEach((function(t){"text"!=t.object&&(t.isLeafInline()?e.push(t):e=e.concat(t.getInlinesAsArray()))})),e}},{key:"getInlinesAtRange",value:function(e){var t=this.getInlinesAtRangeAsArray(e);return new Fr(new Kn(t))}},{key:"getInlinesAtRangeAsArray",value:function(e){var t=this;return(e=e.normalize(this)).isUnset?[]:this.getTextsAtRangeAsArray(e).map((function(e){return t.getClosestInline(e.key)})).filter((function(e){return e}))}},{key:"getInlinesByType",value:function(e){var t=this.getInlinesByTypeAsArray(e);return new Fr(t)}},{key:"getInlinesByTypeAsArray",value:function(e){return this.nodes.reduce((function(t,r){return"text"==r.object?t:r.isLeafInline()&&r.type==e?(t.push(r),t):t.concat(r.getInlinesByTypeAsArray(e))}),[])}},{key:"getInsertMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return hn();if(e.isCollapsed)return this.getMarksAtPosition(e.startKey,e.startOffset);var t=e,r=t.startKey,n=t.startOffset;return this.getDescendant(r).getMarksAtIndex(n+1)}},{key:"getKeysToPathsTable",value:function(){var e=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},this.key,[]);return this.nodes.forEach((function(t,r){if(e[t.key]=[r],"text"!==t.object){var n=t.getKeysToPathsTable();for(var o in n){var i=n[o];e[o]=[r].concat(_o(i))}}})),e}},{key:"getLastText",value:function(){var e=null,t=this.nodes.findLast((function(t){return"text"==t.object||(e=t.getLastText())}));return e||t}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return new hn(e)}},{key:"getMarksAsArray",value:function(){var e,t=[];return this.nodes.forEach((function(e){t.push(e.getMarksAsArray())})),(e=[]).concat.apply(e,t)}},{key:"getMarksAtPosition",value:function(e,t){var r=this.getDescendant(e).getMarksAtIndex(t);if(0!==t)return r;var n=this.getClosestBlock(e);if(""===n.text)return r;var o=this.getPreviousText(e);return o?n.hasDescendant(o.key)?o.getMarksAtIndex(o.text.length):r:hn()}},{key:"getMarksAtRange",value:function(e){return new hn(this.getOrderedMarksAtRange(e))}},{key:"getMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return new hn(t)}},{key:"getMarksByTypeAsArray",value:function(e){return this.nodes.reduce((function(t,r){return"text"==r.object?t.concat(r.getMarksAsArray().filter((function(t){return t.type==e}))):t.concat(r.getMarksByTypeAsArray(e))}),[])}},{key:"getNextBlock",value:function(e){var t=this.assertDescendant(e),r=void 0;"block"==t.object?r=t.getLastText():r=this.getClosestBlock(e).getLastText();var n=this.getNextText(r.key);return n?this.getClosestBlock(n.key):null}},{key:"getNextNode",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;for(var t=e.size;t>0;t--){var r=e.slice(0,t),n=Io.increment(r),o=this.getNode(n);if(o)return o}return null}},{key:"getNextSibling",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=Io.increment(e);return this.getNode(t)}},{key:"getNextText",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=this.getNextNode(e);return t?t.getFirstText():null}},{key:"getNode",value:function(e){return(e=this.resolvePath(e))?e.size?this.getDescendant(e):this:null}},{key:"getOffset",value:function(e){this.assertDescendant(e);var t=this.getFurthestAncestor(e),r=this.nodes.takeUntil((function(e){return e==t})).reduce((function(e,t){return e+t.text.length}),0);return this.hasChild(e)?r:r+t.getOffset(e)}},{key:"getOffsetAtRange",value:function(e){if((e=e.normalize(this)).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,r=t.startKey,n=t.startOffset;return this.getOffset(r)+n}},{key:"getOrderedMarks",value:function(){var e=this.getMarksAsArray();return new Kn(e)}},{key:"getOrderedMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return Kn();if(e.isCollapsed)return this.getMarksAtPosition(e.startKey,e.startOffset);var t=e,r=t.startKey,n=t.startOffset,o=t.endKey,i=t.endOffset;return this.getOrderedMarksBetweenPositions(r,n,o,i)}},{key:"getOrderedMarksBetweenPositions",value:function(e,t,r,n){if(e===r)return this.getDescendant(e).getMarksBetweenOffsets(t,n);var o=this.getTextsBetweenPositionsAsArray(e,r);return Kn().withMutations((function(i){o.forEach((function(o){o.key===e?i.union(o.getMarksBetweenOffsets(t,o.text.length)):o.key===r?i.union(o.getMarksBetweenOffsets(0,n)):i.union(o.getMarks())}))}))}},{key:"getOrderedMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return new Kn(t)}},{key:"getParent",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=Io.lift(e);return this.getNode(t)}},{key:"getPath",value:function(e){if(Fr.isList(e))return e;var t=this.getKeysToPathsTable()[e];return t?Fr(t):null}},{key:"getPreviousBlock",value:function(e){var t=this.assertDescendant(e),r=void 0;"block"==t.object?r=t.getFirstText():r=this.getClosestBlock(e).getFirstText();var n=this.getPreviousText(r.key);return n?this.getClosestBlock(n.key):null}},{key:"getPreviousNode",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;for(var t=e.size;t>0;t--){var r=e.slice(0,t);if(0!==r.last()){var n=Io.decrement(r),o=this.getNode(n);if(o)return o}}return null}},{key:"getPreviousSibling",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;if(0===e.last())return null;var t=Io.decrement(e);return this.getNode(t)}},{key:"getPreviousText",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=this.getPreviousNode(e);return t?t.getLastText():null}},{key:"getSelectionIndexes",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.startKey,n=e.endKey;if(!t)return null;if(e.isUnset)return null;if(r==n){var o=this.getFurthestAncestor(r),i=o?this.nodes.indexOf(o):null;return{start:i,end:i+1}}var a=null,s=null;return this.nodes.forEach((function(e,t){return"text"==e.object?(null==a&&e.key==r&&(a=t),null==s&&e.key==n&&(s=t+1)):(null==a&&e.hasDescendant(r)&&(a=t),null==s&&e.hasDescendant(n)&&(s=t+1)),null==a||null==s})),t&&null==a&&(a=0),t&&null==s&&(s=this.nodes.size),null==a?null:{start:a,end:s}}},{key:"getText",value:function(){return this.nodes.reduce((function(e,t){return e+t.text}),"")}},{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;return this.getTexts().find((function(r,n,o){return(t+=r.text.length)>e}))}},{key:"getTextDirection",value:function(){var e=Yn(this.text);return"neutral"===e?null:e}},{key:"getTexts",value:function(){var e=this.getTextsAsArray();return new Fr(e)}},{key:"getTextsAsArray",value:function(){var e=[];return this.nodes.forEach((function(t){"text"==t.object?e.push(t):e=e.concat(t.getTextsAsArray())})),e}},{key:"getTextsAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return Fr();var t=e,r=t.startKey,n=t.endKey;return new Fr(this.getTextsBetweenPositionsAsArray(r,n))}},{key:"getTextsAtRangeAsArray",value:function(e){if((e=e.normalize(this)).isUnset)return[];var t=e,r=t.startKey,n=t.endKey;return this.getTextsBetweenPositionsAsArray(r,n)}},{key:"getTextsBetweenPositionsAsArray",value:function(e,t){var r=this.getDescendant(e);if(e==t)return[r];var n=this.getDescendant(t),o=this.getTextsAsArray(),i=o.indexOf(r),a=o.indexOf(n,i);return o.slice(i,a+1)}},{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:"hasNode",value:function(e){return!!this.getNode(e)}},{key:"hasVoidParent",value:function(e){return!!this.getClosestVoid(e)}},{key:"insertNode",value:function(e,t){var r=(e=this.resolvePath(e)).last(),n=Io.lift(e),o=this.assertNode(n),i=o.nodes.splice(r,0,t);return o=o.set("nodes",i),this.replaceNode(n,o)}},{key:"insertText",value:function(e,t,r,n){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.insertText(t,r,n),this.replaceNode(e,o)}},{key:"isLeafBlock",value:function(){return"block"===this.object&&this.nodes.every((function(e){return"block"!==e.object}))}},{key:"isLeafInline",value:function(){return"inline"===this.object&&this.nodes.every((function(e){return"inline"!==e.object}))}},{key:"mapChildren",value:function(e){var t=this,r=this.nodes;return r.forEach((function(n,o){var i=e(n,o,t.nodes);i!==n&&(r=r.set(i.key,i))})),this.set("nodes",r)}},{key:"mapDescendants",value:function(e){var t=this,r=this.nodes;return r.forEach((function(n,o){var i=n;"text"!==i.object&&(i=i.mapDescendants(e)),(i=e(i,o,t.nodes))!==n&&(r=r.set(o,i))})),this.set("nodes",r)}},{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 r=Io.decrement(e),n=this.assertNode(r);if(n.object!==t.object)throw new Error("Unable to merge two different kinds of nodes: "+n+" and "+t);var o="text"===n.object?n.mergeText(t):n.set("nodes",n.nodes.concat(t.nodes)),i=this;return i=(i=(i=i.removeNode(e)).removeNode(r)).insertNode(r,o)}},{key:"moveNode",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.assertNode(e);e=this.resolvePath(e),t=this.resolvePath(t,r);var o=Io.lift(t);this.assertNode(o);var i=Io.crop(e,t),a=ko(i,2),s=a[0],u=a[1],c=Io.compare(s,u);e.size<t.size&&-1===c&&(t=Io.decrement(t,1,s.size-1));var l=this;return l=(l=l.removeNode(e)).insertNode(t,n)}},{key:"refindNode",value:function(e,t){var r=this.getDescendant(e);return r&&r.key===t?r:this.getDescendant(t)}},{key:"refindPath",value:function(e,t){var r=this.getDescendant(e);return r&&r.key===t?e:this.getPath(t)}},{key:"regenerateKey",value:function(){var e=fo.create();return this.set("key",e)}},{key:"removeMark",value:function(e,t,r,n){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.removeMark(t,r,n),this.replaceNode(e,o)}},{key:"removeNode",value:function(e){this.assertDescendant(e);var t=(e=this.resolvePath(e)).flatMap((function(e){return Fr(["nodes",e])}));return this.deleteIn(t)}},{key:"removeText",value:function(e,t,r){var n=this.assertDescendant(e);return n=n.removeText(t,r.length),this.replaceNode(e,n)}},{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 r=e.flatMap((function(e){return Fr(["nodes",e])}));return this.setIn(r,t)}},{key:"resolvePath",value:function(e,t){return"string"==typeof e?(e=this.getPath(e),null!=t&&(e=e.concat(t))):e=Io.create(e),e}},{key:"setNode",value:function(e,t){var r=this.assertNode(e);return r=r.merge(t),this.replaceNode(e,r)}},{key:"setMark",value:function(e,t,r,n,o){var i=this.assertNode(e);return i=i.updateMark(t,r,n,o),this.replaceNode(e,i)}},{key:"splitNode",value:function(e,t,r){var n=this.assertNode(e);e=this.resolvePath(e);var o=void 0,i=void 0;if("text"===n.object){var a=n.splitText(t),s=ko(a,2);o=s[0],i=s[1]}else{var u=n.nodes.take(t),c=n.nodes.skip(t);o=n.set("nodes",u),i=n.set("nodes",c).regenerateKey()}r&&"text"!==n.object&&(i=i.merge(r));var l=this;return l=(l=(l=l.removeNode(e)).insertNode(e,i)).insertNode(e,o)}},{key:"normalize",value:function(e){return e.normalizeNode(this)}},{key:"validate",value:function(e){return e.validateNode(this)}},{key:"getNodeAtPath",value:function(e){return ee.deprecate("0.35.0","The `Node.getNodeAtPath` method has been combined into `Node.getNode`."),this.getNode(e)}},{key:"getDescendantAtPath",value:function(e){return ee.deprecate("0.35.0","The `Node.getDescendantAtPath` has been combined into `Node.getDescendant`."),this.getDescendant(e)}},{key:"getKeys",value:function(){ee.deprecate("0.35.0","The `Node.getKeys` method is deprecated.");var e=this.getKeysAsArray();return new hn(e)}},{key:"getKeysAsArray",value:function(){ee.deprecate("0.35.0","The `Node.getKeysAsArray` method is deprecated.");var e=this.getKeysToPathsTable(),t=[];for(var r in e)this.key!==r&&t.push(r);return t}},{key:"areDescendantsSorted",value:function(e,t){var r=this;ee.deprecate("0.35.0","The `Node.areDescendantsSorted` method is deprecated. Use the new `PathUtils.compare` helper instead."),e=fo.create(e),t=fo.create(t);var n=this.getKeysAsArray().filter((function(e){return e!==r.key})),o=n.indexOf(e),i=n.indexOf(t);return-1==o||-1==i?null:o<i}},{key:"isInRange",value:function(e){ee.deprecate("0.35.0","The `Node.isInRange` method is deprecated. Use the new `PathUtils.compare` helper instead."),e=e.normalize(this);var t=this,r=e,n=r.startKey,o=r.endKey,i=r.isCollapsed;if(t.key==n||t.key==o||t.hasDescendant(n)||t.hasDescendant(o))return!0;if(i)return!1;var a=t.getTextsAtRange(e),s=!1;return a.forEach((function(e){return t.hasDescendant(e.key)&&(s=!0),s})),s}}],[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.isNode(t))return t;if(w(t)){var r=t.object;switch(!r&&t.kind&&(ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),r=t.kind),r){case"block":return bo.create(t);case"document":return zo.create(t);case"inline":return wo.create(t);case"text":return qo.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Fr.isList(t)||Array.isArray(t)){var r=Fr(t.map(e.create));return r}throw new Error("`Node.createList` only accepts lists or arrays, but you passed it: "+t)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(bo.isBlock(e)||wo.isInline(e))return{data:e.data,isVoid:e.isVoid,type:e.type};if("string"==typeof e)return{type:e};if(w(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=xo.create(e.data)),"isVoid"in e&&(t.isVoid=e.isVoid),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&&(ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),t=e.kind),t){case"block":return bo.fromJSON(e);case"document":return zo.fromJSON(e);case"inline":return wo.fromJSON(e);case"text":return qo.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!!["BLOCK","DOCUMENT","INLINE","TEXT"].find((function(t){return so(t,e)}))}},{key:"isNodeList",value:function(t){return Fr.isList(t)&&t.every((function(t){return e.isNode(t)}))}}]),e}();Uo.fromJS=Uo.fromJSON;var Vo=function(e){Uo.prototype["assert"+e]=function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=this["get"+e].apply(this,[t].concat(n));if(null==i)throw new Error("`Node.assert"+e+"` could not find node with path or key: "+t);return i}},Wo=!0,$o=!1,Ho=void 0;try{for(var Go,Qo=["Child","Depth","Descendant","Node","Parent","Path"][Symbol.iterator]();!(Wo=(Go=Qo.next()).done);Wo=!0){Vo(Go.value)}}catch(e){$o=!0,Ho=e}finally{try{!Wo&&Qo.return&&Qo.return()}finally{if($o)throw Ho}}So(Uo.prototype,["getBlocksAsArray","getBlocksAtRangeAsArray","getBlocksByTypeAsArray","getDecorations","getFirstInvalidDescendant","getFirstText","getFragmentAtRange","getInlinesAsArray","getInlinesAtRangeAsArray","getInlinesByTypeAsArray","getMarksAsArray","getMarksAtPosition","getOrderedMarksBetweenPositions","getInsertMarksAtRange","getKeysToPathsTable","getLastText","getMarksByTypeAsArray","getNextBlock","getOffset","getOffsetAtRange","getPreviousBlock","getText","getTextAtOffset","getTextDirection","getTextsAsArray","getTextsBetweenPositionsAsArray","isLeafBlock","isLeafInline","normalize","validate"]),Object.getOwnPropertyNames(Uo.prototype).forEach((function(e){"constructor"!==e&&(bo.prototype[e]=Uo.prototype[e],wo.prototype[e]=Uo.prototype[e],zo.prototype[e]=Uo.prototype[e])})),bo.createChildren=Uo.createList,wo.createChildren=Uo.createList,zo.createChildren=Uo.createList;var Yo=/\s/,Xo=/['\u2018\u2019]/,Zo=/[\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 ei(e){return 55296<=e&&e<=57343}function ti(e,t){if(Yo.test(e))return!1;if(Xo.test(e)){var r=t.charAt(0),n=ri(r);if(ti(r=t.slice(0,n),t.slice(n)))return!0}return!Zo.test(e)}function ri(e){return ei(e.charCodeAt(0))?2:1}function ni(e){return ri(e.charAt(0))}function oi(e){for(var t=0,r=0,n=!1,o=void 0;o=e.charAt(r);){var i=ri(o);if(ti(o=e.slice(r,r+i),e.slice(r+i)))n=!0,t+=i;else{if(n)break;t+=i}r+=i}return t}var ii={getCharLength:ri,getCharOffset:ni,getCharOffsetBackward:function(e,t){return e=e.slice(0,t),ni(e=Xn.exports.reverse(e))},getCharOffsetForward:function(e,t){return ni(e=e.slice(t))},getWordOffset:oi,getWordOffsetBackward:function(e,t){return e=e.slice(0,t),oi(e=Xn.exports.reverse(e))},getWordOffsetForward:function(e,t){return oi(e=e.slice(t))},isSurrogate:ei,isWord:ti},ai={addMarkAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!t.isCollapsed){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=t.startKey,u=t.startOffset,c=t.endKey,l=t.endOffset,f=a.getTextsAtRange(t);f.forEach((function(t){var n=t.key,i=0,a=t.text.length;n==s&&(i=u),n==c&&(a=l),n==s&&n==c&&(a=l-u),e.addMarkByKey(n,i,a,r,{normalize:o})}))}},addMarksAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r.forEach((function(r){return e.addMarkAtRange(t,r,n)}))},deleteAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t.isCollapsed){e.snapshotSelection();var n=e.getFlag("normalize",r),o=e.value,i=t.startKey,a=t.startOffset,s=t.endKey,u=t.endOffset,c=o.document,l=c.hasVoidParent(i),f=c.hasVoidParent(s),h=c.getClosestBlock(i),d=c.getClosestBlock(s),p=0==a&&0==u&&0==l&&i==h.getFirstText().key&&s==d.getFirstText().key;if(p&&f){var v=c.getPreviousText(s);s=v.key,u=v.text.length,f=c.hasVoidParent(s)}for(;l;){var y=c.getClosestVoid(i),m=c.getNextText(i);if(e.removeNodeByKey(y.key,{normalize:!1}),i==s)return;if(!m)return;c=e.value.document,i=m.key,a=0,l=c.hasVoidParent(i)}for(;f;){var g=c.getClosestVoid(s),k=c.getPreviousText(s);e.removeNodeByKey(g.key,{normalize:!1}),c=e.value.document,s=k.key,u=k.text.length,f=c.hasVoidParent(s)}if(i==s&&p)e.removeNodeByKey(h.key,{normalize:n});else if(i!=s){h=c.getClosestBlock(i),d=c.getClosestBlock(s);var _=c.getNode(i),b=c.getNode(s),w=_.text.length-a,x=u,A=c.getCommonAncestor(i,s),O=A.getFurthestAncestor(i),S=A.getFurthestAncestor(s),E=c.getParent(h.key),T=E.nodes.indexOf(h),N=E.nodes.indexOf(d),B=void 0;for(B=_;B.key!=O.key;){var z=c.getParent(B.key),j=z.nodes.indexOf(B),C=z.nodes.slice(j+1);C.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),B=z}var P=A.nodes.indexOf(O),K=A.nodes.indexOf(S),F=A.nodes.slice(P+1,K);for(F.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),B=b;B.key!=S.key;){var I=c.getParent(B.key),M=I.nodes.indexOf(B),R=I.nodes.slice(0,M);R.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),B=I}if(0!=w&&e.removeTextByKey(i,a,w,{normalize:!1}),0!=x&&e.removeTextByKey(s,0,u,{normalize:!1}),h.key!=d.key){var D=(c=e.value.document).getFurthestOnlyChildAncestor(d.key);N!=T+1&&e.moveNodeByKey(d.key,E.key,T+1,{normalize:!1}),p?e.removeNodeByKey(h.key,{normalize:!1}):e.mergeNodeByKey(d.key,{normalize:!1}),D&&e.removeNodeByKey(D.key,{normalize:!1})}n&&e.normalizeNodeByKey(A.key)}else{var L=a,J=u-a;e.removeTextByKey(i,L,J,{normalize:n})}}},deleteCharBackwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ii.getCharOffsetBackward(u,s);e.deleteBackwardAtRange(t,c,r)},deleteLineBackwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o).getOffset(o)+i;e.deleteBackwardAtRange(t,a,r)},deleteWordBackwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ii.getWordOffsetBackward(u,s);e.deleteBackwardAtRange(t,c,r)},deleteBackwardAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(0!==r){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=t,u=s.startKey,c=s.focusOffset;if(t.isExpanded)e.deleteAtRange(t,{normalize:o});else{var l=a.getClosestVoid(u);if(l)e.removeNodeByKey(l.key,{normalize:o});else{var f=a.getClosestBlock(u);if(f&&f.isEmpty&&1!==a.nodes.size)e.removeNodeByKey(f.key,{normalize:o});else if(!t.isAtStartOf(a)){var h=a.getDescendant(u);if(t.isAtStartOf(h)){var d=a.getPreviousText(h.key),p=a.getClosestBlock(d.key),v=a.getClosestVoid(d.key);if(v)return void e.removeNodeByKey(v.key,{normalize:o});if(1==r&&p!=f)return t=t.merge({anchorKey:d.key,anchorOffset:d.text.length}),void e.deleteAtRange(t,{normalize:o})}if(r<c)return t=t.merge({focusOffset:c-r,isBackward:!0}),void e.deleteAtRange(t,{normalize:o});for(var y=h,m=0,g=c;r>g;){var k=g+(y=a.getPreviousText(y.key)).text.length;if(r<=k){m=k-r;break}g=k}t=t.merge({focusKey:y.key,focusOffset:m,isBackward:!0}),e.deleteAtRange(t,{normalize:o})}}}}},deleteCharForwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ii.getCharOffsetForward(u,s);e.deleteForwardAtRange(t,c,r)},deleteLineForwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i;e.deleteForwardAtRange(t,a.text.length-s,r)},deleteWordForwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ii.getWordOffsetForward(u,s);e.deleteForwardAtRange(t,c,r)},deleteForwardAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(0!==r){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=t,u=s.startKey,c=s.focusOffset;if(t.isExpanded)e.deleteAtRange(t,{normalize:o});else{var l=a.getClosestVoid(u);if(l)e.removeNodeByKey(l.key,{normalize:o});else{var f=a.getClosestBlock(u);if(f&&f.isEmpty&&1!==a.nodes.size){var h=a.getNextBlock(f.key);return e.removeNodeByKey(f.key,{normalize:o}),void(h&&h.key&&e.moveToStartOf(h))}if(!t.isAtEndOf(a)){var d=a.getDescendant(u);if(t.isAtEndOf(d)){var p=a.getNextText(d.key),v=a.getClosestBlock(p.key),y=a.getClosestVoid(p.key);if(y)return void e.removeNodeByKey(y.key,{normalize:o});if(1==r&&v!=f)return t=t.merge({focusKey:p.key,focusOffset:0}),void e.deleteAtRange(t,{normalize:o})}if(r<=d.text.length-c)return t=t.merge({focusOffset:c+r}),void e.deleteAtRange(t,{normalize:o});for(var m=d,g=c,k=d.text.length-c;r>k;){var _=k+(m=a.getNextText(m.key)).text.length;if(r<=_){g=r-k;break}k=_}t=t.merge({focusKey:m.key,focusOffset:g}),e.deleteAtRange(t,{normalize:o})}}}}},insertBlockAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=bo.create(r);var o=e.getFlag("normalize",n);t.isExpanded&&(e.deleteAtRange(t),t=t.collapseToStart());var i=e.value,a=i.document,s=t,u=s.startKey,c=s.startOffset,l=a.getClosestBlock(u),f=a.getClosestInline(u),h=a.getParent(l.key),d=h.nodes.indexOf(l);if(l.isVoid){var p=t.isAtEndOf(l)?1:0;e.insertNodeByKey(h.key,d+p,r,{normalize:o})}else if(l.isEmpty)e.insertNodeByKey(h.key,d+1,r,{normalize:o});else if(t.isAtStartOf(l))e.insertNodeByKey(h.key,d,r,{normalize:o});else if(t.isAtEndOf(l))e.insertNodeByKey(h.key,d+1,r,{normalize:o});else{if(f&&f.isVoid){var v=t.isAtEndOf(f),y=v?a.getNextText(u):a.getPreviousText(u),m=v?t.moveToStartOf(y):t.moveToEndOf(y);u=m.startKey,c=m.startOffset}e.splitDescendantsByKey(l.key,u,c,{normalize:!1}),e.insertNodeByKey(h.key,d+1,r,{normalize:o})}o&&e.normalizeNodeByKey(h.key)},insertFragmentAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n);if(t.isExpanded&&(e.deleteAtRange(t,{normalize:!1}),t=e.value.document.getDescendant(t.startKey)?t.collapseToStart():t.collapseTo(t.endKey,0)),r.nodes.size){r=r.mapDescendants((function(e){return e.regenerateKey()}));var i=t,a=i.startKey,s=i.startOffset,u=e.value,c=u.document,l=c.getDescendant(a),f=c.getClosestBlock(l.key),h=f.getFurthestAncestor(l.key),d=t.isAtStartOf(f),p=c.getParent(f.key),v=p.nodes.indexOf(f),y=r.getBlocks(),m=r.nodes.first(),g=r.nodes.last(),k=y.first(),_=y.last();if(k==_&&k.isVoid)e.insertBlockAtRange(t,k,n);else if(m.hasBlockChildren()||g.hasBlockChildren())r.nodes.reverse().forEach((function(r){e.insertBlockAtRange(t,r,n)}));else{if(k!=_){var b=r.getFurthest(k.key,(function(e){return 1==e.nodes.size})),w=b||k,x=p.nodes.indexOf(f);(r=r.removeNode(w.key)).nodes.forEach((function(t,r){var n=x+r+1;e.insertNodeByKey(p.key,n,t,{normalize:!1})}))}if(0!=s&&e.splitDescendantsByKey(h.key,a,s,{normalize:!1}),l=(c=e.value.document).getDescendant(a),h=(f=c.getClosestBlock(a)).getFurthestAncestor(l.key),k!=_){var A=d?h:f.getNextSibling(h.key),O=A?f.nodes.skipUntil((function(e){return e.key==A.key})):Fr(),S=_.nodes.size;O.forEach((function(t,r){var n=S+r;e.moveNodeByKey(t.key,_.key,n,{normalize:!1})}))}if(f.isEmpty)e.removeNodeByKey(f.key,{normalize:!1}),e.insertNodeByKey(p.key,v,k,{normalize:!1});else{var E=f.getFurthestAncestor(l.key),T=f.nodes.indexOf(E);k.nodes.forEach((function(t,r){var n=T+r+(0==s?0:1);e.insertNodeByKey(f.key,n,t,{normalize:!1})}))}o&&e.normalizeNodeByKey(p.key)}}},insertInlineAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n);r=wo.create(r),t.isExpanded&&(e.deleteAtRange(t,{normalize:!1}),t=t.collapseToStart());var i=e.value,a=i.document,s=t,u=s.startKey,c=s.startOffset,l=a.getParent(u),f=a.assertDescendant(u),h=l.nodes.indexOf(f);l.isVoid||(e.splitNodeByKey(u,c,{normalize:!1}),e.insertNodeByKey(l.key,h+1,r,{normalize:!1}),o&&e.normalizeNodeByKey(l.key))},insertTextAtRange:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=o.normalize,a=e.value,s=a.document,u=t.startKey,c=t.startOffset,l=u,f=c,h=s.getParent(u);if(!h.isVoid&&(t.isExpanded&&(e.deleteAtRange(t,{normalize:!1}),e.value.startKey!==l&&(l=e.value.startKey,f=e.value.startOffset)),void 0===i&&(i=t.isExpanded&&n&&0!==n.size),e.insertTextByKey(l,f,r,n,{normalize:!1}),i)){var d=s.getCommonAncestor(u,t.endKey),p=s.getAncestors(d.key).push(d),v=p.findLast((function(t){return e.value.document.getDescendant(t.key)})),y=v?v.key:u;e.normalizeNodeByKey(y)}},removeMarkAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!t.isCollapsed){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getTextsAtRange(t),u=t.startKey,c=t.startOffset,l=t.endKey,f=t.endOffset;s.forEach((function(t){var n=t.key,i=0,a=t.text.length;n==u&&(i=c),n==l&&(a=f),n==u&&n==l&&(a=f-c),e.removeMarkByKey(n,i,a,r,{normalize:o})}))}},setBlocksAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getBlocksAtRange(t),u=t.startKey,c=t.startOffset,l=t.endKey,f=t.endOffset,h=t.isCollapsed,d=a.hasVoidParent(u),p=a.getClosestBlock(u),v=a.getClosestBlock(l),y=0==h&&0==c&&0==f&&0==d&&u==p.getFirstText().key&&l==v.getFirstText().key,m=y?s.slice(0,-1):s;m.forEach((function(t){e.setNodeByKey(t.key,r,{normalize:o})}))},setBlockAtRange:function(){ee.deprecate("slate@0.33.0","The `setBlockAtRange` method of Slate changes has been renamed to `setBlocksAtRange`."),ai.setBlocksAtRange.apply(ai,arguments)},setInlinesAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getInlinesAtRange(t);s.forEach((function(t){e.setNodeByKey(t.key,r,{normalize:o})}))},setInlineAtRange:function(){ee.deprecate("slate@0.33.0","The `setInlineAtRange` method of Slate changes has been renamed to `setInlinesAtRange`."),ai.setInlinesAtRange.apply(ai,arguments)},splitBlockAtRange:function(e,t){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n),i=t,a=i.startKey,s=i.startOffset,u=i.endOffset,c=i.endKey,l=e.value,f=l.document,h=f.assertDescendant(a),d=f.getClosestBlock(h.key),p=0;d&&"block"==d.object&&p<r;)h=d,d=f.getClosestBlock(d.key),p++;if(e.splitDescendantsByKey(h.key,a,s,{normalize:o&&t.isCollapsed}),t.isExpanded){t.isBackward&&(t=t.flip());var v=e.value.document.getNextBlock(h.key);t=t.moveAnchorToStartOf(v),a===c&&(t=t.moveFocusTo(t.anchorKey,u-s)),e.deleteAtRange(t,{normalize:o})}},splitInlineAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n);t.isExpanded&&(e.deleteAtRange(t,{normalize:o}),t=t.collapseToStart());for(var i=t,a=i.startKey,s=i.startOffset,u=e.value,c=u.document,l=c.assertDescendant(a),f=c.getClosestInline(l.key),h=0;f&&"inline"==f.object&&h<r;)l=f,f=c.getClosestInline(f.key),h++;e.splitDescendantsByKey(l.key,a,s,{normalize:o})},toggleMarkAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!t.isCollapsed){r=No.create(r);var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getActiveMarksAtRange(t),u=s.some((function(e){return e.equals(r)}));u?e.removeMarkAtRange(t,r,{normalize:o}):e.addMarkAtRange(t,r,{normalize:o})}},unwrapBlockAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=Uo.createProperties(r);var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getBlocksAtRange(t),u=s.map((function(e){return a.getClosest(e.key,(function(e){return"block"==e.object&&((null==r.type||e.type==r.type)&&((null==r.isVoid||e.isVoid==r.isVoid)&&!(null!=r.data&&!e.data.isSuperset(r.data))))}))})).filter((function(e){return e})).toOrderedSet().toList();u.forEach((function(t){var r=t.nodes.first(),n=t.nodes.last(),o=a.getParent(t.key),i=o.nodes.indexOf(t),u=t.nodes.filter((function(e){return s.some((function(t){return e==t||e.hasDescendant(t.key)}))})),c=u.first(),l=u.last();if(r==c&&n==l)t.nodes.forEach((function(t,r){e.moveNodeByKey(t.key,o.key,i+r,{normalize:!1})})),e.removeNodeByKey(t.key,{normalize:!1});else if(n==l)t.nodes.skipUntil((function(e){return e==c})).forEach((function(t,r){e.moveNodeByKey(t.key,o.key,i+1+r,{normalize:!1})}));else if(r==c)t.nodes.takeUntil((function(e){return e==l})).push(l).forEach((function(t,r){e.moveNodeByKey(t.key,o.key,i+r,{normalize:!1})}));else{var f=c.getFirstText();e.splitDescendantsByKey(t.key,f.key,0,{normalize:!1}),a=e.value.document,u.forEach((function(t,r){if(0==r){var n=t;t=a.getNextBlock(t.key),e.removeNodeByKey(n.key,{normalize:!1})}e.moveNodeByKey(t.key,o.key,i+1+r,{normalize:!1})}))}})),o&&e.normalizeDocument()},unwrapInlineAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=Uo.createProperties(r);var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getTextsAtRange(t),u=s.map((function(e){return a.getClosest(e.key,(function(e){return"inline"==e.object&&((null==r.type||e.type==r.type)&&((null==r.isVoid||e.isVoid==r.isVoid)&&!(null!=r.data&&!e.data.isSuperset(r.data))))}))})).filter((function(e){return e})).toOrderedSet().toList();u.forEach((function(t){var r=e.value.document.getParent(t.key),n=r.nodes.indexOf(t);t.nodes.forEach((function(t,o){e.moveNodeByKey(t.key,r.key,n+o,{normalize:!1})}))})),o&&e.normalizeDocument()},wrapBlockAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=(r=bo.create(r)).set("nodes",r.nodes.clear());var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getBlocksAtRange(t),u=s.first(),c=s.last(),l=void 0,f=void 0,h=void 0;if(1===s.length?(l=a.getParent(u.key),f=s):l=a.getClosest(u.key,(function(e){return!!a.getClosest(c.key,(function(t){return e==t}))})),null==l&&(l=a),null==f){var d=l.nodes.reduce((function(e,t,r){return(t==u||t.hasDescendant(u.key))&&(e[0]=r),(t==c||t.hasDescendant(c.key))&&(e[1]=r),e}),[]);h=d[0],f=l.nodes.slice(d[0],d[1]+1)}null==h&&(h=l.nodes.indexOf(f.first())),e.insertNodeByKey(l.key,h,r,{normalize:!1}),f.forEach((function(t,n){e.moveNodeByKey(t.key,r.key,n,{normalize:!1})})),o&&e.normalizeNodeByKey(l.key)},wrapInlineAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.value,i=o.document,a=e.getFlag("normalize",n),s=t.startKey,u=t.startOffset,c=t.endKey,l=t.endOffset;if(t.isCollapsed){var f=i.getClosestInline(s);if(!f.isVoid)return;return e.wrapInlineByKey(f.key,r,n)}r=(r=wo.create(r)).set("nodes",r.nodes.clear());var h=i.getBlocksAtRange(t),d=i.getClosestBlock(s),p=i.getClosestBlock(c),v=i.getClosestInline(s),y=i.getClosestInline(c),m=d.getFurthestAncestor(s),g=p.getFurthestAncestor(c);v&&v==y||(e.splitDescendantsByKey(g.key,c,l,{normalize:!1}),e.splitDescendantsByKey(m.key,s,u,{normalize:!1})),d=(i=e.value.document).getDescendant(d.key),p=i.getDescendant(p.key),m=d.getFurthestAncestor(s),g=p.getFurthestAncestor(c);var k=d.nodes.indexOf(m),_=p.nodes.indexOf(g);if(v&&v==y){var b=d.getTextsAtRange(t).get(0).splitText(u)[1].splitText(l-u)[0];r=r.set("nodes",Fr([b])),ai.insertInlineAtRange(e,t,r,{normalize:!1});var w=r.getFirstText().key,x={anchorKey:w,focusKey:w,anchorOffset:0,focusOffset:l-u,isFocused:!0};e.select(x)}else if(d==p){m=(d=(i=e.value.document).getClosestBlock(s)).getFurthestAncestor(s);var A=i.getNextSibling(m.key),O=d.nodes.indexOf(A),S=s==c?A:d.getFurthestAncestor(c),E=d.nodes.skipUntil((function(e){return e==A})).takeUntil((function(e){return e==S})).push(S),T=r.regenerateKey();e.insertNodeByKey(d.key,O,T,{normalize:!1}),E.forEach((function(t,r){e.moveNodeByKey(t.key,T.key,r,{normalize:!1})})),a&&e.normalizeNodeByKey(d.key)}else{var N=d.nodes.slice(k+1),B=p.nodes.slice(0,_+1),z=r.regenerateKey(),j=r.regenerateKey();e.insertNodeByKey(d.key,k+1,z,{normalize:!1}),e.insertNodeByKey(p.key,_,j,{normalize:!1}),N.forEach((function(t,r){e.moveNodeByKey(t.key,z.key,r,{normalize:!1})})),B.forEach((function(t,r){e.moveNodeByKey(t.key,j.key,r,{normalize:!1})})),a&&e.normalizeNodeByKey(d.key).normalizeNodeByKey(p.key),h.slice(1,-1).forEach((function(t){var n=r.regenerateKey();e.insertNodeByKey(t.key,0,n,{normalize:!1}),t.nodes.forEach((function(t,r){e.moveNodeByKey(t.key,n.key,r,{normalize:!1})})),a&&e.normalizeNodeByKey(t.key)}))}},wrapTextAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=e.getFlag("normalize",o),a=t.startKey,s=t.endKey,u=t.collapseToStart(),c=t.collapseToEnd();a==s&&(c=c.move(r.length)),e.insertTextAtRange(u,r,[],{normalize:i}),e.insertTextAtRange(c,n,[],{normalize:i})}},si={addMarkByPath:function(e,t,r,n,o,i){o=No.create(o);var a=e.value,s=a.document.assertNode(t).getLeaves(),u=[],c=r,l=r+n,f=0;s.forEach((function(e){var r=f,n=r+e.text.length;if(f+=e.text.length,!(n<c||l<r||e.marks.has(o))){var i=Math.max(r,c),s=Math.min(n,l);u.push({type:"add_mark",value:a,path:t,offset:i,length:s-i,mark:o})}})),e.applyOperations(u),e.normalizeParentByPath(t,i)},insertFragmentByPath:function(e,t,r,n,o){n.nodes.forEach((function(n,o){e.insertNodeByPath(t,r+o,n)})),e.normalizeNodeByPath(t,o)},insertNodeByPath:function(e,t,r,n,o){var i=e.value;e.applyOperation({type:"insert_node",value:i,path:t.concat(r),node:n}),e.normalizeNodeByPath(t,o)},insertTextByPath:function(e,t,r,n,o,i){var a=e.value,s=a.document.assertNode(t);o=o||s.getMarksAtIndex(r),e.applyOperation({type:"insert_text",value:a,path:t,offset:r,text:n,marks:o}),e.normalizeParentByPath(t,i)},mergeNodeByPath:function(e,t,r){var n=e.value,o=n.document,i=o.getDescendant(t),a=o.getPreviousSibling(t);if(!a)throw new Error('Unable to merge node with path "'+t+'", because it has no previous sibling.');var s="text"==a.object?a.text.length:a.nodes.size;e.applyOperation({type:"merge_node",value:n,path:t,position:s,properties:{type:i.type,data:i.data},target:null}),e.normalizeParentByPath(t,r)},moveNodeByPath:function(e,t,r,n,o){var i=e.value;e.applyOperation({type:"move_node",value:i,path:t,newPath:r.concat(n)});var a=Io.relate(t,r);e.normalizeNodeByPath(a,o)},removeMarkByPath:function(e,t,r,n,o,i){o=No.create(o);var a=e.value,s=a.document.assertNode(t).getLeaves(),u=[],c=r,l=r+n,f=0;s.forEach((function(e){var r=f,n=r+e.text.length;if(f+=e.text.length,!(n<c||l<r)&&e.marks.has(o)){var i=Math.max(r,c),s=Math.min(n,l);u.push({type:"remove_mark",value:a,path:t,offset:i,length:s-i,mark:o})}})),e.applyOperations(u),e.normalizeParentByPath(t,i)},removeAllMarksByPath:function(e,t,r){var n=e.state.document.assertNode(t);("text"===n.object?[n]:n.getTextsAsArray()).forEach((function(t){t.getMarksAsArray().forEach((function(n){e.removeMarkByKey(t.key,0,t.text.length,n,r)}))}))},removeNodeByPath:function(e,t,r){var n=e.value,o=n.document.assertNode(t);e.applyOperation({type:"remove_node",value:n,path:t,node:o}),e.normalizeParentByPath(t,r)},setTextByPath:function(e,t,r,n,o){var i=e.value.document.assertNode(t).text.length;e.replaceTextByPath(t,0,i,r,n,o)},replaceTextByPath:function(e,t,r,n,o,i,a){var s=e.value.document,u=s.assertNode(t);n+r>u.text.length&&(n=u.text.length-r);var c=Mo.create({anchorPath:t,focusPath:t,anchorOffset:r,focusOffset:r+n}).normalize(s),l=s.getActiveMarksAtRange(c);e.removeTextByPath(t,r,n,{normalize:!1}),i?l&&(l=l.filter((function(e){return!i.find((function(t){return e.type===t.type}))})),i=l.merge(i)):i=l||[],e.insertTextByPath(t,r,o,i,a)},removeTextByPath:function(e,t,r,n,o){var i=e.value,a=i.document,s=a.assertNode(t),u=s.getLeaves(),c=s.text,l=[],f=r,h=r+n,d=0;u.forEach((function(e){var r=d,n=r+e.text.length;if(d+=e.text.length,!(n<f||h<r)){var o=Math.max(r,f),a=Math.min(n,h),s=c.slice(o,a);l.push({type:"remove_text",value:i,path:t,offset:o,text:s,marks:e.marks})}})),e.applyOperations(l.reverse());var p=a.getClosestBlock(s.key);e.normalizeNodeByKey(p.key,o)},replaceNodeByPath:function(e,t,r,n){r=Uo.create(r);var o=t.last(),i=Io.lift(t);e.removeNodeByPath(t,{normalize:!1}),e.insertNodeByPath(i,o,r,{normalize:!1}),e.normalizeParentByPath(t,n)},setMarkByPath:function(e,t,r,n,o,i,a){o=No.create(o),i=No.createProperties(i);var s=e.value;e.applyOperation({type:"set_mark",value:s,path:t,offset:r,length:n,mark:o,properties:i}),e.normalizeParentByPath(t,a)},setNodeByPath:function(e,t,r,n){r=Uo.createProperties(r);var o=e.value,i=o.document.assertNode(t);e.applyOperation({type:"set_node",value:o,path:t,node:i,properties:r}),e.normalizeNodeByPath(t,n)},splitNodeByPath:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n.target,i=void 0===o?null:o,a=e.value,s=a.document,u=s.getDescendant(t);e.applyOperation({type:"split_node",value:a,path:t,position:r,properties:{type:u.type,data:u.data},target:i}),e.normalizeParentByPath(t,n)},splitDescendantsByPath:function(e,t,r,n,o){if(t.equals(r))e.splitNodeByPath(r,n,o);else{var i=e.value.document,a=i.assertNode(t),s=i.assertNode(r),u=i.getAncestors(r).skipUntil((function(e){return e.key==a.key})).reverse().unshift(s),c=void 0,l=void 0;u.forEach((function(t){var r=null==l?null:l;l=c?t.nodes.indexOf(c)+1:n,c=t,e.splitNodeByKey(t.key,l,{normalize:!1,target:r})})),e.normalizeParentByPath(t,o)}},unwrapInlineByPath:function(e,t,r,n){var o=e.value,i=o.document,a=o.selection,s=i.assertNode(t),u=s.getFirstText(),c=s.getLastText(),l=a.moveToRangeOf(u,c);e.unwrapInlineAtRange(l,r,n)},unwrapBlockByPath:function(e,t,r,n){var o=e.value,i=o.document,a=o.selection,s=i.assertNode(t),u=s.getFirstText(),c=s.getLastText(),l=a.moveToRangeOf(u,c);e.unwrapBlockAtRange(l,r,n)},unwrapNodeByPath:function(e,t,r){var n=e.value.document;n.assertNode(t);var o=Io.lift(t),i=n.assertNode(o),a=t.last(),s=o.last(),u=Io.lift(o),c=0===a,l=a===i.nodes.size-1;if(1===i.nodes.size)e.moveNodeByPath(t,u,s+1,{normalize:!1}),e.removeNodeByPath(o,r);else if(c)e.moveNodeByPath(t,u,s,r);else if(l)e.moveNodeByPath(t,u,s+1,r);else{e.splitNodeByPath(o,a,{normalize:!1});var f=Io.increment(t,1,o.size-1);f=f.set(f.size-1,0),e.moveNodeByPath(f,u,s+1,{normalize:!1}),e.normalizeNodeByPath(u,r)}},wrapBlockByPath:function(e,t,r,n){r=(r=bo.create(r)).set("nodes",r.nodes.clear());var o=Io.lift(t),i=t.last(),a=Io.increment(t);e.insertNodeByPath(o,i,r,{normalize:!1}),e.moveNodeByPath(a,t,0,n)},wrapInlineByPath:function(e,t,r,n){r=(r=wo.create(r)).set("nodes",r.nodes.clear());var o=Io.lift(t),i=t.last(),a=Io.increment(t);e.insertNodeByPath(o,i,r,{normalize:!1}),e.moveNodeByPath(a,t,0,n)},wrapNodeByPath:function(e,t,r){"block"!=(r=Uo.create(r)).object?"inline"!=r.object||e.wrapInlineByPath(t,r):e.wrapBlockByPath(t,r)}},ui=function(e){si[e+"ByKey"]=function(t,r){for(var n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a=t.value,s=a.document,u=s.assertPath(r);t[e+"ByPath"].apply(t,[u].concat(o))}},ci=!0,li=!1,fi=void 0;try{for(var hi,di=["addMark","insertFragment","insertNode","insertText","mergeNode","removeMark","removeAllMarks","removeNode","setText","replaceText","removeText","replaceNode","setMark","setNode","splitNode","unwrapInline","unwrapBlock","unwrapNode","wrapBlock","wrapInline","wrapNode"][Symbol.iterator]();!(ci=(hi=di.next()).done);ci=!0){ui(hi.value)}}catch(e){li=!0,fi=e}finally{try{!ci&&di.return&&di.return()}finally{if(li)throw fi}}si.moveNodeByKey=function(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];var a=e.value,s=a.document,u=s.assertPath(t),c=s.assertPath(r);e.moveNodeByPath.apply(e,[u,c].concat(o))},si.splitDescendantsByKey=function(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];var a=e.value,s=a.document,u=s.assertPath(t),c=s.assertPath(r);e.splitDescendantsByPath.apply(e,[u,c].concat(o))};var pi=ro("slate:history"),vi=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"save",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this,n=r,o=n.undos,i=n.redos,a=t.merge,s=t.skip,u=o.peek(),c=u&&u.last();if(null==s&&(s=mi(e,c)),s)return r;if(null==a&&(a=yi(e,c)),pi("save",{operation:e,merge:a}),a&&u){var l=u.push(e);o=(o=o.pop()).push(l)}else{var f=new Fr([e]);o=o.push(f)}return o.size>100&&(o=o.take(100)),i=i.clear(),r=r.set("undos",o).set("redos",i)}},{key:"toJSON",value:function(){return{object:this.object,redos:this.redos.toJSON(),undos:this.undos.toJSON()}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"history"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isHistory(e))return e;if(w(e))return t.fromJSON(e);throw new Error("`History.create` only accepts objects or histories, but you passed it: "+e)}},{key:"createOperationsList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Fr.isList(e))return e;if(Array.isArray(e))return new Fr(e);throw new Error("`History.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.redos,n=void 0===r?[]:r,o=e.undos,i=void 0===o?[]:o;return new t({redos:new tn(n.map(this.createOperationsList)),undos:new tn(i.map(this.createOperationsList))})}}]),t}(Dn({redos:new tn,undos:new tn}));function yi(e,t){return!!t&&("set_selection"==e.type&&"set_selection"==t.type||"insert_text"==e.type&&"insert_text"==t.type&&e.offset==t.offset+t.text.length&&no(e.path,t.path)||"remove_text"==e.type&&"remove_text"==t.type&&e.offset+e.text.length==t.offset&&no(e.path,t.path))}function mi(e,t){return!!t&&("set_selection"==e.type&&"set_selection"==t.type)}vi.fromJS=vi.fromJSON,vi.isHistory=so.bind(null,"HISTORY"),vi.prototype[ao.HISTORY]=!0;var gi=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"getPluginsWith",value:function(e){return this.plugins.filter((function(t){return null!=t[e]}))}},{key:"find",value:function(e){for(var t=this.getPluginsWith(e),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value,f=l[e].apply(l,n);if(null!=f)return f}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}},{key:"map",value:function(e){for(var t=this.getPluginsWith(e),r=[],n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];var a=!0,s=!1,u=void 0;try{for(var c,l=t[Symbol.iterator]();!(a=(c=l.next()).done);a=!0){var f=c.value,h=f[e].apply(f,o);null!=h&&r.push(h)}}catch(e){s=!0,u=e}finally{try{!a&&l.return&&l.return()}finally{if(s)throw u}}return r}},{key:"run",value:function(e){for(var t=this.getPluginsWith(e),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value,f=l[e].apply(l,n);if(null!=f)return}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}},{key:"render",value:function(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];var i=this.getPluginsWith(e);return i.reduceRight((function(r,o){if(!o[e])return r;var i=o[e].apply(o,[t].concat(n));return null==i?r:(t.children=i,i)}),void 0===t.children?null:t.children)}},{key:"object",get:function(){return"stack"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.plugins,n=void 0===r?[]:r,o=new t({plugins:n});return o}},{key:"isStack",value:function(e){return!(!e||!e[ao.STACK])}}]),t}(Dn({plugins:[]}));gi.prototype[ao.STACK]=!0,So(gi.prototype,["getPluginsWith"]);var ki=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};po(this,t);var n=go(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));for(var o in n.code=e,r)n[o]=r[o];return Error.captureStackTrace?Error.captureStackTrace(n,n.constructor):n.stack=(new Error).stack,n}return mo(t,e),t}(Error),_i=ro("slate:schema"),bi=[{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 r=t.code,n=t.node;"child_required"===r&&e.insertNodeByKey(n.key,0,qo.create(),{normalize:!1})}},{match:{object:"inline",isVoid:!1,nodes:[{match:{object:"text"}}]},text:/[\w\W]+/},{match:{object:"block"},first:[{object:"block"},{object:"text"}],last:[{object:"block"},{object:"text"}],normalize:function(e,t){var r=t.code,n=t.node,o=qo.create(),i=void 0;if("first_child_object_invalid"===r)i=0;else{if("last_child_object_invalid"!==r)return;i=n.nodes.size}e.insertNodeByKey(n.key,i,o,{normalize:!1})}},{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 r=t.code,n=t.node,o=t.index,i=qo.create(),a=void 0;if("first_child_object_invalid"===r)a=0;else if("last_child_object_invalid"===r)a=n.nodes.size;else if("previous_sibling_object_invalid"===r)a=o;else{if("next_sibling_object_invalid"!==r)return;a=o+1}e.insertNodeByKey(n.key,a,i,{normalize:!1})}},{match:{object:"text"},next:[{object:"block"},{object:"inline"}],normalize:function(e,t){var r=t.code,n=t.next;"next_sibling_object_invalid"===r&&e.mergeNodeByKey(n.key,{normalize:!1})}}],wi=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"validateNode",value:function(e){var t=this.rules.filter((function(t){return xi(e,t.match)})),r=Ai(e,t,this.rules,{every:!0});if(r)return new ki(r.code,r)}},{key:"testNode",value:function(e){return!this.validateNode(e)}},{key:"assertNode",value:function(e){var t=this.validateNode(e);if(t)throw t}},{key:"normalizeNode",value:function(e){var t=this.stack.find("normalizeNode",e);if(t)return t;if("text"!=e.object){var r=this.validateNode(e);if(r)return function(e){_i("normalizing",{error:r});var t=r.rule,n=e.operations.size;t.normalize&&t.normalize(e,r),e.operations.size===n&&function(e,t){switch(t.code){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":var r=t.child,n=t.node;return"text"==r.object&&"block"==n.object&&1==n.nodes.size?e.removeNodeByKey(n.key):e.removeNodeByKey(r.key);case"child_required":case"node_text_invalid":case"parent_object_invalid":case"parent_type_invalid":var o=t.node;return"document"==o.object?o.nodes.forEach((function(t){return e.removeNodeByKey(t.key)})):e.removeNodeByKey(o.key);case"node_data_invalid":var i=t.node,a=t.key;return void 0===i.data.get(a)&&"document"!=i.object?e.removeNodeByKey(i.key):e.setNodeByKey(i.key,{data:i.data.delete(a)});case"node_is_void_invalid":var s=t.node;return e.setNodeByKey(s.key,{isVoid:!s.isVoid});case"node_mark_invalid":var u=t.node,c=t.mark;return u.getTexts().forEach((function(t){return e.removeMarkByKey(t.key,0,t.text.length,c)}));default:var l=t.node;e.removeNodeByKey(l.key)}}(e,r)}}}},{key:"toJSON",value:function(){return{object:this.object,rules:this.rules}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"schema"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isSchema(e))return e;if(w(e))return t.fromJSON(e);throw new Error("`Schema.create` only accepts objects or schemas, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isSchema(e))return e;var r=e.plugins?e.plugins:[{schema:e}],n=[].concat(bi),o=!0,i=!1,a=void 0;try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value.schema,l=void 0===c?{}:c,f=l.blocks,h=void 0===f?{}:f,d=l.inlines,p=void 0===d?{}:d;for(var v in l.rules&&(n=n.concat(l.rules)),l.document&&n.push(yo({match:[{object:"document"}]},l.document)),h)n.push(yo({match:[{object:"block",type:v}]},h[v]));for(var y in p)n.push(yo({match:[{object:"inline",type:y}]},p[y]))}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return new t({stack:gi.create({plugins:r}),rules:n})}},{key:"isSchema",value:function(e){return!(!e||!e[ao.SCHEMA])}}]),t}(Dn({stack:gi.create(),rules:[]}));function xi(e,t){return!Ai(e,t)}function Ai(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n.every,i=void 0!==o&&o;if(Array.isArray(t)){var a=t.length?t:[{}],s=void 0,u=!0,c=!1,l=void 0;try{for(var f,h=a[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var d=f.value,p=Ai(e,d,r);if(s=s||p,i&&p)return p;if(!i&&!p)return}}catch(e){c=!0,l=e}finally{try{!u&&h.return&&h.return()}finally{if(c)throw l}}return s}var v=Oi(e,t)||Si(e,t)||Ei(e,t)||Ti(e,t)||Ni(e,t)||Bi(e,t)||zi(e,t)||ji(e,t)||Ci(e,t,r);return v}function Oi(e,t){if(t.objects&&ee.warn("The `objects` schema validation rule was changed. Please use the new `match` syntax with `object`."),null!=t.object&&t.object!==e.object)return Ii("node_object_invalid",{rule:t,node:e})}function Si(e,t){if(t.types&&ee.warn("The `types` schema validation rule was changed. Please use the new `match` syntax with `type`."),null!=t.type&&t.type!==e.type)return Ii("node_type_invalid",{rule:t,node:e})}function Ei(e,t){if(null!=t.isVoid&&t.isVoid!==e.isVoid)return Ii("node_is_void_invalid",{rule:t,node:e})}function Ti(e,t){if(null!=t.data&&null!=e.data)for(var r in t.data){var n=t.data[r],o=e.data&&e.data.get(r);if(!("function"==typeof n?n(o):n===o))return Ii("node_data_invalid",{rule:t,node:e,key:r,value:o})}}function Ni(e,t){if(null!=t.marks){var r=e.getMarks().toArray(),n=function(r){return t.marks.some((function(e){return e.type===r.type}))?"continue":{v:Ii("node_mark_invalid",{rule:t,node:e,mark:r})}},o=!0,i=!1,a=void 0;try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=n(s.value);if("continue"!==c&&"object"===(void 0===c?"undefined":ho(c)))return c.v}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}}}function Bi(e,t){if(null!=t.text){var r=e.text;if(!t.text.test(r))return Ii("node_text_invalid",{rule:t,node:e,text:r})}}function zi(e,t){if(null!=t.first){var r=e.nodes.first();if(r){var n=Ai(r,t.first);if(n)return n.rule=t,n.node=e,n.child=r,n.code=n.code.replace("node_","first_child_"),n}}}function ji(e,t){if(null!=t.last){var r=e.nodes.last();if(r){var n=Ai(r,t.last);if(n)return n.rule=t,n.node=e,n.child=r,n.code=n.code.replace("node_","last_child_"),n}}}function Ci(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(null!=e.nodes){var n=e.nodes.toArray(),o=null!=t.nodes?t.nodes.slice():[],i=void 0,a=void 0,s=void 0,u=void 0,c=void 0,l=void 0,f=void 0,h=void 0;for(null!=t.nodes&&v();y();){var d=Pi(e,l,r)||Ki(e,l,f,s,r)||Fi(e,l,h,s,r);if(d)return d;if(null!=t.nodes){if(!u)return Ii("child_unknown",{rule:t,node:e,child:l,index:s});if(u&&(u.objects&&ee.warn("The `objects` schema validation rule was changed. Please use the new `match` syntax with `object`."),u.types&&ee.warn("The `types` schema validation rule was changed. Please use the new `match` syntax with `type`.")),u.match){var p=Ai(l,u.match);if(p&&i>=a&&v()){m();continue}if(p)return p.rule=t,p.node=e,p.child=l,p.index=s,p.code=p.code.replace("node_","child_"),p}}}if(null!=t.nodes)for(;null!=a;){if(i<a)return Ii("child_required",{rule:t,node:e,index:s});v()}}function v(){return i=null==i?null:0,u=o.shift(),a=u&&u.min,c=u&&u.max,!!u}function y(){return i=null==i?0:i+1,f=l,l=n[s=null==s?0:s+1],h=n[s+1],null!=c&&i==c&&v(),!!l}function m(){i-=1,s-=1}}function Pi(e,t,r){var n=!0,o=!1,i=void 0;try{for(var a,s=r[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(null!=u.parent&&xi(t,u.match)){var c=Ai(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,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}}function Ki(e,t,r,n,o){if(r){var i=!0,a=!1,s=void 0;try{for(var u,c=o[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;if(null!=l.previous&&xi(t,l.match)){var f=Ai(r,l.previous);if(f)return f.rule=l,f.node=e,f.child=t,f.index=n,f.previous=r,f.code=f.code.replace("node_","previous_sibling_"),f}}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}}function Fi(e,t,r,n,o){if(r){var i=!0,a=!1,s=void 0;try{for(var u,c=o[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;if(null!=l.next&&xi(t,l.match)){var f=Ai(r,l.next);if(f)return f.rule=l,f.node=e,f.child=t,f.index=n,f.next=r,f.code=f.code.replace("node_","next_sibling_"),f}}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}}function Ii(e,t){return yo({code:e},t)}wi.fromJS=wi.fromJSON,wi.prototype[ao.SCHEMA]=!0;var Mi=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"change",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new ta(yo({},e,{value:this}))}},{key:"addMark",value:function(e,t,r,n){var o=this,i=o.document;return i=i.addMark(e,t,r,n),o=this.set("document",i)}},{key:"insertNode",value:function(e,t){var r=this,n=r.document;return n=n.insertNode(e,t),r=(r=r.set("document",n)).mapRanges((function(e){return e.merge({anchorPath:null,focusPath:null})}))}},{key:"insertText",value:function(e,t,r,n){var o=this,i=o.document;i=i.insertText(e,t,r,n),o=o.set("document",i);var a=i.assertNode(e);return o=(o=(o=o.clearAtomicRanges(a.key,t)).mapRanges((function(e){var n=e.anchorKey,o=e.anchorOffset,i=e.isBackward,s=e.isAtomic;return n!==a.key||!(o>t)&&(o!==t||s&&i)?e:e.moveAnchor(r.length)}))).mapRanges((function(e){var n=e.focusKey,o=e.focusOffset,i=e.isBackward,s=e.isAtomic;return n===a.key&&(o>t||o==t&&(!s||i))?e.moveFocus(r.length):e}))}},{key:"mergeNode",value:function(e){var t=this,r=t.document,n=r.mergeNode(e);e=r.resolvePath(e);var o=Io.decrement(e),i=r.getNode(o),a=r.getNode(e);return t=(t=t.set("document",n)).mapRanges((function(e){if("text"===a.object){var t=i.text.length;e.anchorKey===a.key&&(e=e.moveAnchorTo(i.key,t+e.anchorOffset)),e.focusKey===a.key&&(e=e.moveFocusTo(i.key,t+e.focusOffset))}return e=e.merge({anchorPath:null,focusPath:null})})),t}},{key:"moveNode",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this,o=n,i=o.document;return i=i.moveNode(e,t,r),n=(n=n.set("document",i)).mapRanges((function(e){return e.merge({anchorPath:null,focusPath:null})}))}},{key:"removeMark",value:function(e,t,r,n){var o=this,i=o.document;return i=i.removeMark(e,t,r,n),o=this.set("document",i)}},{key:"removeNode",value:function(e){var t=this,r=t.document,n=r.assertNode(e),o="text"==n.object?n:n.getFirstText()||n,i="text"==n.object?n:n.getLastText()||n,a=r.getPreviousText(o.key),s=r.getNextText(i.key);return r=r.removeNode(e),t=(t=t.set("document",r)).mapRanges((function(e){var t=e,r=t.startKey,o=t.endKey;return n.hasNode(r)&&(e=a?e.moveStartTo(a.key,a.text.length):s?e.moveStartTo(s.key,0):e.deselect()),n.hasNode(o)&&(e=a?e.moveEndTo(a.key,a.text.length):s?e.moveEndTo(s.key,0):e.deselect()),e=e.merge({anchorPath:null,focusPath:null})}))}},{key:"removeText",value:function(e,t,r){var n=this,o=n.document;o=o.removeText(e,t,r),n=n.set("document",o);var i=o.assertNode(e),a=r.length,s=t+a;return n=(n=(n=n.clearAtomicRanges(i.key,t,t+a)).mapRanges((function(e){return e.anchorKey===i.key?e.anchorOffset>=s?e.moveAnchor(-a):e.anchorOffset>t?e.moveAnchorTo(e.anchorKey,t):e:e}))).mapRanges((function(e){return e.focusKey===i.key?e.focusOffset>=s?e.moveFocus(-a):e.focusOffset>t?e.moveFocusTo(e.focusKey,t):e:e}))}},{key:"setNode",value:function(e,t){var r=this,n=r.document;return n=n.setNode(e,t),r=r.set("document",n)}},{key:"setMark",value:function(e,t,r,n,o){var i=this,a=i.document;return a=a.setMark(e,t,r,n,o),i=i.set("document",a)}},{key:"setSelection",value:function(e){var t=this,r=t,n=r.document,o=r.selection;return o=(o=o.merge(e)).normalize(n),t=t.set("selection",o)}},{key:"splitNode",value:function(e,t,r){var n=this,o=n.document,i=o.splitNode(e,t,r),a=o.assertNode(e);return n=(n=n.set("document",i)).mapRanges((function(e){var r=i.getNextText(a.key),n=e,o=n.startKey,s=n.startOffset,u=n.endKey,c=n.endOffset;return a.key===o&&t<=s&&(e=e.moveStartTo(r.key,s-t)),a.key===u&&t<=c&&(e=e.moveEndTo(r.key,c-t)),e=e.merge({anchorPath:null,focusPath:null})}))}},{key:"mapRanges",value:function(e){var t=this,r=t,n=r.document,o=r.selection,i=r.decorations;if(o){var a=o.isSet?e(o):o;a||(a=o.deselect()),a!==o&&(a=a.normalize(n)),t=t.set("selection",a)}if(i){var s=i.map((function(t){var r=t.isSet?e(t):t;return r&&r!==t&&(r=r.normalize(n)),r}));s=(s=s.filter((function(e){return!!e}))).size?s:null,t=t.set("decorations",s)}return t}},{key:"clearAtomicRanges",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.mapRanges((function(n){var o=n.isAtomic,i=n.startKey,a=n.startOffset,s=n.endKey,u=n.endOffset;return o?i!==e?n:a<t&&(s!==e||u>t)||null!=r&&a<r&&(s!==e||u>r)?null:n:n}))}},{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.preserveDecorations&&(t.decorations=this.decorations?this.decorations.toArray().map((function(t){return t.toJSON(e)})):null),e.preserveHistory&&(t.history=this.history.toJSON(e)),e.preserveSelection&&(t.selection=this.selection.toJSON(e)),e.preserveSchema&&(t.schema=this.schema.toJSON(e)),t}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"value"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"hasUndos",get:function(){return this.history.undos.size>0}},{key:"hasRedos",get:function(){return this.history.redos.size>0}},{key:"isBlurred",get:function(){return this.selection.isBlurred}},{key:"isFocused",get:function(){return this.selection.isFocused}},{key:"isCollapsed",get:function(){return this.selection.isCollapsed}},{key:"isExpanded",get:function(){return this.selection.isExpanded}},{key:"isBackward",get:function(){return this.selection.isBackward}},{key:"isForward",get:function(){return this.selection.isForward}},{key:"startKey",get:function(){return this.selection.startKey}},{key:"endKey",get:function(){return this.selection.endKey}},{key:"startPath",get:function(){return this.selection.startPath}},{key:"endPath",get:function(){return this.selection.endPath}},{key:"startOffset",get:function(){return this.selection.startOffset}},{key:"endOffset",get:function(){return this.selection.endOffset}},{key:"anchorKey",get:function(){return this.selection.anchorKey}},{key:"focusKey",get:function(){return this.selection.focusKey}},{key:"anchorPath",get:function(){return this.selection.anchorPath}},{key:"focusPath",get:function(){return this.selection.focusPath}},{key:"anchorOffset",get:function(){return this.selection.anchorOffset}},{key:"focusOffset",get:function(){return this.selection.focusOffset}},{key:"startBlock",get:function(){return this.startKey&&this.document.getClosestBlock(this.startKey)}},{key:"endBlock",get:function(){return this.endKey&&this.document.getClosestBlock(this.endKey)}},{key:"anchorBlock",get:function(){return this.anchorKey&&this.document.getClosestBlock(this.anchorKey)}},{key:"focusBlock",get:function(){return this.focusKey&&this.document.getClosestBlock(this.focusKey)}},{key:"startInline",get:function(){return this.startKey&&this.document.getClosestInline(this.startKey)}},{key:"endInline",get:function(){return this.endKey&&this.document.getClosestInline(this.endKey)}},{key:"anchorInline",get:function(){return this.anchorKey&&this.document.getClosestInline(this.anchorKey)}},{key:"focusInline",get:function(){return this.focusKey&&this.document.getClosestInline(this.focusKey)}},{key:"startText",get:function(){return this.startKey&&this.document.getDescendant(this.startKey)}},{key:"endText",get:function(){return this.endKey&&this.document.getDescendant(this.endKey)}},{key:"anchorText",get:function(){return this.anchorKey&&this.document.getDescendant(this.anchorKey)}},{key:"focusText",get:function(){return this.focusKey&&this.document.getDescendant(this.focusKey)}},{key:"nextBlock",get:function(){return this.endKey&&this.document.getNextBlock(this.endKey)}},{key:"previousBlock",get:function(){return this.startKey&&this.document.getPreviousBlock(this.startKey)}},{key:"nextInline",get:function(){return this.endKey&&this.document.getNextInline(this.endKey)}},{key:"previousInline",get:function(){return this.startKey&&this.document.getPreviousInline(this.startKey)}},{key:"nextText",get:function(){return this.endKey&&this.document.getNextText(this.endKey)}},{key:"previousText",get:function(){return this.startKey&&this.document.getPreviousText(this.startKey)}},{key:"characters",get:function(){return this.selection.isUnset?new Fr:this.document.getCharactersAtRange(this.selection)}},{key:"marks",get:function(){return this.selection.isUnset?new hn:this.selection.marks||this.document.getMarksAtRange(this.selection)}},{key:"activeMarks",get:function(){return this.selection.isUnset?new hn:this.selection.marks||this.document.getActiveMarksAtRange(this.selection)}},{key:"blocks",get:function(){return this.selection.isUnset?new Fr:this.document.getBlocksAtRange(this.selection)}},{key:"fragment",get:function(){return this.selection.isUnset?zo.create():this.document.getFragmentAtRange(this.selection)}},{key:"inlines",get:function(){return this.selection.isUnset?new Fr:this.document.getInlinesAtRange(this.selection)}},{key:"texts",get:function(){return this.selection.isUnset?new Fr:this.document.getTextsAtRange(this.selection)}},{key:"isEmpty",get:function(){return!!this.isCollapsed||(0==this.endOffset||0==this.startOffset)&&this.fragment.isEmpty}},{key:"isInVoid",get:function(){return!this.isExpanded&&this.document.hasVoidParent(this.startKey)}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.isValue(e))return e;if(w(e))return t.fromJSON(e,r);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(t.isValue(e))return{data:e.data,decorations:e.decorations,schema:e.schema};if(w(e)){var r={};return"data"in e&&(r.data=xo.create(e.data)),"decorations"in e&&(r.decorations=Mo.createList(e.decorations)),"schema"in e&&(r.schema=wi.create(e.schema)),r}throw new Error("`Value.createProperties` only accepts objects or values, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.document,o=void 0===n?{}:n,i=e.selection,a=void 0===i?{}:i,s=e.schema,u=void 0===s?{}:s,c=e.history,l=void 0===c?{}:c,f=new dr;if(o=zo.fromJSON(o),a=Mo.fromJSON(a),u=wi.fromJSON(u),l=vi.fromJSON(l),r.plugins){var h=!0,d=!1,p=void 0;try{for(var v,y=r.plugins[Symbol.iterator]();!(h=(v=y.next()).done);h=!0){var m=v.value;m.data&&(f=f.merge(m.data))}}catch(e){d=!0,p=e}finally{try{!h&&y.return&&y.return()}finally{if(d)throw p}}}if("data"in e&&(f=f.merge(e.data)),a.isUnset){var g=o.getFirstText();g&&(a=a.collapseToStartOf(g))}var k=new t({data:f,document:o,selection:a=a.normalize(o),schema:u,history:l});return!1!==r.normalize&&(k=k.change({save:!1}).normalize().value),k}},{key:"isValue",value:function(e){return!(!e||!e[ao.VALUE])}}]),t}(Dn({data:new dr,decorations:null,document:zo.create(),history:vi.create(),schema:wi.create(),selection:Mo.create()}));Mi.fromJS=Mi.fromJSON,Mi.prototype[ao.VALUE]=!0;var Ri={add_mark:["value","path","offset","length","mark"],insert_node:["value","path","node"],insert_text:["value","path","offset","text","marks"],merge_node:["value","path","position","properties","target"],move_node:["value","path","newPath"],remove_mark:["value","path","offset","length","mark"],remove_node:["value","path","node"],remove_text:["value","path","offset","text","marks"],set_mark:["value","path","offset","length","mark","properties"],set_node:["value","path","node","properties"],set_selection:["value","selection","properties"],set_value:["value","properties"],split_node:["value","path","position","properties","target"]},Di=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"toJSON",value:function(){var e=this.object,t=this.type,r={object:e,type:t},n=Ri[t],o=!0,i=!1,a=void 0;try{for(var s,u=n[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value,l=this[c];if("document"!=c&&("selection"!=c&&"value"!=c&&("node"!=c||"insert_node"==t))){if("mark"!=c&&"marks"!=c&&"node"!=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&&"set_mark"==t){var h={};"data"in l&&(h.data=l.data.toJS()),"type"in l&&(h.type=l.type),l=h}if("properties"==c&&"set_node"==t){var d={};"data"in l&&(d.data=l.data.toJS()),"isVoid"in l&&(d.isVoid=l.isVoid),"type"in l&&(d.type=l.type),l=d}if("properties"==c&&"set_selection"==t){var p={};"anchorOffset"in l&&(p.anchorOffset=l.anchorOffset),"anchorPath"in l&&(p.anchorPath=l.anchorPath&&l.anchorPath.toJSON()),"focusOffset"in l&&(p.focusOffset=l.focusOffset),"focusPath"in l&&(p.focusPath=l.focusPath&&l.focusPath.toJSON()),"isBackward"in l&&(p.isBackward=l.isBackward),"isFocused"in l&&(p.isFocused=l.isFocused),"marks"in l&&(p.marks=l.marks&&l.marks.toJSON()),l=p}if("properties"==c&&"set_value"==t){var v={};"data"in l&&(v.data=l.data.toJS()),"decorations"in l&&(v.decorations=l.decorations.toJS()),"schema"in l&&(v.schema=l.schema.toJS()),l=v}if("properties"==c&&"split_node"==t){var y={};"data"in l&&(y.data=l.data.toJS()),"type"in l&&(y.type=l.type),l=y}r[c]=l}}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return r}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"operation"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isOperation(e))return e;if(w(e))return t.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(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Operation.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isOperation(e))return e;var r=e.type,n=Ri[r],o={type:r};if(!n)throw new Error('`Operation.fromJSON` was passed an unrecognized operation type: "'+r+'"');var i=!0,a=!1,s=void 0;try{for(var u,c=n[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value,f=e[l];if(void 0===f){if("document"==l)continue;if("selection"==l)continue;if("value"==l)continue;if("node"==l&&"insert_node"!=r)continue;throw new Error('`Operation.fromJSON` was passed a "'+r+'" operation without the required "'+l+'" attribute.')}"path"!==l&&"newPath"!==l||(f=Io.create(f)),"mark"===l&&(f=No.create(f)),"marks"===l&&null!=f&&(f=No.createSet(f)),"node"===l&&(f=Uo.create(f)),"selection"===l&&(f=Mo.create(f)),"value"===l&&(f=Mi.create(f)),"properties"===l&&"merge_node"===r&&(f=Uo.createProperties(f)),"properties"===l&&"set_mark"===r&&(f=No.createProperties(f)),"properties"===l&&"set_node"===r&&(f=Uo.createProperties(f)),"properties"===l&&"set_selection"===r&&(f=Mo.createProperties(f)),"properties"===l&&"set_value"===r&&(f=Mi.createProperties(f)),"properties"===l&&"split_node"===r&&(f=Uo.createProperties(f)),o[l]=f}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}return new t(o)}},{key:"isOperation",value:function(e){return!(!e||!e[ao.OPERATION])}},{key:"isOperationList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isOperation(e)}))}}]),t}(Dn({length:void 0,mark:void 0,marks:void 0,newPath:void 0,node:void 0,offset:void 0,path:void 0,position:void 0,properties:void 0,selection:void 0,target:void 0,text:void 0,type:void 0,value:void 0}));Di.fromJS=Di.fromJSON,Di.prototype[ao.OPERATION]=!0;var Li=ro("slate:operation:invert");function Ji(e){var t=(e=Di.create(e)).type;switch(Li(t,e),t){case"insert_node":return e.set("type","remove_node");case"remove_node":return e.set("type","insert_node");case"move_node":var r=e,n=r.newPath,o=r.path,i=n,a=o,s=o.size-1,u=n.size-1;return o.size<i.size&&o.slice(0,s).every((function(e,t){return e==i.get(t)}))&&o.last()<i.get(s)&&(i=i.slice(0,s).concat(i.get(s)-1).concat(i.slice(s+1,i.size))),n.size<a.size&&n.slice(0,u).every((function(e,t){return e==a.get(t)}))&&n.last()<=a.get(u)&&(a=a.slice(0,u).concat(a.get(u)+1).concat(a.slice(u+1,a.size))),e.set("path",i).set("newPath",a);case"merge_node":var c=e.path,l=Io.decrement(c);return e.set("type","split_node").set("path",l);case"split_node":var f=e.path,h=Io.increment(f);return e.set("type","merge_node").set("path",h);case"set_node":var d=e,p=d.properties,v=d.node,y=v.merge(p),m=oo(v,Object.keys(p));return e.set("node",y).set("properties",m);case"insert_text":return e.set("type","remove_text");case"remove_text":return e.set("type","insert_text");case"add_mark":return e.set("type","remove_mark");case"remove_mark":return e.set("type","add_mark");case"set_mark":var g=e,k=g.properties,_=g.mark,b=_.merge(k),w=oo(_,Object.keys(k));return e.set("mark",b).set("properties",w);case"set_selection":var x=e,A=x.properties,O=x.selection,S=O.merge(A),E=oo(O,Object.keys(A));return e.set("selection",S).set("properties",E);case"set_value":var T=e,N=T.properties,B=T.value,z=B.merge(N),j=oo(B,Object.keys(N));return e.set("value",z).set("properties",j);default:throw new Error('Unknown operation type: "'+t+'".')}}var qi={redo:function(e){var t=e.value,r=t.history;if(r){var n=r,o=n.undos,i=n.redos,a=i.peek();a&&(i=i.pop(),o=o.push(a),a.forEach((function(t){var r=t,n=r.type,o=r.properties;"set_selection"==n&&(t=t.set("properties",io(o,"isFocused"))),e.applyOperation(t,{save:!1})})),t=e.value,r=r.set("undos",o).set("redos",i),t=t.set("history",r),e.value=t)}},undo:function(e){var t=e.value,r=t.history;if(r){var n=r,o=n.undos,i=n.redos,a=o.peek();a&&(o=o.pop(),i=i.push(a),a.slice().reverse().map(Ji).forEach((function(t){var r=t,n=r.type,o=r.properties;"set_selection"==n&&(t=t.set("properties",io(o,"isFocused"))),e.applyOperation(t,{save:!1})})),t=e.value,r=r.set("undos",o).set("redos",i),t=t.set("history",r),e.value=t)}}},Ui={select:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Mo.createProperties(t);var n=r.snapshot,o=void 0!==n&&n,i=e.value,a=i.document,s=i.selection,u={},c=s.merge(t).normalize(a);for(var l in t=oo(c,Object.keys(t)))!0!==o&&Ye(t[l],s[l])||(u[l]=t[l]);s.marks&&!u.marks&&(u.hasOwnProperty("anchorKey")||u.hasOwnProperty("anchorOffset")||u.hasOwnProperty("focusKey")||u.hasOwnProperty("focusOffset"))&&(u.marks=null),to(u)||e.applyOperation({type:"set_selection",value:i,properties:u,selection:s.toJSON()},o?{skip:!1,merge:!1}:{})},selectAll:function(e){var t=e.value,r=t.document,n=t.selection.moveToRangeOf(r);e.select(n)},snapshotSelection:function(e){var t=e.value.selection;e.select(t,{snapshot:!0})},moveAnchorCharBackward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.anchorText,i=t.anchorBlock,a=n.anchorOffset,s=r.getPreviousText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a>0?e.moveAnchor(-1):s&&(e.moveAnchorToEndOf(s),u||c||!i.hasNode(s.key)||e.moveAnchor(-1))},moveAnchorCharForward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.anchorText,i=t.anchorBlock,a=n.anchorOffset,s=r.getNextText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a<o.text.length?e.moveAnchor(1):s&&(e.moveAnchorToStartOf(s),u||c||!i.hasNode(s.key)||e.moveAnchor(1))},moveFocusCharBackward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.focusText,i=t.focusBlock,a=n.focusOffset,s=r.getPreviousText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a>0?e.moveFocus(-1):s&&(e.moveFocusToEndOf(s),u||c||!i.hasNode(s.key)||e.moveFocus(-1))},moveFocusCharForward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.focusText,i=t.focusBlock,a=n.focusOffset,s=r.getNextText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a<o.text.length?e.moveFocus(1):s&&(e.moveFocusToStartOf(s),u||c||!i.hasNode(s.key)||e.moveFocus(1))}};["Forward","Backward"].forEach((function(e){var t="moveAnchorChar"+e,r="moveFocusChar"+e;Ui["moveChar"+e]=function(e){e[t]()[r]()},Ui["moveStartChar"+e]=function(e){e.value.isBackward?e[r]():e[t]()},Ui["moveEndChar"+e]=function(e){e.value.isBackward?e[t]():e[r]()},Ui["extendChar"+e]=function(t){t["moveFocusChar"+e]()},Ui["collapseChar"+e]=function(t){t["Forward"==e?"collapseToEnd":"collapseToStart"]()["moveChar"+e]()}}));[["collapseLineBackward","collapseToStartOfBlock"],["collapseLineForward","collapseToEndOfBlock"],["extendLineBackward","extendToStartOfBlock"],["extendLineForward","extendToEndOfBlock"]].forEach((function(e){var t=ko(e,2),r=t[0],n=t[1];Ui[r]=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e[n].apply(e,[e].concat(r))}}));["blur","collapseTo","collapseToAnchor","collapseToEnd","collapseToEndOf","collapseToFocus","collapseToStart","collapseToStartOf","extend","extendTo","extendToEndOf","extendToStartOf","flip","focus","move","moveAnchor","moveAnchorOffsetTo","moveAnchorTo","moveAnchorToEndOf","moveAnchorToStartOf","moveEnd","moveEndOffsetTo","moveEndTo","moveFocus","moveFocusOffsetTo","moveFocusTo","moveFocusToEndOf","moveFocusToStartOf","moveOffsetsTo","moveStart","moveStartOffsetTo","moveStartTo","moveTo","moveToEnd","moveToEndOf","moveToRangeOf","moveToStart","moveToStartOf","deselect"].forEach((function(e){Ui[e]=function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i="deselect"!=e,a=t.value,s=a.document,u=a.selection,c=u[e].apply(u,n);i&&(c=c.normalize(s)),t.select(c)}}));var Vi=["Next","Previous"],Wi=["Block","Inline","Text"];["moveTo","moveAnchorTo","moveFocusTo","moveStartTo","moveEndTo","collapseTo","extendTo"].forEach((function(e){var t=["Start","End"];"moveTo"==e&&t.push("Range"),t.forEach((function(t){var r=""+e+t+"Of";Wi.forEach((function(e){var t="Text"==e?"getNode":"getClosest"+e;Ui[""+r+e]=function(e){var n=e.value,o=n.document,i=n.selection,a=o[t](i.startKey);a&&e[r](a)},Vi.forEach((function(n){var o="get"+n+e,i="Next"==n?"startKey":"endKey";Ui[""+r+n+e]=function(e){var n=e.value,a=n.document,s=n.selection,u=a[t](s[i]);if(u){var c=a[o](u.key);c&&e[r](c)}}}))}))}))}));var $i={setValue:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Mi.createProperties(t);var n=e.value;e.applyOperation({type:"set_value",properties:t,value:n},r)}},Hi={};function Gi(e,t,r){if("text"!=t.object){for(var n=t.getFirstInvalidDescendant(r),o=e.value.document.getPath(t.key);t&&n;)Gi(e,n,r),(t=e.value.document.refindNode(o,t.key))?(o=e.value.document.refindPath(o,t.key),n=t.getFirstInvalidDescendant(r)):(o=[],n=null);t&&Qi(e,t,r)}else Qi(e,t,r)}function Qi(e,t,r){var n=r.stack.plugins.length+r.rules.length+1,o=0;!function e(t,i){var a=i.normalize(r);if(a){var s=t.value.document.getPath(i.key);if(a(t),i=t.value.document.refindNode(s,i.key)){if(s=t.value.document.refindPath(s,i.key),++o>n)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.");e(t,i)}}}(e,t)}Hi.normalize=function(e,t){e.normalizeDocument(t)},Hi.normalizeDocument=function(e,t){var r=e.value.document;e.normalizeNodeByKey(r.key,t)},Hi.normalizeNodeByKey=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=e.getFlag("normalize",r);if(n){var o=e.value,i=o.document,a=o.schema,s=i.assertNode(t);Gi(e,s,a),e.normalizeAncestorsByKey(t)}},Hi.normalizeAncestorsByKey=function(e,t){var r=e.value,n=r.document,o=r.schema,i=n.getAncestors(t);i&&i.forEach((function(t){e.value.document.getDescendant(t.key)&&Qi(e,t,o)}))},Hi.normalizeParentByKey=function(e,t,r){var n=e.value.document.getParent(t);e.normalizeNodeByKey(n.key,r)},Hi.normalizeNodeByPath=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=e.getFlag("normalize",r);if(n){var o=e.value,i=o.document,a=o.schema,s=i.assertNode(t);Gi(e,s,a);var u=(i=e.value.document).getAncestors(t);u&&u.forEach((function(t){e.value.document.getDescendant(t.key)&&Qi(e,t,a)}))}},Hi.normalizeParentByPath=function(e,t,r){var n=Io.lift(t);e.normalizeNodeByPath(n,r)};var Yi=yo({},Bo,ai,si,qi,Ui,$i,Hi),Xi=ro("slate:operation:apply");function Zi(e,t){var r=(t=Di.create(t)).type;switch(Xi(r,t),r){case"add_mark":var n=t,o=n.path,i=n.offset,a=n.length,s=n.mark;return e.addMark(o,i,a,s);case"insert_node":var u=t,c=u.path,l=u.node;return e.insertNode(c,l);case"insert_text":var f=t,h=f.path,d=f.offset,p=f.text,v=f.marks;return e.insertText(h,d,p,v);case"merge_node":var y=t.path;return e.mergeNode(y);case"move_node":var m=t,g=m.path,k=m.newPath;return e.moveNode(g,k);case"remove_mark":var _=t,b=_.path,w=_.offset,x=_.length,A=_.mark;return e.removeMark(b,w,x,A);case"remove_node":var O=t.path;return e.removeNode(O);case"remove_text":var S=t,E=S.path,T=S.offset,N=S.text;return e.removeText(E,T,N);case"set_mark":var B=t,z=B.path,j=B.offset,C=B.length,P=B.mark,K=B.properties;return e.setMark(z,j,C,P,K);case"set_node":var F=t,I=F.path,M=F.properties;return e.setNode(I,M);case"set_selection":var R=t.properties;return e.setSelection(R);case"set_value":var D=t.properties;return e.merge(D);case"split_node":var L=t,J=L.path,q=L.position,U=L.properties;return e.splitNode(J,q,U);default:throw new Error('Unknown operation type: "'+r+'".')}}var ea=ro("slate:change"),ta=function(){function e(t){po(this,e);var r=t.value;this.value=r,this.operations=new Fr,this.flags=yo({normalize:!0},oo(t,["merge","save","normalize"]))}return vo(e,[{key:"applyOperation",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.operations,n=this.flags,o=this.value,i=o,a=i.history;w(e)&&(e=yo({},e,{value:o})),e=Di.create(e);var s=t=yo({},n,t),u=s.merge,c=void 0===u?0!=r.size||null:u,l=s.save,f=void 0===l||l,h=s.skip,d=void 0===h?null:h;return ea("apply",{operation:e,save:f,merge:c}),o=Zi(o,e),a&&f&&(a=a.save(e,{merge:c,skip:d}),o=o.set("history",a)),this.value=o,this.operations=r.push(e),this}},{key:"applyOperations",value:function(e,t){var r=this;return e.forEach((function(e){return r.applyOperation(e,t)})),this}},{key:"call",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.apply(void 0,[this].concat(r)),this}},{key:"withoutNormalization",value:function(e){var t=this.flags.normalize;return this.setOperationFlag("normalize",!1),e(this),this.setOperationFlag("normalize",t),this.normalizeDocument(),this}},{key:"setOperationFlag",value:function(e,t){return this.flags[e]=t,this}},{key:"getFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0!==t[e]?t[e]:this.flags[e]}},{key:"unsetOperationFlag",value:function(e){return delete this.flags[e],this}},{key:"object",get:function(){return"change"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}]),e}();ta.isChange=so.bind(null,"CHANGE"),ta.prototype[ao.CHANGE]=!0,Object.keys(Yi).forEach((function(e){ta.prototype[e]=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return ea(e,{args:r}),this.call.apply(this,[Yi[e]].concat(r)),this}}));const ra=r,{renderToStaticMarkup:na}=n;var oa=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},ia=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},aa=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},sa=new Dn({object:"string",text:""}),ua={deserialize:function(e){if(e.tagName&&"br"===e.tagName.toLowerCase())return{object:"text",leaves:[{object:"leaf",text:"\n"}]};if("#text"==e.nodeName){if(e.nodeValue&&e.nodeValue.match(/<!--.*?-->/))return;return{object:"text",leaves:[{object:"leaf",text:e.nodeValue}]}}},serialize:function(e,t){if("string"===e.object)return t.split("\n").reduce((function(e,t,r){return 0!=r&&e.push(ra.createElement("br",{key:r})),e.push(t),e}),[])}};function ca(e){if("undefined"==typeof DOMParser)throw new Error("The native `DOMParser` global which the `Html` serializer uses by default is not present in this environment. You must supply the `options.parseHtml` function instead.");return(new DOMParser).parseFromString(e,"text/html").body||window.document.createElement("body")}var la=function(){var e=this;this.deserialize=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.toJSON,o=void 0!==n&&n,i=e.defaultBlock,a=e.parseHtml,s=a(t),u=Array.from(s.childNodes),c=e.deserializeElements(u);0==(c=c.reduce((function(e,t,r,n){if("block"==t.object)return e.push(t),e;if(r>0&&"block"!=n[r-1].object)return e[e.length-1].nodes.push(t),e;var o=ia({object:"block",data:{},isVoid:!1},i,{nodes:[t]});return e.push(o),e}),[])).length&&(c=[ia({object:"block",data:{},isVoid:!1},i,{nodes:[{object:"text",leaves:[{object:"leaf",text:"",marks:[]}]}]})]);var l={object:"value",document:{object:"document",data:{},nodes:c}},f=o?l:Mi.fromJSON(l);return f},this.deserializeElements=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=[];return t.filter(e.cruftNewline).forEach((function(t){var n=e.deserializeElement(t);switch(k(n)){case"array":r=r.concat(n);break;case"object":r.push(n)}})),r},this.deserializeElement=function(t){var r=void 0;t.tagName||(t.tagName="");var n=function(t){switch("[object NodeList]"==Object.prototype.toString.call(t)&&(t=Array.from(t)),k(t)){case"array":return e.deserializeElements(t);case"object":return e.deserializeElement(t);case"null":case"undefined":return;default:throw new Error('The `next` argument was called with invalid children: "'+t+'".')}},o=!0,i=!1,a=void 0;try{for(var s,u=e.rules[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value;if(c.deserialize){var l=c.deserialize(t,n),f=k(l);if("array"!=f&&"object"!=f&&"null"!=f&&"undefined"!=f)throw new Error('A rule returned an invalid deserialized representation: "'+r+'".');if(void 0!==l){if(null===l)return null;r="mark"==l.object?e.deserializeMark(l):l;break}}}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return r||n(t.childNodes)},this.deserializeMark=function(t){var r=t.type,n=t.data,o=function t(o){return"mark"==o.object?e.deserializeMark(o):("text"==o.object?o.leaves=o.leaves.map((function(e){return e.marks=e.marks||[],e.marks.push({type:r,data:n}),e})):o.nodes&&(o.nodes=o.nodes.map(t)),o)};return t.nodes.reduce((function(e,t){var r=o(t);return Array.isArray(r)?e.concat(r):(e.push(r),e)}),[])},this.serialize=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.document,o=n.nodes.map(e.serializeNode).filter((function(e){return e}));if(!1===r.render)return o;var i=na(ra.createElement("body",null,o)),a=i.slice(6,-7);return a},this.serializeNode=function(t){if("text"===t.object)return t.getLeaves().map(e.serializeLeaf);var r=t.nodes.map(e.serializeNode),n=!0,o=!1,i=void 0;try{for(var a,s=e.rules[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(u.serialize){var c=u.serialize(t,r);if(null===c)return;if(c)return ha(c)}}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}throw new Error('No serializer defined for node of type "'+t.type+'".')},this.serializeLeaf=function(t){var r=new sa({text:t.text}),n=e.serializeString(r);return t.marks.reduce((function(t,r){var n=!0,o=!1,i=void 0;try{for(var a,s=e.rules[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(u.serialize){var c=u.serialize(r,t);if(null===c)return;if(c)return ha(c)}}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}throw new Error('No serializer defined for mark of type "'+r.type+'".')}),n)},this.serializeString=function(t){var r=!0,n=!1,o=void 0;try{for(var i,a=e.rules[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var s=i.value;if(s.serialize){var u=s.serialize(t,t.text);if(u)return u}}}catch(e){n=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw o}}},this.cruftNewline=function(e){return!("#text"===e.nodeName&&"\n"==e.nodeValue)}},fa=0;function ha(e){return ra.cloneElement(e,{key:fa++})}var da,pa,va,ya={"border-radius":1,"border-top-left-radius":1,"border-top-right-radius":1,"border-bottom-left-radius":1,"border-bottom-right-radius":1,"box-shadow":1,order:1,flex:function(e,t){return[t+"box-flex"]},"box-flex":1,"box-align":1,animation:1,"animation-duration":1,"animation-name":1,transition:1,"transition-duration":1,transform:1,"transform-style":1,"transform-origin":1,"backface-visibility":1,perspective:1,"box-pack":1},ma={animation:1,"column-count":1,columns:1,"font-weight":1,opacity:1,"order ":1,"z-index":1,zoom:1,flex:1,"box-flex":1,transform:1,perspective:1,"box-pack":1,"box-align":1,colspan:1,rowspan:1},ga=function(e){return e.length?e.charAt(0).toUpperCase()+e.substring(1):e},ka=ga,_a=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,ba="undefined"==typeof document?{}:document.documentElement.style,wa=(da=function(){for(var e in ba)if(_a.test(e))return e.match(_a)[0];return"WebkitOpacity"in ba?"Webkit":"KhtmlOpacity"in ba?"Khtml":""}(),pa=da.toLowerCase(),{style:da,css:"-"+pa+"-",dom:{Webkit:"WebKit",ms:"MS",o:"WebKit"}[da]||ka(da)}),xa=function(e,t){return t?t.toUpperCase():""},Aa=/[-\s]+(.)?/g,Oa=function(e){return e?e.replace(Aa,xa):""},Sa=/::/g,Ea=/([A-Z]+)([A-Z][a-z])/g,Ta=/([a-z\d])([A-Z])/g,Na=/_/g,Ba=function(e,t){return e?e.replace(Sa,"/").replace(Ea,"$1_$2").replace(Ta,"$1_$2").replace(Na,t||"-"):""},za=function(e){return Ba(e).toLowerCase()},ja=Oa,Ca=za,Pa=function(e){return e.length?e.charAt(0).toLowerCase()+e.substring(1):e},Ka=ga,Fa=wa,Ia=ya,Ma="undefined"==typeof document?{}:document.documentElement.style,Ra=function(e,t){t=t||{};var r=Pa(ja(e)),n=Ca(e),o=va?r:n,i=Fa.style?va?Fa.style:Fa.css:"";if(r in Ma)return t.asString?o:[o];var a=o,s=Ia[n],u=[];if(va&&(a=Ka(o)),"function"==typeof s){var c=s(o,i)||[];c&&!Array.isArray(c)&&(c=[c]),c.length&&(c=c.map((function(e){return va?Pa(ja(e)):Ca(e)}))),u=u.concat(c)}return i&&u.push(i+a),u.push(o),t.asString||1==u.length?u[0]:u},Da=Object.prototype.hasOwnProperty,La=function(e,t){return Da.call(e,t)},Ja=Object.prototype.toString,qa=Object.prototype.toString,Ua=Ra,Va=za,Wa=Oa,$a=La,Ha=function(e){return!!e&&"[object Object]"===Ja.call(e)},Ga=function(e){return"[object Function]"===qa.apply(e)},Qa=function(e,t,r,n){Ua(t).forEach((function(t){e[n?n(t):t]=r}))},Ya={cssUnitless:ma},Xa=function(e,t,r,n){"string"==typeof e&&(e=function(e){e=(e||"").split(";");var t={};return e.forEach((function(e){var r=e.split(":");2==r.length&&(t[r[0].trim()]=r[1].trim())})),t}(e)),(t=t||Ya).cssUnitless=t.cssUnitless||Ya.cssUnitless,n=n||{};var o,i,a,s,u,c,l,f,h=t.scope||{},d=null!=t.addUnits?t.addUnits:!h||null==h.addUnits||h.addUnits,p=(null!=t.cssUnitless?t.cssUnitless:h?h.cssUnitless:null)||{},v=(t.cssUnit||h?h.cssUnit:null)||"px",y=t.prefixProperties||(h?h.prefixProperties:null)||{},m=t.camelize?Wa:Va;for(a in e)if($a(e,a)){if(s=e[a],i=Va(r?r+a:a),o=!1,f=!1,Ga(s)&&(l=s.call(h||e,s,a,i,e),Ha(l)&&null!=l.value?(s=l.value,f=l.prefix,i=l.name?Va(l.name):i):s=l),c="number"==(u=typeof s)||"string"==u&&""!=s&&1*s==s,null==s||null==i||""===i)continue;if((c||"string"==u)&&(o=!0),!o&&null!=s.value&&s.prefix&&(o=!0,f=s.prefix,s=s.value),o){if(f=f||!!y[i],c&&(s=d&&!(i in p)?s+v:s+""),"border"!=i&&(i.indexOf("border")||~i.indexOf("radius")||~i.indexOf("width"))||!c||(i+="-width"),!i.indexOf("border-radius-")&&(i.replace(/border(-radius)(-(.*))/,(function(e,t,r){var n={"-top":["-top-left","-top-right"],"-left":["-top-left","-bottom-left"],"-right":["-top-right","-bottom-right"],"-bottom":["-bottom-left","-bottom-right"]};r in n?(i=[],n[r].forEach((function(e){i.push("border"+e+t)}))):i="border"+r+t})),Array.isArray(i))){i.forEach((function(e){f?Qa(n,e,s,m):n[m(e)]=s}));continue}f?Qa(n,i,s,m):n[m(i)]=s}else Xa(s,t,i+"-",n)}return n},Za=Xa,es=La,ts={prefixProperties:ya,cssUnitless:ma,object:Xa,string:function(e,t){e=Za(e,t);var r,n=[];for(r in e)es(e,r)&&n.push(r+": "+e[r]);return n.join("; ")}};const rs=e("@pie-lib:mask-markup:serialization"),ns=["span"],os=["em","strong","u"],is=(e,t)=>{const r=e.getAttribute(t);return n=(e=>{const t=/([\w-]*)\s*:\s*([^;]*)/g;let r;const n={};for(;r=t.exec(e);)n[r[1]]=r[2].trim();return n})(r),ts.object(n,{camelize:!0,addUnits:!1});var n},as=["border","class","style"],ss={b:"bold",em:"italic",u:"underline",s:"strikethrough",code:"code",strong:"strong"},us=[{deserialize(e,t){const r=ss[e.tagName.toLowerCase()];if(r)return rs("[deserialize] mark: ",r),{object:"mark",type:r,nodes:t(e.childNodes)}}},{deserialize:(e,t)=>{if(8===e.nodeType)return;if(3===e.nodeType)return{object:"text",leaves:[{text:e.textContent}]};const r=e.tagName.toLowerCase(),n=(e=>{if(!e.attributes||e.attributes.length<=0)return;const t={};let r;for(r=0;r<e.attributes.length;r++){const n=e.attributes[r];t[n.name]=n.value}return t})(e)||{};"audio"==r&&""==n.controls&&(n.controls=!0);const o=as.reduce((e=>(t,r)=>{if(!e.getAttribute)return t;if(e.getAttribute(r))switch(r){case"style":t.style=is(e,r);break;case"class":t.className=((e,t,r)=>{const n=e.getAttribute(r);return delete t.class,n})(e,t,r);break;default:t[r]=e.getAttribute(r)}return t})(e),{...n}),i=(e=>ns.includes(e)?"inline":os.includes(e)?"mark":"block")(r);return"math"===e.tagName.toLowerCase()?{isMath:!0,nodes:[e]}:{object:i,type:r,data:{dataset:{...e.dataset},attributes:{...o}},nodes:t(e.childNodes)}}}],cs=new function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};oa(this,e),la.call(this);var r=t.defaultBlock,n=void 0===r?"paragraph":r,o=t.parseHtml,i=void 0===o?ca:o,a=t.rules,s=void 0===a?[]:a;n=Uo.createProperties(n),this.rules=[].concat(aa(s),[ua]),this.defaultBlock=n,this.parseHtml=i}({rules:us,defaultBlock:"span"}),ls=r,fs=o,{get:hs}=t,{withStyles:ds}=i,ps=a;function vs(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}const ys=ds((e=>({para:{paddingTop:2*e.spacing.unit,paddingBottom:2*e.spacing.unit}})))((e=>ls.createElement("div",{className:e.classes.para},e.children))),ms=ds((()=>({spacer:{display:"inline-block",width:".75em"}})))((e=>ls.createElement("span",{className:e.classes.spacer}))),gs=["tbody","tr"],ks=(e,t,r,n,o,i)=>{if(!t)return null;const a=[];return(e.nodes||[]).forEach(((e,s)=>{const u=e.type?`${e.type}-${s}`:`${s}`;if(e.isMath)return a.push(ls.createElement("span",{dangerouslySetInnerHTML:{__html:`<math displaystyle="true">${e.nodes[0].innerHTML}</math>`}})),a;if(n){const u=n(e,t,r);if(u)return a.push(u),void("td"!==vs([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(ls.createElement(ms,{key:`spacer-${s}`})))}if("text"===e.object){const t=e.leaves.reduce(((e,t)=>{const r=t.text,n=((e,t)=>{const r=""===t.trim(),n=e&&e.type;return r&&gs.includes(n)?void 0:t})(o,r);return n?e+n:e}),""),r=(e=>{const t=e.leaves.find((e=>hs(e,"marks",[]).length));return t?t.marks[0]:null})(e);if(r){let e;for(e in ss)if(ss[e]===r.type){const r=e;a.push(ls.createElement(r,{key:u},t));break}}else t.length>0&&(a.push(t),"td"!==vs([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(ls.createElement(ms,{key:`spacer-${s}`})))}else{const o=ks(e,t,r,n,e,i);if("p"===e.type||"paragraph"===e.type)a.push(ls.createElement(ys,{key:u},o));else{const t=e.type;e.nodes&&e.nodes.length>0?a.push(ls.createElement(t,{key:u,...e.data.attributes},o)):a.push(ls.createElement(t,{key:u,...e.data.attributes}))}}})),a},_s=ds((()=>({main:{display:"initial"},tableStyle:{"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:"8px 12px",textAlign:"left"}}})))((e=>ls.createElement("div",{className:ps(e.classes.main,e.classes.tableStyle)},e.children)));class bs extends ls.Component{constructor(...e){super(...e),bs.prototype.__init.call(this)}static __initStatic(){this.propTypes={renderChildren:fs.func,layout:fs.object,value:fs.object,onChange:fs.func,elementType:fs.string}}__init(){this.handleChange=(e,t)=>{const r={...this.props.value,[e]:t};this.props.onChange(r)}}render(){const{value:e,layout:t,elementType:r}=this.props,n=ks(t,e,this.handleChange,this.props.renderChildren,null,r);return ls.createElement(_s,null,n)}}bs.__initStatic();const ws=/\{\{(\d+)\}\}/g;const xs=r,As=s,Os=o;var Ss;const Es=(e,t)=>{const{markup:r}=(o=t,(n=e)?{markup:n.replace(ws,((e,t)=>`<span data-component="${o}" data-id="${t}"></span>`))}:{markup:""});var n,o;const i=(e=>cs.deserialize(e,{toJSON:!0}))(r);return i.document},Ts=(e,t)=>((Ss=class extends xs.Component{static __initStatic(){this.propTypes={markup:Os.string,layout:Os.object,value:Os.object,onChange:Os.func,customMarkMarkupComponent:Os.func,elementType:Os.string}}componentDidUpdate(e){if(this.props.markup!==e.markup){const e=As.findDOMNode(this);(e&&e.querySelectorAll('[data-latex][data-math-handled="true"]')||[]).forEach((e=>{const t=e.querySelector("mjx-container");t&&e.removeChild(t);const r=e.getAttribute("data-raw");e.innerHTML=r,e.removeAttribute("data-math-handled")}))}}render(){const{markup:r,layout:n,value:o,onChange:i,elementType:a}=this.props,s=n||Es(r,e);return xs.createElement(bs,{elementType:a,layout:s,value:o,onChange:i,renderChildren:t(this.props)})}}).__initStatic(),Ss),Ns=r,Bs=s,zs=o,{withStyles:js}=i,{Chip:Cs}=u,Ps=a,{color:Ks}=c,{renderMath:Fs}=h,{DragSource:Is}=v;class Ms extends Ns.Component{constructor(...e){super(...e),Ms.prototype.__init.call(this),Ms.prototype.__init2.call(this),Ms.prototype.__init3.call(this),Ms.prototype.__init4.call(this)}static __initStatic(){this.propTypes={disabled:zs.bool,choice:zs.object,classes:zs.object,connectDragSource:zs.func}}__init(){this.startDrag=()=>{const{connectDragSource:e,disabled:t}=this.props;t||e(this.dragContainerRef)}}__init2(){this.handleTouchStart=e=>{e.preventDefault(),this.longPressTimer=setTimeout((()=>{this.startDrag(e)}),500)}}__init3(){this.handleTouchEnd=()=>{clearTimeout(this.longPressTimer)}}__init4(){this.handleTouchMove=()=>{clearTimeout(this.longPressTimer)}}componentDidMount(){this.dragContainerRef&&(this.dragContainerRef.addEventListener("touchstart",this.handleTouchStart,{passive:!1}),this.dragContainerRef.addEventListener("touchend",this.handleTouchEnd),this.dragContainerRef.addEventListener("touchmove",this.handleTouchMove))}componentWillUnmount(){this.dragContainerRef&&(this.dragContainerRef.removeEventListener("touchstart",this.handleTouchStart),this.dragContainerRef.removeEventListener("touchend",this.handleTouchEnd),this.dragContainerRef.removeEventListener("touchmove",this.handleTouchMove))}componentDidUpdate(){Fs(this.rootRef)}render(){const{connectDragSource:e,choice:t,classes:r,disabled:n}=this.props;return e(Ns.createElement("span",{className:Ps(r.choice,n&&r.disabled),ref:e=>{this.dragContainerRef=Bs.findDOMNode(e)}},Ns.createElement(Cs,{clickable:!1,disabled:!0,ref:e=>{this.rootRef=Bs.findDOMNode(e)},className:r.chip,label:Ns.createElement("span",{className:r.chipLabel,ref:e=>{e&&(e.innerHTML=t.value||" ")}}," "),variant:n?"outlined":void 0})),{})}}Ms.__initStatic();const Rs=js((e=>({choice:{border:`solid 0px ${e.palette.primary.main}`,borderRadius:2*e.spacing.unit,margin:e.spacing.unit/2,transform:"translate(0, 0)"},chip:{backgroundColor:Ks.white(),border:`1px solid ${Ks.text()}`,color:Ks.text(),alignItems:"center",display:"inline-flex",height:"initial",minHeight:"32px",fontSize:"inherit",whiteSpace:"pre-wrap",maxWidth:"374px",pointerEvents:"none",borderRadius:"3px",paddingTop:"12px",paddingBottom:"12px"},chipLabel:{whiteSpace:"normal","& img":{display:"block",padding:"2px 0"},"& mjx-frac":{fontSize:"120% !important"}},disabled:{opacity:.6}})))(Ms),Ds=Is("MaskBlank",{canDrag:e=>!e.disabled,beginDrag:e=>({choice:e.choice,instanceId:e.instanceId})},((e,t)=>({connectDragSource:e.dragSource(),isDragging:t.isDragging()})))(Rs),Ls=r,Js=o,{findKey:qs}=t,{DragDroppablePlaceholder:Us}=v;class Vs extends Ls.Component{constructor(...e){super(...e),Vs.prototype.__init.call(this)}static __initStatic(){this.propTypes={disabled:Js.bool,duplicates:Js.bool,choices:Js.arrayOf(Js.shape({label:Js.string,value:Js.string})),value:Js.object,choicePosition:Js.string.isRequired}}__init(){this.getStyleForWrapper=()=>{const{choicePosition:e}=this.props;switch(e){case"above":return{margin:"0 0 40px 0"};case"below":return{margin:"40px 0 0 0"};case"right":return{margin:"0 0 0 40px"};default:return{margin:"0 40px 0 0"}}}}render(){const{disabled:e,duplicates:t,choices:r,value:n}=this.props,o=r.filter((e=>{if(!0===t)return!0;return void 0===qs(n,(t=>t===e.id))})),i={...this.getStyleForWrapper(),minWidth:"100px"};return Ls.createElement("div",{style:i},Ls.createElement(Us,{disabled:e},o.map(((t,r)=>Ls.createElement(Ds,{key:`${t.value}-${r}`,disabled:e,choice:t})))))}}Vs.__initStatic();const{colors:{grey:Ws}}=u,{Chip:$s}=u,Hs=r,Gs=s,Qs=o,Ys=e,{withStyles:Xs}=i,Zs=a,{color:eu}=c,{renderMath:tu}=h,{DragSource:ru}=v,{DropTarget:nu}=v;const ou=Ys("pie-lib:mask-markup:blank"),iu=Xs((()=>({content:{border:`solid 0px ${eu.primary()}`,minWidth:"200px",touchAction:"none",overflow:"hidden",whiteSpace:"nowrap"},chip:{backgroundColor:eu.background(),border:`2px dashed ${eu.text()}`,color:eu.text(),fontSize:"inherit",maxWidth:"374px",position:"relative",borderRadius:"3px"},chipLabel:{whiteSpace:"normal",pointerEvents:"none","& img":{display:"block",padding:"2px 0"},"& p":{marginTop:"0",marginBottom:"0"},"& mjx-frac":{fontSize:"120% !important"}},hidden:{color:"transparent",opacity:0},dragged:{position:"absolute",left:16,maxWidth:"60px"},correct:{border:`solid 1px ${eu.correct()}`},incorrect:{border:`solid 1px ${eu.incorrect()}`},over:{whiteSpace:"nowrap",overflow:"hidden"},parentOver:{border:`1px solid ${Ws[500]}`,backgroundColor:`${Ws[300]}`}})));class au extends Hs.Component{constructor(){super(),au.prototype.__init.call(this),au.prototype.__init2.call(this),au.prototype.__init3.call(this),this.state={height:0,width:0}}__init(){this.handleImageLoad=()=>{this.updateDimensions()}}handleElements(){const e=function(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}([this,"access",e=>e.spanRef,"optionalAccess",e=>e.querySelector,"call",e=>e("img")]);e?e.onload=this.handleImageLoad:setTimeout((()=>{this.updateDimensions()}),300)}componentDidMount(){this.handleElements(),this.rootRef&&this.rootRef.addEventListener("touchstart",this.handleTouchStart,{passive:!1})}componentDidUpdate(e){tu(this.rootRef);const{choice:t}=this.props,{choice:r}=e;if(JSON.stringify(t)!==JSON.stringify(r)){if(!t)return void this.setState({height:0,width:0});this.handleElements()}}componentWillUnmount(){this.rootRef&&this.rootRef.removeEventListener("touchstart",this.handleTouchStart)}__init2(){this.handleTouchStart=e=>{e.preventDefault(),this.touchStartTimer=setTimeout((()=>{this.startDrag()}),300)}}__init3(){this.startDrag=()=>{const{connectDragSource:e,disabled:t}=this.props;t||e(this.rootRef)}}updateDimensions(){if(this.spanRef&&this.rootRef){this.rootRef.style.width="auto";const e=(this.spanRef.offsetWidth||0)+24,t=(this.spanRef.offsetHeight||0)+24,r=parseFloat(this.props.emptyResponseAreaWidth)||0,n=parseFloat(this.props.emptyResponseAreaHeight)||0,o=e<=r?r:e,i=t<=n?n:t;this.setState((e=>({width:o>r?o:e.width,height:i>n?i:e.height}))),this.rootRef.style.width=`${o}px`,this.rootRef.style.height=`${i}px`}}addDraggableFalseAttributes(e){e.childNodes.forEach((e=>{(e instanceof Element||e instanceof HTMLDocument)&&e.setAttribute("draggable",!1)}))}getRootDimensions(){const e=isNaN(parseFloat(this.props.emptyResponseAreaWidth))?0:parseFloat(this.props.emptyResponseAreaWidth),t=isNaN(parseFloat(this.props.emptyResponseAreaHeight))?0:parseFloat(this.props.emptyResponseAreaHeight);return{...{height:this.state.height||t,width:this.state.width||e},...e?{}:{minWidth:90},...t?{}:{minHeight:32}}}render(){const{disabled:e,choice:t,classes:r,isOver:n,dragItem:o,correct:i}=this.props,a=o&&n&&o.choice.value,s=t&&t.value;return Hs.createElement($s,{clickable:!1,disabled:!0,ref:e=>{this.rootRef=Gs.findDOMNode(e)},component:"span",label:Hs.createElement(Hs.Fragment,null,Hs.createElement("span",{className:Zs(r.chipLabel,n&&r.over,{[r.hidden]:a}),ref:e=>{e&&(this.spanRef=Gs.findDOMNode(e),e.innerHTML=s||"",this.addDraggableFalseAttributes(e))}}," "),a&&Hs.createElement("span",{className:Zs(r.chipLabel,n&&r.over,r.dragged),ref:e=>{e&&(this.spanRef=Gs.findDOMNode(e),e.innerHTML=a||"",this.addDraggableFalseAttributes(e))}}," ")),className:Zs(r.chip,n&&r.over,n&&r.parentOver,{[r.correct]:void 0!==i&&i,[r.incorrect]:void 0!==i&&!i}),variant:e?"outlined":void 0,style:{...this.getRootDimensions()}})}}au.defaultProps={emptyResponseAreaWidth:0,emptyResponseAreaHeight:0},au.propTypes={id:Qs.oneOfType([Qs.string,Qs.number]),disabled:Qs.bool,duplicates:Qs.bool,choice:Qs.object,classes:Qs.object,isOver:Qs.bool,dragItem:Qs.object,correct:Qs.bool,onChange:Qs.func,emptyResponseAreaWidth:Qs.oneOfType([Qs.string,Qs.number]),emptyResponseAreaHeight:Qs.oneOfType([Qs.string,Qs.number])};const su=iu(au),uu=iu((({connectDragSource:e,connectDropTarget:t,...r})=>{const{classes:n,isOver:o}=r;return t(e(Hs.createElement("span",{className:Zs(n.content,o&&n.over)},Hs.createElement(su,{...r}))))})),cu=nu("MaskBlank",{drop(e,t){const r=t.getItem();return ou("props.instanceId",e.instanceId,"draggedItem.instanceId:",r.instanceId),r.id!==e.id&&e.onChange(e.id,r.choice.id),{dropped:r.id!==e.id}},canDrop:(e,t)=>t.getItem().instanceId===e.instanceId},((e,t)=>({connectDropTarget:e.dropTarget(),isOver:t.isOver(),dragItem:t.getItem()})))(uu),lu=ru("MaskBlank",{canDrag:e=>!e.disabled&&!!e.choice,beginDrag:e=>({id:e.id,choice:e.choice,instanceId:e.instanceId,fromChoice:!0}),endDrag(e,t){const r=t.getDropResult();if(!r||r.dropped){t.getItem().fromChoice&&e.onChange(e.id,void 0)}}},((e,t)=>({connectDragSource:e.dragSource(),isDragging:t.isDragging()})))(cu),fu=r,hu=o,{renderMath:du}=h,pu=Ts("blank",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("blank"===o.component){const{disabled:i,duplicates:a,correctResponse:s,feedback:u,showCorrectAnswer:c,emptyResponseAreaWidth:l,emptyResponseAreaHeight:f}=e,h=c?s[o.id]:r[o.id],d=h&&e.choices.find((e=>e.id===h));return fu.createElement(lu,{key:`${t.type}-${o.id}`,correct:c||u&&u[o.id],disabled:i,duplicates:a,choice:d,id:o.id,emptyResponseAreaWidth:l,emptyResponseAreaHeight:f,onChange:n})}}));class vu extends fu.Component{constructor(...e){super(...e),vu.prototype.__init.call(this)}static __initStatic(){this.propTypes={markup:hu.string,layout:hu.object,choicesPosition:hu.string,choices:hu.arrayOf(hu.shape({label:hu.string,value:hu.string})),value:hu.object,onChange:hu.func,duplicates:hu.bool,disabled:hu.bool,feedback:hu.object,correctResponse:hu.object,showCorrectAnswer:hu.bool,emptyResponseAreaWidth:hu.oneOfType([hu.string,hu.number]),emptyResponseAreaHeight:hu.oneOfType([hu.string,hu.number])}}UNSAFE_componentWillReceiveProps(){this.rootRef&&du(this.rootRef)}componentDidUpdate(){du(this.rootRef)}__init(){this.getPositionDirection=e=>{let t,r,n;switch(e){case"left":t="row",n="center";break;case"right":t="row-reverse",r="flex-end",n="center";break;case"below":t="column-reverse";break;default:t="column"}return{flexDirection:t,justifyContent:r,alignItems:n}}}render(){const{markup:e,duplicates:t,layout:r,value:n,onChange:o,choicesPosition:i,choices:a,correctResponse:s,disabled:u,feedback:c,showCorrectAnswer:l,emptyResponseAreaWidth:f,emptyResponseAreaHeight:h}=this.props,d=i||"below",p={display:"flex",minWidth:"100px",...this.getPositionDirection(d)};return fu.createElement("div",{ref:e=>e&&(this.rootRef=e),style:p},fu.createElement(Vs,{choicePosition:d,duplicates:t,choices:a,value:n,disabled:u}),fu.createElement(pu,{elementType:"drag-in-the-blank",markup:e,layout:r,value:n,choices:a,onChange:o,disabled:u,duplicates:t,feedback:c,correctResponse:s,showCorrectAnswer:l,emptyResponseAreaWidth:f,emptyResponseAreaHeight:h}))}}vu.__initStatic();const yu=r,{withStyles:mu}=i,gu=a,{color:ku}=c,_u=y;function bu(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}mu((()=>({editableHtmlCustom:{display:"inline-block",verticalAlign:"middle",margin:"4px",borderRadius:"4px",border:`1px solid ${ku.black()}`},correct:{border:`1px solid ${ku.correct()}`},incorrect:{border:`1px solid ${ku.incorrect()}`}})))(Ts("input",(e=>(t,r)=>{const{adjustedLimit:n,disabled:o,feedback:i,showCorrectAnswer:a,maxLength:s,spellCheck:u,classes:c,pluginProps:l,onChange:f}=e,h=bu([t,"access",e=>e.data,"optionalAccess",e=>e.dataset])||{};if("input"===h.component){const d=(e.choices&&h&&e.choices[h.id]||[])[0],p=a?d&&d.label:r[h.id]||"",v=s&&s[h.id],y=i&&i[h.id],m=a||"correct"===y,g=!a&&"incorrect"===y,k=e=>{const t={...r,[h.id]:e};f(t)},_=e=>{if("Enter"===e.key||13===e.keyCode)return!1};return yu.createElement(_u,{id:h.id,key:`${t.type}-input-${h.id}`,disabled:a||o,disableUnderline:!0,onChange:k,markup:p||"",charactersLimit:n?v:25,activePlugins:["languageCharacters"],pluginProps:l,languageCharactersProps:[{language:"spanish"}],spellCheck:u,width:`calc(${v}em + 42px)`,onKeyDown:_,autoWidthToolbar:!0,toolbarOpts:{minWidth:"auto",noBorder:!0,isHidden:!!bu([l,"optionalAccess",e=>e.characters,"optionalAccess",e=>e.disabled])},className:gu(c.editableHtmlCustom,{[c.correct]:m,[c.incorrect]:g})})}})));var wu=Ts("input",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("input"===o.component)return e.customMarkMarkupComponent(o.id)}));const xu=r,Au=o,{Button:Ou}=u,{InputLabel:Su}=u,{Menu:Eu}=u,{MenuItem:Tu}=u,{ArrowDropDown:Nu}=l,{ArrowDropUp:Bu}=l,{Close:zu}=l,{Check:ju}=l,{withStyles:Cu}=i,Pu=a,{color:Ku}=c,{renderMath:Fu}=h;class Iu extends xu.Component{static __initStatic(){this.propTypes={id:Au.string,value:Au.string,disabled:Au.bool,onChange:Au.func,classes:Au.object,correct:Au.bool,choices:Au.arrayOf(Au.shape({value:Au.string,label:Au.string})),showCorrectAnswer:Au.bool,singleQuery:Au.bool,correctValue:Au.string}}constructor(e){super(e),Iu.prototype.__init.call(this),Iu.prototype.__init2.call(this),Iu.prototype.__init3.call(this),Iu.prototype.__init4.call(this),Iu.prototype.__init5.call(this),this.state={anchorEl:null,highlightedOptionId:null,menuWidth:null,previewValue:null},this.hiddenRef=xu.createRef(),this.buttonRef=xu.createRef(),this.previewRef=xu.createRef(),this.elementRefs=[]}componentDidMount(){this.hiddenRef.current&&null===this.state.menuWidth&&this.setState({menuWidth:this.hiddenRef.current.clientWidth})}componentDidUpdate(e,t){const r=this.hiddenRef.current;if(!t.anchorEl&&this.state.anchorEl&&this.elementRefs.forEach((e=>{if(!e)return;const t=e.querySelector("[data-latex], [data-raw]"),r=e.querySelector("mjx-container"),n=e.querySelector('[data-math-handled="true"]');!t||n&&r||Fu(e)})),r){const e=r.clientWidth;e!==this.state.menuWidth&&(this.elementRefs.forEach((e=>{e&&Fu(e)})),Fu(r),this.setState({menuWidth:e}))}}__init(){this.handleClick=e=>this.setState({anchorEl:e.currentTarget})}__init2(){this.handleClose=()=>{const{value:e}=this.props;this.setState({anchorEl:null,previewValue:null,highlightedOptionId:null}),!e&&this.previewRef.current&&(this.previewRef.current.innerHTML="")}}__init3(){this.handleHighlight=e=>{const t={highlightedOptionId:`dropdown-option-${this.props.id}-${e}`};this.props.value||(t.previewValue=this.props.choices[e].value),this.setState(t)}}__init4(){this.handleSelect=(e,t)=>{this.props.onChange(this.props.id,e),this.handleHighlight(t),this.handleClose()}}__init5(){this.handleHover=e=>{if(this.props.value)return;const t=`dropdown-option-${this.props.id}-${e}`,r=this.state.previewValue;this.setState({highlightedOptionId:t,previewValue:r},(()=>{const t=this.elementRefs[e],r=this.previewRef.current;t&&r&&(r.innerHTML=t.innerHTML)}))}}getLabel(e,t){const r=(e||[]).find((e=>e.value===t));return r?r.label.trim():void 0}render(){const{classes:e,id:t,correct:r,disabled:n,value:o,choices:i,showCorrectAnswer:a,singleQuery:s,correctValue:u}=this.props,{anchorEl:c}=this.state,l=Boolean(c),f=`dropdown-button-${t}`,h=`dropdown-menu-${t}`,d=`dropdown-value-${t}`;let p;this.elementRefs=[],n&&void 0!==r&&(p=r||a?e.disabledCorrect:e.disabledIncorrect);const v=parseInt(t,10)+1,y=s?"Query-label":`Query-label-${v}`,m=s?"Query":`Query ${v}`;let g=null;return n&&void 0!==r&&(g=r||a?xu.createElement(ju,{className:Pu(e.correctnessIndicatorIcon,e.correctIcon)}):xu.createElement(zu,{className:Pu(e.correctnessIndicatorIcon,e.incorrectIcon)})),xu.createElement(xu.Fragment,null,xu.createElement("div",{ref:this.hiddenRef,style:{position:"absolute",visibility:"hidden",top:0,left:0},tabIndex:-1,"aria-hidden":"true"},(i||[]).map(((t,r)=>xu.createElement(Tu,{key:r,classes:{root:e.menuRoot,selected:e.selected},tabIndex:-1,"aria-hidden":"true"},xu.createElement("span",{className:e.label,dangerouslySetInnerHTML:{__html:t.label}}))))),xu.createElement(Su,{className:e.srOnly,id:y,tabIndex:-1,"aria-hidden":"true"},m),xu.createElement(Ou,{ref:this.buttonRef,style:{...this.state.menuWidth&&{minWidth:`calc(${this.state.menuWidth}px + 8px)`},borderWidth:l?"2px":"1px",transition:"border-width 0.2s ease-in-out"},"aria-controls":l?h:void 0,"aria-haspopup":"listbox","aria-expanded":l?"true":void 0,"aria-activedescendant":this.state.highlightedOptionId,onClick:this.handleClick,classes:{root:e.root,disabled:p},disabled:n,id:f,role:"combobox","aria-label":`Select an option for ${m}`,"aria-labelledby":d},g,xu.createElement("span",{id:d,ref:this.previewRef,className:e.label,dangerouslySetInnerHTML:{__html:u||(l&&this.state.previewValue?this.getLabel(i,this.state.previewValue):this.getLabel(i,o)||"")}}),l?xu.createElement(Bu,null):xu.createElement(Nu,null)),xu.createElement(Eu,{id:h,anchorEl:c,className:e.selectMenu,keepMounted:!0,open:l,onClose:this.handleClose,getContentAnchorEl:null,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},PaperProps:this.state.menuWidth?{style:{minWidth:this.state.menuWidth,padding:"4px"}}:void 0,MenuListProps:{"aria-labelledby":f,role:"listbox",disablePadding:!0}},(i||[]).map(((r,n)=>{const i=`dropdown-option-${t}-${n}`;return xu.createElement(Tu,{id:i,classes:{root:e.menuRoot,selected:e.selected},key:`${r.label}-${n}`,value:r.value,onClick:()=>this.handleSelect(r.value,n),role:"option","aria-selected":this.state.highlightedOptionId===i?"true":void 0,onMouseOver:()=>this.handleHover(n)},xu.createElement("span",{ref:e=>this.elementRefs[n]=e,className:e.label,dangerouslySetInnerHTML:{__html:r.label}}),xu.createElement("span",{className:e.selectedIndicator,dangerouslySetInnerHTML:{__html:r.value===o?" ✓":""}}))}))))}}Iu.__initStatic();var Mu=Cu((()=>({root:{color:Ku.text(),border:`1px solid ${Ku.borderGray()}`,borderRadius:"4px",justifyContent:"space-between",backgroundColor:Ku.background(),position:"relative",height:"45px",width:"fit-content",margin:"2px",textTransform:"none","& span":{paddingRight:"5px"},"& svg":{position:"absolute",right:0,top:"calc(50% - 12px)",pointerEvents:"none",color:Ku.text(),marginLeft:"5px"},"&:focus, &:focus-visible":{outline:`3px solid ${Ku.tertiary()}`,outlineOffset:"2px",borderWidth:"3px"}},disabledCorrect:{borderWidth:"2px",borderColor:Ku.correct(),color:`${Ku.text()} !important`},disabledIncorrect:{borderWidth:"2px",borderColor:Ku.incorrectWithIcon(),color:`${Ku.text()} !important`},selectMenu:{backgroundColor:Ku.background(),border:`1px solid ${Ku.correct()} !important`,"&:hover":{border:`1px solid ${Ku.text()} `,borderColor:"initial"},"&:focus":{border:`1px solid ${Ku.text()}`,borderColor:"initial"},"& .MuiList-root":{padding:0}},selected:{color:`${Ku.text()} !important`,backgroundColor:`${Ku.background()} !important`,"&:hover":{color:Ku.text(),backgroundColor:`${Ku.dropdownBackground()} !important`}},menuRoot:{color:Ku.text(),backgroundColor:Ku.background(),"&:focus, &:focus-visible":{outline:`3px solid ${Ku.tertiary()}`,outlineOffset:"-1px"},"&:focus":{color:Ku.text(),backgroundColor:Ku.background()},"&:hover":{color:Ku.text(),backgroundColor:Ku.dropdownBackground()},boxSizing:"border-box",padding:"25px",borderRadius:"4px"},label:{fontSize:"max(1rem, 14px)"},selectedIndicator:{fontSize:"max(1rem, 14px)",position:"absolute",right:"10px"},srOnly:{position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"},correctnessIndicatorIcon:{color:`${Ku.white()} !important`,position:"absolute",top:"-8px !important",left:"-8px",marginLeft:"0 !important",borderRadius:"50%",fontSize:"16px",padding:"2px"},correctIcon:{backgroundColor:Ku.correct()},incorrectIcon:{backgroundColor:Ku.incorrectWithIcon()}})))(Iu);const Ru=r;Ts("dropdown",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("dropdown"===o.component){const{choices:i,disabled:a,feedback:s,showCorrectAnswer:u}=e,c=i&&i[o.id]&&i[o.id].find((e=>e.correct)),l=u?c&&c.value:r[o.id];return Ru.createElement(Mu,{key:`${t.type}-dropdown-${o.id}`,correct:s&&s[o.id]&&"correct"===s[o.id],disabled:a||u,value:l,correctValue:u?c&&c.label:void 0,id:o.id,onChange:n,choices:i[o.id],showCorrectAnswer:u,singleQuery:1==Object.keys(i).length})}}));const Du=r,Lu=o,Ju=a,{isEqual:qu}=t,{isEmpty:Uu}=t,{withStyles:Vu}=i,{Tooltip:Wu}=u,{color:$u}=c,{Collapsible:Hu}=c,{Readable:Gu}=c,{hasText:Qu}=c,{hasMedia:Yu}=c,{PreviewPrompt:Xu}=c,{UiLayout:Zu}=c,ec=f,tc=s,{mq:rc}=d,{HorizontalKeypad:nc}=d,{updateSpans:oc}=d,ic=p,{renderMath:ac}=h;function sc(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}let uc=!1;const cc=/(\{\{\d+\}\})/gm,lc=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function fc(e=[],t){return 30*Math.floor(e.length/5)+("miscellaneous"===t?600:500)}function hc(e,t){const{responses:r,disabled:n,markup:o,printMode:i,alwaysShowCorrect:a}=e||{};if(o){if(t.showCorrect)return Object.keys(r||{}).reduce(((e,t)=>(e[t]=sc([r,"optionalAccess",e=>e[t],"optionalAccess",e=>e.answer]),e)),{});return o.split(cc).filter((e=>e)).reduce(((e,r)=>{if(r.match(cc)){const o=dc.getResponseKey(r),s=t.session.answers[`r${o}`];if(i&&!a){const t="\\ \\ ".repeat(30)+"\\embed{newLine}[] ";return{...e,[o]:`\\MathQuillMathField[r${o}]{${t.repeat(3)}}`}}return n?{...e,[o]:`\\embed{answerBlock}[r${o}]`}:{...e,[o]:`\\MathQuillMathField[r${o}]{${s&&s.value||""}}`}}return e}),{})}}class dc extends Du.Component{static __initStatic(){this.getResponseKey=e=>(e||"").replaceAll("{{","").replaceAll("}}","")}static __initStatic2(){this.propTypes={classes:Lu.object,session:Lu.object.isRequired,onSessionChange:Lu.func,model:Lu.object.isRequired}}constructor(e){super(e),dc.prototype.__init.call(this),dc.prototype.__init2.call(this),dc.prototype.__init3.call(this),dc.prototype.__init4.call(this),dc.prototype.__init5.call(this),dc.prototype.__init6.call(this),dc.prototype.__init7.call(this),dc.prototype.__init8.call(this),dc.prototype.__init9.call(this),dc.prototype.__init10.call(this),dc.prototype.__init11.call(this),dc.prototype.__init12.call(this),dc.prototype.__init13.call(this);const t={},{model:r,session:n}=e||{},{markup:o,alwaysShowCorrect:i}=r||{},{answers:a}=n||{};o&&(o||"").replace(cc,(e=>{const r=dc.getResponseKey(e),n=a&&a[`r${r}`];t[`r${r}`]={value:sc([n,"optionalAccess",e=>e.value])||""}})),this.state={session:{...e.session,answers:t},activeAnswerBlock:"",showCorrect:i||!1}}UNSAFE_componentWillMount(){const{classes:e}=this.props;if("undefined"!=typeof window){let t=ic.getInterface(2);uc||(t.registerEmbed("answerBlock",(t=>({htmlString:`<div class="${e.blockContainer}">\n <div class="${e.blockResponse}" id="${t}Index">R</div>\n <div class="${e.blockMath}">\n <span id="${t}"></span>\n </div>\n </div>`,text:()=>"text",latex:()=>`\\embed{answerBlock}[${t}]`}))),uc=!0)}}__init(){this.handleAnswerBlockDomUpdate=()=>{const{model:e,classes:t}=this.props,{session:r,showCorrect:n}=this.state,o=r.answers;this.root&&e.disabled&&!n&&Object.keys(o).forEach((r=>{const n=this.root.querySelector(`#${r}`),i=this.root.querySelector(`#${r}Index`);if(n){let a=ic.getInterface(2);const s=o[r];n.textContent=s&&s.value||"",e.view&&(n.parentElement.parentElement.classList.remove(t.correct),n.parentElement.parentElement.classList.remove(t.incorrect)),a.StaticMath(n),i.textContent="R"}})),ac(this.root)}}UNSAFE_componentWillReceiveProps(e){const{model:t}=this.props,{model:r={}}=e||{},{markup:n="",env:o={}}=t||{},{markup:i="",env:a={},alwaysShowCorrect:s=!1}=r,u=e=>e&&"evaluate"===e.mode;u(o)&&u(a)||this.setState((e=>({...e.session,showCorrect:!1}))),s&&this.setState({showCorrect:!0});const c=n.match(cc),l=i.match(cc);if(!qu(c,l)){const e={},t=this.state.session.answers;(l||[]).forEach((r=>{const n=dc.getResponseKey(r),o=t&&t[`r${n}`];e[`r${n}`]={value:sc([o,"optionalAccess",e=>e.value])||""}})),this.setState((t=>({session:{...t.session,answers:e}})),(()=>{this.props.onSessionChange(this.state.session),this.handleAnswerBlockDomUpdate()}))}}shouldComponentUpdate(e,t){const r=qu(this.props.model,e.model),n=qu(this.state,t);return!r||!n}componentDidMount(){this.handleAnswerBlockDomUpdate(),setTimeout((()=>ac(this.root)),100)}componentDidUpdate(){this.handleAnswerBlockDomUpdate()}__init2(){this.onSubFieldFocus=e=>{this.setState({activeAnswerBlock:e})}}__init3(){this.toNodeData=e=>{if(!e)return;const{type:t,value:r}=e;return"command"===t||"cursor"===t?e:"answer"===t?{type:"answer",...e}:"clear"===r?{type:"clear"}:{type:"write",value:r}}}__init4(){this.setInput=e=>{this.input=e}}__init5(){this.onClick=e=>{const t=this.toNodeData(e);"clear"===t.type?this.input.clear():"command"===t.type?Array.isArray(t.value)?t.value.forEach((e=>{this.input.cmd(e)})):this.input.cmd(t.value):"cursor"===t.type?this.input.keystroke(t.value):this.input.write(t.value),this.input.focus()}}__init6(){this.callOnSessionChange=()=>{const{onSessionChange:e}=this.props;e&&e(this.state.session)}}__init7(){this.toggleShowCorrect=e=>{this.setState({showCorrect:e},this.handleAnswerBlockDomUpdate)}}__init8(){this.subFieldChanged=(e,t)=>{oc(),e&&this.setState((r=>({session:{...r.session,answers:{...r.session.answers,[e]:{value:t}}}})),this.callOnSessionChange)}}__init9(){this.getFieldName=(e,t)=>{const{answers:r}=this.state.session;if(Object.keys(r||{}).length){return Object.keys(r).find((r=>{const n=t[r];return n&&n.id==e.id}))}}}__init10(){this.onBlur=e=>{const{relatedTarget:t,currentTarget:r}=e||{};const n=function e(t,r=0){if(!t||r>=16)return null;const n=t.offsetParent;return n?"tooltip"===n.getAttribute("role")?n:e(n,r+1):null}(t),o=n?function e(t,r=0){if(!t||r>=4)return null;const n=sc([t,"optionalAccess",e=>e.children,"optionalAccess",e=>e[0]]);return n?n.attributes&&n.attributes["data-keypad"]?n:e(n,r+1):null}(n):null;t&&r&&sc([o,"optionalAccess",e=>e.attributes,"access",e=>e["data-keypad"]])||this.setState({activeAnswerBlock:""})}}setTooltipRef(e){setTimeout((()=>{if(e&&lc){const e=document.querySelector("[role='tooltip']");if(e){e.firstChild.setAttribute("tabindex","-1")}}}),1)}__init11(){this.renderTeacherInstructions=()=>{const{model:e,classes:t}=this.props,{teacherInstructions:r,animationsDisabled:n}=e||{},o=r&&(Qu(r)||Yu(r)),i=Du.createElement(Xu,{defaultClassName:"teacher-instructions",prompt:r});return o&&Du.createElement("div",{className:t.collapsible},n?i:Du.createElement(Hu,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},i))}}__init12(){this.renderRationale=()=>{const{model:e,classes:t}=this.props,{rationale:r,animationsDisabled:n}=e||{},o=Du.createElement(Xu,{prompt:r});return r&&(Qu(r)||Yu(r))&&Du.createElement("div",{className:t.collapsible},n?o:Du.createElement(Hu,{labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},o))}}__init13(){this.renderPlayerContent=()=>{const{model:e,classes:t}=this.props,{activeAnswerBlock:r,showCorrect:n,session:o}=this.state,{correctness:i,disabled:a,view:s,responses:u,equationEditor:c,customKeys:l,feedback:f,env:{mode:h}={},printMode:d,alwaysShowCorrect:p}=e||{},v=Uu(u),y=function(e=[]){return e.map((e=>({name:e,latex:e,write:e,label:e})))}(l),m=hc(e,this.state)||"",g=d&&!p;return Du.createElement("div",{className:t.inputAndKeypadContainer},Du.createElement(wu,{disabled:a,markup:e.markup,value:{},customMarkMarkupComponent:e=>{const u="evaluate"===h&&f&&f[e],l=Du.createElement(rc.Static,{className:t.static,ref:e=>{this.mqStatic=e||this.mqStatic},latex:m[e],onSubFieldChange:this.subFieldChanged,getFieldName:this.getFieldName,setInput:this.setInput,onSubFieldFocus:this.onSubFieldFocus,onBlur:this.onBlur});return Du.createElement("div",{className:Ju(t.expression,{[t.incorrect]:!v&&!u&&!n,[t.correct]:!v&&(u||n),[t.showCorrectness]:!v&&a&&i&&!s,[t.correctAnswerShown]:n})},Du.createElement(Wu,{ref:e=>this.setTooltipRef(e),enterTouchDelay:0,interactive:!0,open:r===`r${e}`,classes:{tooltip:t.keypadTooltip,popper:t.keypadTooltipPopper},title:Object.keys(o.answers).map((e=>e===r&&!(n||a)&&Du.createElement("div",{"data-keypad":!0,key:e,className:t.responseContainer,style:{width:fc(y,c)}},Du.createElement(nc,{additionalKeys:y,mode:c||6,onClick:this.onClick}))||null))},g?Du.createElement("div",{className:t.printContainer},l):l))}}))}}render(){const{model:e,classes:t}=this.props,{showCorrect:r}=this.state,{prompt:n,env:{mode:o,role:i}={},extraCSSRules:a,correctness:s,responses:u,language:c,showNote:l,note:f}=e||{},h=!Uu(u)&&s&&"correct"!==s.correctness,d=(r||"view"===o&&"instructor"===i)&&l&&f;return Du.createElement(Zu,{extraCSSRules:a,className:t.mainContainer,ref:e=>{const t=tc.findDOMNode(e);this.root=t||this.root}},Du.createElement("div",{className:t.main},"gather"===o&&Du.createElement("h2",{className:t.srOnly},"Math Equation Response Question"),Du.createElement("div",{className:t.main},h&&Du.createElement(ec,{language:c,className:t.toggle,show:!0,toggled:r,onToggle:this.toggleShowCorrect})),this.renderTeacherInstructions(),n&&Du.createElement("div",{className:t.promptContainer},Du.createElement(Xu,{prompt:n})),Du.createElement(Gu,{false:!0},this.renderPlayerContent()),d&&Du.createElement("div",{className:Ju(t.note,"note"),dangerouslySetInnerHTML:{__html:f}}),this.renderRationale()))}}dc.__initStatic(),dc.__initStatic2();var pc=Vu((e=>({mainContainer:{color:$u.text(),backgroundColor:$u.background(),display:"inline-block"},tooltip:{background:`${$u.primaryLight()} !important`,color:$u.text(),padding:2*e.spacing.unit,border:`1px solid ${$u.secondary()}`,fontSize:"16px","& :not(.MathJax) > table tr":{"&:nth-child(2n)":{backgroundColor:"unset !important"}}},tooltipPopper:{opacity:1},keypadTooltip:{fontSize:"initial",background:"transparent",width:"600px",marginTop:0,paddingTop:0},keypadTooltipPopper:{background:"transparent",width:"650px",opacity:1},promptContainer:{marginBottom:2*e.spacing.unit},main:{width:"100%",position:"relative",backgroundColor:$u.background(),color:$u.text()},title:{fontSize:"1.1rem",display:"block",marginTop:2*e.spacing.unit,marginBottom:e.spacing.unit},collapsible:{marginBottom:2*e.spacing.unit},responseContainer:{zIndex:10,minWidth:"400px",marginTop:2*e.spacing.unit},expression:{maxWidth:"fit-content","& > .mq-math-mode":{"& > .mq-root-block":{"& > .mq-editable-field":{minWidth:"10px",padding:e.spacing.unit/4}},"& sup":{top:0}}},static:{"& > .mq-root-block":{"& > .mq-editable-field":{borderColor:$u.text()}}},inputAndKeypadContainer:{position:"relative","& > div > div":{display:"flex",alignItems:"baseline",flexWrap:"wrap"},"& .mq-overarrow-inner":{border:"none !important",padding:"0 !important"},"& .mq-overarrow-inner-right":{display:"none !important"},"& .mq-overarrow-inner-left":{display:"none !important"},"& .mq-overarrow.mq-arrow-both":{minWidth:"1.23em","& *":{lineHeight:"1 !important"},"&:before":{top:"-0.4em",left:"-1px"},"&:after":{top:"-2.4em",right:"-1px"},"&.mq-empty:after":{top:"-0.45em"}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:"-0.4em",right:"-1px"}},"& .mq-longdiv-inner":{borderTop:"1px solid !important",paddingTop:"1.5px !important"},"& .mq-parallelogram":{lineHeight:.85}},showCorrectness:{border:"2px solid"},correctAnswerShown:{padding:e.spacing.unit,letterSpacing:"0.5px"},correct:{borderColor:`${$u.correct()} !important`},incorrect:{borderColor:`${$u.incorrect()} !important`},blockContainer:{margin:`${e.spacing.unit}px !important`,display:"inline-flex",border:"2px solid grey !important"},blockResponse:{flex:2,color:"grey",background:e.palette.grey.A100,fontSize:"0.8rem !important",padding:e.spacing.unit/2+"px !important",display:"flex",alignItems:"center",justifyContent:"center",borderRight:`2px solid ${$u.disabled()} !important`},toggle:{color:$u.text(),marginBottom:2*e.spacing.unit},blockMath:{color:$u.text(),backgroundColor:$u.background(),padding:e.spacing.unit/2+"px !important",display:"flex",alignItems:"center",justifyContent:"center",flex:8,"& > .mq-math-mode":{"& > .mq-hasCursor":{"& > .mq-cursor":{display:"none"}}}},printContainer:{marginBottom:e.spacing.unit,pointerEvents:"none"},srOnly:{position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"},note:{marginBottom:2*e.spacing.unit}})))(dc);const vc=r,yc=s,{debounce:mc}=t,gc=e,{renderMath:kc}=h,_c=gc("pie-element:math-templated:print");class bc extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._rerender=mc((()=>{if(this._model&&this._session){const e=((e,t)=>{const r="instructor"===t.role;return e.prompt=!1!==e.promptEnabled?e.prompt:void 0,e.teacherInstructions=r&&!1!==e.teacherInstructionsEnabled?e.teacherInstructions:void 0,e.rationale=r&&!1!==e.rationaleEnabled?e.rationale:void 0,e.showTeacherInstructions=r,e.alwaysShowCorrect=r,e.printMode=!0,e.feedback=void 0,e.markup=e.markup||"{{0}}",{...e,disabled:!0,env:{mode:r?"evaluate":e.mode,role:t.role}}})(this._model,this._options),t=this._options&&vc.createElement(pc,{model:e,session:{}});yc.render(t,this,(()=>{_c("render complete - render math"),kc(this)}))}else _c("skip")}),50,{leading:!1,trailing:!0})}set options(e){this._options=e}set model(e){this._model=e,this._rerender()}connectedCallback(){}}export{bc as default};
|
|
1
|
+
import{_dll_debug as e,_dll_lodash as t,_dll_react as r,_dll_react_dom_server as n,_dll_prop_types as o,_dll_material_ui__core_styles as i,_dll_classnames as a,_dll_react_dom as s,_dll_material_ui__core as u,_dll_pie_lib__render_ui as c,_dll_material_ui__icons as l,_dll_pie_lib__correct_answer_toggle as f}from"../../../@pie-lib/shared-module@^1.17.3/module/index.js";import{_dll_pie_lib__math_rendering as h}from"../../../@pie-lib/math-rendering-module@^3.1.3/module/index.js";import{_dll_pie_lib__math_input as d,_dll_pie_framework__mathquill as p}from"../../../@pie-lib/math-edit-module@^2.8.3/module/index.js";import{_dll_pie_lib__drag as v}from"../../../@pie-lib/drag-module@^2.11.3/module/index.js";import{_dll_pie_lib__editable_html as y}from"../../../@pie-lib/editable-html-module@^5.9.3/module/index.js";var m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},g=Object.prototype.toString,k=function(e){switch(g.call(e)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}if("object"==typeof e&&e&&"number"==typeof e.length)try{if("function"==typeof e.callee)return"arguments"}catch(e){if(e instanceof TypeError)return"arguments"}return null===e?"null":void 0===e?"undefined":e&&1===e.nodeType?"element":e===Object(e)?"object":typeof e},_=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function b(e){return!0===_(e)&&"[object Object]"===Object.prototype.toString.call(e)}var w=function(e){var t,r;return!1!==b(e)&&("function"==typeof(t=e.constructor)&&(!1!==b(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))},x="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function A(){throw new Error("setTimeout has not been defined")}function O(){throw new Error("clearTimeout has not been defined")}var S=A,E=O;function T(e){if(S===setTimeout)return setTimeout(e,0);if((S===A||!S)&&setTimeout)return S=setTimeout,setTimeout(e,0);try{return S(e,0)}catch(t){try{return S.call(null,e,0)}catch(t){return S.call(this,e,0)}}}"function"==typeof x.setTimeout&&(S=setTimeout),"function"==typeof x.clearTimeout&&(E=clearTimeout);var N,B=[],z=!1,j=-1;function C(){z&&N&&(z=!1,N.length?B=N.concat(B):j=-1,B.length&&P())}function P(){if(!z){var e=T(C);z=!0;for(var t=B.length;t;){for(N=B,B=[];++j<t;)N&&N[j].run();j=-1,t=B.length}N=null,z=!1,function(e){if(E===clearTimeout)return clearTimeout(e);if((E===O||!E)&&clearTimeout)return E=clearTimeout,clearTimeout(e);try{E(e)}catch(t){try{return E.call(null,e)}catch(t){return E.call(this,e)}}}(e)}}function K(e,t){this.fun=e,this.array=t}K.prototype.run=function(){this.fun.apply(null,this.array)};function F(){}var I=F,M=F,R=F,D=F,L=F,J=F,q=F;var U=x.performance||{},V=U.now||U.mozNow||U.msNow||U.oNow||U.webkitNow||function(){return(new Date).getTime()};var W=new Date;var $={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];B.push(new K(e,t)),1!==B.length||z||T(P)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:I,addListener:M,once:R,off:D,removeListener:L,removeAllListeners:J,emit:q,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*V.call(U),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-W)/1e3}},H=$&&$.env&&$.env.FORBID_DEPRECATIONS,G=$&&$.env&&$.env.FORBID_WARNINGS,Q=void 0!==$&&$.env&&!0,Y="undefined"!=typeof console&&"function"==typeof console.log&&"function"==typeof console.warn&&"function"==typeof console.error;function X(e,t){if(Q&&Y){for(var r,n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];(r=console)[e].apply(r,[t].concat(o))}}function Z(e,t){throw new Error(t)}var ee={deprecate:function(e,t){for(var r=H?Z:X,n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];r.apply(void 0,["warn","Deprecation ("+e+"): "+t].concat(o))},error:function(e){if(Y){for(var t,r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(t=console).error.apply(t,[e].concat(n))}},warn:function(e){for(var t=G?Z:X,r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];t.apply(void 0,["warn","Warning: "+e].concat(n))}},te={};function re(e){e&&(e.value=!0)}function ne(){}function oe(e){return void 0===e.size&&(e.size=e.__iterate(ae)),e.size}function ie(e,t){if("number"!=typeof t){var r=t>>>0;if(""+r!==t||4294967295===r)return NaN;t=r}return t<0?oe(e)+t:t}function ae(){return!0}function se(e,t,r){return(0===e&&!fe(e)||void 0!==r&&e<=-r)&&(void 0===t||void 0!==r&&t>=r)}function ue(e,t){return le(e,t,0)}function ce(e,t){return le(e,t,t)}function le(e,t,r){return void 0===e?r:fe(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function fe(e){return e<0||0===e&&1/e==-1/0}function he(e){return Boolean(e&&e["@@__IMMUTABLE_ITERABLE__@@"])}function de(e){return Boolean(e&&e["@@__IMMUTABLE_KEYED__@@"])}function pe(e){return Boolean(e&&e["@@__IMMUTABLE_INDEXED__@@"])}function ve(e){return de(e)||pe(e)}var ye=function(e){return he(e)?e:Fe(e)},me=function(e){function t(e){return de(e)?e:Ie(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(ye),ge=function(e){function t(e){return pe(e)?e:Me(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(ye),ke=function(e){function t(e){return he(e)&&!ve(e)?e:Re(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(ye);ye.Keyed=me,ye.Indexed=ge,ye.Set=ke;function _e(e){return Boolean(e&&e["@@__IMMUTABLE_SEQ__@@"])}function be(e){return Boolean(e&&e["@@__IMMUTABLE_RECORD__@@"])}function we(e){return he(e)||be(e)}var xe="@@__IMMUTABLE_ORDERED__@@";function Ae(e){return Boolean(e&&e[xe])}var Oe="function"==typeof Symbol&&Symbol.iterator,Se=Oe||"@@iterator",Ee=function(e){this.next=e};function Te(e,t,r,n){var o=0===e?t:1===e?r:[t,r];return n?n.value=o:n={value:o,done:!1},n}function Ne(){return{value:void 0,done:!0}}function Be(e){return!!Array.isArray(e)||!!Ce(e)}function ze(e){return e&&"function"==typeof e.next}function je(e){var t=Ce(e);return t&&t.call(e)}function Ce(e){var t=e&&(Oe&&e[Oe]||e["@@iterator"]);if("function"==typeof t)return t}Ee.prototype.toString=function(){return"[Iterator]"},Ee.KEYS=0,Ee.VALUES=1,Ee.ENTRIES=2,Ee.prototype.inspect=Ee.prototype.toSource=function(){return this.toString()},Ee.prototype[Se]=function(){return this};var Pe=Object.prototype.hasOwnProperty;function Ke(e){return!(!Array.isArray(e)&&"string"!=typeof e)||e&&"object"==typeof e&&Number.isInteger(e.length)&&e.length>=0&&(0===e.length?1===Object.keys(e).length:e.hasOwnProperty(e.length-1))}var Fe=function(e){function t(e){return null==e?Ue():we(e)?e.toSeq():function(e){var t=$e(e);if(t)return(n=Ce(r=e))&&n===r.entries?t.fromEntrySeq():function(e){var t=Ce(e);return t&&t===e.keys}(e)?t.toSetSeq():t;var r,n;if("object"==typeof e)return new Le(e);throw new TypeError("Expected Array or collection object of values, or keyed object: "+e)}(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(e,t){var r=this._cache;if(r){for(var n=r.length,o=0;o!==n;){var i=r[t?n-++o:o++];if(!1===e(i[1],i[0],this))break}return o}return this.__iterateUncached(e,t)},t.prototype.__iterator=function(e,t){var r=this._cache;if(r){var n=r.length,o=0;return new Ee((function(){if(o===n)return{value:void 0,done:!0};var i=r[t?n-++o:o++];return Te(e,i[0],i[1])}))}return this.__iteratorUncached(e,t)},t}(ye),Ie=function(e){function t(e){return null==e?Ue().toKeyedSeq():he(e)?de(e)?e.toSeq():e.fromEntrySeq():be(e)?e.toSeq():Ve(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(Fe),Me=function(e){function t(e){return null==e?Ue():he(e)?de(e)?e.entrySeq():e.toIndexedSeq():be(e)?e.toSeq().entrySeq():We(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t}(Fe),Re=function(e){function t(e){return(he(e)&&!ve(e)?e:Me(e)).toSetSeq()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t}(Fe);Fe.isSeq=_e,Fe.Keyed=Ie,Fe.Set=Re,Fe.Indexed=Me,Fe.prototype["@@__IMMUTABLE_SEQ__@@"]=!0;var De=function(e){function t(e){this._array=e,this.size=e.length}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return this.has(e)?this._array[ie(this,e)]:t},t.prototype.__iterate=function(e,t){for(var r=this._array,n=r.length,o=0;o!==n;){var i=t?n-++o:o++;if(!1===e(r[i],i,this))break}return o},t.prototype.__iterator=function(e,t){var r=this._array,n=r.length,o=0;return new Ee((function(){if(o===n)return{value:void 0,done:!0};var i=t?n-++o:o++;return Te(e,i,r[i])}))},t}(Me),Le=function(e){function t(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},t.prototype.has=function(e){return Pe.call(this._object,e)},t.prototype.__iterate=function(e,t){for(var r=this._object,n=this._keys,o=n.length,i=0;i!==o;){var a=n[t?o-++i:i++];if(!1===e(r[a],a,this))break}return i},t.prototype.__iterator=function(e,t){var r=this._object,n=this._keys,o=n.length,i=0;return new Ee((function(){if(i===o)return{value:void 0,done:!0};var a=n[t?o-++i:i++];return Te(e,a,r[a])}))},t}(Ie);Le.prototype[xe]=!0;var Je,qe=function(e){function t(e){this._collection=e,this.size=e.length||e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var r=je(this._collection),n=0;if(ze(r))for(var o;!(o=r.next()).done&&!1!==e(o.value,n++,this););return n},t.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var r=je(this._collection);if(!ze(r))return new Ee(Ne);var n=0;return new Ee((function(){var t=r.next();return t.done?t:Te(e,n++,t.value)}))},t}(Me);function Ue(){return Je||(Je=new De([]))}function Ve(e){var t=$e(e);if(t)return t.fromEntrySeq();if("object"==typeof e)return new Le(e);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function We(e){var t=$e(e);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+e)}function $e(e){return Ke(e)?new De(e):Be(e)?new qe(e):void 0}function He(e){return Boolean(e&&e["@@__IMMUTABLE_MAP__@@"])}function Ge(e){return He(e)&&Ae(e)}function Qe(e){return Boolean(e&&"function"==typeof e.equals&&"function"==typeof e.hashCode)}function Ye(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!!(Qe(e)&&Qe(t)&&e.equals(t))}var Xe="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var r=65535&(e|=0),n=65535&(t|=0);return r*n+((e>>>16)*n+r*(t>>>16)<<16>>>0)|0};function Ze(e){return e>>>1&1073741824|3221225471&e}var et=Object.prototype.valueOf;function tt(e){if(null==e)return rt(e);if("function"==typeof e.hashCode)return Ze(e.hashCode(e));var t,r=(t=e).valueOf!==et&&"function"==typeof t.valueOf?t.valueOf(t):t;if(null==r)return rt(r);switch(typeof r){case"boolean":return r?1108378657:1108378656;case"number":return function(e){if(e!=e||e===1/0)return 0;var t=0|e;t!==e&&(t^=4294967295*e);for(;e>4294967295;)t^=e/=4294967295;return Ze(t)}(r);case"string":return r.length>ht?function(e){var t=vt[e];void 0===t&&(t=nt(e),pt===dt&&(pt=0,vt={}),pt++,vt[e]=t);return t}(r):nt(r);case"object":case"function":return function(e){var t;if(ut&&void 0!==(t=st.get(e)))return t;if(void 0!==(t=e[ft]))return t;if(!it){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[ft]))return t;if(void 0!==(t=function(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e)))return t}if(t=at(),ut)st.set(e,t);else{if(void 0!==ot&&!1===ot(e))throw new Error("Non-extensible objects are not allowed as keys.");if(it)Object.defineProperty(e,ft,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[ft]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[ft]=t}}return t}(r);case"symbol":return function(e){var t=ct[e];if(void 0!==t)return t;return t=at(),ct[e]=t,t}(r);default:if("function"==typeof r.toString)return nt(r.toString());throw new Error("Value type "+typeof r+" cannot be hashed.")}}function rt(e){return null===e?1108378658:1108378659}function nt(e){for(var t=0,r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)|0;return Ze(t)}var ot=Object.isExtensible,it=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}();function at(){var e=++lt;return 1073741824<&&(lt=0),e}var st,ut="function"==typeof WeakMap;ut&&(st=new WeakMap);var ct=Object.create(null),lt=0,ft="__immutablehash__";"function"==typeof Symbol&&(ft=Symbol(ft));var ht=16,dt=255,pt=0,vt={},yt=function(e){function t(e,t){this._iter=e,this._useKeys=t,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return this._iter.get(e,t)},t.prototype.has=function(e){return this._iter.has(e)},t.prototype.valueSeq=function(){return this._iter.valueSeq()},t.prototype.reverse=function(){var e=this,t=wt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},t.prototype.map=function(e,t){var r=this,n=bt(this,e,t);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(e,t)}),n},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t,n){return e(t,n,r)}),t)},t.prototype.__iterator=function(e,t){return this._iter.__iterator(e,t)},t}(Ie);yt.prototype[xe]=!0;var mt=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.includes=function(e){return this._iter.includes(e)},t.prototype.__iterate=function(e,t){var r=this,n=0;return t&&oe(this),this._iter.__iterate((function(o){return e(o,t?r.size-++n:n++,r)}),t)},t.prototype.__iterator=function(e,t){var r=this,n=this._iter.__iterator(1,t),o=0;return t&&oe(this),new Ee((function(){var i=n.next();return i.done?i:Te(e,t?r.size-++o:o++,i.value,i)}))},t}(Me),gt=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.has=function(e){return this._iter.includes(e)},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t){return e(t,t,r)}),t)},t.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t);return new Ee((function(){var t=r.next();return t.done?t:Te(e,t.value,t.value,t)}))},t}(Re),kt=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t){if(t){Ct(t);var n=he(t);return e(n?t.get(1):t[1],n?t.get(0):t[0],r)}}),t)},t.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t);return new Ee((function(){for(;;){var t=r.next();if(t.done)return t;var n=t.value;if(n){Ct(n);var o=he(n);return Te(e,o?n.get(0):n[0],o?n.get(1):n[1],t)}}}))},t}(Ie);function _t(e){var t=Kt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Ft,t.__iterateUncached=function(t,r){var n=this;return e.__iterate((function(e,r){return!1!==t(r,e,n)}),r)},t.__iteratorUncached=function(t,r){if(2===t){var n=e.__iterator(t,r);return new Ee((function(){var e=n.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e}))}return e.__iterator(1===t?0:1,r)},t}function bt(e,t,r){var n=Kt(e);return n.size=e.size,n.has=function(t){return e.has(t)},n.get=function(n,o){var i=e.get(n,te);return i===te?o:t.call(r,i,n,e)},n.__iterateUncached=function(n,o){var i=this;return e.__iterate((function(e,o,a){return!1!==n(t.call(r,e,o,a),o,i)}),o)},n.__iteratorUncached=function(n,o){var i=e.__iterator(2,o);return new Ee((function(){var o=i.next();if(o.done)return o;var a=o.value,s=a[0];return Te(n,s,t.call(r,a[1],s,e),o)}))},n}function wt(e,t){var r=this,n=Kt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=_t(e);return t.reverse=function(){return e.flip()},t}),n.get=function(r,n){return e.get(t?r:-1-r,n)},n.has=function(r){return e.has(t?r:-1-r)},n.includes=function(t){return e.includes(t)},n.cacheResult=Ft,n.__iterate=function(r,n){var o=this,i=0;return n&&oe(e),e.__iterate((function(e,a){return r(e,t?a:n?o.size-++i:i++,o)}),!n)},n.__iterator=function(n,o){var i=0;o&&oe(e);var a=e.__iterator(2,!o);return new Ee((function(){var e=a.next();if(e.done)return e;var s=e.value;return Te(n,t?s[0]:o?r.size-++i:i++,s[1],e)}))},n}function xt(e,t,r,n){var o=Kt(e);return n&&(o.has=function(n){var o=e.get(n,te);return o!==te&&!!t.call(r,o,n,e)},o.get=function(n,o){var i=e.get(n,te);return i!==te&&t.call(r,i,n,e)?i:o}),o.__iterateUncached=function(o,i){var a=this,s=0;return e.__iterate((function(e,i,u){if(t.call(r,e,i,u))return s++,o(e,n?i:s-1,a)}),i),s},o.__iteratorUncached=function(o,i){var a=e.__iterator(2,i),s=0;return new Ee((function(){for(;;){var i=a.next();if(i.done)return i;var u=i.value,c=u[0],l=u[1];if(t.call(r,l,c,e))return Te(o,n?c:s++,l,i)}}))},o}function At(e,t,r,n){var o=e.size;if(se(t,r,o))return e;var i=ue(t,o),a=ce(r,o);if(i!=i||a!=a)return At(e.toSeq().cacheResult(),t,r,n);var s,u=a-i;u==u&&(s=u<0?0:u);var c=Kt(e);return c.size=0===s?s:e.size&&s||void 0,!n&&_e(e)&&s>=0&&(c.get=function(t,r){return(t=ie(this,t))>=0&&t<s?e.get(t+i,r):r}),c.__iterateUncached=function(t,r){var o=this;if(0===s)return 0;if(r)return this.cacheResult().__iterate(t,r);var a=0,u=!0,c=0;return e.__iterate((function(e,r){if(!u||!(u=a++<i))return c++,!1!==t(e,n?r:c-1,o)&&c!==s})),c},c.__iteratorUncached=function(t,r){if(0!==s&&r)return this.cacheResult().__iterator(t,r);if(0===s)return new Ee(Ne);var o=e.__iterator(t,r),a=0,u=0;return new Ee((function(){for(;a++<i;)o.next();if(++u>s)return{value:void 0,done:!0};var e=o.next();return n||1===t||e.done?e:Te(t,u-1,0===t?void 0:e.value[1],e)}))},c}function Ot(e,t,r,n){var o=Kt(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var s=!0,u=0;return e.__iterate((function(e,i,c){if(!s||!(s=t.call(r,e,i,c)))return u++,o(e,n?i:u-1,a)})),u},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var s=e.__iterator(2,i),u=!0,c=0;return new Ee((function(){var e,i,l;do{if((e=s.next()).done)return n||1===o?e:Te(o,c++,0===o?void 0:e.value[1],e);var f=e.value;i=f[0],l=f[1],u&&(u=t.call(r,l,i,a))}while(u);return 2===o?e:Te(o,i,l,e)}))},o}function St(e,t){var r=de(e),n=[e].concat(t).map((function(e){return he(e)?r&&(e=me(e)):e=r?Ve(e):We(Array.isArray(e)?e:[e]),e})).filter((function(e){return 0!==e.size}));if(0===n.length)return e;if(1===n.length){var o=n[0];if(o===e||r&&de(o)||pe(e)&&pe(o))return o}var i=new De(n);return r?i=i.toKeyedSeq():pe(e)||(i=i.toSetSeq()),(i=i.flatten(!0)).size=n.reduce((function(e,t){if(void 0!==e){var r=t.size;if(void 0!==r)return e+r}}),0),i}function Et(e,t,r){var n=Kt(e);return n.__iterateUncached=function(o,i){if(i)return this.cacheResult().__iterate(o,i);var a=0,s=!1;return function e(u,c){u.__iterate((function(i,u){return(!t||c<t)&&he(i)?e(i,c+1):(a++,!1===o(i,r?u:a-1,n)&&(s=!0)),!s}),i)}(e,0),a},n.__iteratorUncached=function(n,o){if(o)return this.cacheResult().__iterator(n,o);var i=e.__iterator(n,o),a=[],s=0;return new Ee((function(){for(;i;){var e=i.next();if(!1===e.done){var u=e.value;if(2===n&&(u=u[1]),t&&!(a.length<t)||!he(u))return r?e:Te(n,s++,u,e);a.push(i),i=u.__iterator(n,o)}else i=a.pop()}return{value:void 0,done:!0}}))},n}function Tt(e,t,r){t||(t=It);var n=de(e),o=0,i=e.toSeq().map((function(t,n){return[n,t,o++,r?r(t,n,e):t]})).valueSeq().toArray();return i.sort((function(e,r){return t(e[3],r[3])||e[2]-r[2]})).forEach(n?function(e,t){i[t].length=2}:function(e,t){i[t]=e[1]}),n?Ie(i):pe(e)?Me(i):Re(i)}function Nt(e,t,r){if(t||(t=It),r){var n=e.toSeq().map((function(t,n){return[t,r(t,n,e)]})).reduce((function(e,r){return Bt(t,e[1],r[1])?r:e}));return n&&n[0]}return e.reduce((function(e,r){return Bt(t,e,r)?r:e}))}function Bt(e,t,r){var n=e(r,t);return 0===n&&r!==t&&(null==r||r!=r)||n>0}function zt(e,t,r,n){var o=Kt(e),i=new De(r).map((function(e){return e.size}));return o.size=n?i.max():i.min(),o.__iterate=function(e,t){for(var r,n=this.__iterator(1,t),o=0;!(r=n.next()).done&&!1!==e(r.value,o++,this););return o},o.__iteratorUncached=function(e,o){var i=r.map((function(e){return e=ye(e),je(o?e.reverse():e)})),a=0,s=!1;return new Ee((function(){var r;return s||(r=i.map((function(e){return e.next()})),s=n?r.every((function(e){return e.done})):r.some((function(e){return e.done}))),s?{value:void 0,done:!0}:Te(e,a++,t.apply(null,r.map((function(e){return e.value}))))}))},o}function jt(e,t){return e===t?e:_e(e)?t:e.constructor(t)}function Ct(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Pt(e){return de(e)?me:pe(e)?ge:ke}function Kt(e){return Object.create((de(e)?Ie:pe(e)?Me:Re).prototype)}function Ft(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):Fe.prototype.cacheResult.call(this)}function It(e,t){return void 0===e&&void 0===t?0:void 0===e?1:void 0===t?-1:e>t?1:e<t?-1:0}function Mt(e,t){t=t||0;for(var r=Math.max(0,e.length-t),n=new Array(r),o=0;o<r;o++)n[o]=e[o+t];return n}function Rt(e,t){if(!e)throw new Error(t)}function Dt(e){Rt(e!==1/0,"Cannot perform this action with an infinite size.")}function Lt(e){if(Ke(e)&&"string"!=typeof e)return e;if(Ae(e))return e.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+e)}mt.prototype.cacheResult=yt.prototype.cacheResult=gt.prototype.cacheResult=kt.prototype.cacheResult=Ft;var Jt=Object.prototype.toString;function qt(e){return"object"==typeof e&&(we(e)||Array.isArray(e)||function(e){if(!e||"object"!=typeof e||"[object Object]"!==Jt.call(e))return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var r=t,n=Object.getPrototypeOf(t);null!==n;)r=n,n=Object.getPrototypeOf(r);return r===t}(e))}function Ut(e){try{return"string"==typeof e?JSON.stringify(e):String(e)}catch(t){return JSON.stringify(e)}}function Vt(e,t,r){return we(e)?e.get(t,r):function(e,t){return we(e)?e.has(t):qt(e)&&Pe.call(e,t)}(e,t)?"function"==typeof e.get?e.get(t):e[t]:r}function Wt(e){if(Array.isArray(e))return Mt(e);var t={};for(var r in e)Pe.call(e,r)&&(t[r]=e[r]);return t}function $t(e,t,r,n){n||(n=r,r=void 0);var o=Ht(we(e),e,Lt(t),0,r,n);return o===te?r:o}function Ht(e,t,r,n,o,i){var a=t===te;if(n===r.length){var s=a?o:t,u=i(s);return u===s?t:u}if(!a&&!qt(t))throw new TypeError("Cannot update within non-data-structure value in path ["+r.slice(0,n).map(Ut)+"]: "+t);var c=r[n],l=a?te:Vt(t,c,te),f=Ht(l===te?e:we(l),l,r,n+1,o,i);return f===l?t:f===te?function(e,t){if(!qt(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(we(e)){if(!e.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+e);return e.remove(t)}if(!Pe.call(e,t))return e;var r=Wt(e);return Array.isArray(r)?r.splice(t,1):delete r[t],r}(t,c):function(e,t,r){if(!qt(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(we(e)){if(!e.set)throw new TypeError("Cannot update immutable value without .set() method: "+e);return e.set(t,r)}if(Pe.call(e,t)&&r===e[t])return e;var n=Wt(e);return n[t]=r,n}(a?e?Or():{}:t,c,f)}function Gt(e,t){return function(e,t,r){return $t(e,t,te,(function(){return r}))}(this,e,t)}function Qt(e){return function(e,t){return $t(e,t,(function(){return te}))}(this,e)}function Yt(e,t,r,n){return $t(e,[t],r,n)}function Xt(e,t,r){return 1===arguments.length?e(this):Yt(this,e,t,r)}function Zt(e,t,r){return $t(this,e,t,r)}function er(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return rr(this,e)}function tr(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if("function"!=typeof e)throw new TypeError("Invalid merger function: "+e);return rr(this,t,e)}function rr(e,t,r){for(var n=[],o=0;o<t.length;o++){var i=me(t[o]);0!==i.size&&n.push(i)}return 0===n.length?e:0!==e.toSeq().size||e.__ownerID||1!==n.length?e.withMutations((function(e){for(var t=r?function(t,n){Yt(e,n,te,(function(e){return e===te?t:r(e,t,n)}))}:function(t,r){e.set(r,t)},o=0;o<n.length;o++)n[o].forEach(t)})):e.constructor(n[0])}function nr(e,t,r){return or(e,t,function(e){function t(r,n,o){return qt(r)&&qt(n)&&(i=n,a=Fe(r),s=Fe(i),pe(a)===pe(s)&&de(a)===de(s))?or(r,[n],t):e?e(r,n,o):n;var i,a,s}return t}(r))}function or(e,t,r){if(!qt(e))throw new TypeError("Cannot merge into non-data-structure value: "+e);if(we(e))return"function"==typeof r&&e.mergeWith?e.mergeWith.apply(e,[r].concat(t)):e.merge?e.merge.apply(e,t):e.concat.apply(e,t);for(var n=Array.isArray(e),o=e,i=n?ge:me,a=n?function(t){o===e&&(o=Wt(o)),o.push(t)}:function(t,n){var i=Pe.call(o,n),a=i&&r?r(o[n],t,n):t;i&&a===o[n]||(o===e&&(o=Wt(o)),o[n]=a)},s=0;s<t.length;s++)i(t[s]).forEach(a);return o}function ir(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return nr(this,e)}function ar(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return nr(this,t,e)}function sr(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return $t(this,e,Or(),(function(e){return or(e,t)}))}function ur(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return $t(this,e,Or(),(function(e){return nr(e,t)}))}function cr(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function lr(){return this.__ownerID?this:this.__ensureOwner(new ne)}function fr(){return this.__ensureOwner()}function hr(){return this.__altered}var dr=function(e){function t(t){return null==t?Or():He(t)&&!Ae(t)?t:Or().withMutations((function(r){var n=e(t);Dt(n.size),n.forEach((function(e,t){return r.set(t,e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Or().withMutations((function(t){for(var r=0;r<e.length;r+=2){if(r+1>=e.length)throw new Error("Missing value for key: "+e[r]);t.set(e[r],e[r+1])}}))},t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},t.prototype.set=function(e,t){return Sr(this,e,t)},t.prototype.remove=function(e){return Sr(this,e,te)},t.prototype.deleteAll=function(e){var t=ye(e);return 0===t.size?this:this.withMutations((function(e){t.forEach((function(t){return e.remove(t)}))}))},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Or()},t.prototype.sort=function(e){return Qr(Tt(this,e))},t.prototype.sortBy=function(e,t){return Qr(Tt(this,t,e))},t.prototype.map=function(e,t){var r=this;return this.withMutations((function(n){n.forEach((function(o,i){n.set(i,e.call(t,o,i,r))}))}))},t.prototype.__iterator=function(e,t){return new br(this,e,t)},t.prototype.__iterate=function(e,t){var r=this,n=0;return this._root&&this._root.iterate((function(t){return n++,e(t[1],t[0],r)}),t),n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Ar(this.size,this._root,e,this.__hash):0===this.size?Or():(this.__ownerID=e,this.__altered=!1,this)},t}(me);dr.isMap=He;var pr=dr.prototype;pr["@@__IMMUTABLE_MAP__@@"]=!0,pr.delete=pr.remove,pr.removeAll=pr.deleteAll,pr.setIn=Gt,pr.removeIn=pr.deleteIn=Qt,pr.update=Xt,pr.updateIn=Zt,pr.merge=pr.concat=er,pr.mergeWith=tr,pr.mergeDeep=ir,pr.mergeDeepWith=ar,pr.mergeIn=sr,pr.mergeDeepIn=ur,pr.withMutations=cr,pr.wasAltered=hr,pr.asImmutable=fr,pr["@@transducer/init"]=pr.asMutable=lr,pr["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},pr["@@transducer/result"]=function(e){return e.asImmutable()};var vr=function(e,t){this.ownerID=e,this.entries=t};vr.prototype.get=function(e,t,r,n){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(Ye(r,o[i][0]))return o[i][1];return n},vr.prototype.update=function(e,t,r,n,o,i,a){for(var s=o===te,u=this.entries,c=0,l=u.length;c<l&&!Ye(n,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(re(a),(s||!f)&&re(i),!s||1!==u.length){if(!f&&!s&&u.length>=jr)return function(e,t,r,n){e||(e=new ne);for(var o=new kr(e,tt(r),[r,n]),i=0;i<t.length;i++){var a=t[i];o=o.update(e,0,void 0,a[0],a[1])}return o}(e,u,n,o);var h=e&&e===this.ownerID,d=h?u:Mt(u);return f?s?c===l-1?d.pop():d[c]=d.pop():d[c]=[n,o]:d.push([n,o]),h?(this.entries=d,this):new vr(e,d)}};var yr=function(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r};yr.prototype.get=function(e,t,r,n){void 0===t&&(t=tt(r));var o=1<<(31&(0===e?t:t>>>e)),i=this.bitmap;return 0==(i&o)?n:this.nodes[Br(i&o-1)].get(e+5,t,r,n)},yr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=tt(n));var s=31&(0===t?r:r>>>t),u=1<<s,c=this.bitmap,l=0!=(c&u);if(!l&&o===te)return this;var f=Br(c&u-1),h=this.nodes,d=l?h[f]:void 0,p=Er(d,e,t+5,r,n,o,i,a);if(p===d)return this;if(!l&&p&&h.length>=Cr)return function(e,t,r,n,o){for(var i=0,a=new Array(32),s=0;0!==r;s++,r>>>=1)a[s]=1&r?t[i++]:void 0;return a[n]=o,new mr(e,i+1,a)}(e,h,c,s,p);if(l&&!p&&2===h.length&&Tr(h[1^f]))return h[1^f];if(l&&p&&1===h.length&&Tr(p))return p;var v=e&&e===this.ownerID,y=l?p?c:c^u:c|u,m=l?p?zr(h,f,p,v):function(e,t,r){var n=e.length-1;if(r&&t===n)return e.pop(),e;for(var o=new Array(n),i=0,a=0;a<n;a++)a===t&&(i=1),o[a]=e[a+i];return o}(h,f,v):function(e,t,r,n){var o=e.length+1;if(n&&t+1===o)return e[t]=r,e;for(var i=new Array(o),a=0,s=0;s<o;s++)s===t?(i[s]=r,a=-1):i[s]=e[s+a];return i}(h,f,p,v);return v?(this.bitmap=y,this.nodes=m,this):new yr(e,y,m)};var mr=function(e,t,r){this.ownerID=e,this.count=t,this.nodes=r};mr.prototype.get=function(e,t,r,n){void 0===t&&(t=tt(r));var o=31&(0===e?t:t>>>e),i=this.nodes[o];return i?i.get(e+5,t,r,n):n},mr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=tt(n));var s=31&(0===t?r:r>>>t),u=o===te,c=this.nodes,l=c[s];if(u&&!l)return this;var f=Er(l,e,t+5,r,n,o,i,a);if(f===l)return this;var h=this.count;if(l){if(!f&&--h<Pr)return function(e,t,r,n){for(var o=0,i=0,a=new Array(r),s=0,u=1,c=t.length;s<c;s++,u<<=1){var l=t[s];void 0!==l&&s!==n&&(o|=u,a[i++]=l)}return new yr(e,o,a)}(e,c,h,s)}else h++;var d=e&&e===this.ownerID,p=zr(c,s,f,d);return d?(this.count=h,this.nodes=p,this):new mr(e,h,p)};var gr=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entries=r};gr.prototype.get=function(e,t,r,n){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(Ye(r,o[i][0]))return o[i][1];return n},gr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=tt(n));var s=o===te;if(r!==this.keyHash)return s?this:(re(a),re(i),Nr(this,e,t,r,[n,o]));for(var u=this.entries,c=0,l=u.length;c<l&&!Ye(n,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(re(a),(s||!f)&&re(i),s&&2===l)return new kr(e,this.keyHash,u[1^c]);var h=e&&e===this.ownerID,d=h?u:Mt(u);return f?s?c===l-1?d.pop():d[c]=d.pop():d[c]=[n,o]:d.push([n,o]),h?(this.entries=d,this):new gr(e,this.keyHash,d)};var kr=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entry=r};kr.prototype.get=function(e,t,r,n){return Ye(r,this.entry[0])?this.entry[1]:n},kr.prototype.update=function(e,t,r,n,o,i,a){var s=o===te,u=Ye(n,this.entry[0]);return(u?o===this.entry[1]:s)?this:(re(a),s?void re(i):u?e&&e===this.ownerID?(this.entry[1]=o,this):new kr(e,this.keyHash,[n,o]):(re(i),Nr(this,e,t,tt(n),[n,o])))},vr.prototype.iterate=gr.prototype.iterate=function(e,t){for(var r=this.entries,n=0,o=r.length-1;n<=o;n++)if(!1===e(r[t?o-n:n]))return!1},yr.prototype.iterate=mr.prototype.iterate=function(e,t){for(var r=this.nodes,n=0,o=r.length-1;n<=o;n++){var i=r[t?o-n:n];if(i&&!1===i.iterate(e,t))return!1}},kr.prototype.iterate=function(e,t){return e(this.entry)};var _r,br=function(e){function t(e,t,r){this._type=t,this._reverse=r,this._stack=e._root&&xr(e._root)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.next=function(){for(var e=this._type,t=this._stack;t;){var r=t.node,n=t.index++,o=void 0;if(r.entry){if(0===n)return wr(e,r.entry)}else if(r.entries){if(n<=(o=r.entries.length-1))return wr(e,r.entries[this._reverse?o-n:n])}else if(n<=(o=r.nodes.length-1)){var i=r.nodes[this._reverse?o-n:n];if(i){if(i.entry)return wr(e,i.entry);t=this._stack=xr(i,t)}continue}t=this._stack=this._stack.__prev}return{value:void 0,done:!0}},t}(Ee);function wr(e,t){return Te(e,t[0],t[1])}function xr(e,t){return{node:e,index:0,__prev:t}}function Ar(e,t,r,n){var o=Object.create(pr);return o.size=e,o._root=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function Or(){return _r||(_r=Ar(0))}function Sr(e,t,r){var n,o;if(e._root){var i={value:!1},a={value:!1};if(n=Er(e._root,e.__ownerID,0,void 0,t,r,i,a),!a.value)return e;o=e.size+(i.value?r===te?-1:1:0)}else{if(r===te)return e;o=1,n=new vr(e.__ownerID,[[t,r]])}return e.__ownerID?(e.size=o,e._root=n,e.__hash=void 0,e.__altered=!0,e):n?Ar(o,n):Or()}function Er(e,t,r,n,o,i,a,s){return e?e.update(t,r,n,o,i,a,s):i===te?e:(re(s),re(a),new kr(t,n,[o,i]))}function Tr(e){return e.constructor===kr||e.constructor===gr}function Nr(e,t,r,n,o){if(e.keyHash===n)return new gr(t,n,[e.entry,o]);var i,a=31&(0===r?e.keyHash:e.keyHash>>>r),s=31&(0===r?n:n>>>r),u=a===s?[Nr(e,t,r+5,n,o)]:(i=new kr(t,n,o),a<s?[e,i]:[i,e]);return new yr(t,1<<a|1<<s,u)}function Br(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function zr(e,t,r,n){var o=n?e:Mt(e);return o[t]=r,o}var jr=8,Cr=16,Pr=8;function Kr(e){return Boolean(e&&e["@@__IMMUTABLE_LIST__@@"])}var Fr=function(e){function t(t){var r=qr();if(null==t)return r;if(Kr(t))return t;var n=e(t),o=n.size;return 0===o?r:(Dt(o),o>0&&o<32?Jr(0,o,5,null,new Mr(n.toArray())):r.withMutations((function(e){e.setSize(o),n.forEach((function(t,r){return e.set(r,t)}))})))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("List [","]")},t.prototype.get=function(e,t){if((e=ie(this,e))>=0&&e<this.size){var r=Wr(this,e+=this._origin);return r&&r.array[31&e]}return t},t.prototype.set=function(e,t){return function(e,t,r){if((t=ie(e,t))!=t)return e;if(t>=e.size||t<0)return e.withMutations((function(e){t<0?$r(e,t).set(0,r):$r(e,0,t+1).set(t,r)}));t+=e._origin;var n=e._tail,o=e._root,i={value:!1};t>=Hr(e._capacity)?n=Ur(n,e.__ownerID,0,t,r,i):o=Ur(o,e.__ownerID,e._level,t,r,i);if(!i.value)return e;if(e.__ownerID)return e._root=o,e._tail=n,e.__hash=void 0,e.__altered=!0,e;return Jr(e._origin,e._capacity,e._level,o,n)}(this,e,t)},t.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},t.prototype.insert=function(e,t){return this.splice(e,0,t)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=5,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):qr()},t.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations((function(r){$r(r,0,t+e.length);for(var n=0;n<e.length;n++)r.set(t+n,e[n])}))},t.prototype.pop=function(){return $r(this,0,-1)},t.prototype.unshift=function(){var e=arguments;return this.withMutations((function(t){$r(t,-e.length);for(var r=0;r<e.length;r++)t.set(r,e[r])}))},t.prototype.shift=function(){return $r(this,1)},t.prototype.concat=function(){for(var t=arguments,r=[],n=0;n<arguments.length;n++){var o=t[n],i=e("string"!=typeof o&&Be(o)?o:[o]);0!==i.size&&r.push(i)}return 0===r.length?this:0!==this.size||this.__ownerID||1!==r.length?this.withMutations((function(e){r.forEach((function(t){return t.forEach((function(t){return e.push(t)}))}))})):this.constructor(r[0])},t.prototype.setSize=function(e){return $r(this,0,e)},t.prototype.map=function(e,t){var r=this;return this.withMutations((function(n){for(var o=0;o<r.size;o++)n.set(o,e.call(t,n.get(o),o,r))}))},t.prototype.slice=function(e,t){var r=this.size;return se(e,t,r)?this:$r(this,ue(e,r),ce(t,r))},t.prototype.__iterator=function(e,t){var r=t?this.size:0,n=Lr(this,t);return new Ee((function(){var o=n();return o===Dr?{value:void 0,done:!0}:Te(e,t?--r:r++,o)}))},t.prototype.__iterate=function(e,t){for(var r,n=t?this.size:0,o=Lr(this,t);(r=o())!==Dr&&!1!==e(r,t?--n:n++,this););return n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Jr(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):0===this.size?qr():(this.__ownerID=e,this.__altered=!1,this)},t}(ge);Fr.isList=Kr;var Ir=Fr.prototype;Ir["@@__IMMUTABLE_LIST__@@"]=!0,Ir.delete=Ir.remove,Ir.merge=Ir.concat,Ir.setIn=Gt,Ir.deleteIn=Ir.removeIn=Qt,Ir.update=Xt,Ir.updateIn=Zt,Ir.mergeIn=sr,Ir.mergeDeepIn=ur,Ir.withMutations=cr,Ir.wasAltered=hr,Ir.asImmutable=fr,Ir["@@transducer/init"]=Ir.asMutable=lr,Ir["@@transducer/step"]=function(e,t){return e.push(t)},Ir["@@transducer/result"]=function(e){return e.asImmutable()};var Mr=function(e,t){this.array=e,this.ownerID=t};Mr.prototype.removeBefore=function(e,t,r){if(r===t?1<<t:0===this.array.length)return this;var n=r>>>t&31;if(n>=this.array.length)return new Mr([],e);var o,i=0===n;if(t>0){var a=this.array[n];if((o=a&&a.removeBefore(e,t-5,r))===a&&i)return this}if(i&&!o)return this;var s=Vr(this,e);if(!i)for(var u=0;u<n;u++)s.array[u]=void 0;return o&&(s.array[n]=o),s},Mr.prototype.removeAfter=function(e,t,r){if(r===(t?1<<t:0)||0===this.array.length)return this;var n,o=r-1>>>t&31;if(o>=this.array.length)return this;if(t>0){var i=this.array[o];if((n=i&&i.removeAfter(e,t-5,r))===i&&o===this.array.length-1)return this}var a=Vr(this,e);return a.array.splice(o+1),n&&(a.array[o]=n),a};var Rr,Dr={};function Lr(e,t){var r=e._origin,n=e._capacity,o=Hr(n),i=e._tail;return a(e._root,e._level,0);function a(e,s,u){return 0===s?function(e,a){var s=a===o?i&&i.array:e&&e.array,u=a>r?0:r-a,c=n-a;c>32&&(c=32);return function(){if(u===c)return Dr;var e=t?--c:u++;return s&&s[e]}}(e,u):function(e,o,i){var s,u=e&&e.array,c=i>r?0:r-i>>o,l=1+(n-i>>o);l>32&&(l=32);return function(){for(;;){if(s){var e=s();if(e!==Dr)return e;s=null}if(c===l)return Dr;var r=t?--l:c++;s=a(u&&u[r],o-5,i+(r<<o))}}}(e,s,u)}}function Jr(e,t,r,n,o,i,a){var s=Object.create(Ir);return s.size=t-e,s._origin=e,s._capacity=t,s._level=r,s._root=n,s._tail=o,s.__ownerID=i,s.__hash=a,s.__altered=!1,s}function qr(){return Rr||(Rr=Jr(0,0,5))}function Ur(e,t,r,n,o,i){var a,s=n>>>r&31,u=e&&s<e.array.length;if(!u&&void 0===o)return e;if(r>0){var c=e&&e.array[s],l=Ur(c,t,r-5,n,o,i);return l===c?e:((a=Vr(e,t)).array[s]=l,a)}return u&&e.array[s]===o?e:(i&&re(i),a=Vr(e,t),void 0===o&&s===a.array.length-1?a.array.pop():a.array[s]=o,a)}function Vr(e,t){return t&&e&&t===e.ownerID?e:new Mr(e?e.array.slice():[],t)}function Wr(e,t){if(t>=Hr(e._capacity))return e._tail;if(t<1<<e._level+5){for(var r=e._root,n=e._level;r&&n>0;)r=r.array[t>>>n&31],n-=5;return r}}function $r(e,t,r){void 0!==t&&(t|=0),void 0!==r&&(r|=0);var n=e.__ownerID||new ne,o=e._origin,i=e._capacity,a=o+t,s=void 0===r?i:r<0?i+r:o+r;if(a===o&&s===i)return e;if(a>=s)return e.clear();for(var u=e._level,c=e._root,l=0;a+l<0;)c=new Mr(c&&c.array.length?[void 0,c]:[],n),l+=1<<(u+=5);l&&(a+=l,o+=l,s+=l,i+=l);for(var f=Hr(i),h=Hr(s);h>=1<<u+5;)c=new Mr(c&&c.array.length?[c]:[],n),u+=5;var d=e._tail,p=h<f?Wr(e,s-1):h>f?new Mr([],n):d;if(d&&h>f&&a<i&&d.array.length){for(var v=c=Vr(c,n),y=u;y>5;y-=5){var m=f>>>y&31;v=v.array[m]=Vr(v.array[m],n)}v.array[f>>>5&31]=d}if(s<i&&(p=p&&p.removeAfter(n,0,s)),a>=h)a-=h,s-=h,u=5,c=null,p=p&&p.removeBefore(n,0,a);else if(a>o||h<f){for(l=0;c;){var g=a>>>u&31;if(g!==h>>>u&31)break;g&&(l+=(1<<u)*g),u-=5,c=c.array[g]}c&&a>o&&(c=c.removeBefore(n,u,a-l)),c&&h<f&&(c=c.removeAfter(n,u,h-l)),l&&(a-=l,s-=l)}return e.__ownerID?(e.size=s-a,e._origin=a,e._capacity=s,e._level=u,e._root=c,e._tail=p,e.__hash=void 0,e.__altered=!0,e):Jr(a,s,u,c,p)}function Hr(e){return e<32?0:e-1>>>5<<5}var Gr,Qr=function(e){function t(e){return null==e?Xr():Ge(e)?e:Xr().withMutations((function(t){var r=me(e);Dt(r.size),r.forEach((function(e,r){return t.set(r,e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("OrderedMap {","}")},t.prototype.get=function(e,t){var r=this._map.get(e);return void 0!==r?this._list.get(r)[1]:t},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):Xr()},t.prototype.set=function(e,t){return Zr(this,e,t)},t.prototype.remove=function(e){return Zr(this,e,te)},t.prototype.__iterate=function(e,t){var r=this;return this._list.__iterate((function(t){return t&&e(t[1],t[0],r)}),t)},t.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},t.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),r=this._list.__ensureOwner(e);return e?Yr(t,r,e,this.__hash):0===this.size?Xr():(this.__ownerID=e,this.__altered=!1,this._map=t,this._list=r,this)},t}(dr);function Yr(e,t,r,n){var o=Object.create(Qr.prototype);return o.size=e?e.size:0,o._map=e,o._list=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function Xr(){return Gr||(Gr=Yr(Or(),qr()))}function Zr(e,t,r){var n,o,i=e._map,a=e._list,s=i.get(t),u=void 0!==s;if(r===te){if(!u)return e;a.size>=32&&a.size>=2*i.size?(n=(o=a.filter((function(e,t){return void 0!==e&&s!==t}))).toKeyedSeq().map((function(e){return e[0]})).flip().toMap(),e.__ownerID&&(n.__ownerID=o.__ownerID=e.__ownerID)):(n=i.remove(t),o=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(r===a.get(s)[1])return e;n=i,o=a.set(s,[t,r])}else n=i.set(t,a.size),o=a.set(a.size,[t,r]);return e.__ownerID?(e.size=n.size,e._map=n,e._list=o,e.__hash=void 0,e.__altered=!0,e):Yr(n,o)}Qr.isOrderedMap=Ge,Qr.prototype[xe]=!0,Qr.prototype.delete=Qr.prototype.remove;function en(e){return Boolean(e&&e["@@__IMMUTABLE_STACK__@@"])}var tn=function(e){function t(e){return null==e?an():en(e)?e:an().pushAll(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(e,t){var r=this._head;for(e=ie(this,e);r&&e--;)r=r.next;return r?r.value:t},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var e=arguments;if(0===arguments.length)return this;for(var t=this.size+arguments.length,r=this._head,n=arguments.length-1;n>=0;n--)r={value:e[n],next:r};return this.__ownerID?(this.size=t,this._head=r,this.__hash=void 0,this.__altered=!0,this):on(t,r)},t.prototype.pushAll=function(t){if(0===(t=e(t)).size)return this;if(0===this.size&&en(t))return t;Dt(t.size);var r=this.size,n=this._head;return t.__iterate((function(e){r++,n={value:e,next:n}}),!0),this.__ownerID?(this.size=r,this._head=n,this.__hash=void 0,this.__altered=!0,this):on(r,n)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):an()},t.prototype.slice=function(t,r){if(se(t,r,this.size))return this;var n=ue(t,this.size);if(ce(r,this.size)!==this.size)return e.prototype.slice.call(this,t,r);for(var o=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=o,this._head=i,this.__hash=void 0,this.__altered=!0,this):on(o,i)},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?on(this.size,this._head,e,this.__hash):0===this.size?an():(this.__ownerID=e,this.__altered=!1,this)},t.prototype.__iterate=function(e,t){var r=this;if(t)return new De(this.toArray()).__iterate((function(t,n){return e(t,n,r)}),t);for(var n=0,o=this._head;o&&!1!==e(o.value,n++,this);)o=o.next;return n},t.prototype.__iterator=function(e,t){if(t)return new De(this.toArray()).__iterator(e,t);var r=0,n=this._head;return new Ee((function(){if(n){var t=n.value;return n=n.next,Te(e,r++,t)}return{value:void 0,done:!0}}))},t}(ge);tn.isStack=en;var rn,nn=tn.prototype;function on(e,t,r,n){var o=Object.create(nn);return o.size=e,o._head=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function an(){return rn||(rn=on(0))}nn["@@__IMMUTABLE_STACK__@@"]=!0,nn.shift=nn.pop,nn.unshift=nn.push,nn.unshiftAll=nn.pushAll,nn.withMutations=cr,nn.wasAltered=hr,nn.asImmutable=fr,nn["@@transducer/init"]=nn.asMutable=lr,nn["@@transducer/step"]=function(e,t){return e.unshift(t)},nn["@@transducer/result"]=function(e){return e.asImmutable()};function sn(e){return Boolean(e&&e["@@__IMMUTABLE_SET__@@"])}function un(e){return sn(e)&&Ae(e)}function cn(e,t){if(e===t)return!0;if(!he(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||de(e)!==de(t)||pe(e)!==pe(t)||Ae(e)!==Ae(t))return!1;if(0===e.size&&0===t.size)return!0;var r=!ve(e);if(Ae(e)){var n=e.entries();return t.every((function(e,t){var o=n.next().value;return o&&Ye(o[1],e)&&(r||Ye(o[0],t))}))&&n.next().done}var o=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{o=!0;var i=e;e=t,t=i}var a=!0,s=t.__iterate((function(t,n){if(r?!e.has(t):o?!Ye(t,e.get(n,te)):!Ye(e.get(n,te),t))return a=!1,!1}));return a&&e.size===s}function ln(e,t){var r=function(r){e.prototype[r]=t[r]};return Object.keys(t).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(r),e}function fn(e){if(!e||"object"!=typeof e)return e;if(!he(e)){if(!qt(e))return e;e=Fe(e)}if(de(e)){var t={};return e.__iterate((function(e,r){t[r]=fn(e)})),t}var r=[];return e.__iterate((function(e){r.push(fn(e))})),r}var hn=function(e){function t(t){return null==t?mn():sn(t)&&!Ae(t)?t:mn().withMutations((function(r){var n=e(t);Dt(n.size),n.forEach((function(e){return r.add(e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(me(e).keySeq())},t.intersect=function(e){return(e=ye(e).toArray()).length?pn.intersect.apply(t(e.pop()),e):mn()},t.union=function(e){return(e=ye(e).toArray()).length?pn.union.apply(t(e.pop()),e):mn()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(e){return this._map.has(e)},t.prototype.add=function(e){return vn(this,this._map.set(e,e))},t.prototype.remove=function(e){return vn(this,this._map.remove(e))},t.prototype.clear=function(){return vn(this,this._map.clear())},t.prototype.map=function(e,t){var r=this,n=!1,o=vn(this,this._map.mapEntries((function(o){var i=o[1],a=e.call(t,i,i,r);return a!==i&&(n=!0),[a,a]}),t));return n?o:this},t.prototype.union=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return 0===(t=t.filter((function(e){return 0!==e.size}))).length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations((function(r){for(var n=0;n<t.length;n++)e(t[n]).forEach((function(e){return r.add(e)}))})):this.constructor(t[0])},t.prototype.intersect=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];if(0===t.length)return this;t=t.map((function(t){return e(t)}));var n=[];return this.forEach((function(e){t.every((function(t){return t.includes(e)}))||n.push(e)})),this.withMutations((function(e){n.forEach((function(t){e.remove(t)}))}))},t.prototype.subtract=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];if(0===t.length)return this;t=t.map((function(t){return e(t)}));var n=[];return this.forEach((function(e){t.some((function(t){return t.includes(e)}))&&n.push(e)})),this.withMutations((function(e){n.forEach((function(t){e.remove(t)}))}))},t.prototype.sort=function(e){return Kn(Tt(this,e))},t.prototype.sortBy=function(e,t){return Kn(Tt(this,t,e))},t.prototype.wasAltered=function(){return this._map.wasAltered()},t.prototype.__iterate=function(e,t){var r=this;return this._map.__iterate((function(t){return e(t,t,r)}),t)},t.prototype.__iterator=function(e,t){return this._map.__iterator(e,t)},t.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e);return e?this.__make(t,e):0===this.size?this.__empty():(this.__ownerID=e,this._map=t,this)},t}(ke);hn.isSet=sn;var dn,pn=hn.prototype;function vn(e,t){return e.__ownerID?(e.size=t.size,e._map=t,e):t===e._map?e:0===t.size?e.__empty():e.__make(t)}function yn(e,t){var r=Object.create(pn);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function mn(){return dn||(dn=yn(Or()))}pn["@@__IMMUTABLE_SET__@@"]=!0,pn.delete=pn.remove,pn.merge=pn.concat=pn.union,pn.withMutations=cr,pn.asImmutable=fr,pn["@@transducer/init"]=pn.asMutable=lr,pn["@@transducer/step"]=function(e,t){return e.add(t)},pn["@@transducer/result"]=function(e){return e.asImmutable()},pn.__empty=mn,pn.__make=yn;var gn,kn=function(e){function t(e,r,n){if(!(this instanceof t))return new t(e,r,n);if(Rt(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===r&&(r=1/0),n=void 0===n?1:Math.abs(n),r<e&&(n=-n),this._start=e,this._end=r,this._step=n,this.size=Math.max(0,Math.ceil((r-e)/n-1)+1),0===this.size){if(gn)return gn;gn=this}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},t.prototype.get=function(e,t){return this.has(e)?this._start+ie(this,e)*this._step:t},t.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t<this.size&&t===Math.floor(t)},t.prototype.slice=function(e,r){return se(e,r,this.size)?this:(e=ue(e,this.size),(r=ce(r,this.size))<=e?new t(0,0):new t(this.get(e,this._end),this.get(r,this._end),this._step))},t.prototype.indexOf=function(e){var t=e-this._start;if(t%this._step==0){var r=t/this._step;if(r>=0&&r<this.size)return r}return-1},t.prototype.lastIndexOf=function(e){return this.indexOf(e)},t.prototype.__iterate=function(e,t){for(var r=this.size,n=this._step,o=t?this._start+(r-1)*n:this._start,i=0;i!==r&&!1!==e(o,t?r-++i:i++,this);)o+=t?-n:n;return i},t.prototype.__iterator=function(e,t){var r=this.size,n=this._step,o=t?this._start+(r-1)*n:this._start,i=0;return new Ee((function(){if(i===r)return{value:void 0,done:!0};var a=o;return o+=t?-n:n,Te(e,t?r-++i:i++,a)}))},t.prototype.equals=function(e){return e instanceof t?this._start===e._start&&this._end===e._end&&this._step===e._step:cn(this,e)},t}(Me);function _n(e,t,r){for(var n=Lt(t),o=0;o!==n.length;)if((e=Vt(e,n[o++],te))===te)return r;return e}function bn(e,t){return _n(this,e,t)}function wn(){Dt(this.size);var e={};return this.__iterate((function(t,r){e[r]=t})),e}ye.isIterable=he,ye.isKeyed=de,ye.isIndexed=pe,ye.isAssociative=ve,ye.isOrdered=Ae,ye.Iterator=Ee,ln(ye,{toArray:function(){Dt(this.size);var e=new Array(this.size||0),t=de(this),r=0;return this.__iterate((function(n,o){e[r++]=t?[o,n]:n})),e},toIndexedSeq:function(){return new mt(this)},toJS:function(){return fn(this)},toKeyedSeq:function(){return new yt(this,!0)},toMap:function(){return dr(this.toKeyedSeq())},toObject:wn,toOrderedMap:function(){return Qr(this.toKeyedSeq())},toOrderedSet:function(){return Kn(de(this)?this.valueSeq():this)},toSet:function(){return hn(de(this)?this.valueSeq():this)},toSetSeq:function(){return new gt(this)},toSeq:function(){return pe(this)?this.toIndexedSeq():de(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return tn(de(this)?this.valueSeq():this)},toList:function(){return Fr(de(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return jt(this,St(this,e))},includes:function(e){return this.some((function(t){return Ye(t,e)}))},entries:function(){return this.__iterator(2)},every:function(e,t){Dt(this.size);var r=!0;return this.__iterate((function(n,o,i){if(!e.call(t,n,o,i))return r=!1,!1})),r},filter:function(e,t){return jt(this,xt(this,e,t,!0))},find:function(e,t,r){var n=this.findEntry(e,t);return n?n[1]:r},forEach:function(e,t){return Dt(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Dt(this.size),e=void 0!==e?""+e:",";var t="",r=!0;return this.__iterate((function(n){r?r=!1:t+=e,t+=null!=n?n.toString():""})),t},keys:function(){return this.__iterator(0)},map:function(e,t){return jt(this,bt(this,e,t))},reduce:function(e,t,r){return En(this,e,t,r,arguments.length<2,!1)},reduceRight:function(e,t,r){return En(this,e,t,r,arguments.length<2,!0)},reverse:function(){return jt(this,wt(this,!0))},slice:function(e,t){return jt(this,At(this,e,t,!0))},some:function(e,t){return!this.every(Bn(e),t)},sort:function(e){return jt(this,Tt(this,e))},values:function(){return this.__iterator(1)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(e,t){return oe(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,r){var n=dr().asMutable();return e.__iterate((function(o,i){n.update(t.call(r,o,i,e),0,(function(e){return e+1}))})),n.asImmutable()}(this,e,t)},equals:function(e){return cn(this,e)},entrySeq:function(){var e=this;if(e._cache)return new De(e._cache);var t=e.toSeq().map(Nn).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Bn(e),t)},findEntry:function(e,t,r){var n=r;return this.__iterate((function(r,o,i){if(e.call(t,r,o,i))return n=[o,r],!1})),n},findKey:function(e,t){var r=this.findEntry(e,t);return r&&r[0]},findLast:function(e,t,r){return this.toKeyedSeq().reverse().find(e,t,r)},findLastEntry:function(e,t,r){return this.toKeyedSeq().reverse().findEntry(e,t,r)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(e){return this.find(ae,null,e)},flatMap:function(e,t){return jt(this,function(e,t,r){var n=Pt(e);return e.toSeq().map((function(o,i){return n(t.call(r,o,i,e))})).flatten(!0)}(this,e,t))},flatten:function(e){return jt(this,Et(this,e,!0))},fromEntrySeq:function(){return new kt(this)},get:function(e,t){return this.find((function(t,r){return Ye(r,e)}),void 0,t)},getIn:bn,groupBy:function(e,t){return function(e,t,r){var n=de(e),o=(Ae(e)?Qr():dr()).asMutable();e.__iterate((function(i,a){o.update(t.call(r,i,a,e),(function(e){return(e=e||[]).push(n?[a,i]:i),e}))}));var i=Pt(e);return o.map((function(t){return jt(e,i(t))})).asImmutable()}(this,e,t)},has:function(e){return this.get(e,te)!==te},hasIn:function(e){return _n(this,e,te)!==te},isSubset:function(e){return e="function"==typeof e.includes?e:ye(e),this.every((function(t){return e.includes(t)}))},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:ye(e)).isSubset(this)},keyOf:function(e){return this.findKey((function(t){return Ye(t,e)}))},keySeq:function(){return this.toSeq().map(Tn).toIndexedSeq()},last:function(e){return this.toSeq().reverse().first(e)},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Nt(this,e)},maxBy:function(e,t){return Nt(this,t,e)},min:function(e){return Nt(this,e?zn(e):Cn)},minBy:function(e,t){return Nt(this,t?zn(t):Cn,e)},rest:function(){return this.slice(1)},skip:function(e){return 0===e?this:this.slice(Math.max(0,e))},skipLast:function(e){return 0===e?this:this.slice(0,-Math.max(0,e))},skipWhile:function(e,t){return jt(this,Ot(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Bn(e),t)},sortBy:function(e,t){return jt(this,Tt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return this.slice(-Math.max(0,e))},takeWhile:function(e,t){return jt(this,function(e,t,r){var n=Kt(e);return n.__iterateUncached=function(n,o){var i=this;if(o)return this.cacheResult().__iterate(n,o);var a=0;return e.__iterate((function(e,o,s){return t.call(r,e,o,s)&&++a&&n(e,o,i)})),a},n.__iteratorUncached=function(n,o){var i=this;if(o)return this.cacheResult().__iterator(n,o);var a=e.__iterator(2,o),s=!0;return new Ee((function(){if(!s)return{value:void 0,done:!0};var e=a.next();if(e.done)return e;var o=e.value,u=o[0],c=o[1];return t.call(r,c,u,i)?2===n?e:Te(n,u,c,e):(s=!1,{value:void 0,done:!0})}))},n}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Bn(e),t)},update:function(e){return e(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(e){if(e.size===1/0)return 0;var t=Ae(e),r=de(e),n=t?1:0;return function(e,t){return t=Xe(t,3432918353),t=Xe(t<<15|t>>>-15,461845907),t=Xe(t<<13|t>>>-13,5),t=Xe((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=Ze((t=Xe(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(r?t?function(e,t){n=31*n+Pn(tt(e),tt(t))|0}:function(e,t){n=n+Pn(tt(e),tt(t))|0}:t?function(e){n=31*n+tt(e)|0}:function(e){n=n+tt(e)|0}),n)}(this))}});var xn=ye.prototype;xn["@@__IMMUTABLE_ITERABLE__@@"]=!0,xn[Se]=xn.values,xn.toJSON=xn.toArray,xn.__toStringMapper=Ut,xn.inspect=xn.toSource=function(){return this.toString()},xn.chain=xn.flatMap,xn.contains=xn.includes,ln(me,{flip:function(){return jt(this,_t(this))},mapEntries:function(e,t){var r=this,n=0;return jt(this,this.toSeq().map((function(o,i){return e.call(t,[i,o],n++,r)})).fromEntrySeq())},mapKeys:function(e,t){var r=this;return jt(this,this.toSeq().flip().map((function(n,o){return e.call(t,n,o,r)})).flip())}});var An=me.prototype;An["@@__IMMUTABLE_KEYED__@@"]=!0,An[Se]=xn.entries,An.toJSON=wn,An.__toStringMapper=function(e,t){return Ut(t)+": "+Ut(e)},ln(ge,{toKeyedSeq:function(){return new yt(this,!1)},filter:function(e,t){return jt(this,xt(this,e,t,!1))},findIndex:function(e,t){var r=this.findEntry(e,t);return r?r[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return jt(this,wt(this,!1))},slice:function(e,t){return jt(this,At(this,e,t,!1))},splice:function(e,t){var r=arguments.length;if(t=Math.max(t||0,0),0===r||2===r&&!t)return this;e=ue(e,e<0?this.count():this.size);var n=this.slice(0,e);return jt(this,1===r?n:n.concat(Mt(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var r=this.findLastEntry(e,t);return r?r[0]:-1},first:function(e){return this.get(0,e)},flatten:function(e){return jt(this,Et(this,e,!1))},get:function(e,t){return(e=ie(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find((function(t,r){return r===e}),void 0,t)},has:function(e){return(e=ie(this,e))>=0&&(void 0!==this.size?this.size===1/0||e<this.size:-1!==this.indexOf(e))},interpose:function(e){return jt(this,function(e,t){var r=Kt(e);return r.size=e.size&&2*e.size-1,r.__iterateUncached=function(r,n){var o=this,i=0;return e.__iterate((function(e){return(!i||!1!==r(t,i++,o))&&!1!==r(e,i++,o)}),n),i},r.__iteratorUncached=function(r,n){var o,i=e.__iterator(1,n),a=0;return new Ee((function(){return(!o||a%2)&&(o=i.next()).done?o:a%2?Te(r,a++,t):Te(r,a++,o.value,o)}))},r}(this,e))},interleave:function(){var e=[this].concat(Mt(arguments)),t=zt(this.toSeq(),Me.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),jt(this,r)},keySeq:function(){return kn(0,this.size)},last:function(e){return this.get(-1,e)},skipWhile:function(e,t){return jt(this,Ot(this,e,t,!1))},zip:function(){var e=[this].concat(Mt(arguments));return jt(this,zt(this,jn,e))},zipAll:function(){var e=[this].concat(Mt(arguments));return jt(this,zt(this,jn,e,!0))},zipWith:function(e){var t=Mt(arguments);return t[0]=this,jt(this,zt(this,e,t))}});var On=ge.prototype;On["@@__IMMUTABLE_INDEXED__@@"]=!0,On[xe]=!0,ln(ke,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}});var Sn=ke.prototype;function En(e,t,r,n,o,i){return Dt(e.size),e.__iterate((function(e,i,a){o?(o=!1,r=e):r=t.call(n,r,e,i,a)}),i),r}function Tn(e,t){return t}function Nn(e,t){return[t,e]}function Bn(e){return function(){return!e.apply(this,arguments)}}function zn(e){return function(){return-e.apply(this,arguments)}}function jn(){return Mt(arguments)}function Cn(e,t){return e<t?1:e>t?-1:0}function Pn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}Sn.has=xn.includes,Sn.contains=Sn.includes,Sn.keys=Sn.values,ln(Ie,An),ln(Me,On),ln(Re,Sn);var Kn=function(e){function t(e){return null==e?Rn():un(e)?e:Rn().withMutations((function(t){var r=ke(e);Dt(r.size),r.forEach((function(e){return t.add(e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(me(e).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t}(hn);Kn.isOrderedSet=un;var Fn,In=Kn.prototype;function Mn(e,t){var r=Object.create(In);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function Rn(){return Fn||(Fn=Mn(Xr()))}In[xe]=!0,In.zip=On.zip,In.zipWith=On.zipWith,In.zipAll=On.zipAll,In.__empty=Rn,In.__make=Mn;var Dn=function(e,t){var r;!function(e){if(be(e))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(we(e))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(null===e||"object"!=typeof e)throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}(e);var n=function(i){var a=this;if(i instanceof n)return i;if(!(this instanceof n))return new n(i);if(!r){r=!0;var s=Object.keys(e),u=o._indices={};o._name=t,o._keys=s,o._defaultValues=e;for(var c=0;c<s.length;c++){var l=s[c];u[l]=c,o[l]?"object"==typeof console&&console.warn&&console.warn("Cannot define "+Wn(this)+' with property "'+l+'" since that property name is part of the Record API.'):Hn(o,l)}}return this.__ownerID=void 0,this._values=Fr().withMutations((function(e){e.setSize(a._keys.length),me(i).forEach((function(t,r){e.set(a._indices[r],t===a._defaultValues[r]?void 0:t)}))})),this},o=n.prototype=Object.create(Un);return o.constructor=n,t&&(n.displayName=t),n};Dn.prototype.toString=function(){for(var e,t=Wn(this)+" { ",r=this._keys,n=0,o=r.length;n!==o;n++)t+=(n?", ":"")+(e=r[n])+": "+Ut(this.get(e));return t+" }"},Dn.prototype.equals=function(e){return this===e||e&&$n(this).equals($n(e))},Dn.prototype.hashCode=function(){return $n(this).hashCode()},Dn.prototype.has=function(e){return this._indices.hasOwnProperty(e)},Dn.prototype.get=function(e,t){if(!this.has(e))return t;var r=this._indices[e],n=this._values.get(r);return void 0===n?this._defaultValues[e]:n},Dn.prototype.set=function(e,t){if(this.has(e)){var r=this._values.set(this._indices[e],t===this._defaultValues[e]?void 0:t);if(r!==this._values&&!this.__ownerID)return Vn(this,r)}return this},Dn.prototype.remove=function(e){return this.set(e)},Dn.prototype.clear=function(){var e=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Vn(this,e)},Dn.prototype.wasAltered=function(){return this._values.wasAltered()},Dn.prototype.toSeq=function(){return $n(this)},Dn.prototype.toJS=function(){return fn(this)},Dn.prototype.entries=function(){return this.__iterator(2)},Dn.prototype.__iterator=function(e,t){return $n(this).__iterator(e,t)},Dn.prototype.__iterate=function(e,t){return $n(this).__iterate(e,t)},Dn.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._values.__ensureOwner(e);return e?Vn(this,t,e):(this.__ownerID=e,this._values=t,this)},Dn.isRecord=be,Dn.getDescriptiveName=Wn;var Ln,Jn,qn,Un=Dn.prototype;function Vn(e,t,r){var n=Object.create(Object.getPrototypeOf(e));return n._values=t,n.__ownerID=r,n}function Wn(e){return e.constructor.displayName||e.constructor.name||"Record"}function $n(e){return Ve(e._keys.map((function(t){return[t,e.get(t)]})))}function Hn(e,t){try{Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){Rt(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch(e){}}Un["@@__IMMUTABLE_RECORD__@@"]=!0,Un.delete=Un.remove,Un.deleteIn=Un.removeIn=Qt,Un.getIn=bn,Un.hasIn=xn.hasIn,Un.merge=er,Un.mergeWith=tr,Un.mergeIn=sr,Un.mergeDeep=ir,Un.mergeDeepWith=ar,Un.mergeDeepIn=ur,Un.setIn=Gt,Un.update=Xt,Un.updateIn=Zt,Un.withMutations=cr,Un.asMutable=lr,Un.asImmutable=fr,Un[Se]=Un.entries,Un.toJSON=Un.toObject=xn.toObject,Un.inspect=Un.toSource=function(){return this.toString()},function(e){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this._value=e,this.size=void 0===r?1/0:Math.max(0,r),0===this.size){if(Ln)return Ln;Ln=this}}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},t.prototype.get=function(e,t){return this.has(e)?this._value:t},t.prototype.includes=function(e){return Ye(this._value,e)},t.prototype.slice=function(e,r){var n=this.size;return se(e,r,n)?this:new t(this._value,ce(r,n)-ue(e,n))},t.prototype.reverse=function(){return this},t.prototype.indexOf=function(e){return Ye(this._value,e)?0:-1},t.prototype.lastIndexOf=function(e){return Ye(this._value,e)?this.size:-1},t.prototype.__iterate=function(e,t){for(var r=this.size,n=0;n!==r&&!1!==e(this._value,t?r-++n:n++,this););return n},t.prototype.__iterator=function(e,t){var r=this,n=this.size,o=0;return new Ee((function(){return o===n?{value:void 0,done:!0}:Te(e,t?n-++o:o++,r._value)}))},t.prototype.equals=function(e){return e instanceof t?Ye(this._value,e._value):cn(e)}}(Me),Jn=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]"),qn=new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]*[֑-߿יִ-﷽ﹰ-ﻼ]");var Gn,Qn,Yn=function(e){return e=e.toString(),qn.test(e)?"rtl":Jn.test(e)?"ltr":"neutral"},Xn={exports:{}};Gn=Xn,Qn=Xn.exports,function(e){var t=Qn,r=Gn&&Gn.exports==t&&Gn,n="object"==typeof m&&m;n.global!==n&&n.window!==n||(e=n);var o=/([\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,i=/([\uD800-\uDBFF])([\uDC00-\uDFFF])/g,a=function(e){for(var t="",r=(e=e.replace(o,(function(e,t,r){return a(r)+t})).replace(i,"$2$1")).length;r--;)t+=e.charAt(r);return t},s={version:"0.2.0",reverse:a};if(t&&!t.nodeType)if(r)r.exports=s;else for(var u in s)s.hasOwnProperty(u)&&(t[u]=s[u]);else e.esrever=s}(m);var Zn=Object.prototype.hasOwnProperty,eo=Object.prototype.toString;var to=function(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(e.toString==eo)switch(e.toString()){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(var t in e)if(Zn.call(e,t))return!1;return!0}return!1};const ro=e,{isEqual:no}=t,{pick:oo}=t,{omit:io}=t;var ao={BLOCK:"@@__SLATE_BLOCK__@@",CHANGE:"@@__SLATE_CHANGE__@@",CHARACTER:"@@__SLATE_CHARACTER__@@",DOCUMENT:"@@__SLATE_DOCUMENT__@@",HISTORY:"@@__SLATE_HISTORY__@@",INLINE:"@@__SLATE_INLINE__@@",LEAF:"@@__SLATE_LEAF__@@",MARK:"@@__SLATE_MARK__@@",OPERATION:"@@__SLATE_OPERATION__@@",RANGE:"@@__SLATE_RANGE__@@",SCHEMA:"@@__SLATE_SCHEMA__@@",STACK:"@@__SLATE_STACK__@@",TEXT:"@@__SLATE_TEXT__@@",VALUE:"@@__SLATE_VALUE__@@"};function so(e,t){return!(!t||!t[ao[e]])}var uo=void 0,co=void 0;function lo(){uo=0,co=function(){return""+uo++}}lo();var fo={create:function(e){if(null==e)return co();if("string"==typeof e)return e;throw new Error("Keys must be strings, but you passed: "+e)},setGenerator:function(e){co=e},resetGenerator:lo},ho="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},po=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},vo=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),yo=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mo=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)},go=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},ko=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},_o=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},bo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,isVoid:this.isVoid,data:this.data.toJSON(),nodes:this.nodes.toArray().map((function(t){return t.toJSON(e)}))};return e.preserveKeys&&(t.key=this.key),t}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"block"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return!this.isVoid&&!this.nodes.some((function(e){return!e.isEmpty}))}},{key:"text",get:function(){return this.getText()}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isBlock(e))return e;if("string"==typeof e&&(e={type:e}),w(e))return t.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(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Block.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isBlock(e))return e;var r=e.data,n=void 0===r?{}:r,o=e.isVoid,i=void 0!==o&&o,a=e.key,s=void 0===a?fo.create():a,u=e.nodes,c=void 0===u?[]:u,l=e.type;if("string"!=typeof l)throw new Error("`Block.fromJSON` requires a `type` string.");return new t({key:s,type:l,isVoid:!!i,data:dr(n),nodes:t.createChildren(c)})}},{key:"isBlockList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isBlock(e)}))}}]),t}(Dn({data:new dr,isVoid:!1,key:void 0,nodes:new Fr,type:void 0}));bo.fromJS=bo.fromJSON,bo.isBlock=so.bind(null,"BLOCK"),bo.prototype[ao.BLOCK]=!0;var wo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,isVoid:this.isVoid,data:this.data.toJSON(),nodes:this.nodes.toArray().map((function(t){return t.toJSON(e)}))};return e.preserveKeys&&(t.key=this.key),t}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"inline"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return!this.isVoid&&!this.nodes.some((function(e){return!e.isEmpty}))}},{key:"text",get:function(){return this.getText()}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isInline(e))return e;if("string"==typeof e&&(e={type:e}),w(e))return t.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(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Inline.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isInline(e))return e;var r=e.data,n=void 0===r?{}:r,o=e.isVoid,i=void 0!==o&&o,a=e.key,s=void 0===a?fo.create():a,u=e.nodes,c=void 0===u?[]:u,l=e.type;if("string"!=typeof l)throw new Error("`Inline.fromJS` requires a `type` string.");return new t({key:s,type:l,isVoid:!!i,data:new dr(n),nodes:t.createChildren(c)})}},{key:"isInlineList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isInline(e)}))}}]),t}(Dn({data:new dr,isVoid:!1,key:void 0,nodes:new Fr,type:void 0}));wo.fromJS=wo.fromJSON,wo.isInline=so.bind(null,"INLINE"),wo.prototype[ao.INLINE]=!0;var xo=function(){function e(){po(this,e)}return vo(e,null,[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(dr.isMap(t))return t;if(w(t))return e.fromJSON(t);throw new Error("`Data.create` only accepts objects or maps, but you passed it: "+t)}},{key:"fromJSON",value:function(e){return new dr(e)}}]),e}();xo.fromJS=xo.fromJSON;var Ao={},Oo={};function So(e,t){var r=function(t){var r=e[t];if(!r)throw new Error('Object does not have a property named "'+t+'".');e[t]=function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];0!==this.__cache_key&&(this.__cache_key=0,this.__cache=new Map,this.__cache_no_args={}),this.__cache||(this.__cache=new Map),this.__cache_no_args||(this.__cache_no_args={});var i=0!==n.length,a=void 0,s=void 0;if(i?(s=[t].concat(n),a=Eo(this.__cache,s)):a=this.__cache_no_args[t],undefined!==a)return a===Oo?void 0:a;var u=r.apply(this,n),c=void 0===u?Oo:u;return i?this.__cache=To(this.__cache,s,c):this.__cache_no_args[t]=c,u}},n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){r(a.value)}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}}function Eo(e,t){var r=!0,n=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var s=i.value;if(undefined===(e=e.get(s)))return}}catch(e){n=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw o}}return e.get(Ao)}function To(e,t,r){var n=e,o=void 0,i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;undefined===(o=n.get(l))&&(o=new Map,n.set(l,o)),n=o}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}return o.set(Ao,r),e}var No=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"getComponent",value:function(e){return e.__getComponent(this)}},{key:"toJSON",value:function(){return{object:this.object,type:this.type,data:this.data.toJSON()}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"mark"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isMark(e))return e;if("string"==typeof e&&(e={type:e}),w(e))return t.fromJSON(e);throw new Error("`Mark.create` only accepts objects, strings or marks, but you passed it: "+e)}},{key:"createSet",value:function(e){if(hn.isSet(e)||Array.isArray(e))return new hn(e.map(t.create));if(null==e)return hn();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(t.isMark(e))return{data:e.data,type:e.type};if("string"==typeof e)return{type:e};if(w(e)){var r={};return"type"in e&&(r.type=e.type),"data"in e&&(r.data=xo.create(e.data)),r}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,n=void 0===r?{}:r,o=e.type;if("string"!=typeof o)throw new Error("`Mark.fromJS` requires a `type` string.");return new t({type:o,data:new dr(n)})}},{key:"isMarkSet",value:function(e){return hn.isSet(e)&&e.every((function(e){return t.isMark(e)}))}}]),t}(Dn({data:new dr,type:void 0}));No.fromJS=No.fromJSON,No.isMark=so.bind(null,"MARK"),No.prototype[ao.MARK]=!0,So(No.prototype,["getComponent"]);var Bo={};["deleteBackward","deleteCharBackward","deleteLineBackward","deleteWordBackward","deleteForward","deleteCharForward","deleteWordForward","deleteLineForward","setBlocks","setInlines","splitInline","unwrapBlock","unwrapInline","wrapBlock","wrapInline"].forEach((function(e){Bo[e]=function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=t.value,a=i.selection,s=e+"AtRange";t[s].apply(t,[a].concat(n)),e.match(/Backward$/)?t.collapseToStart():e.match(/Forward$/)&&t.collapseToEnd()}})),Bo.setBlock=function(){ee.deprecate("slate@0.33.0","The `setBlock` method of Slate changes has been renamed to `setBlocks`."),Bo.setBlocks.apply(Bo,arguments)},Bo.setInline=function(){ee.deprecate("slate@0.33.0","The `setInline` method of Slate changes has been renamed to `setInlines`."),Bo.setInlines.apply(Bo,arguments)},Bo.addMark=function(e,t){t=No.create(t);var r=e.value,n=r.document,o=r.selection;if(o.isExpanded)e.addMarkAtRange(o,t);else if(o.marks){var i=o.marks.add(t),a=o.set("marks",i);e.select(a)}else{var s=n.getActiveMarksAtRange(o).add(t),u=o.set("marks",s);e.select(u)}},Bo.addMarks=function(e,t){t.forEach((function(t){return e.addMark(t)}))},Bo.delete=function(e){var t=e.value.selection;e.deleteAtRange(t),e.collapseToStart()},Bo.insertBlock=function(e,t){t=bo.create(t);var r=e.value.selection;e.insertBlockAtRange(r,t);var n=e.value.document.getNode(t.key);n&&e.collapseToEndOf(n)},Bo.insertFragment=function(e,t){if(t.nodes.size){var r=e.value,n=r,o=n.document,i=n.selection,a=r,s=a.startText,u=a.endText,c=a.startInline,l=t.getLastText(),f=t.getClosestInline(l.key),h=t.nodes.first(),d=t.nodes.last(),p=o.getTexts().map((function(e){return e.key})),v=!c||i.hasEdgeAtStartOf(s)||i.hasEdgeAtEndOf(u),y=h.hasBlockChildren()||d.hasBlockChildren();e.insertFragmentAtRange(i,t);var m=(o=(r=e.value).document).getTexts().filter((function(e){return!p.includes(e.key)})),g=v?m.last():m.takeLast(2).first();g&&(f||y)?e.select(i.collapseToEndOf(g)):g?e.select(i.collapseToStartOf(g).move(l.text.length)):e.select(i.collapseToStart().move(l.text.length))}},Bo.insertInline=function(e,t){t=wo.create(t);var r=e.value.selection;e.insertInlineAtRange(r,t);var n=e.value.document.getNode(t.key);n&&e.collapseToEndOf(n)},Bo.insertText=function(e,t,r){var n=e.value,o=n.document,i=n.selection;r=r||i.marks||o.getInsertMarksAtRange(i),e.insertTextAtRange(i,t,r),i.marks&&o!=e.value.document&&e.select({marks:null})},Bo.splitBlock=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=e.value,n=r.selection,o=r.document,i=n.marks||o.getInsertMarksAtRange(n);e.splitBlockAtRange(n,t).collapseToEnd(),i&&0!==i.size&&e.select({marks:i})},Bo.removeMark=function(e,t){t=No.create(t);var r=e.value,n=r.document,o=r.selection;if(o.isExpanded)e.removeMarkAtRange(o,t);else if(o.marks){var i=o.marks.remove(t),a=o.set("marks",i);e.select(a)}else{var s=n.getActiveMarksAtRange(o).remove(t),u=o.set("marks",s);e.select(u)}},Bo.replaceMark=function(e,t,r){e.removeMark(t),e.addMark(r)},Bo.toggleMark=function(e,t){t=No.create(t),e.value.activeMarks.has(t)?e.removeMark(t):e.addMark(t)},Bo.wrapText=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,n=e.value,o=n.selection;e.wrapTextAtRange(o,t,r),o.isCollapsed&&e.moveStart(0-t.length),e.moveEnd(0-r.length),o.isForward!=e.value.selection.isForward&&e.flip()};var zo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{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:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"document"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return!this.nodes.some((function(e){return!e.isEmpty}))}},{key:"text",get:function(){return this.getText()}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isDocument(e))return e;if((Fr.isList(e)||Array.isArray(e))&&(e={nodes:e}),w(e))return t.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(t.isDocument(e))return e;var r=e.data,n=void 0===r?{}:r,o=e.key,i=void 0===o?fo.create():o,a=e.nodes,s=void 0===a?[]:a;return new t({key:i,data:new dr(n),nodes:t.createChildren(s)})}}]),t}(Dn({data:new dr,key:void 0,nodes:new Fr}));function jo(e,t){if(e.size!==t.size)return null;for(var r=0;r<e.size;r++){var n=e.get(r),o=t.get(r);if(n<o)return-1;if(n>o)return 1}return 0}function Co(e){if(null==e)return null;if(Fr.isList(e))return e;if(Array.isArray(e))return Fr(e);throw new Error("Paths can only be created from arrays or lists, but you passed: "+e)}function Po(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Fo(e,t),n=e.slice(0,r),o=t.slice(0,r);return[n,o]}function Ko(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1,n=e.get(r),o=n+t,i=e.set(r,o);return i}function Fo(e,t){return Math.min(e.size,t.size)}zo.fromJS=zo.fromJSON,zo.isDocument=so.bind(null,"DOCUMENT"),zo.prototype[ao.DOCUMENT]=!0;var Io={compare:jo,create:Co,crop:Po,decrement:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1;return Ko(e,0-t,r)},increment:Ko,isAbove:function(e,t){var r=Po(e,t),n=ko(r,2),o=n[0],i=n[1];return e.size<t.size&&0===jo(o,i)},isAfter:function(e,t){var r=Po(e,t),n=ko(r,2);return 1===jo(n[0],n[1])},isBefore:function(e,t){var r=Po(e,t),n=ko(r,2);return-1===jo(n[0],n[1])},lift:function(e){return e.slice(0,-1)},max:function(e,t){return Math.max(e.size,t.size)},min:Fo,relate:function(e,t){for(var r=[],n=0;n<e.size&&n<t.size;n++){var o=e.get(n);if(o!==t.get(n))break;r.push(o)}return Co(r)}},Mo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"hasAnchorAtStartOf",value:function(e){if(0!=this.anchorOffset)return!1;var t=Ro(e);return this.anchorKey==t.key}},{key:"hasAnchorAtEndOf",value:function(e){var t=Do(e);return this.anchorKey==t.key&&this.anchorOffset==t.text.length}},{key:"hasAnchorBetween",value:function(e,t,r){return this.anchorOffset<=r&&t<=this.anchorOffset&&this.hasAnchorIn(e)}},{key:"hasAnchorIn",value:function(e){return"text"==e.object?e.key==this.anchorKey:null!=this.anchorKey&&e.hasDescendant(this.anchorKey)}},{key:"hasFocusAtEndOf",value:function(e){var t=Do(e);return this.focusKey==t.key&&this.focusOffset==t.text.length}},{key:"hasFocusAtStartOf",value:function(e){if(0!=this.focusOffset)return!1;var t=Ro(e);return this.focusKey==t.key}},{key:"hasFocusBetween",value:function(e,t,r){return t<=this.focusOffset&&this.focusOffset<=r&&this.hasFocusIn(e)}},{key:"hasFocusIn",value:function(e){return"text"==e.object?e.key==this.focusKey:null!=this.focusKey&&e.hasDescendant(this.focusKey)}},{key:"isAtStartOf",value:function(e){return this.isCollapsed&&this.hasAnchorAtStartOf(e)}},{key:"isAtEndOf",value:function(e){return this.isCollapsed&&this.hasAnchorAtEndOf(e)}},{key:"focus",value:function(){return this.merge({isFocused:!0})}},{key:"blur",value:function(){return this.merge({isFocused:!1})}},{key:"deselect",value:function(){return this.merge({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isFocused:!1,isBackward:!1})}},{key:"flip",value:function(){return this.merge({anchorKey:this.focusKey,anchorOffset:this.focusOffset,anchorPath:this.focusPath,focusKey:this.anchorKey,focusOffset:this.anchorOffset,focusPath:this.anchorPath,isBackward:null==this.isBackward?null:!this.isBackward})}},{key:"moveAnchor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=this.anchorKey,r=this.focusKey,n=this.focusOffset,o=this.isBackward,i=this.anchorOffset+e;return this.merge({anchorOffset:i,isBackward:t==r?i>n:o})}},{key:"moveFocus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=this.anchorKey,r=this.anchorOffset,n=this.focusKey,o=this.isBackward,i=this.focusOffset+e;return this.merge({focusOffset:i,isBackward:n==t?r>i:o})}},{key:"moveAnchorTo",value:function(e,t){var r=this.anchorKey,n=this.focusKey,o=this.focusOffset,i=this.anchorPath,a=this.focusPath,s=this.isBackward;if("string"==typeof e){var u=e===r,c=e===n;return this.merge({anchorKey:e,anchorPath:c?a:u?i:null,anchorOffset:t,isBackward:c?t>o:u?s:null})}var l=e,f=l&&l.equals(i),h=l&&l.equals(a);return this.merge({anchorPath:l,anchorKey:f?r:h?n:null,anchorOffset:t,isBackward:h?t>o:f?s:null})}},{key:"moveFocusTo",value:function(e,t){var r=this.focusKey,n=this.anchorKey,o=this.anchorOffset,i=this.anchorPath,a=this.focusPath,s=this.isBackward;if("string"==typeof e){var u=e===n,c=e===r;return this.merge({focusKey:e,focusPath:u?i:c?a:null,focusOffset:t,isBackward:u?t<o:c?s:null})}var l=e,f=l&&l.equals(i),h=l&&l.equals(a);return this.merge({focusPath:l,focusKey:h?r:f?n:null,focusOffset:t,isBackward:f?t<o:h?s:null})}},{key:"moveAnchorOffsetTo",value:function(e){return this.merge({anchorOffset:e,isBackward:this.anchorKey==this.focusKey?e>this.focusOffset:this.isBackward})}},{key:"moveFocusOffsetTo",value:function(e){return this.merge({focusOffset:e,isBackward:this.anchorKey==this.focusKey?this.anchorOffset>e:this.isBackward})}},{key:"moveOffsetsTo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.moveAnchorOffsetTo(e).moveFocusOffsetTo(t)}},{key:"moveToAnchor",value:function(){return this.moveFocusTo(this.anchorKey,this.anchorOffset)}},{key:"moveToFocus",value:function(){return this.moveAnchorTo(this.focusKey,this.focusOffset)}},{key:"moveAnchorToStartOf",value:function(e){return e=Ro(e),this.moveAnchorTo(e.key,0)}},{key:"moveAnchorToEndOf",value:function(e){return e=Do(e),this.moveAnchorTo(e.key,e.text.length)}},{key:"moveFocusToStartOf",value:function(e){return e=Ro(e),this.moveFocusTo(e.key,0)}},{key:"moveFocusToEndOf",value:function(e){return e=Do(e),this.moveFocusTo(e.key,e.text.length)}},{key:"moveToRangeOf",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.isBackward?this.flip():this;return r.moveAnchorToStartOf(e).moveFocusToEndOf(t)}},{key:"normalize",value:function(e){var t=this,r=t.anchorKey,n=t.anchorOffset,o=t.anchorPath,i=t.focusKey,a=t.focusOffset,s=t.focusPath,u=t.isBackward,c=void 0===n?"undefined":ho(n),l=void 0===a?"undefined":ho(a);if("number"==c&&"number"==l||ee.warn('The range offsets should be numbers, but they were of type "'+c+'" and "'+l+'".'),null==r&&null==o||null==i&&null==s)return t.merge({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isBackward:!1});var f=e.getNode(r||o),h=e.getNode(i||s);if(!f||!h){ee.warn("The range was invalid and was reset. The range in question was:",t);var d=e.getFirstText(),p=d&&e.getPath(d.key);return t.merge({anchorKey:d?d.key:null,anchorOffset:0,anchorPath:d?p:null,focusKey:d?d.key:null,focusOffset:0,focusPath:d?p:null,isBackward:!1})}if("text"!=f.object){ee.warn("The range anchor was set to a Node that is not a Text node. This should not happen and can degrade performance. The node in question was:",f);var v=f.getTextAtOffset(n);n-=f.getOffset(v.key),f=v}if("text"!=h.object){ee.warn("The range focus was set to a Node that is not a Text node. This should not happen and can degrade performance. The node in question was:",h);var y=h.getTextAtOffset(a);a-=h.getOffset(y.key),h=y}if(r=f.key,i=h.key,o=e.getPath(r),s=e.getPath(i),null==u){var m=Io.compare(o,s);u=0===m?n>a:1===m}return t.merge({anchorKey:r,anchorOffset:n,anchorPath:o,focusKey:i,focusOffset:a,focusPath:s,isBackward:u})}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,anchorKey:this.anchorKey,anchorOffset:this.anchorOffset,anchorPath:this.anchorPath&&this.anchorPath.toArray(),focusKey:this.focusKey,focusOffset:this.focusOffset,focusPath:this.focusPath&&this.focusPath.toArray(),isAtomic:this.isAtomic,isBackward:this.isBackward,isFocused:this.isFocused,marks:null==this.marks?null:this.marks.toArray().map((function(e){return e.toJSON()}))};return e.preserveKeys||(delete t.anchorKey,delete t.focusKey),t}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"range"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isBlurred",get:function(){return!this.isFocused}},{key:"isCollapsed",get:function(){return this.anchorKey==this.focusKey&&this.anchorOffset==this.focusOffset}},{key:"isExpanded",get:function(){return!this.isCollapsed}},{key:"isForward",get:function(){return null==this.isBackward?null:!this.isBackward}},{key:"isSet",get:function(){return null!=this.anchorKey&&null!=this.focusKey||null!=this.anchorPath&&null!=this.focusPath}},{key:"isUnset",get:function(){return!this.isSet}},{key:"startKey",get:function(){return this.isBackward?this.focusKey:this.anchorKey}},{key:"startOffset",get:function(){return this.isBackward?this.focusOffset:this.anchorOffset}},{key:"startPath",get:function(){return this.isBackward?this.focusPath:this.anchorPath}},{key:"endKey",get:function(){return this.isBackward?this.anchorKey:this.focusKey}},{key:"endOffset",get:function(){return this.isBackward?this.anchorOffset:this.focusOffset}},{key:"endPath",get:function(){return this.isBackward?this.anchorPath:this.focusPath}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isRange(e))return e;if(w(e))return t.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(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}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(t.isRange(e))return{anchorKey:e.anchorKey,anchorOffset:e.anchorOffset,anchorPath:e.anchorPath,focusKey:e.focusKey,focusOffset:e.focusOffset,focusPath:e.focusPath,isAtomic:e.isAtomic,isBackward:e.isBackward,isFocused:e.isFocused,marks:e.marks};if(w(e)){var r={};return"anchorKey"in e&&(r.anchorKey=e.anchorKey),"anchorOffset"in e&&(r.anchorOffset=e.anchorOffset),"anchorPath"in e&&(r.anchorPath=Io.create(e.anchorPath)),"focusKey"in e&&(r.focusKey=e.focusKey),"focusOffset"in e&&(r.focusOffset=e.focusOffset),"focusPath"in e&&(r.focusPath=Io.create(e.focusPath)),"isAtomic"in e&&(r.isAtomic=e.isAtomic),"isBackward"in e&&(r.isBackward=e.isBackward),"isFocused"in e&&(r.isFocused=e.isFocused),"marks"in e&&(r.marks=null==e.marks?null:No.createSet(e.marks)),"anchorPath"in e&&!("anchorKey"in e)&&(r.anchorKey=null),"anchorKey"in e&&!("anchorPath"in e)&&(r.anchorPath=null),"focusPath"in e&&!("focusKey"in e)&&(r.focusKey=null),"focusKey"in e&&!("focusPath"in e)&&(r.focusPath=null),r}throw new Error("`Range.createProperties` only accepts objects or ranges, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.anchorKey,n=void 0===r?null:r,o=e.anchorOffset,i=void 0===o?0:o,a=e.anchorPath,s=void 0===a?null:a,u=e.focusKey,c=void 0===u?null:u,l=e.focusOffset,f=void 0===l?0:l,h=e.focusPath,d=void 0===h?null:h,p=e.isAtomic,v=void 0!==p&&p,y=e.isBackward,m=void 0===y?null:y,g=e.isFocused,k=void 0!==g&&g,_=e.marks,b=void 0===_?null:_;return new t({anchorKey:n,anchorOffset:i,anchorPath:Io.create(s),focusKey:c,focusOffset:f,focusPath:Io.create(d),isAtomic:v,isBackward:m,isFocused:k,marks:null==b?null:new hn(b.map(No.fromJSON))})}},{key:"isRange",value:function(e){return!(!e||!e[ao.RANGE])}}]),t}(Dn({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isAtomic:!1,isBackward:null,isFocused:!1,marks:null}));Mo.fromJS=Mo.fromJSON,Mo.prototype[ao.RANGE]=!0;[["move",""],["move","To"],["move","ToStartOf"],["move","ToEndOf"]].forEach((function(e){var t=ko(e,2),r=t[0],n=t[1];Mo.prototype[""+r+n]=function(){var e;return(e=this[r+"Anchor"+n].apply(this,arguments))[r+"Focus"+n].apply(e,arguments)}}));[["has","AtStartOf",!0],["has","AtEndOf",!0],["has","Between",!0],["has","In",!0],["collapseTo",""],["move",""],["moveTo",""],["move","To"],["move","OffsetTo"]].forEach((function(e){var t=ko(e,3),r=t[0],n=t[1],o=t[2],i=r+"Anchor"+n,a=r+"Focus"+n;Mo.prototype[r+"Start"+n]=function(){return this.isBackward?this[a].apply(this,arguments):this[i].apply(this,arguments)},Mo.prototype[r+"End"+n]=function(){return this.isBackward?this[i].apply(this,arguments):this[a].apply(this,arguments)},o&&(Mo.prototype[r+"Edge"+n]=function(){return this[i].apply(this,arguments)||this[a].apply(this,arguments)})}));function Ro(e){return"text"==e.object?e:e.getFirstText()}function Do(e){return"text"==e.object?e:e.getLastText()}[["collapseTo","moveTo"],["collapseToAnchor","moveToAnchor"],["collapseToFocus","moveToFocus"],["collapseToStart","moveToStart"],["collapseToEnd","moveToEnd"],["collapseToStartOf","moveToStartOf"],["collapseToEndOf","moveToEndOf"],["extend","moveFocus"],["extendTo","moveFocusTo"],["extendToStartOf","moveFocusToStartOf"],["extendToEndOf","moveFocusToEndOf"]].forEach((function(e){var t=ko(e,2),r=t[0],n=t[1];Mo.prototype[r]=function(){return this[n].apply(this,arguments)}}));var Lo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"toJSON",value:function(){return{object:this.object,text:this.text,marks:this.marks.toArray().map((function(e){return e.toJSON()}))}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"character"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isCharacter(e))return e;if("string"==typeof e&&(e={text:e}),w(e))return t.fromJSON(e);throw new Error("`Character.create` only accepts objects, strings or characters, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if("string"==typeof e&&(e=e.split("")),Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Block.createList` only accepts strings, arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.text,n=e.marks,o=void 0===n?[]:n;if("string"!=typeof r)throw new Error("`Character.fromJSON` requires a block `text` string.");return new t({text:r,marks:new hn(o)})}},{key:"isCharacterList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isCharacter(e)}))}}]),t}(Dn({marks:new hn,text:""}));Lo.fromJS=Lo.fromJSON,Lo.isCharacter=so.bind(null,"CHARACTER"),Lo.prototype[ao.CHARACTER]=!0;var Jo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"getCharacters",value:function(){ee.deprecate("slate@0.34.0","The `characters` property of Slate objects is deprecated");var e=this.marks;return Lo.createList(this.text.split("").map((function(t){return Lo.create({text:t,marks:e})})))}},{key:"updateMark",value:function(e,t){var r=this.marks;if(t.equals(e))return this;if(!r.has(e))return this;var n=r.withMutations((function(r){r.remove(e).add(t)}));return this.set("marks",n)}},{key:"addMarks",value:function(e){var t=this.marks;return this.set("marks",t.union(e))}},{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:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"leaf"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isLeaf(e))return e;if("string"==typeof e&&(e={text:e}),w(e))return t.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 t=!1,r=Fr().withMutations((function(r){e.findLast((function(e,n){var o=r.first();if(o){if(o.marks.equals(e.marks))return t=!0,void r.set(0,o.set("text",""+e.text+o.text));if(""===o.text)return t=!0,void r.set(0,e);if(""===e.text)return void(t=!0)}r.unshift(e)}))}));return t?r:e}},{key:"splitLeaves",value:function(e,t){if(t<0)return[Fr(),e];if(0===e.size)return[Fr(),Fr()];var r=0,n=-1,o=void 0,i=void 0;return e.find((function(e){n++;var a=r,s=e.text;if((r+=s.length)<t)return!1;if(a>t)return!1;var u=t-a;return o=e.set("text",s.slice(0,u)),i=e.set("text",s.slice(u)),!0})),o?""===o.text?0===n?[Fr.of(o),e]:[e.take(n),e.skip(n)]:""===i.text?n===e.size-1?[e,Fr.of(i)]:[e.take(n+1),e.skip(n+1)]:[e.take(n).push(o),e.skip(n+1).unshift(i)]:[e,Fr()]}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Leaf.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.text,n=void 0===r?"":r,o=e.marks;return new t({text:n,marks:hn((void 0===o?[]:o).map(No.fromJSON))})}},{key:"isLeafList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isLeaf(e)}))}}]),t}(Dn({marks:hn(),text:""}));Jo.fromJS=Jo.fromJSON,Jo.isLeaf=so.bind(null,"LEAF"),Jo.prototype[ao.LEAF]=!0;var qo=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"getString",value:function(){return this.leaves.reduce((function(e,t){return e+t.text}),"")}},{key:"searchLeafAtOffset",value:function(e){var t=0,r=0,n=-1;return{leaf:this.leaves.find((function(o){return n++,(t=(r=t)+o.text.length)>=e})),endOffset:t,index:n,startOffset:r}}},{key:"addMark",value:function(e,t,r){var n=hn.of(r);return this.addMarks(e,t,n)}},{key:"addMarks",value:function(e,t,r){if(""===this.text&&0===t&&0===e){var n=this.leaves.first();if(!n)return this.set("leaves",Fr.of(Jo.fromJSON({text:"",marks:r})));var o=n.addMarks(r);return o===n?this:this.set("leaves",Fr.of(o))}if(""===this.text)return this;if(0===t)return this;if(e>=this.text.length)return this;var i=Jo.splitLeaves(this.leaves,e),a=ko(i,2),s=a[0],u=a[1],c=Jo.splitLeaves(u,t),l=ko(c,2),f=l[0],h=l[1],d=s.concat(f.map((function(e){return e.addMarks(r)})),h);return this.setLeaves(d)}},{key:"getDecorations",value:function(e){return e.__getDecorations(this)}},{key:"getLeaves",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.leaves;if(0===r.size)return Fr.of(Jo.create({}));if(!t||0===t.length)return r;if(0===this.text.length)return r;var n=this.key;return t.forEach((function(t){var o=t.startKey,i=t.endKey,a=t.startOffset,s=t.endOffset,u=t.marks,c=o==n,l=i==n;if(c&&l){var f=c?a:0,h=l?s-f:e.text.length-f;if(h<1)return;if(f>=e.text.length)return;if(0!==f||h<e.text.length){var d=Jo.splitLeaves(r,f),p=ko(d,2),v=p[0],y=p[1],m=Jo.splitLeaves(y,h),g=ko(m,2),k=g[0],_=g[1];return void(r=v.concat(k.map((function(e){return e.addMarks(u)})),_))}}r=r.map((function(e){return e.addMarks(u)}))})),r===this.leaves?r:Jo.createLeaves(r)}},{key:"getActiveMarksBetweenOffsets",value:function(e,t){if(e<=0&&t>=this.text.length)return this.getActiveMarks();if(e>=t)return hn();if(""===this.text)return this.getActiveMarks();var r=null,n=0;return this.leaves.forEach((function(o){var i=n;if(!((n=i+o.text.length)<=e)){if(i>=t)return!1;if(r)return(r=r.intersect(o.marks))&&r.size,!1;r=o.marks}})),r||hn()}},{key:"getActiveMarks",value:function(){var e=this;if(0===this.leaves.size)return hn();var t=this.leaves.first().marks;return 0===t.size?t:t.withMutations((function(t){e.leaves.forEach((function(e){if(t.intersect(e.marks),0===t.size)return!1}))}))}},{key:"getFirstText",value:function(){return this}},{key:"getLastText",value:function(){return this}},{key:"getMarksBetweenOffsets",value:function(e,t){if(e<=0&&t>=this.text.length)return this.getMarks();if(e>=t)return hn();if(""===this.text)return this.getActiveMarks();var r=null,n=0;return this.leaves.forEach((function(o){var i=n;if(!((n=i+o.text.length)<=e))return!(i>=t)&&void(r=r?r.union(o.marks):o.marks)})),r||hn()}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return new Kn(e)}},{key:"getMarksAsArray",value:function(){if(0===this.leaves.size)return[];var e=this.leaves.first().marks;if(1===this.leaves.size)return e.toArray();var t=[];return this.leaves.forEach((function(e){t.push(e.marks.toArray())})),Array.prototype.concat.apply(e.toArray(),t)}},{key:"getMarksAtIndex",value:function(e){var t=this.searchLeafAtOffset(e).leaf;return t?t.marks:hn()}},{key:"getNode",value:function(e){return this.key==e?this:null}},{key:"hasNode",value:function(e){return!!this.getNode(e)}},{key:"insertText",value:function(e,t,r){if(""===this.text)return this.set("leaves",Fr.of(Jo.create({text:t,marks:r})));if(0===t.length)return this;r||(r=hn());var n=this.searchLeafAtOffset(e),o=n.startOffset,i=n.leaf,a=n.index,s=e-o,u=i.text.slice(0,s),c=i.text.slice(s),l=this.leaves;if(i.marks.equals(r))return this.set("leaves",l.set(a,i.set("text",u+t+c)));var f=l.splice(a,1,i.set("text",u),Jo.create({text:t,marks:r}),i.set("text",c));return this.setLeaves(f)}},{key:"regenerateKey",value:function(){var e=fo.create();return this.set("key",e)}},{key:"removeMark",value:function(e,t,r){if(""===this.text&&0===e&&0===t){var n=this.leaves.first();if(!n)return this;var o=n.removeMark(r);return o===n?this:this.set("leaves",Fr.of(o))}if(t<=0)return this;if(e>=this.text.length)return this;var i=Jo.splitLeaves(this.leaves,e),a=ko(i,2),s=a[0],u=a[1],c=Jo.splitLeaves(u,t),l=ko(c,2),f=l[0],h=l[1],d=s.concat(f.map((function(e){return e.removeMark(r)})),h);return this.setLeaves(d)}},{key:"removeText",value:function(e,t){if(t<=0)return this;if(e>=this.text.length)return this;if(1===t){var r=this.searchLeafAtOffset(e+1),n=r.leaf,o=r.index,i=e-r.startOffset;if(n){if(1===n.text.length){var a=this.leaves.remove(o);return this.setLeaves(a)}var s=n.text.slice(0,i)+n.text.slice(i+t);if(s.length>0)return this.set("leaves",this.leaves.set(o,n.set("text",s)))}}var u=Jo.splitLeaves(this.leaves,e),c=ko(u,2),l=c[0],f=c[1],h=Jo.splitLeaves(f,t)[1],d=Jo.createLeaves(l.concat(h));if(1===d.size){var p=d.first();if(""===p.text)return this.set("leaves",Fr.of(p.set("marks",this.getActiveMarks())))}return this.set("leaves",d)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,leaves:this.getLeaves().toArray().map((function(e){return e.toJSON()}))};return e.preserveKeys&&(t.key=this.key),t}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"updateMark",value:function(e,t,r,n){var o=r.merge(n);if(""===this.text&&0===t&&0===e){var i=this.leaves.first();if(!i)return this;var a=i.updateMark(r,o);return a===i?this:this.set("leaves",Fr.of(a))}if(t<=0)return this;if(e>=this.text.length)return this;var s=Jo.splitLeaves(this.leaves,e),u=ko(s,2),c=u[0],l=u[1],f=Jo.splitLeaves(l,t),h=ko(f,2),d=h[0],p=h[1],v=c.concat(d.map((function(e){return e.updateMark(r,o)})),p);return this.setLeaves(v)}},{key:"splitText",value:function(e){var t=Jo.splitLeaves(this.leaves,e);return[this.set("leaves",t[0]),this.set("leaves",t[1]).regenerateKey()]}},{key:"mergeText",value:function(e){var t=this.leaves.concat(e.leaves);return this.setLeaves(t)}},{key:"normalize",value:function(e){return e.normalizeNode(this)}},{key:"validate",value:function(e){return e.validateNode(this)}},{key:"getFirstInvalidDescendant",value:function(e){return this.validate(e)?this:null}},{key:"setLeaves",value:function(e){var t=Jo.createLeaves(e);if(1===t.size){var r=t.first();if((!r.marks||0===r.marks.size)&&""===r.text)return this.set("leaves",Fr())}return this.set("leaves",Jo.createLeaves(e))}},{key:"object",get:function(){return"text"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return""==this.text}},{key:"text",get:function(){return this.getString()}},{key:"characters",get:function(){return this.leaves.flatMap((function(e){return e.getCharacters()}))}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(t.isText(e))return e;if("string"==typeof e&&(e={leaves:[{text:e}]}),w(e)){if(e.text){var r=e,n=r.text,o=r.marks,i=r.key;e={key:i,leaves:[{text:n,marks:o}]}}return t.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(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Text.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isText(e))return e;var r=e.key,n=void 0===r?fo.create():r,o=e.leaves;if(o||(e.ranges?(ee.deprecate("slate@0.27.0","The `ranges` property of Slate objects has been renamed to `leaves`."),o=e.ranges):o=Fr()),Array.isArray(o))o=Fr(o.map((function(e){return Jo.create(e)})));else{if(!Fr.isList(o))throw new Error("leaves must be either Array or Immutable.List");o=o.map((function(e){return Jo.create(e)}))}return new t({leaves:Jo.createLeaves(o),key:n})}},{key:"isTextList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isText(e)}))}}]),t}(Dn({leaves:Fr(),key:void 0}));qo.fromJS=qo.fromJSON,qo.isText=so.bind(null,"TEXT"),qo.prototype[ao.TEXT]=!0,So(qo.prototype,["getDecorations","getActiveMarks","getMarks","getMarksAsArray","normalize","validate","getString"]);var Uo=function(){function e(){po(this,e)}return vo(e,[{key:"addMark",value:function(e,t,r,n){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.addMark(t,r,n),this.replaceNode(e,o)}},{key:"filterDescendants",value:function(e){var t=[];return this.forEachDescendant((function(r,n,o){e(r,n,o)&&t.push(r)})),Fr(t)}},{key:"findDescendant",value:function(e){var t=null;return this.forEachDescendant((function(r,n,o){if(e(r,n,o))return t=r,!1})),t}},{key:"forEachDescendant",value:function(e){var t=void 0;return this.nodes.forEach((function(r,n,o){return!1===e(r,n,o)?(t=!1,!1):"text"!=r.object?t=r.forEachDescendant(e):void 0})),t}},{key:"getActiveMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return hn();if(e.isCollapsed){var t=e,r=t.startKey,n=t.startOffset;return this.getMarksAtPosition(r,n).toSet()}var o=e,i=o.startKey,a=o.endKey,s=o.startOffset,u=o.endOffset,c=this.getDescendant(i);if(i!==a){for(;i!==a&&0===u;){var l=this.getPreviousText(a);a=l.key,u=l.text.length}for(;i!==a&&s===c.text.length;)i=(c=this.getNextText(i)).key,s=0}if(i===a)return c.getActiveMarksBetweenOffsets(s,u);var f=c.getActiveMarksBetweenOffsets(s,c.text.length);if(0===f.size)return hn();var h=this.getDescendant(a).getActiveMarksBetweenOffsets(0,u),d=f.intersect(h);if(0===d.size)return d;for(var p=this.getNextText(i);p.key!==a;){if(0!==p.text.length&&0===(d=d.intersect(p.getActiveMarks())).size)return hn();p=this.getNextText(p.key)}return d}},{key:"getAncestors",value:function(e){var t=this;if(!(e=this.resolvePath(e)))return null;var r=[];return e.forEach((function(n,o){var i=e.slice(0,o),a=t.getNode(i);r.push(a)})),Fr(r)}},{key:"getBlocks",value:function(){var e=this.getBlocksAsArray();return new Fr(e)}},{key:"getBlocksAsArray",value:function(){return this.nodes.reduce((function(e,t){return"block"!=t.object?e:t.isLeafBlock()?(e.push(t),e):e.concat(t.getBlocksAsArray())}),[])}},{key:"getBlocksAtRange",value:function(e){var t=this.getBlocksAtRangeAsArray(e);return new Fr(new Kn(t))}},{key:"getBlocksAtRangeAsArray",value:function(e){if((e=e.normalize(this)).isUnset)return[];var t=e,r=t.startKey,n=t.endKey,o=this.getClosestBlock(r);if(r===n)return[o];var i=this.getClosestBlock(n),a=this.getBlocksAsArray(),s=a.indexOf(o),u=a.indexOf(i);return a.slice(s,u+1)}},{key:"getBlocksByType",value:function(e){var t=this.getBlocksByTypeAsArray(e);return new Fr(t)}},{key:"getBlocksByTypeAsArray",value:function(e){return this.nodes.reduce((function(t,r){return"block"!=r.object?t:r.isLeafBlock()&&r.type==e?(t.push(r),t):t.concat(r.getBlocksByTypeAsArray(e))}),[])}},{key:"getCharacters",value:function(){return this.getTexts().flatMap((function(e){return e.characters}))}},{key:"getCharactersAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return Fr();var t=e,r=t.startKey,n=t.endKey,o=t.startOffset,i=t.endOffset;return r===n?this.getDescendant(n).characters.slice(o,i):this.getTextsAtRange(e).flatMap((function(e){return e.key===r?e.characters.slice(o):e.key===n?e.characters.slice(0,i):e.characters}))}},{key:"getChild",value:function(e){return(e=this.resolvePath(e))&&1===e.size?this.nodes.get(e.first()):null}},{key:"getClosest",value:function(e,t){var r=this,n=this.getAncestors(e);if(!n)return null;var o=n.findLast((function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e!==r&&t.apply(void 0,[e].concat(o))}));return o||null}},{key:"getClosestBlock",value:function(e){var t=this.getClosest(e,(function(e){return"block"===e.object}));return t}},{key:"getClosestInline",value:function(e){var t=this.getClosest(e,(function(e){return"inline"===e.object}));return t}},{key:"getClosestVoid",value:function(e){return this.getClosest(e,(function(e){return e.isVoid}))}},{key:"getCommonAncestor",value:function(e,t){if(e=this.resolvePath(e),t=this.resolvePath(t),!e||!t)return null;var r=Io.relate(e,t);return this.getNode(r)}},{key:"getDecorations",value:function(e){var t=e.find("decorateNode",this);return Mo.createList(t||[])}},{key:"getDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!(e=this.resolvePath(e)))return null;var r=this.getNode(e),n=r?e.size-1+t:null;return n}},{key:"getDescendant",value:function(e){if(!(e=this.resolvePath(e)))return null;var t=e.toArray(),r=this,n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(!r)return null;if(!r.nodes)return null;r=r.nodes.get(u)}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}},{key:"getFirstInvalidDescendant",value:function(e){var t=null;return this.nodes.find((function(r){return t=r.validate(e)?r:r.getFirstInvalidDescendant(e)})),t}},{key:"getFirstText",value:function(){var e=null,t=this.nodes.find((function(t){return"text"===t.object||!!(e=t.getFirstText())}));return e||t}},{key:"getFragmentAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return zo.create();for(var t=e,r=t.startPath,n=t.startOffset,o=t.endPath,i=this,a=o,s=t.endOffset,u="end";a.size;){var c=a.last();i=i.splitNode(a,s),s=c+1,(a=Io.lift(a)).size||"end"!==u||(a=r,s=n,u="start")}var l=r.first()+1,f=o.first()+2,h=i.nodes.slice(l,f);return zo.create({nodes:h})}},{key:"getFurthest",value:function(e,t){var r=this,n=this.getAncestors(e);if(!n)return null;var o=n.find((function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e!==r&&t.apply(void 0,[e].concat(o))}));return o||null}},{key:"getFurthestAncestor",value:function(e){return(e=this.resolvePath(e))&&e.size?this.nodes.get(e.first()):null}},{key:"getFurthestBlock",value:function(e){var t=this.getFurthest(e,(function(e){return"block"===e.object}));return t}},{key:"getFurthestInline",value:function(e){var t=this.getFurthest(e,(function(e){return"inline"===e.object}));return t}},{key:"getFurthestOnlyChildAncestor",value:function(e){var t=this.getAncestors(e);return t&&t.rest().reverse().takeUntil((function(e){return e.nodes.size>1})).last()||null}},{key:"getInlines",value:function(){var e=this.getInlinesAsArray();return new Fr(e)}},{key:"getInlinesAsArray",value:function(){var e=[];return this.nodes.forEach((function(t){"text"!=t.object&&(t.isLeafInline()?e.push(t):e=e.concat(t.getInlinesAsArray()))})),e}},{key:"getInlinesAtRange",value:function(e){var t=this.getInlinesAtRangeAsArray(e);return new Fr(new Kn(t))}},{key:"getInlinesAtRangeAsArray",value:function(e){var t=this;return(e=e.normalize(this)).isUnset?[]:this.getTextsAtRangeAsArray(e).map((function(e){return t.getClosestInline(e.key)})).filter((function(e){return e}))}},{key:"getInlinesByType",value:function(e){var t=this.getInlinesByTypeAsArray(e);return new Fr(t)}},{key:"getInlinesByTypeAsArray",value:function(e){return this.nodes.reduce((function(t,r){return"text"==r.object?t:r.isLeafInline()&&r.type==e?(t.push(r),t):t.concat(r.getInlinesByTypeAsArray(e))}),[])}},{key:"getInsertMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return hn();if(e.isCollapsed)return this.getMarksAtPosition(e.startKey,e.startOffset);var t=e,r=t.startKey,n=t.startOffset;return this.getDescendant(r).getMarksAtIndex(n+1)}},{key:"getKeysToPathsTable",value:function(){var e=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},this.key,[]);return this.nodes.forEach((function(t,r){if(e[t.key]=[r],"text"!==t.object){var n=t.getKeysToPathsTable();for(var o in n){var i=n[o];e[o]=[r].concat(_o(i))}}})),e}},{key:"getLastText",value:function(){var e=null,t=this.nodes.findLast((function(t){return"text"==t.object||(e=t.getLastText())}));return e||t}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return new hn(e)}},{key:"getMarksAsArray",value:function(){var e,t=[];return this.nodes.forEach((function(e){t.push(e.getMarksAsArray())})),(e=[]).concat.apply(e,t)}},{key:"getMarksAtPosition",value:function(e,t){var r=this.getDescendant(e).getMarksAtIndex(t);if(0!==t)return r;var n=this.getClosestBlock(e);if(""===n.text)return r;var o=this.getPreviousText(e);return o?n.hasDescendant(o.key)?o.getMarksAtIndex(o.text.length):r:hn()}},{key:"getMarksAtRange",value:function(e){return new hn(this.getOrderedMarksAtRange(e))}},{key:"getMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return new hn(t)}},{key:"getMarksByTypeAsArray",value:function(e){return this.nodes.reduce((function(t,r){return"text"==r.object?t.concat(r.getMarksAsArray().filter((function(t){return t.type==e}))):t.concat(r.getMarksByTypeAsArray(e))}),[])}},{key:"getNextBlock",value:function(e){var t=this.assertDescendant(e),r=void 0;"block"==t.object?r=t.getLastText():r=this.getClosestBlock(e).getLastText();var n=this.getNextText(r.key);return n?this.getClosestBlock(n.key):null}},{key:"getNextNode",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;for(var t=e.size;t>0;t--){var r=e.slice(0,t),n=Io.increment(r),o=this.getNode(n);if(o)return o}return null}},{key:"getNextSibling",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=Io.increment(e);return this.getNode(t)}},{key:"getNextText",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=this.getNextNode(e);return t?t.getFirstText():null}},{key:"getNode",value:function(e){return(e=this.resolvePath(e))?e.size?this.getDescendant(e):this:null}},{key:"getOffset",value:function(e){this.assertDescendant(e);var t=this.getFurthestAncestor(e),r=this.nodes.takeUntil((function(e){return e==t})).reduce((function(e,t){return e+t.text.length}),0);return this.hasChild(e)?r:r+t.getOffset(e)}},{key:"getOffsetAtRange",value:function(e){if((e=e.normalize(this)).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,r=t.startKey,n=t.startOffset;return this.getOffset(r)+n}},{key:"getOrderedMarks",value:function(){var e=this.getMarksAsArray();return new Kn(e)}},{key:"getOrderedMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return Kn();if(e.isCollapsed)return this.getMarksAtPosition(e.startKey,e.startOffset);var t=e,r=t.startKey,n=t.startOffset,o=t.endKey,i=t.endOffset;return this.getOrderedMarksBetweenPositions(r,n,o,i)}},{key:"getOrderedMarksBetweenPositions",value:function(e,t,r,n){if(e===r)return this.getDescendant(e).getMarksBetweenOffsets(t,n);var o=this.getTextsBetweenPositionsAsArray(e,r);return Kn().withMutations((function(i){o.forEach((function(o){o.key===e?i.union(o.getMarksBetweenOffsets(t,o.text.length)):o.key===r?i.union(o.getMarksBetweenOffsets(0,n)):i.union(o.getMarks())}))}))}},{key:"getOrderedMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return new Kn(t)}},{key:"getParent",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=Io.lift(e);return this.getNode(t)}},{key:"getPath",value:function(e){if(Fr.isList(e))return e;var t=this.getKeysToPathsTable()[e];return t?Fr(t):null}},{key:"getPreviousBlock",value:function(e){var t=this.assertDescendant(e),r=void 0;"block"==t.object?r=t.getFirstText():r=this.getClosestBlock(e).getFirstText();var n=this.getPreviousText(r.key);return n?this.getClosestBlock(n.key):null}},{key:"getPreviousNode",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;for(var t=e.size;t>0;t--){var r=e.slice(0,t);if(0!==r.last()){var n=Io.decrement(r),o=this.getNode(n);if(o)return o}}return null}},{key:"getPreviousSibling",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;if(0===e.last())return null;var t=Io.decrement(e);return this.getNode(t)}},{key:"getPreviousText",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=this.getPreviousNode(e);return t?t.getLastText():null}},{key:"getSelectionIndexes",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.startKey,n=e.endKey;if(!t)return null;if(e.isUnset)return null;if(r==n){var o=this.getFurthestAncestor(r),i=o?this.nodes.indexOf(o):null;return{start:i,end:i+1}}var a=null,s=null;return this.nodes.forEach((function(e,t){return"text"==e.object?(null==a&&e.key==r&&(a=t),null==s&&e.key==n&&(s=t+1)):(null==a&&e.hasDescendant(r)&&(a=t),null==s&&e.hasDescendant(n)&&(s=t+1)),null==a||null==s})),t&&null==a&&(a=0),t&&null==s&&(s=this.nodes.size),null==a?null:{start:a,end:s}}},{key:"getText",value:function(){return this.nodes.reduce((function(e,t){return e+t.text}),"")}},{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;return this.getTexts().find((function(r,n,o){return(t+=r.text.length)>e}))}},{key:"getTextDirection",value:function(){var e=Yn(this.text);return"neutral"===e?null:e}},{key:"getTexts",value:function(){var e=this.getTextsAsArray();return new Fr(e)}},{key:"getTextsAsArray",value:function(){var e=[];return this.nodes.forEach((function(t){"text"==t.object?e.push(t):e=e.concat(t.getTextsAsArray())})),e}},{key:"getTextsAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return Fr();var t=e,r=t.startKey,n=t.endKey;return new Fr(this.getTextsBetweenPositionsAsArray(r,n))}},{key:"getTextsAtRangeAsArray",value:function(e){if((e=e.normalize(this)).isUnset)return[];var t=e,r=t.startKey,n=t.endKey;return this.getTextsBetweenPositionsAsArray(r,n)}},{key:"getTextsBetweenPositionsAsArray",value:function(e,t){var r=this.getDescendant(e);if(e==t)return[r];var n=this.getDescendant(t),o=this.getTextsAsArray(),i=o.indexOf(r),a=o.indexOf(n,i);return o.slice(i,a+1)}},{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:"hasNode",value:function(e){return!!this.getNode(e)}},{key:"hasVoidParent",value:function(e){return!!this.getClosestVoid(e)}},{key:"insertNode",value:function(e,t){var r=(e=this.resolvePath(e)).last(),n=Io.lift(e),o=this.assertNode(n),i=o.nodes.splice(r,0,t);return o=o.set("nodes",i),this.replaceNode(n,o)}},{key:"insertText",value:function(e,t,r,n){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.insertText(t,r,n),this.replaceNode(e,o)}},{key:"isLeafBlock",value:function(){return"block"===this.object&&this.nodes.every((function(e){return"block"!==e.object}))}},{key:"isLeafInline",value:function(){return"inline"===this.object&&this.nodes.every((function(e){return"inline"!==e.object}))}},{key:"mapChildren",value:function(e){var t=this,r=this.nodes;return r.forEach((function(n,o){var i=e(n,o,t.nodes);i!==n&&(r=r.set(i.key,i))})),this.set("nodes",r)}},{key:"mapDescendants",value:function(e){var t=this,r=this.nodes;return r.forEach((function(n,o){var i=n;"text"!==i.object&&(i=i.mapDescendants(e)),(i=e(i,o,t.nodes))!==n&&(r=r.set(o,i))})),this.set("nodes",r)}},{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 r=Io.decrement(e),n=this.assertNode(r);if(n.object!==t.object)throw new Error("Unable to merge two different kinds of nodes: "+n+" and "+t);var o="text"===n.object?n.mergeText(t):n.set("nodes",n.nodes.concat(t.nodes)),i=this;return i=(i=(i=i.removeNode(e)).removeNode(r)).insertNode(r,o)}},{key:"moveNode",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.assertNode(e);e=this.resolvePath(e),t=this.resolvePath(t,r);var o=Io.lift(t);this.assertNode(o);var i=Io.crop(e,t),a=ko(i,2),s=a[0],u=a[1],c=Io.compare(s,u);e.size<t.size&&-1===c&&(t=Io.decrement(t,1,s.size-1));var l=this;return l=(l=l.removeNode(e)).insertNode(t,n)}},{key:"refindNode",value:function(e,t){var r=this.getDescendant(e);return r&&r.key===t?r:this.getDescendant(t)}},{key:"refindPath",value:function(e,t){var r=this.getDescendant(e);return r&&r.key===t?e:this.getPath(t)}},{key:"regenerateKey",value:function(){var e=fo.create();return this.set("key",e)}},{key:"removeMark",value:function(e,t,r,n){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.removeMark(t,r,n),this.replaceNode(e,o)}},{key:"removeNode",value:function(e){this.assertDescendant(e);var t=(e=this.resolvePath(e)).flatMap((function(e){return Fr(["nodes",e])}));return this.deleteIn(t)}},{key:"removeText",value:function(e,t,r){var n=this.assertDescendant(e);return n=n.removeText(t,r.length),this.replaceNode(e,n)}},{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 r=e.flatMap((function(e){return Fr(["nodes",e])}));return this.setIn(r,t)}},{key:"resolvePath",value:function(e,t){return"string"==typeof e?(e=this.getPath(e),null!=t&&(e=e.concat(t))):e=Io.create(e),e}},{key:"setNode",value:function(e,t){var r=this.assertNode(e);return r=r.merge(t),this.replaceNode(e,r)}},{key:"setMark",value:function(e,t,r,n,o){var i=this.assertNode(e);return i=i.updateMark(t,r,n,o),this.replaceNode(e,i)}},{key:"splitNode",value:function(e,t,r){var n=this.assertNode(e);e=this.resolvePath(e);var o=void 0,i=void 0;if("text"===n.object){var a=n.splitText(t),s=ko(a,2);o=s[0],i=s[1]}else{var u=n.nodes.take(t),c=n.nodes.skip(t);o=n.set("nodes",u),i=n.set("nodes",c).regenerateKey()}r&&"text"!==n.object&&(i=i.merge(r));var l=this;return l=(l=(l=l.removeNode(e)).insertNode(e,i)).insertNode(e,o)}},{key:"normalize",value:function(e){return e.normalizeNode(this)}},{key:"validate",value:function(e){return e.validateNode(this)}},{key:"getNodeAtPath",value:function(e){return ee.deprecate("0.35.0","The `Node.getNodeAtPath` method has been combined into `Node.getNode`."),this.getNode(e)}},{key:"getDescendantAtPath",value:function(e){return ee.deprecate("0.35.0","The `Node.getDescendantAtPath` has been combined into `Node.getDescendant`."),this.getDescendant(e)}},{key:"getKeys",value:function(){ee.deprecate("0.35.0","The `Node.getKeys` method is deprecated.");var e=this.getKeysAsArray();return new hn(e)}},{key:"getKeysAsArray",value:function(){ee.deprecate("0.35.0","The `Node.getKeysAsArray` method is deprecated.");var e=this.getKeysToPathsTable(),t=[];for(var r in e)this.key!==r&&t.push(r);return t}},{key:"areDescendantsSorted",value:function(e,t){var r=this;ee.deprecate("0.35.0","The `Node.areDescendantsSorted` method is deprecated. Use the new `PathUtils.compare` helper instead."),e=fo.create(e),t=fo.create(t);var n=this.getKeysAsArray().filter((function(e){return e!==r.key})),o=n.indexOf(e),i=n.indexOf(t);return-1==o||-1==i?null:o<i}},{key:"isInRange",value:function(e){ee.deprecate("0.35.0","The `Node.isInRange` method is deprecated. Use the new `PathUtils.compare` helper instead."),e=e.normalize(this);var t=this,r=e,n=r.startKey,o=r.endKey,i=r.isCollapsed;if(t.key==n||t.key==o||t.hasDescendant(n)||t.hasDescendant(o))return!0;if(i)return!1;var a=t.getTextsAtRange(e),s=!1;return a.forEach((function(e){return t.hasDescendant(e.key)&&(s=!0),s})),s}}],[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.isNode(t))return t;if(w(t)){var r=t.object;switch(!r&&t.kind&&(ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),r=t.kind),r){case"block":return bo.create(t);case"document":return zo.create(t);case"inline":return wo.create(t);case"text":return qo.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Fr.isList(t)||Array.isArray(t)){var r=Fr(t.map(e.create));return r}throw new Error("`Node.createList` only accepts lists or arrays, but you passed it: "+t)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(bo.isBlock(e)||wo.isInline(e))return{data:e.data,isVoid:e.isVoid,type:e.type};if("string"==typeof e)return{type:e};if(w(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=xo.create(e.data)),"isVoid"in e&&(t.isVoid=e.isVoid),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&&(ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),t=e.kind),t){case"block":return bo.fromJSON(e);case"document":return zo.fromJSON(e);case"inline":return wo.fromJSON(e);case"text":return qo.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!!["BLOCK","DOCUMENT","INLINE","TEXT"].find((function(t){return so(t,e)}))}},{key:"isNodeList",value:function(t){return Fr.isList(t)&&t.every((function(t){return e.isNode(t)}))}}]),e}();Uo.fromJS=Uo.fromJSON;var Vo=function(e){Uo.prototype["assert"+e]=function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=this["get"+e].apply(this,[t].concat(n));if(null==i)throw new Error("`Node.assert"+e+"` could not find node with path or key: "+t);return i}},Wo=!0,$o=!1,Ho=void 0;try{for(var Go,Qo=["Child","Depth","Descendant","Node","Parent","Path"][Symbol.iterator]();!(Wo=(Go=Qo.next()).done);Wo=!0){Vo(Go.value)}}catch(e){$o=!0,Ho=e}finally{try{!Wo&&Qo.return&&Qo.return()}finally{if($o)throw Ho}}So(Uo.prototype,["getBlocksAsArray","getBlocksAtRangeAsArray","getBlocksByTypeAsArray","getDecorations","getFirstInvalidDescendant","getFirstText","getFragmentAtRange","getInlinesAsArray","getInlinesAtRangeAsArray","getInlinesByTypeAsArray","getMarksAsArray","getMarksAtPosition","getOrderedMarksBetweenPositions","getInsertMarksAtRange","getKeysToPathsTable","getLastText","getMarksByTypeAsArray","getNextBlock","getOffset","getOffsetAtRange","getPreviousBlock","getText","getTextAtOffset","getTextDirection","getTextsAsArray","getTextsBetweenPositionsAsArray","isLeafBlock","isLeafInline","normalize","validate"]),Object.getOwnPropertyNames(Uo.prototype).forEach((function(e){"constructor"!==e&&(bo.prototype[e]=Uo.prototype[e],wo.prototype[e]=Uo.prototype[e],zo.prototype[e]=Uo.prototype[e])})),bo.createChildren=Uo.createList,wo.createChildren=Uo.createList,zo.createChildren=Uo.createList;var Yo=/\s/,Xo=/['\u2018\u2019]/,Zo=/[\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 ei(e){return 55296<=e&&e<=57343}function ti(e,t){if(Yo.test(e))return!1;if(Xo.test(e)){var r=t.charAt(0),n=ri(r);if(ti(r=t.slice(0,n),t.slice(n)))return!0}return!Zo.test(e)}function ri(e){return ei(e.charCodeAt(0))?2:1}function ni(e){return ri(e.charAt(0))}function oi(e){for(var t=0,r=0,n=!1,o=void 0;o=e.charAt(r);){var i=ri(o);if(ti(o=e.slice(r,r+i),e.slice(r+i)))n=!0,t+=i;else{if(n)break;t+=i}r+=i}return t}var ii={getCharLength:ri,getCharOffset:ni,getCharOffsetBackward:function(e,t){return e=e.slice(0,t),ni(e=Xn.exports.reverse(e))},getCharOffsetForward:function(e,t){return ni(e=e.slice(t))},getWordOffset:oi,getWordOffsetBackward:function(e,t){return e=e.slice(0,t),oi(e=Xn.exports.reverse(e))},getWordOffsetForward:function(e,t){return oi(e=e.slice(t))},isSurrogate:ei,isWord:ti},ai={addMarkAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!t.isCollapsed){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=t.startKey,u=t.startOffset,c=t.endKey,l=t.endOffset,f=a.getTextsAtRange(t);f.forEach((function(t){var n=t.key,i=0,a=t.text.length;n==s&&(i=u),n==c&&(a=l),n==s&&n==c&&(a=l-u),e.addMarkByKey(n,i,a,r,{normalize:o})}))}},addMarksAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r.forEach((function(r){return e.addMarkAtRange(t,r,n)}))},deleteAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t.isCollapsed){e.snapshotSelection();var n=e.getFlag("normalize",r),o=e.value,i=t.startKey,a=t.startOffset,s=t.endKey,u=t.endOffset,c=o.document,l=c.hasVoidParent(i),f=c.hasVoidParent(s),h=c.getClosestBlock(i),d=c.getClosestBlock(s),p=0==a&&0==u&&0==l&&i==h.getFirstText().key&&s==d.getFirstText().key;if(p&&f){var v=c.getPreviousText(s);s=v.key,u=v.text.length,f=c.hasVoidParent(s)}for(;l;){var y=c.getClosestVoid(i),m=c.getNextText(i);if(e.removeNodeByKey(y.key,{normalize:!1}),i==s)return;if(!m)return;c=e.value.document,i=m.key,a=0,l=c.hasVoidParent(i)}for(;f;){var g=c.getClosestVoid(s),k=c.getPreviousText(s);e.removeNodeByKey(g.key,{normalize:!1}),c=e.value.document,s=k.key,u=k.text.length,f=c.hasVoidParent(s)}if(i==s&&p)e.removeNodeByKey(h.key,{normalize:n});else if(i!=s){h=c.getClosestBlock(i),d=c.getClosestBlock(s);var _=c.getNode(i),b=c.getNode(s),w=_.text.length-a,x=u,A=c.getCommonAncestor(i,s),O=A.getFurthestAncestor(i),S=A.getFurthestAncestor(s),E=c.getParent(h.key),T=E.nodes.indexOf(h),N=E.nodes.indexOf(d),B=void 0;for(B=_;B.key!=O.key;){var z=c.getParent(B.key),j=z.nodes.indexOf(B),C=z.nodes.slice(j+1);C.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),B=z}var P=A.nodes.indexOf(O),K=A.nodes.indexOf(S),F=A.nodes.slice(P+1,K);for(F.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),B=b;B.key!=S.key;){var I=c.getParent(B.key),M=I.nodes.indexOf(B),R=I.nodes.slice(0,M);R.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),B=I}if(0!=w&&e.removeTextByKey(i,a,w,{normalize:!1}),0!=x&&e.removeTextByKey(s,0,u,{normalize:!1}),h.key!=d.key){var D=(c=e.value.document).getFurthestOnlyChildAncestor(d.key);N!=T+1&&e.moveNodeByKey(d.key,E.key,T+1,{normalize:!1}),p?e.removeNodeByKey(h.key,{normalize:!1}):e.mergeNodeByKey(d.key,{normalize:!1}),D&&e.removeNodeByKey(D.key,{normalize:!1})}n&&e.normalizeNodeByKey(A.key)}else{var L=a,J=u-a;e.removeTextByKey(i,L,J,{normalize:n})}}},deleteCharBackwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ii.getCharOffsetBackward(u,s);e.deleteBackwardAtRange(t,c,r)},deleteLineBackwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o).getOffset(o)+i;e.deleteBackwardAtRange(t,a,r)},deleteWordBackwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ii.getWordOffsetBackward(u,s);e.deleteBackwardAtRange(t,c,r)},deleteBackwardAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(0!==r){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=t,u=s.startKey,c=s.focusOffset;if(t.isExpanded)e.deleteAtRange(t,{normalize:o});else{var l=a.getClosestVoid(u);if(l)e.removeNodeByKey(l.key,{normalize:o});else{var f=a.getClosestBlock(u);if(f&&f.isEmpty&&1!==a.nodes.size)e.removeNodeByKey(f.key,{normalize:o});else if(!t.isAtStartOf(a)){var h=a.getDescendant(u);if(t.isAtStartOf(h)){var d=a.getPreviousText(h.key),p=a.getClosestBlock(d.key),v=a.getClosestVoid(d.key);if(v)return void e.removeNodeByKey(v.key,{normalize:o});if(1==r&&p!=f)return t=t.merge({anchorKey:d.key,anchorOffset:d.text.length}),void e.deleteAtRange(t,{normalize:o})}if(r<c)return t=t.merge({focusOffset:c-r,isBackward:!0}),void e.deleteAtRange(t,{normalize:o});for(var y=h,m=0,g=c;r>g;){var k=g+(y=a.getPreviousText(y.key)).text.length;if(r<=k){m=k-r;break}g=k}t=t.merge({focusKey:y.key,focusOffset:m,isBackward:!0}),e.deleteAtRange(t,{normalize:o})}}}}},deleteCharForwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ii.getCharOffsetForward(u,s);e.deleteForwardAtRange(t,c,r)},deleteLineForwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i;e.deleteForwardAtRange(t,a.text.length-s,r)},deleteWordForwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ii.getWordOffsetForward(u,s);e.deleteForwardAtRange(t,c,r)},deleteForwardAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(0!==r){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=t,u=s.startKey,c=s.focusOffset;if(t.isExpanded)e.deleteAtRange(t,{normalize:o});else{var l=a.getClosestVoid(u);if(l)e.removeNodeByKey(l.key,{normalize:o});else{var f=a.getClosestBlock(u);if(f&&f.isEmpty&&1!==a.nodes.size){var h=a.getNextBlock(f.key);return e.removeNodeByKey(f.key,{normalize:o}),void(h&&h.key&&e.moveToStartOf(h))}if(!t.isAtEndOf(a)){var d=a.getDescendant(u);if(t.isAtEndOf(d)){var p=a.getNextText(d.key),v=a.getClosestBlock(p.key),y=a.getClosestVoid(p.key);if(y)return void e.removeNodeByKey(y.key,{normalize:o});if(1==r&&v!=f)return t=t.merge({focusKey:p.key,focusOffset:0}),void e.deleteAtRange(t,{normalize:o})}if(r<=d.text.length-c)return t=t.merge({focusOffset:c+r}),void e.deleteAtRange(t,{normalize:o});for(var m=d,g=c,k=d.text.length-c;r>k;){var _=k+(m=a.getNextText(m.key)).text.length;if(r<=_){g=r-k;break}k=_}t=t.merge({focusKey:m.key,focusOffset:g}),e.deleteAtRange(t,{normalize:o})}}}}},insertBlockAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=bo.create(r);var o=e.getFlag("normalize",n);t.isExpanded&&(e.deleteAtRange(t),t=t.collapseToStart());var i=e.value,a=i.document,s=t,u=s.startKey,c=s.startOffset,l=a.getClosestBlock(u),f=a.getClosestInline(u),h=a.getParent(l.key),d=h.nodes.indexOf(l);if(l.isVoid){var p=t.isAtEndOf(l)?1:0;e.insertNodeByKey(h.key,d+p,r,{normalize:o})}else if(l.isEmpty)e.insertNodeByKey(h.key,d+1,r,{normalize:o});else if(t.isAtStartOf(l))e.insertNodeByKey(h.key,d,r,{normalize:o});else if(t.isAtEndOf(l))e.insertNodeByKey(h.key,d+1,r,{normalize:o});else{if(f&&f.isVoid){var v=t.isAtEndOf(f),y=v?a.getNextText(u):a.getPreviousText(u),m=v?t.moveToStartOf(y):t.moveToEndOf(y);u=m.startKey,c=m.startOffset}e.splitDescendantsByKey(l.key,u,c,{normalize:!1}),e.insertNodeByKey(h.key,d+1,r,{normalize:o})}o&&e.normalizeNodeByKey(h.key)},insertFragmentAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n);if(t.isExpanded&&(e.deleteAtRange(t,{normalize:!1}),t=e.value.document.getDescendant(t.startKey)?t.collapseToStart():t.collapseTo(t.endKey,0)),r.nodes.size){r=r.mapDescendants((function(e){return e.regenerateKey()}));var i=t,a=i.startKey,s=i.startOffset,u=e.value,c=u.document,l=c.getDescendant(a),f=c.getClosestBlock(l.key),h=f.getFurthestAncestor(l.key),d=t.isAtStartOf(f),p=c.getParent(f.key),v=p.nodes.indexOf(f),y=r.getBlocks(),m=r.nodes.first(),g=r.nodes.last(),k=y.first(),_=y.last();if(k==_&&k.isVoid)e.insertBlockAtRange(t,k,n);else if(m.hasBlockChildren()||g.hasBlockChildren())r.nodes.reverse().forEach((function(r){e.insertBlockAtRange(t,r,n)}));else{if(k!=_){var b=r.getFurthest(k.key,(function(e){return 1==e.nodes.size})),w=b||k,x=p.nodes.indexOf(f);(r=r.removeNode(w.key)).nodes.forEach((function(t,r){var n=x+r+1;e.insertNodeByKey(p.key,n,t,{normalize:!1})}))}if(0!=s&&e.splitDescendantsByKey(h.key,a,s,{normalize:!1}),l=(c=e.value.document).getDescendant(a),h=(f=c.getClosestBlock(a)).getFurthestAncestor(l.key),k!=_){var A=d?h:f.getNextSibling(h.key),O=A?f.nodes.skipUntil((function(e){return e.key==A.key})):Fr(),S=_.nodes.size;O.forEach((function(t,r){var n=S+r;e.moveNodeByKey(t.key,_.key,n,{normalize:!1})}))}if(f.isEmpty)e.removeNodeByKey(f.key,{normalize:!1}),e.insertNodeByKey(p.key,v,k,{normalize:!1});else{var E=f.getFurthestAncestor(l.key),T=f.nodes.indexOf(E);k.nodes.forEach((function(t,r){var n=T+r+(0==s?0:1);e.insertNodeByKey(f.key,n,t,{normalize:!1})}))}o&&e.normalizeNodeByKey(p.key)}}},insertInlineAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n);r=wo.create(r),t.isExpanded&&(e.deleteAtRange(t,{normalize:!1}),t=t.collapseToStart());var i=e.value,a=i.document,s=t,u=s.startKey,c=s.startOffset,l=a.getParent(u),f=a.assertDescendant(u),h=l.nodes.indexOf(f);l.isVoid||(e.splitNodeByKey(u,c,{normalize:!1}),e.insertNodeByKey(l.key,h+1,r,{normalize:!1}),o&&e.normalizeNodeByKey(l.key))},insertTextAtRange:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=o.normalize,a=e.value,s=a.document,u=t.startKey,c=t.startOffset,l=u,f=c,h=s.getParent(u);if(!h.isVoid&&(t.isExpanded&&(e.deleteAtRange(t,{normalize:!1}),e.value.startKey!==l&&(l=e.value.startKey,f=e.value.startOffset)),void 0===i&&(i=t.isExpanded&&n&&0!==n.size),e.insertTextByKey(l,f,r,n,{normalize:!1}),i)){var d=s.getCommonAncestor(u,t.endKey),p=s.getAncestors(d.key).push(d),v=p.findLast((function(t){return e.value.document.getDescendant(t.key)})),y=v?v.key:u;e.normalizeNodeByKey(y)}},removeMarkAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!t.isCollapsed){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getTextsAtRange(t),u=t.startKey,c=t.startOffset,l=t.endKey,f=t.endOffset;s.forEach((function(t){var n=t.key,i=0,a=t.text.length;n==u&&(i=c),n==l&&(a=f),n==u&&n==l&&(a=f-c),e.removeMarkByKey(n,i,a,r,{normalize:o})}))}},setBlocksAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getBlocksAtRange(t),u=t.startKey,c=t.startOffset,l=t.endKey,f=t.endOffset,h=t.isCollapsed,d=a.hasVoidParent(u),p=a.getClosestBlock(u),v=a.getClosestBlock(l),y=0==h&&0==c&&0==f&&0==d&&u==p.getFirstText().key&&l==v.getFirstText().key,m=y?s.slice(0,-1):s;m.forEach((function(t){e.setNodeByKey(t.key,r,{normalize:o})}))},setBlockAtRange:function(){ee.deprecate("slate@0.33.0","The `setBlockAtRange` method of Slate changes has been renamed to `setBlocksAtRange`."),ai.setBlocksAtRange.apply(ai,arguments)},setInlinesAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getInlinesAtRange(t);s.forEach((function(t){e.setNodeByKey(t.key,r,{normalize:o})}))},setInlineAtRange:function(){ee.deprecate("slate@0.33.0","The `setInlineAtRange` method of Slate changes has been renamed to `setInlinesAtRange`."),ai.setInlinesAtRange.apply(ai,arguments)},splitBlockAtRange:function(e,t){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n),i=t,a=i.startKey,s=i.startOffset,u=i.endOffset,c=i.endKey,l=e.value,f=l.document,h=f.assertDescendant(a),d=f.getClosestBlock(h.key),p=0;d&&"block"==d.object&&p<r;)h=d,d=f.getClosestBlock(d.key),p++;if(e.splitDescendantsByKey(h.key,a,s,{normalize:o&&t.isCollapsed}),t.isExpanded){t.isBackward&&(t=t.flip());var v=e.value.document.getNextBlock(h.key);t=t.moveAnchorToStartOf(v),a===c&&(t=t.moveFocusTo(t.anchorKey,u-s)),e.deleteAtRange(t,{normalize:o})}},splitInlineAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n);t.isExpanded&&(e.deleteAtRange(t,{normalize:o}),t=t.collapseToStart());for(var i=t,a=i.startKey,s=i.startOffset,u=e.value,c=u.document,l=c.assertDescendant(a),f=c.getClosestInline(l.key),h=0;f&&"inline"==f.object&&h<r;)l=f,f=c.getClosestInline(f.key),h++;e.splitDescendantsByKey(l.key,a,s,{normalize:o})},toggleMarkAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!t.isCollapsed){r=No.create(r);var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getActiveMarksAtRange(t),u=s.some((function(e){return e.equals(r)}));u?e.removeMarkAtRange(t,r,{normalize:o}):e.addMarkAtRange(t,r,{normalize:o})}},unwrapBlockAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=Uo.createProperties(r);var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getBlocksAtRange(t),u=s.map((function(e){return a.getClosest(e.key,(function(e){return"block"==e.object&&((null==r.type||e.type==r.type)&&((null==r.isVoid||e.isVoid==r.isVoid)&&!(null!=r.data&&!e.data.isSuperset(r.data))))}))})).filter((function(e){return e})).toOrderedSet().toList();u.forEach((function(t){var r=t.nodes.first(),n=t.nodes.last(),o=a.getParent(t.key),i=o.nodes.indexOf(t),u=t.nodes.filter((function(e){return s.some((function(t){return e==t||e.hasDescendant(t.key)}))})),c=u.first(),l=u.last();if(r==c&&n==l)t.nodes.forEach((function(t,r){e.moveNodeByKey(t.key,o.key,i+r,{normalize:!1})})),e.removeNodeByKey(t.key,{normalize:!1});else if(n==l)t.nodes.skipUntil((function(e){return e==c})).forEach((function(t,r){e.moveNodeByKey(t.key,o.key,i+1+r,{normalize:!1})}));else if(r==c)t.nodes.takeUntil((function(e){return e==l})).push(l).forEach((function(t,r){e.moveNodeByKey(t.key,o.key,i+r,{normalize:!1})}));else{var f=c.getFirstText();e.splitDescendantsByKey(t.key,f.key,0,{normalize:!1}),a=e.value.document,u.forEach((function(t,r){if(0==r){var n=t;t=a.getNextBlock(t.key),e.removeNodeByKey(n.key,{normalize:!1})}e.moveNodeByKey(t.key,o.key,i+1+r,{normalize:!1})}))}})),o&&e.normalizeDocument()},unwrapInlineAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=Uo.createProperties(r);var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getTextsAtRange(t),u=s.map((function(e){return a.getClosest(e.key,(function(e){return"inline"==e.object&&((null==r.type||e.type==r.type)&&((null==r.isVoid||e.isVoid==r.isVoid)&&!(null!=r.data&&!e.data.isSuperset(r.data))))}))})).filter((function(e){return e})).toOrderedSet().toList();u.forEach((function(t){var r=e.value.document.getParent(t.key),n=r.nodes.indexOf(t);t.nodes.forEach((function(t,o){e.moveNodeByKey(t.key,r.key,n+o,{normalize:!1})}))})),o&&e.normalizeDocument()},wrapBlockAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=(r=bo.create(r)).set("nodes",r.nodes.clear());var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getBlocksAtRange(t),u=s.first(),c=s.last(),l=void 0,f=void 0,h=void 0;if(1===s.length?(l=a.getParent(u.key),f=s):l=a.getClosest(u.key,(function(e){return!!a.getClosest(c.key,(function(t){return e==t}))})),null==l&&(l=a),null==f){var d=l.nodes.reduce((function(e,t,r){return(t==u||t.hasDescendant(u.key))&&(e[0]=r),(t==c||t.hasDescendant(c.key))&&(e[1]=r),e}),[]);h=d[0],f=l.nodes.slice(d[0],d[1]+1)}null==h&&(h=l.nodes.indexOf(f.first())),e.insertNodeByKey(l.key,h,r,{normalize:!1}),f.forEach((function(t,n){e.moveNodeByKey(t.key,r.key,n,{normalize:!1})})),o&&e.normalizeNodeByKey(l.key)},wrapInlineAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.value,i=o.document,a=e.getFlag("normalize",n),s=t.startKey,u=t.startOffset,c=t.endKey,l=t.endOffset;if(t.isCollapsed){var f=i.getClosestInline(s);if(!f.isVoid)return;return e.wrapInlineByKey(f.key,r,n)}r=(r=wo.create(r)).set("nodes",r.nodes.clear());var h=i.getBlocksAtRange(t),d=i.getClosestBlock(s),p=i.getClosestBlock(c),v=i.getClosestInline(s),y=i.getClosestInline(c),m=d.getFurthestAncestor(s),g=p.getFurthestAncestor(c);v&&v==y||(e.splitDescendantsByKey(g.key,c,l,{normalize:!1}),e.splitDescendantsByKey(m.key,s,u,{normalize:!1})),d=(i=e.value.document).getDescendant(d.key),p=i.getDescendant(p.key),m=d.getFurthestAncestor(s),g=p.getFurthestAncestor(c);var k=d.nodes.indexOf(m),_=p.nodes.indexOf(g);if(v&&v==y){var b=d.getTextsAtRange(t).get(0).splitText(u)[1].splitText(l-u)[0];r=r.set("nodes",Fr([b])),ai.insertInlineAtRange(e,t,r,{normalize:!1});var w=r.getFirstText().key,x={anchorKey:w,focusKey:w,anchorOffset:0,focusOffset:l-u,isFocused:!0};e.select(x)}else if(d==p){m=(d=(i=e.value.document).getClosestBlock(s)).getFurthestAncestor(s);var A=i.getNextSibling(m.key),O=d.nodes.indexOf(A),S=s==c?A:d.getFurthestAncestor(c),E=d.nodes.skipUntil((function(e){return e==A})).takeUntil((function(e){return e==S})).push(S),T=r.regenerateKey();e.insertNodeByKey(d.key,O,T,{normalize:!1}),E.forEach((function(t,r){e.moveNodeByKey(t.key,T.key,r,{normalize:!1})})),a&&e.normalizeNodeByKey(d.key)}else{var N=d.nodes.slice(k+1),B=p.nodes.slice(0,_+1),z=r.regenerateKey(),j=r.regenerateKey();e.insertNodeByKey(d.key,k+1,z,{normalize:!1}),e.insertNodeByKey(p.key,_,j,{normalize:!1}),N.forEach((function(t,r){e.moveNodeByKey(t.key,z.key,r,{normalize:!1})})),B.forEach((function(t,r){e.moveNodeByKey(t.key,j.key,r,{normalize:!1})})),a&&e.normalizeNodeByKey(d.key).normalizeNodeByKey(p.key),h.slice(1,-1).forEach((function(t){var n=r.regenerateKey();e.insertNodeByKey(t.key,0,n,{normalize:!1}),t.nodes.forEach((function(t,r){e.moveNodeByKey(t.key,n.key,r,{normalize:!1})})),a&&e.normalizeNodeByKey(t.key)}))}},wrapTextAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=e.getFlag("normalize",o),a=t.startKey,s=t.endKey,u=t.collapseToStart(),c=t.collapseToEnd();a==s&&(c=c.move(r.length)),e.insertTextAtRange(u,r,[],{normalize:i}),e.insertTextAtRange(c,n,[],{normalize:i})}},si={addMarkByPath:function(e,t,r,n,o,i){o=No.create(o);var a=e.value,s=a.document.assertNode(t).getLeaves(),u=[],c=r,l=r+n,f=0;s.forEach((function(e){var r=f,n=r+e.text.length;if(f+=e.text.length,!(n<c||l<r||e.marks.has(o))){var i=Math.max(r,c),s=Math.min(n,l);u.push({type:"add_mark",value:a,path:t,offset:i,length:s-i,mark:o})}})),e.applyOperations(u),e.normalizeParentByPath(t,i)},insertFragmentByPath:function(e,t,r,n,o){n.nodes.forEach((function(n,o){e.insertNodeByPath(t,r+o,n)})),e.normalizeNodeByPath(t,o)},insertNodeByPath:function(e,t,r,n,o){var i=e.value;e.applyOperation({type:"insert_node",value:i,path:t.concat(r),node:n}),e.normalizeNodeByPath(t,o)},insertTextByPath:function(e,t,r,n,o,i){var a=e.value,s=a.document.assertNode(t);o=o||s.getMarksAtIndex(r),e.applyOperation({type:"insert_text",value:a,path:t,offset:r,text:n,marks:o}),e.normalizeParentByPath(t,i)},mergeNodeByPath:function(e,t,r){var n=e.value,o=n.document,i=o.getDescendant(t),a=o.getPreviousSibling(t);if(!a)throw new Error('Unable to merge node with path "'+t+'", because it has no previous sibling.');var s="text"==a.object?a.text.length:a.nodes.size;e.applyOperation({type:"merge_node",value:n,path:t,position:s,properties:{type:i.type,data:i.data},target:null}),e.normalizeParentByPath(t,r)},moveNodeByPath:function(e,t,r,n,o){var i=e.value;e.applyOperation({type:"move_node",value:i,path:t,newPath:r.concat(n)});var a=Io.relate(t,r);e.normalizeNodeByPath(a,o)},removeMarkByPath:function(e,t,r,n,o,i){o=No.create(o);var a=e.value,s=a.document.assertNode(t).getLeaves(),u=[],c=r,l=r+n,f=0;s.forEach((function(e){var r=f,n=r+e.text.length;if(f+=e.text.length,!(n<c||l<r)&&e.marks.has(o)){var i=Math.max(r,c),s=Math.min(n,l);u.push({type:"remove_mark",value:a,path:t,offset:i,length:s-i,mark:o})}})),e.applyOperations(u),e.normalizeParentByPath(t,i)},removeAllMarksByPath:function(e,t,r){var n=e.state.document.assertNode(t);("text"===n.object?[n]:n.getTextsAsArray()).forEach((function(t){t.getMarksAsArray().forEach((function(n){e.removeMarkByKey(t.key,0,t.text.length,n,r)}))}))},removeNodeByPath:function(e,t,r){var n=e.value,o=n.document.assertNode(t);e.applyOperation({type:"remove_node",value:n,path:t,node:o}),e.normalizeParentByPath(t,r)},setTextByPath:function(e,t,r,n,o){var i=e.value.document.assertNode(t).text.length;e.replaceTextByPath(t,0,i,r,n,o)},replaceTextByPath:function(e,t,r,n,o,i,a){var s=e.value.document,u=s.assertNode(t);n+r>u.text.length&&(n=u.text.length-r);var c=Mo.create({anchorPath:t,focusPath:t,anchorOffset:r,focusOffset:r+n}).normalize(s),l=s.getActiveMarksAtRange(c);e.removeTextByPath(t,r,n,{normalize:!1}),i?l&&(l=l.filter((function(e){return!i.find((function(t){return e.type===t.type}))})),i=l.merge(i)):i=l||[],e.insertTextByPath(t,r,o,i,a)},removeTextByPath:function(e,t,r,n,o){var i=e.value,a=i.document,s=a.assertNode(t),u=s.getLeaves(),c=s.text,l=[],f=r,h=r+n,d=0;u.forEach((function(e){var r=d,n=r+e.text.length;if(d+=e.text.length,!(n<f||h<r)){var o=Math.max(r,f),a=Math.min(n,h),s=c.slice(o,a);l.push({type:"remove_text",value:i,path:t,offset:o,text:s,marks:e.marks})}})),e.applyOperations(l.reverse());var p=a.getClosestBlock(s.key);e.normalizeNodeByKey(p.key,o)},replaceNodeByPath:function(e,t,r,n){r=Uo.create(r);var o=t.last(),i=Io.lift(t);e.removeNodeByPath(t,{normalize:!1}),e.insertNodeByPath(i,o,r,{normalize:!1}),e.normalizeParentByPath(t,n)},setMarkByPath:function(e,t,r,n,o,i,a){o=No.create(o),i=No.createProperties(i);var s=e.value;e.applyOperation({type:"set_mark",value:s,path:t,offset:r,length:n,mark:o,properties:i}),e.normalizeParentByPath(t,a)},setNodeByPath:function(e,t,r,n){r=Uo.createProperties(r);var o=e.value,i=o.document.assertNode(t);e.applyOperation({type:"set_node",value:o,path:t,node:i,properties:r}),e.normalizeNodeByPath(t,n)},splitNodeByPath:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n.target,i=void 0===o?null:o,a=e.value,s=a.document,u=s.getDescendant(t);e.applyOperation({type:"split_node",value:a,path:t,position:r,properties:{type:u.type,data:u.data},target:i}),e.normalizeParentByPath(t,n)},splitDescendantsByPath:function(e,t,r,n,o){if(t.equals(r))e.splitNodeByPath(r,n,o);else{var i=e.value.document,a=i.assertNode(t),s=i.assertNode(r),u=i.getAncestors(r).skipUntil((function(e){return e.key==a.key})).reverse().unshift(s),c=void 0,l=void 0;u.forEach((function(t){var r=null==l?null:l;l=c?t.nodes.indexOf(c)+1:n,c=t,e.splitNodeByKey(t.key,l,{normalize:!1,target:r})})),e.normalizeParentByPath(t,o)}},unwrapInlineByPath:function(e,t,r,n){var o=e.value,i=o.document,a=o.selection,s=i.assertNode(t),u=s.getFirstText(),c=s.getLastText(),l=a.moveToRangeOf(u,c);e.unwrapInlineAtRange(l,r,n)},unwrapBlockByPath:function(e,t,r,n){var o=e.value,i=o.document,a=o.selection,s=i.assertNode(t),u=s.getFirstText(),c=s.getLastText(),l=a.moveToRangeOf(u,c);e.unwrapBlockAtRange(l,r,n)},unwrapNodeByPath:function(e,t,r){var n=e.value.document;n.assertNode(t);var o=Io.lift(t),i=n.assertNode(o),a=t.last(),s=o.last(),u=Io.lift(o),c=0===a,l=a===i.nodes.size-1;if(1===i.nodes.size)e.moveNodeByPath(t,u,s+1,{normalize:!1}),e.removeNodeByPath(o,r);else if(c)e.moveNodeByPath(t,u,s,r);else if(l)e.moveNodeByPath(t,u,s+1,r);else{e.splitNodeByPath(o,a,{normalize:!1});var f=Io.increment(t,1,o.size-1);f=f.set(f.size-1,0),e.moveNodeByPath(f,u,s+1,{normalize:!1}),e.normalizeNodeByPath(u,r)}},wrapBlockByPath:function(e,t,r,n){r=(r=bo.create(r)).set("nodes",r.nodes.clear());var o=Io.lift(t),i=t.last(),a=Io.increment(t);e.insertNodeByPath(o,i,r,{normalize:!1}),e.moveNodeByPath(a,t,0,n)},wrapInlineByPath:function(e,t,r,n){r=(r=wo.create(r)).set("nodes",r.nodes.clear());var o=Io.lift(t),i=t.last(),a=Io.increment(t);e.insertNodeByPath(o,i,r,{normalize:!1}),e.moveNodeByPath(a,t,0,n)},wrapNodeByPath:function(e,t,r){"block"!=(r=Uo.create(r)).object?"inline"!=r.object||e.wrapInlineByPath(t,r):e.wrapBlockByPath(t,r)}},ui=function(e){si[e+"ByKey"]=function(t,r){for(var n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a=t.value,s=a.document,u=s.assertPath(r);t[e+"ByPath"].apply(t,[u].concat(o))}},ci=!0,li=!1,fi=void 0;try{for(var hi,di=["addMark","insertFragment","insertNode","insertText","mergeNode","removeMark","removeAllMarks","removeNode","setText","replaceText","removeText","replaceNode","setMark","setNode","splitNode","unwrapInline","unwrapBlock","unwrapNode","wrapBlock","wrapInline","wrapNode"][Symbol.iterator]();!(ci=(hi=di.next()).done);ci=!0){ui(hi.value)}}catch(e){li=!0,fi=e}finally{try{!ci&&di.return&&di.return()}finally{if(li)throw fi}}si.moveNodeByKey=function(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];var a=e.value,s=a.document,u=s.assertPath(t),c=s.assertPath(r);e.moveNodeByPath.apply(e,[u,c].concat(o))},si.splitDescendantsByKey=function(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];var a=e.value,s=a.document,u=s.assertPath(t),c=s.assertPath(r);e.splitDescendantsByPath.apply(e,[u,c].concat(o))};var pi=ro("slate:history"),vi=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"save",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this,n=r,o=n.undos,i=n.redos,a=t.merge,s=t.skip,u=o.peek(),c=u&&u.last();if(null==s&&(s=mi(e,c)),s)return r;if(null==a&&(a=yi(e,c)),pi("save",{operation:e,merge:a}),a&&u){var l=u.push(e);o=(o=o.pop()).push(l)}else{var f=new Fr([e]);o=o.push(f)}return o.size>100&&(o=o.take(100)),i=i.clear(),r=r.set("undos",o).set("redos",i)}},{key:"toJSON",value:function(){return{object:this.object,redos:this.redos.toJSON(),undos:this.undos.toJSON()}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"history"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isHistory(e))return e;if(w(e))return t.fromJSON(e);throw new Error("`History.create` only accepts objects or histories, but you passed it: "+e)}},{key:"createOperationsList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Fr.isList(e))return e;if(Array.isArray(e))return new Fr(e);throw new Error("`History.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.redos,n=void 0===r?[]:r,o=e.undos,i=void 0===o?[]:o;return new t({redos:new tn(n.map(this.createOperationsList)),undos:new tn(i.map(this.createOperationsList))})}}]),t}(Dn({redos:new tn,undos:new tn}));function yi(e,t){return!!t&&("set_selection"==e.type&&"set_selection"==t.type||"insert_text"==e.type&&"insert_text"==t.type&&e.offset==t.offset+t.text.length&&no(e.path,t.path)||"remove_text"==e.type&&"remove_text"==t.type&&e.offset+e.text.length==t.offset&&no(e.path,t.path))}function mi(e,t){return!!t&&("set_selection"==e.type&&"set_selection"==t.type)}vi.fromJS=vi.fromJSON,vi.isHistory=so.bind(null,"HISTORY"),vi.prototype[ao.HISTORY]=!0;var gi=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"getPluginsWith",value:function(e){return this.plugins.filter((function(t){return null!=t[e]}))}},{key:"find",value:function(e){for(var t=this.getPluginsWith(e),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value,f=l[e].apply(l,n);if(null!=f)return f}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}},{key:"map",value:function(e){for(var t=this.getPluginsWith(e),r=[],n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];var a=!0,s=!1,u=void 0;try{for(var c,l=t[Symbol.iterator]();!(a=(c=l.next()).done);a=!0){var f=c.value,h=f[e].apply(f,o);null!=h&&r.push(h)}}catch(e){s=!0,u=e}finally{try{!a&&l.return&&l.return()}finally{if(s)throw u}}return r}},{key:"run",value:function(e){for(var t=this.getPluginsWith(e),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value,f=l[e].apply(l,n);if(null!=f)return}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}},{key:"render",value:function(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];var i=this.getPluginsWith(e);return i.reduceRight((function(r,o){if(!o[e])return r;var i=o[e].apply(o,[t].concat(n));return null==i?r:(t.children=i,i)}),void 0===t.children?null:t.children)}},{key:"object",get:function(){return"stack"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.plugins,n=void 0===r?[]:r,o=new t({plugins:n});return o}},{key:"isStack",value:function(e){return!(!e||!e[ao.STACK])}}]),t}(Dn({plugins:[]}));gi.prototype[ao.STACK]=!0,So(gi.prototype,["getPluginsWith"]);var ki=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};po(this,t);var n=go(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));for(var o in n.code=e,r)n[o]=r[o];return Error.captureStackTrace?Error.captureStackTrace(n,n.constructor):n.stack=(new Error).stack,n}return mo(t,e),t}(Error),_i=ro("slate:schema"),bi=[{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 r=t.code,n=t.node;"child_required"===r&&e.insertNodeByKey(n.key,0,qo.create(),{normalize:!1})}},{match:{object:"inline",isVoid:!1,nodes:[{match:{object:"text"}}]},text:/[\w\W]+/},{match:{object:"block"},first:[{object:"block"},{object:"text"}],last:[{object:"block"},{object:"text"}],normalize:function(e,t){var r=t.code,n=t.node,o=qo.create(),i=void 0;if("first_child_object_invalid"===r)i=0;else{if("last_child_object_invalid"!==r)return;i=n.nodes.size}e.insertNodeByKey(n.key,i,o,{normalize:!1})}},{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 r=t.code,n=t.node,o=t.index,i=qo.create(),a=void 0;if("first_child_object_invalid"===r)a=0;else if("last_child_object_invalid"===r)a=n.nodes.size;else if("previous_sibling_object_invalid"===r)a=o;else{if("next_sibling_object_invalid"!==r)return;a=o+1}e.insertNodeByKey(n.key,a,i,{normalize:!1})}},{match:{object:"text"},next:[{object:"block"},{object:"inline"}],normalize:function(e,t){var r=t.code,n=t.next;"next_sibling_object_invalid"===r&&e.mergeNodeByKey(n.key,{normalize:!1})}}],wi=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"validateNode",value:function(e){var t=this.rules.filter((function(t){return xi(e,t.match)})),r=Ai(e,t,this.rules,{every:!0});if(r)return new ki(r.code,r)}},{key:"testNode",value:function(e){return!this.validateNode(e)}},{key:"assertNode",value:function(e){var t=this.validateNode(e);if(t)throw t}},{key:"normalizeNode",value:function(e){var t=this.stack.find("normalizeNode",e);if(t)return t;if("text"!=e.object){var r=this.validateNode(e);if(r)return function(e){_i("normalizing",{error:r});var t=r.rule,n=e.operations.size;t.normalize&&t.normalize(e,r),e.operations.size===n&&function(e,t){switch(t.code){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":var r=t.child,n=t.node;return"text"==r.object&&"block"==n.object&&1==n.nodes.size?e.removeNodeByKey(n.key):e.removeNodeByKey(r.key);case"child_required":case"node_text_invalid":case"parent_object_invalid":case"parent_type_invalid":var o=t.node;return"document"==o.object?o.nodes.forEach((function(t){return e.removeNodeByKey(t.key)})):e.removeNodeByKey(o.key);case"node_data_invalid":var i=t.node,a=t.key;return void 0===i.data.get(a)&&"document"!=i.object?e.removeNodeByKey(i.key):e.setNodeByKey(i.key,{data:i.data.delete(a)});case"node_is_void_invalid":var s=t.node;return e.setNodeByKey(s.key,{isVoid:!s.isVoid});case"node_mark_invalid":var u=t.node,c=t.mark;return u.getTexts().forEach((function(t){return e.removeMarkByKey(t.key,0,t.text.length,c)}));default:var l=t.node;e.removeNodeByKey(l.key)}}(e,r)}}}},{key:"toJSON",value:function(){return{object:this.object,rules:this.rules}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"schema"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isSchema(e))return e;if(w(e))return t.fromJSON(e);throw new Error("`Schema.create` only accepts objects or schemas, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isSchema(e))return e;var r=e.plugins?e.plugins:[{schema:e}],n=[].concat(bi),o=!0,i=!1,a=void 0;try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value.schema,l=void 0===c?{}:c,f=l.blocks,h=void 0===f?{}:f,d=l.inlines,p=void 0===d?{}:d;for(var v in l.rules&&(n=n.concat(l.rules)),l.document&&n.push(yo({match:[{object:"document"}]},l.document)),h)n.push(yo({match:[{object:"block",type:v}]},h[v]));for(var y in p)n.push(yo({match:[{object:"inline",type:y}]},p[y]))}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return new t({stack:gi.create({plugins:r}),rules:n})}},{key:"isSchema",value:function(e){return!(!e||!e[ao.SCHEMA])}}]),t}(Dn({stack:gi.create(),rules:[]}));function xi(e,t){return!Ai(e,t)}function Ai(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n.every,i=void 0!==o&&o;if(Array.isArray(t)){var a=t.length?t:[{}],s=void 0,u=!0,c=!1,l=void 0;try{for(var f,h=a[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var d=f.value,p=Ai(e,d,r);if(s=s||p,i&&p)return p;if(!i&&!p)return}}catch(e){c=!0,l=e}finally{try{!u&&h.return&&h.return()}finally{if(c)throw l}}return s}var v=Oi(e,t)||Si(e,t)||Ei(e,t)||Ti(e,t)||Ni(e,t)||Bi(e,t)||zi(e,t)||ji(e,t)||Ci(e,t,r);return v}function Oi(e,t){if(t.objects&&ee.warn("The `objects` schema validation rule was changed. Please use the new `match` syntax with `object`."),null!=t.object&&t.object!==e.object)return Ii("node_object_invalid",{rule:t,node:e})}function Si(e,t){if(t.types&&ee.warn("The `types` schema validation rule was changed. Please use the new `match` syntax with `type`."),null!=t.type&&t.type!==e.type)return Ii("node_type_invalid",{rule:t,node:e})}function Ei(e,t){if(null!=t.isVoid&&t.isVoid!==e.isVoid)return Ii("node_is_void_invalid",{rule:t,node:e})}function Ti(e,t){if(null!=t.data&&null!=e.data)for(var r in t.data){var n=t.data[r],o=e.data&&e.data.get(r);if(!("function"==typeof n?n(o):n===o))return Ii("node_data_invalid",{rule:t,node:e,key:r,value:o})}}function Ni(e,t){if(null!=t.marks){var r=e.getMarks().toArray(),n=function(r){return t.marks.some((function(e){return e.type===r.type}))?"continue":{v:Ii("node_mark_invalid",{rule:t,node:e,mark:r})}},o=!0,i=!1,a=void 0;try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=n(s.value);if("continue"!==c&&"object"===(void 0===c?"undefined":ho(c)))return c.v}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}}}function Bi(e,t){if(null!=t.text){var r=e.text;if(!t.text.test(r))return Ii("node_text_invalid",{rule:t,node:e,text:r})}}function zi(e,t){if(null!=t.first){var r=e.nodes.first();if(r){var n=Ai(r,t.first);if(n)return n.rule=t,n.node=e,n.child=r,n.code=n.code.replace("node_","first_child_"),n}}}function ji(e,t){if(null!=t.last){var r=e.nodes.last();if(r){var n=Ai(r,t.last);if(n)return n.rule=t,n.node=e,n.child=r,n.code=n.code.replace("node_","last_child_"),n}}}function Ci(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(null!=e.nodes){var n=e.nodes.toArray(),o=null!=t.nodes?t.nodes.slice():[],i=void 0,a=void 0,s=void 0,u=void 0,c=void 0,l=void 0,f=void 0,h=void 0;for(null!=t.nodes&&v();y();){var d=Pi(e,l,r)||Ki(e,l,f,s,r)||Fi(e,l,h,s,r);if(d)return d;if(null!=t.nodes){if(!u)return Ii("child_unknown",{rule:t,node:e,child:l,index:s});if(u&&(u.objects&&ee.warn("The `objects` schema validation rule was changed. Please use the new `match` syntax with `object`."),u.types&&ee.warn("The `types` schema validation rule was changed. Please use the new `match` syntax with `type`.")),u.match){var p=Ai(l,u.match);if(p&&i>=a&&v()){m();continue}if(p)return p.rule=t,p.node=e,p.child=l,p.index=s,p.code=p.code.replace("node_","child_"),p}}}if(null!=t.nodes)for(;null!=a;){if(i<a)return Ii("child_required",{rule:t,node:e,index:s});v()}}function v(){return i=null==i?null:0,u=o.shift(),a=u&&u.min,c=u&&u.max,!!u}function y(){return i=null==i?0:i+1,f=l,l=n[s=null==s?0:s+1],h=n[s+1],null!=c&&i==c&&v(),!!l}function m(){i-=1,s-=1}}function Pi(e,t,r){var n=!0,o=!1,i=void 0;try{for(var a,s=r[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(null!=u.parent&&xi(t,u.match)){var c=Ai(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,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}}function Ki(e,t,r,n,o){if(r){var i=!0,a=!1,s=void 0;try{for(var u,c=o[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;if(null!=l.previous&&xi(t,l.match)){var f=Ai(r,l.previous);if(f)return f.rule=l,f.node=e,f.child=t,f.index=n,f.previous=r,f.code=f.code.replace("node_","previous_sibling_"),f}}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}}function Fi(e,t,r,n,o){if(r){var i=!0,a=!1,s=void 0;try{for(var u,c=o[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;if(null!=l.next&&xi(t,l.match)){var f=Ai(r,l.next);if(f)return f.rule=l,f.node=e,f.child=t,f.index=n,f.next=r,f.code=f.code.replace("node_","next_sibling_"),f}}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}}function Ii(e,t){return yo({code:e},t)}wi.fromJS=wi.fromJSON,wi.prototype[ao.SCHEMA]=!0;var Mi=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"change",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new ta(yo({},e,{value:this}))}},{key:"addMark",value:function(e,t,r,n){var o=this,i=o.document;return i=i.addMark(e,t,r,n),o=this.set("document",i)}},{key:"insertNode",value:function(e,t){var r=this,n=r.document;return n=n.insertNode(e,t),r=(r=r.set("document",n)).mapRanges((function(e){return e.merge({anchorPath:null,focusPath:null})}))}},{key:"insertText",value:function(e,t,r,n){var o=this,i=o.document;i=i.insertText(e,t,r,n),o=o.set("document",i);var a=i.assertNode(e);return o=(o=(o=o.clearAtomicRanges(a.key,t)).mapRanges((function(e){var n=e.anchorKey,o=e.anchorOffset,i=e.isBackward,s=e.isAtomic;return n!==a.key||!(o>t)&&(o!==t||s&&i)?e:e.moveAnchor(r.length)}))).mapRanges((function(e){var n=e.focusKey,o=e.focusOffset,i=e.isBackward,s=e.isAtomic;return n===a.key&&(o>t||o==t&&(!s||i))?e.moveFocus(r.length):e}))}},{key:"mergeNode",value:function(e){var t=this,r=t.document,n=r.mergeNode(e);e=r.resolvePath(e);var o=Io.decrement(e),i=r.getNode(o),a=r.getNode(e);return t=(t=t.set("document",n)).mapRanges((function(e){if("text"===a.object){var t=i.text.length;e.anchorKey===a.key&&(e=e.moveAnchorTo(i.key,t+e.anchorOffset)),e.focusKey===a.key&&(e=e.moveFocusTo(i.key,t+e.focusOffset))}return e=e.merge({anchorPath:null,focusPath:null})})),t}},{key:"moveNode",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this,o=n,i=o.document;return i=i.moveNode(e,t,r),n=(n=n.set("document",i)).mapRanges((function(e){return e.merge({anchorPath:null,focusPath:null})}))}},{key:"removeMark",value:function(e,t,r,n){var o=this,i=o.document;return i=i.removeMark(e,t,r,n),o=this.set("document",i)}},{key:"removeNode",value:function(e){var t=this,r=t.document,n=r.assertNode(e),o="text"==n.object?n:n.getFirstText()||n,i="text"==n.object?n:n.getLastText()||n,a=r.getPreviousText(o.key),s=r.getNextText(i.key);return r=r.removeNode(e),t=(t=t.set("document",r)).mapRanges((function(e){var t=e,r=t.startKey,o=t.endKey;return n.hasNode(r)&&(e=a?e.moveStartTo(a.key,a.text.length):s?e.moveStartTo(s.key,0):e.deselect()),n.hasNode(o)&&(e=a?e.moveEndTo(a.key,a.text.length):s?e.moveEndTo(s.key,0):e.deselect()),e=e.merge({anchorPath:null,focusPath:null})}))}},{key:"removeText",value:function(e,t,r){var n=this,o=n.document;o=o.removeText(e,t,r),n=n.set("document",o);var i=o.assertNode(e),a=r.length,s=t+a;return n=(n=(n=n.clearAtomicRanges(i.key,t,t+a)).mapRanges((function(e){return e.anchorKey===i.key?e.anchorOffset>=s?e.moveAnchor(-a):e.anchorOffset>t?e.moveAnchorTo(e.anchorKey,t):e:e}))).mapRanges((function(e){return e.focusKey===i.key?e.focusOffset>=s?e.moveFocus(-a):e.focusOffset>t?e.moveFocusTo(e.focusKey,t):e:e}))}},{key:"setNode",value:function(e,t){var r=this,n=r.document;return n=n.setNode(e,t),r=r.set("document",n)}},{key:"setMark",value:function(e,t,r,n,o){var i=this,a=i.document;return a=a.setMark(e,t,r,n,o),i=i.set("document",a)}},{key:"setSelection",value:function(e){var t=this,r=t,n=r.document,o=r.selection;return o=(o=o.merge(e)).normalize(n),t=t.set("selection",o)}},{key:"splitNode",value:function(e,t,r){var n=this,o=n.document,i=o.splitNode(e,t,r),a=o.assertNode(e);return n=(n=n.set("document",i)).mapRanges((function(e){var r=i.getNextText(a.key),n=e,o=n.startKey,s=n.startOffset,u=n.endKey,c=n.endOffset;return a.key===o&&t<=s&&(e=e.moveStartTo(r.key,s-t)),a.key===u&&t<=c&&(e=e.moveEndTo(r.key,c-t)),e=e.merge({anchorPath:null,focusPath:null})}))}},{key:"mapRanges",value:function(e){var t=this,r=t,n=r.document,o=r.selection,i=r.decorations;if(o){var a=o.isSet?e(o):o;a||(a=o.deselect()),a!==o&&(a=a.normalize(n)),t=t.set("selection",a)}if(i){var s=i.map((function(t){var r=t.isSet?e(t):t;return r&&r!==t&&(r=r.normalize(n)),r}));s=(s=s.filter((function(e){return!!e}))).size?s:null,t=t.set("decorations",s)}return t}},{key:"clearAtomicRanges",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.mapRanges((function(n){var o=n.isAtomic,i=n.startKey,a=n.startOffset,s=n.endKey,u=n.endOffset;return o?i!==e?n:a<t&&(s!==e||u>t)||null!=r&&a<r&&(s!==e||u>r)?null:n:n}))}},{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.preserveDecorations&&(t.decorations=this.decorations?this.decorations.toArray().map((function(t){return t.toJSON(e)})):null),e.preserveHistory&&(t.history=this.history.toJSON(e)),e.preserveSelection&&(t.selection=this.selection.toJSON(e)),e.preserveSchema&&(t.schema=this.schema.toJSON(e)),t}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"value"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"hasUndos",get:function(){return this.history.undos.size>0}},{key:"hasRedos",get:function(){return this.history.redos.size>0}},{key:"isBlurred",get:function(){return this.selection.isBlurred}},{key:"isFocused",get:function(){return this.selection.isFocused}},{key:"isCollapsed",get:function(){return this.selection.isCollapsed}},{key:"isExpanded",get:function(){return this.selection.isExpanded}},{key:"isBackward",get:function(){return this.selection.isBackward}},{key:"isForward",get:function(){return this.selection.isForward}},{key:"startKey",get:function(){return this.selection.startKey}},{key:"endKey",get:function(){return this.selection.endKey}},{key:"startPath",get:function(){return this.selection.startPath}},{key:"endPath",get:function(){return this.selection.endPath}},{key:"startOffset",get:function(){return this.selection.startOffset}},{key:"endOffset",get:function(){return this.selection.endOffset}},{key:"anchorKey",get:function(){return this.selection.anchorKey}},{key:"focusKey",get:function(){return this.selection.focusKey}},{key:"anchorPath",get:function(){return this.selection.anchorPath}},{key:"focusPath",get:function(){return this.selection.focusPath}},{key:"anchorOffset",get:function(){return this.selection.anchorOffset}},{key:"focusOffset",get:function(){return this.selection.focusOffset}},{key:"startBlock",get:function(){return this.startKey&&this.document.getClosestBlock(this.startKey)}},{key:"endBlock",get:function(){return this.endKey&&this.document.getClosestBlock(this.endKey)}},{key:"anchorBlock",get:function(){return this.anchorKey&&this.document.getClosestBlock(this.anchorKey)}},{key:"focusBlock",get:function(){return this.focusKey&&this.document.getClosestBlock(this.focusKey)}},{key:"startInline",get:function(){return this.startKey&&this.document.getClosestInline(this.startKey)}},{key:"endInline",get:function(){return this.endKey&&this.document.getClosestInline(this.endKey)}},{key:"anchorInline",get:function(){return this.anchorKey&&this.document.getClosestInline(this.anchorKey)}},{key:"focusInline",get:function(){return this.focusKey&&this.document.getClosestInline(this.focusKey)}},{key:"startText",get:function(){return this.startKey&&this.document.getDescendant(this.startKey)}},{key:"endText",get:function(){return this.endKey&&this.document.getDescendant(this.endKey)}},{key:"anchorText",get:function(){return this.anchorKey&&this.document.getDescendant(this.anchorKey)}},{key:"focusText",get:function(){return this.focusKey&&this.document.getDescendant(this.focusKey)}},{key:"nextBlock",get:function(){return this.endKey&&this.document.getNextBlock(this.endKey)}},{key:"previousBlock",get:function(){return this.startKey&&this.document.getPreviousBlock(this.startKey)}},{key:"nextInline",get:function(){return this.endKey&&this.document.getNextInline(this.endKey)}},{key:"previousInline",get:function(){return this.startKey&&this.document.getPreviousInline(this.startKey)}},{key:"nextText",get:function(){return this.endKey&&this.document.getNextText(this.endKey)}},{key:"previousText",get:function(){return this.startKey&&this.document.getPreviousText(this.startKey)}},{key:"characters",get:function(){return this.selection.isUnset?new Fr:this.document.getCharactersAtRange(this.selection)}},{key:"marks",get:function(){return this.selection.isUnset?new hn:this.selection.marks||this.document.getMarksAtRange(this.selection)}},{key:"activeMarks",get:function(){return this.selection.isUnset?new hn:this.selection.marks||this.document.getActiveMarksAtRange(this.selection)}},{key:"blocks",get:function(){return this.selection.isUnset?new Fr:this.document.getBlocksAtRange(this.selection)}},{key:"fragment",get:function(){return this.selection.isUnset?zo.create():this.document.getFragmentAtRange(this.selection)}},{key:"inlines",get:function(){return this.selection.isUnset?new Fr:this.document.getInlinesAtRange(this.selection)}},{key:"texts",get:function(){return this.selection.isUnset?new Fr:this.document.getTextsAtRange(this.selection)}},{key:"isEmpty",get:function(){return!!this.isCollapsed||(0==this.endOffset||0==this.startOffset)&&this.fragment.isEmpty}},{key:"isInVoid",get:function(){return!this.isExpanded&&this.document.hasVoidParent(this.startKey)}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.isValue(e))return e;if(w(e))return t.fromJSON(e,r);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(t.isValue(e))return{data:e.data,decorations:e.decorations,schema:e.schema};if(w(e)){var r={};return"data"in e&&(r.data=xo.create(e.data)),"decorations"in e&&(r.decorations=Mo.createList(e.decorations)),"schema"in e&&(r.schema=wi.create(e.schema)),r}throw new Error("`Value.createProperties` only accepts objects or values, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.document,o=void 0===n?{}:n,i=e.selection,a=void 0===i?{}:i,s=e.schema,u=void 0===s?{}:s,c=e.history,l=void 0===c?{}:c,f=new dr;if(o=zo.fromJSON(o),a=Mo.fromJSON(a),u=wi.fromJSON(u),l=vi.fromJSON(l),r.plugins){var h=!0,d=!1,p=void 0;try{for(var v,y=r.plugins[Symbol.iterator]();!(h=(v=y.next()).done);h=!0){var m=v.value;m.data&&(f=f.merge(m.data))}}catch(e){d=!0,p=e}finally{try{!h&&y.return&&y.return()}finally{if(d)throw p}}}if("data"in e&&(f=f.merge(e.data)),a.isUnset){var g=o.getFirstText();g&&(a=a.collapseToStartOf(g))}var k=new t({data:f,document:o,selection:a=a.normalize(o),schema:u,history:l});return!1!==r.normalize&&(k=k.change({save:!1}).normalize().value),k}},{key:"isValue",value:function(e){return!(!e||!e[ao.VALUE])}}]),t}(Dn({data:new dr,decorations:null,document:zo.create(),history:vi.create(),schema:wi.create(),selection:Mo.create()}));Mi.fromJS=Mi.fromJSON,Mi.prototype[ao.VALUE]=!0;var Ri={add_mark:["value","path","offset","length","mark"],insert_node:["value","path","node"],insert_text:["value","path","offset","text","marks"],merge_node:["value","path","position","properties","target"],move_node:["value","path","newPath"],remove_mark:["value","path","offset","length","mark"],remove_node:["value","path","node"],remove_text:["value","path","offset","text","marks"],set_mark:["value","path","offset","length","mark","properties"],set_node:["value","path","node","properties"],set_selection:["value","selection","properties"],set_value:["value","properties"],split_node:["value","path","position","properties","target"]},Di=function(e){function t(){return po(this,t),go(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return mo(t,e),vo(t,[{key:"toJSON",value:function(){var e=this.object,t=this.type,r={object:e,type:t},n=Ri[t],o=!0,i=!1,a=void 0;try{for(var s,u=n[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value,l=this[c];if("document"!=c&&("selection"!=c&&"value"!=c&&("node"!=c||"insert_node"==t))){if("mark"!=c&&"marks"!=c&&"node"!=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&&"set_mark"==t){var h={};"data"in l&&(h.data=l.data.toJS()),"type"in l&&(h.type=l.type),l=h}if("properties"==c&&"set_node"==t){var d={};"data"in l&&(d.data=l.data.toJS()),"isVoid"in l&&(d.isVoid=l.isVoid),"type"in l&&(d.type=l.type),l=d}if("properties"==c&&"set_selection"==t){var p={};"anchorOffset"in l&&(p.anchorOffset=l.anchorOffset),"anchorPath"in l&&(p.anchorPath=l.anchorPath&&l.anchorPath.toJSON()),"focusOffset"in l&&(p.focusOffset=l.focusOffset),"focusPath"in l&&(p.focusPath=l.focusPath&&l.focusPath.toJSON()),"isBackward"in l&&(p.isBackward=l.isBackward),"isFocused"in l&&(p.isFocused=l.isFocused),"marks"in l&&(p.marks=l.marks&&l.marks.toJSON()),l=p}if("properties"==c&&"set_value"==t){var v={};"data"in l&&(v.data=l.data.toJS()),"decorations"in l&&(v.decorations=l.decorations.toJS()),"schema"in l&&(v.schema=l.schema.toJS()),l=v}if("properties"==c&&"split_node"==t){var y={};"data"in l&&(y.data=l.data.toJS()),"type"in l&&(y.type=l.type),l=y}r[c]=l}}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return r}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"operation"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isOperation(e))return e;if(w(e))return t.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(Fr.isList(e)||Array.isArray(e)){var r=new Fr(e.map(t.create));return r}throw new Error("`Operation.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isOperation(e))return e;var r=e.type,n=Ri[r],o={type:r};if(!n)throw new Error('`Operation.fromJSON` was passed an unrecognized operation type: "'+r+'"');var i=!0,a=!1,s=void 0;try{for(var u,c=n[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value,f=e[l];if(void 0===f){if("document"==l)continue;if("selection"==l)continue;if("value"==l)continue;if("node"==l&&"insert_node"!=r)continue;throw new Error('`Operation.fromJSON` was passed a "'+r+'" operation without the required "'+l+'" attribute.')}"path"!==l&&"newPath"!==l||(f=Io.create(f)),"mark"===l&&(f=No.create(f)),"marks"===l&&null!=f&&(f=No.createSet(f)),"node"===l&&(f=Uo.create(f)),"selection"===l&&(f=Mo.create(f)),"value"===l&&(f=Mi.create(f)),"properties"===l&&"merge_node"===r&&(f=Uo.createProperties(f)),"properties"===l&&"set_mark"===r&&(f=No.createProperties(f)),"properties"===l&&"set_node"===r&&(f=Uo.createProperties(f)),"properties"===l&&"set_selection"===r&&(f=Mo.createProperties(f)),"properties"===l&&"set_value"===r&&(f=Mi.createProperties(f)),"properties"===l&&"split_node"===r&&(f=Uo.createProperties(f)),o[l]=f}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}return new t(o)}},{key:"isOperation",value:function(e){return!(!e||!e[ao.OPERATION])}},{key:"isOperationList",value:function(e){return Fr.isList(e)&&e.every((function(e){return t.isOperation(e)}))}}]),t}(Dn({length:void 0,mark:void 0,marks:void 0,newPath:void 0,node:void 0,offset:void 0,path:void 0,position:void 0,properties:void 0,selection:void 0,target:void 0,text:void 0,type:void 0,value:void 0}));Di.fromJS=Di.fromJSON,Di.prototype[ao.OPERATION]=!0;var Li=ro("slate:operation:invert");function Ji(e){var t=(e=Di.create(e)).type;switch(Li(t,e),t){case"insert_node":return e.set("type","remove_node");case"remove_node":return e.set("type","insert_node");case"move_node":var r=e,n=r.newPath,o=r.path,i=n,a=o,s=o.size-1,u=n.size-1;return o.size<i.size&&o.slice(0,s).every((function(e,t){return e==i.get(t)}))&&o.last()<i.get(s)&&(i=i.slice(0,s).concat(i.get(s)-1).concat(i.slice(s+1,i.size))),n.size<a.size&&n.slice(0,u).every((function(e,t){return e==a.get(t)}))&&n.last()<=a.get(u)&&(a=a.slice(0,u).concat(a.get(u)+1).concat(a.slice(u+1,a.size))),e.set("path",i).set("newPath",a);case"merge_node":var c=e.path,l=Io.decrement(c);return e.set("type","split_node").set("path",l);case"split_node":var f=e.path,h=Io.increment(f);return e.set("type","merge_node").set("path",h);case"set_node":var d=e,p=d.properties,v=d.node,y=v.merge(p),m=oo(v,Object.keys(p));return e.set("node",y).set("properties",m);case"insert_text":return e.set("type","remove_text");case"remove_text":return e.set("type","insert_text");case"add_mark":return e.set("type","remove_mark");case"remove_mark":return e.set("type","add_mark");case"set_mark":var g=e,k=g.properties,_=g.mark,b=_.merge(k),w=oo(_,Object.keys(k));return e.set("mark",b).set("properties",w);case"set_selection":var x=e,A=x.properties,O=x.selection,S=O.merge(A),E=oo(O,Object.keys(A));return e.set("selection",S).set("properties",E);case"set_value":var T=e,N=T.properties,B=T.value,z=B.merge(N),j=oo(B,Object.keys(N));return e.set("value",z).set("properties",j);default:throw new Error('Unknown operation type: "'+t+'".')}}var qi={redo:function(e){var t=e.value,r=t.history;if(r){var n=r,o=n.undos,i=n.redos,a=i.peek();a&&(i=i.pop(),o=o.push(a),a.forEach((function(t){var r=t,n=r.type,o=r.properties;"set_selection"==n&&(t=t.set("properties",io(o,"isFocused"))),e.applyOperation(t,{save:!1})})),t=e.value,r=r.set("undos",o).set("redos",i),t=t.set("history",r),e.value=t)}},undo:function(e){var t=e.value,r=t.history;if(r){var n=r,o=n.undos,i=n.redos,a=o.peek();a&&(o=o.pop(),i=i.push(a),a.slice().reverse().map(Ji).forEach((function(t){var r=t,n=r.type,o=r.properties;"set_selection"==n&&(t=t.set("properties",io(o,"isFocused"))),e.applyOperation(t,{save:!1})})),t=e.value,r=r.set("undos",o).set("redos",i),t=t.set("history",r),e.value=t)}}},Ui={select:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Mo.createProperties(t);var n=r.snapshot,o=void 0!==n&&n,i=e.value,a=i.document,s=i.selection,u={},c=s.merge(t).normalize(a);for(var l in t=oo(c,Object.keys(t)))!0!==o&&Ye(t[l],s[l])||(u[l]=t[l]);s.marks&&!u.marks&&(u.hasOwnProperty("anchorKey")||u.hasOwnProperty("anchorOffset")||u.hasOwnProperty("focusKey")||u.hasOwnProperty("focusOffset"))&&(u.marks=null),to(u)||e.applyOperation({type:"set_selection",value:i,properties:u,selection:s.toJSON()},o?{skip:!1,merge:!1}:{})},selectAll:function(e){var t=e.value,r=t.document,n=t.selection.moveToRangeOf(r);e.select(n)},snapshotSelection:function(e){var t=e.value.selection;e.select(t,{snapshot:!0})},moveAnchorCharBackward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.anchorText,i=t.anchorBlock,a=n.anchorOffset,s=r.getPreviousText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a>0?e.moveAnchor(-1):s&&(e.moveAnchorToEndOf(s),u||c||!i.hasNode(s.key)||e.moveAnchor(-1))},moveAnchorCharForward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.anchorText,i=t.anchorBlock,a=n.anchorOffset,s=r.getNextText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a<o.text.length?e.moveAnchor(1):s&&(e.moveAnchorToStartOf(s),u||c||!i.hasNode(s.key)||e.moveAnchor(1))},moveFocusCharBackward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.focusText,i=t.focusBlock,a=n.focusOffset,s=r.getPreviousText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a>0?e.moveFocus(-1):s&&(e.moveFocusToEndOf(s),u||c||!i.hasNode(s.key)||e.moveFocus(-1))},moveFocusCharForward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.focusText,i=t.focusBlock,a=n.focusOffset,s=r.getNextText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a<o.text.length?e.moveFocus(1):s&&(e.moveFocusToStartOf(s),u||c||!i.hasNode(s.key)||e.moveFocus(1))}};["Forward","Backward"].forEach((function(e){var t="moveAnchorChar"+e,r="moveFocusChar"+e;Ui["moveChar"+e]=function(e){e[t]()[r]()},Ui["moveStartChar"+e]=function(e){e.value.isBackward?e[r]():e[t]()},Ui["moveEndChar"+e]=function(e){e.value.isBackward?e[t]():e[r]()},Ui["extendChar"+e]=function(t){t["moveFocusChar"+e]()},Ui["collapseChar"+e]=function(t){t["Forward"==e?"collapseToEnd":"collapseToStart"]()["moveChar"+e]()}}));[["collapseLineBackward","collapseToStartOfBlock"],["collapseLineForward","collapseToEndOfBlock"],["extendLineBackward","extendToStartOfBlock"],["extendLineForward","extendToEndOfBlock"]].forEach((function(e){var t=ko(e,2),r=t[0],n=t[1];Ui[r]=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e[n].apply(e,[e].concat(r))}}));["blur","collapseTo","collapseToAnchor","collapseToEnd","collapseToEndOf","collapseToFocus","collapseToStart","collapseToStartOf","extend","extendTo","extendToEndOf","extendToStartOf","flip","focus","move","moveAnchor","moveAnchorOffsetTo","moveAnchorTo","moveAnchorToEndOf","moveAnchorToStartOf","moveEnd","moveEndOffsetTo","moveEndTo","moveFocus","moveFocusOffsetTo","moveFocusTo","moveFocusToEndOf","moveFocusToStartOf","moveOffsetsTo","moveStart","moveStartOffsetTo","moveStartTo","moveTo","moveToEnd","moveToEndOf","moveToRangeOf","moveToStart","moveToStartOf","deselect"].forEach((function(e){Ui[e]=function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i="deselect"!=e,a=t.value,s=a.document,u=a.selection,c=u[e].apply(u,n);i&&(c=c.normalize(s)),t.select(c)}}));var Vi=["Next","Previous"],Wi=["Block","Inline","Text"];["moveTo","moveAnchorTo","moveFocusTo","moveStartTo","moveEndTo","collapseTo","extendTo"].forEach((function(e){var t=["Start","End"];"moveTo"==e&&t.push("Range"),t.forEach((function(t){var r=""+e+t+"Of";Wi.forEach((function(e){var t="Text"==e?"getNode":"getClosest"+e;Ui[""+r+e]=function(e){var n=e.value,o=n.document,i=n.selection,a=o[t](i.startKey);a&&e[r](a)},Vi.forEach((function(n){var o="get"+n+e,i="Next"==n?"startKey":"endKey";Ui[""+r+n+e]=function(e){var n=e.value,a=n.document,s=n.selection,u=a[t](s[i]);if(u){var c=a[o](u.key);c&&e[r](c)}}}))}))}))}));var $i={setValue:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Mi.createProperties(t);var n=e.value;e.applyOperation({type:"set_value",properties:t,value:n},r)}},Hi={};function Gi(e,t,r){if("text"!=t.object){for(var n=t.getFirstInvalidDescendant(r),o=e.value.document.getPath(t.key);t&&n;)Gi(e,n,r),(t=e.value.document.refindNode(o,t.key))?(o=e.value.document.refindPath(o,t.key),n=t.getFirstInvalidDescendant(r)):(o=[],n=null);t&&Qi(e,t,r)}else Qi(e,t,r)}function Qi(e,t,r){var n=r.stack.plugins.length+r.rules.length+1,o=0;!function e(t,i){var a=i.normalize(r);if(a){var s=t.value.document.getPath(i.key);if(a(t),i=t.value.document.refindNode(s,i.key)){if(s=t.value.document.refindPath(s,i.key),++o>n)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.");e(t,i)}}}(e,t)}Hi.normalize=function(e,t){e.normalizeDocument(t)},Hi.normalizeDocument=function(e,t){var r=e.value.document;e.normalizeNodeByKey(r.key,t)},Hi.normalizeNodeByKey=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=e.getFlag("normalize",r);if(n){var o=e.value,i=o.document,a=o.schema,s=i.assertNode(t);Gi(e,s,a),e.normalizeAncestorsByKey(t)}},Hi.normalizeAncestorsByKey=function(e,t){var r=e.value,n=r.document,o=r.schema,i=n.getAncestors(t);i&&i.forEach((function(t){e.value.document.getDescendant(t.key)&&Qi(e,t,o)}))},Hi.normalizeParentByKey=function(e,t,r){var n=e.value.document.getParent(t);e.normalizeNodeByKey(n.key,r)},Hi.normalizeNodeByPath=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=e.getFlag("normalize",r);if(n){var o=e.value,i=o.document,a=o.schema,s=i.assertNode(t);Gi(e,s,a);var u=(i=e.value.document).getAncestors(t);u&&u.forEach((function(t){e.value.document.getDescendant(t.key)&&Qi(e,t,a)}))}},Hi.normalizeParentByPath=function(e,t,r){var n=Io.lift(t);e.normalizeNodeByPath(n,r)};var Yi=yo({},Bo,ai,si,qi,Ui,$i,Hi),Xi=ro("slate:operation:apply");function Zi(e,t){var r=(t=Di.create(t)).type;switch(Xi(r,t),r){case"add_mark":var n=t,o=n.path,i=n.offset,a=n.length,s=n.mark;return e.addMark(o,i,a,s);case"insert_node":var u=t,c=u.path,l=u.node;return e.insertNode(c,l);case"insert_text":var f=t,h=f.path,d=f.offset,p=f.text,v=f.marks;return e.insertText(h,d,p,v);case"merge_node":var y=t.path;return e.mergeNode(y);case"move_node":var m=t,g=m.path,k=m.newPath;return e.moveNode(g,k);case"remove_mark":var _=t,b=_.path,w=_.offset,x=_.length,A=_.mark;return e.removeMark(b,w,x,A);case"remove_node":var O=t.path;return e.removeNode(O);case"remove_text":var S=t,E=S.path,T=S.offset,N=S.text;return e.removeText(E,T,N);case"set_mark":var B=t,z=B.path,j=B.offset,C=B.length,P=B.mark,K=B.properties;return e.setMark(z,j,C,P,K);case"set_node":var F=t,I=F.path,M=F.properties;return e.setNode(I,M);case"set_selection":var R=t.properties;return e.setSelection(R);case"set_value":var D=t.properties;return e.merge(D);case"split_node":var L=t,J=L.path,q=L.position,U=L.properties;return e.splitNode(J,q,U);default:throw new Error('Unknown operation type: "'+r+'".')}}var ea=ro("slate:change"),ta=function(){function e(t){po(this,e);var r=t.value;this.value=r,this.operations=new Fr,this.flags=yo({normalize:!0},oo(t,["merge","save","normalize"]))}return vo(e,[{key:"applyOperation",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.operations,n=this.flags,o=this.value,i=o,a=i.history;w(e)&&(e=yo({},e,{value:o})),e=Di.create(e);var s=t=yo({},n,t),u=s.merge,c=void 0===u?0!=r.size||null:u,l=s.save,f=void 0===l||l,h=s.skip,d=void 0===h?null:h;return ea("apply",{operation:e,save:f,merge:c}),o=Zi(o,e),a&&f&&(a=a.save(e,{merge:c,skip:d}),o=o.set("history",a)),this.value=o,this.operations=r.push(e),this}},{key:"applyOperations",value:function(e,t){var r=this;return e.forEach((function(e){return r.applyOperation(e,t)})),this}},{key:"call",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.apply(void 0,[this].concat(r)),this}},{key:"withoutNormalization",value:function(e){var t=this.flags.normalize;return this.setOperationFlag("normalize",!1),e(this),this.setOperationFlag("normalize",t),this.normalizeDocument(),this}},{key:"setOperationFlag",value:function(e,t){return this.flags[e]=t,this}},{key:"getFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0!==t[e]?t[e]:this.flags[e]}},{key:"unsetOperationFlag",value:function(e){return delete this.flags[e],this}},{key:"object",get:function(){return"change"}},{key:"kind",get:function(){return ee.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}]),e}();ta.isChange=so.bind(null,"CHANGE"),ta.prototype[ao.CHANGE]=!0,Object.keys(Yi).forEach((function(e){ta.prototype[e]=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return ea(e,{args:r}),this.call.apply(this,[Yi[e]].concat(r)),this}}));const ra=r,{renderToStaticMarkup:na}=n;var oa=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},ia=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},aa=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},sa=new Dn({object:"string",text:""}),ua={deserialize:function(e){if(e.tagName&&"br"===e.tagName.toLowerCase())return{object:"text",leaves:[{object:"leaf",text:"\n"}]};if("#text"==e.nodeName){if(e.nodeValue&&e.nodeValue.match(/<!--.*?-->/))return;return{object:"text",leaves:[{object:"leaf",text:e.nodeValue}]}}},serialize:function(e,t){if("string"===e.object)return t.split("\n").reduce((function(e,t,r){return 0!=r&&e.push(ra.createElement("br",{key:r})),e.push(t),e}),[])}};function ca(e){if("undefined"==typeof DOMParser)throw new Error("The native `DOMParser` global which the `Html` serializer uses by default is not present in this environment. You must supply the `options.parseHtml` function instead.");return(new DOMParser).parseFromString(e,"text/html").body||window.document.createElement("body")}var la=function(){var e=this;this.deserialize=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.toJSON,o=void 0!==n&&n,i=e.defaultBlock,a=e.parseHtml,s=a(t),u=Array.from(s.childNodes),c=e.deserializeElements(u);0==(c=c.reduce((function(e,t,r,n){if("block"==t.object)return e.push(t),e;if(r>0&&"block"!=n[r-1].object)return e[e.length-1].nodes.push(t),e;var o=ia({object:"block",data:{},isVoid:!1},i,{nodes:[t]});return e.push(o),e}),[])).length&&(c=[ia({object:"block",data:{},isVoid:!1},i,{nodes:[{object:"text",leaves:[{object:"leaf",text:"",marks:[]}]}]})]);var l={object:"value",document:{object:"document",data:{},nodes:c}},f=o?l:Mi.fromJSON(l);return f},this.deserializeElements=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=[];return t.filter(e.cruftNewline).forEach((function(t){var n=e.deserializeElement(t);switch(k(n)){case"array":r=r.concat(n);break;case"object":r.push(n)}})),r},this.deserializeElement=function(t){var r=void 0;t.tagName||(t.tagName="");var n=function(t){switch("[object NodeList]"==Object.prototype.toString.call(t)&&(t=Array.from(t)),k(t)){case"array":return e.deserializeElements(t);case"object":return e.deserializeElement(t);case"null":case"undefined":return;default:throw new Error('The `next` argument was called with invalid children: "'+t+'".')}},o=!0,i=!1,a=void 0;try{for(var s,u=e.rules[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value;if(c.deserialize){var l=c.deserialize(t,n),f=k(l);if("array"!=f&&"object"!=f&&"null"!=f&&"undefined"!=f)throw new Error('A rule returned an invalid deserialized representation: "'+r+'".');if(void 0!==l){if(null===l)return null;r="mark"==l.object?e.deserializeMark(l):l;break}}}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return r||n(t.childNodes)},this.deserializeMark=function(t){var r=t.type,n=t.data,o=function t(o){return"mark"==o.object?e.deserializeMark(o):("text"==o.object?o.leaves=o.leaves.map((function(e){return e.marks=e.marks||[],e.marks.push({type:r,data:n}),e})):o.nodes&&(o.nodes=o.nodes.map(t)),o)};return t.nodes.reduce((function(e,t){var r=o(t);return Array.isArray(r)?e.concat(r):(e.push(r),e)}),[])},this.serialize=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.document,o=n.nodes.map(e.serializeNode).filter((function(e){return e}));if(!1===r.render)return o;var i=na(ra.createElement("body",null,o)),a=i.slice(6,-7);return a},this.serializeNode=function(t){if("text"===t.object)return t.getLeaves().map(e.serializeLeaf);var r=t.nodes.map(e.serializeNode),n=!0,o=!1,i=void 0;try{for(var a,s=e.rules[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(u.serialize){var c=u.serialize(t,r);if(null===c)return;if(c)return ha(c)}}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}throw new Error('No serializer defined for node of type "'+t.type+'".')},this.serializeLeaf=function(t){var r=new sa({text:t.text}),n=e.serializeString(r);return t.marks.reduce((function(t,r){var n=!0,o=!1,i=void 0;try{for(var a,s=e.rules[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(u.serialize){var c=u.serialize(r,t);if(null===c)return;if(c)return ha(c)}}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}throw new Error('No serializer defined for mark of type "'+r.type+'".')}),n)},this.serializeString=function(t){var r=!0,n=!1,o=void 0;try{for(var i,a=e.rules[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var s=i.value;if(s.serialize){var u=s.serialize(t,t.text);if(u)return u}}}catch(e){n=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw o}}},this.cruftNewline=function(e){return!("#text"===e.nodeName&&"\n"==e.nodeValue)}},fa=0;function ha(e){return ra.cloneElement(e,{key:fa++})}var da,pa,va,ya={"border-radius":1,"border-top-left-radius":1,"border-top-right-radius":1,"border-bottom-left-radius":1,"border-bottom-right-radius":1,"box-shadow":1,order:1,flex:function(e,t){return[t+"box-flex"]},"box-flex":1,"box-align":1,animation:1,"animation-duration":1,"animation-name":1,transition:1,"transition-duration":1,transform:1,"transform-style":1,"transform-origin":1,"backface-visibility":1,perspective:1,"box-pack":1},ma={animation:1,"column-count":1,columns:1,"font-weight":1,opacity:1,"order ":1,"z-index":1,zoom:1,flex:1,"box-flex":1,transform:1,perspective:1,"box-pack":1,"box-align":1,colspan:1,rowspan:1},ga=function(e){return e.length?e.charAt(0).toUpperCase()+e.substring(1):e},ka=ga,_a=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,ba="undefined"==typeof document?{}:document.documentElement.style,wa=(da=function(){for(var e in ba)if(_a.test(e))return e.match(_a)[0];return"WebkitOpacity"in ba?"Webkit":"KhtmlOpacity"in ba?"Khtml":""}(),pa=da.toLowerCase(),{style:da,css:"-"+pa+"-",dom:{Webkit:"WebKit",ms:"MS",o:"WebKit"}[da]||ka(da)}),xa=function(e,t){return t?t.toUpperCase():""},Aa=/[-\s]+(.)?/g,Oa=function(e){return e?e.replace(Aa,xa):""},Sa=/::/g,Ea=/([A-Z]+)([A-Z][a-z])/g,Ta=/([a-z\d])([A-Z])/g,Na=/_/g,Ba=function(e,t){return e?e.replace(Sa,"/").replace(Ea,"$1_$2").replace(Ta,"$1_$2").replace(Na,t||"-"):""},za=function(e){return Ba(e).toLowerCase()},ja=Oa,Ca=za,Pa=function(e){return e.length?e.charAt(0).toLowerCase()+e.substring(1):e},Ka=ga,Fa=wa,Ia=ya,Ma="undefined"==typeof document?{}:document.documentElement.style,Ra=function(e,t){t=t||{};var r=Pa(ja(e)),n=Ca(e),o=va?r:n,i=Fa.style?va?Fa.style:Fa.css:"";if(r in Ma)return t.asString?o:[o];var a=o,s=Ia[n],u=[];if(va&&(a=Ka(o)),"function"==typeof s){var c=s(o,i)||[];c&&!Array.isArray(c)&&(c=[c]),c.length&&(c=c.map((function(e){return va?Pa(ja(e)):Ca(e)}))),u=u.concat(c)}return i&&u.push(i+a),u.push(o),t.asString||1==u.length?u[0]:u},Da=Object.prototype.hasOwnProperty,La=function(e,t){return Da.call(e,t)},Ja=Object.prototype.toString,qa=Object.prototype.toString,Ua=Ra,Va=za,Wa=Oa,$a=La,Ha=function(e){return!!e&&"[object Object]"===Ja.call(e)},Ga=function(e){return"[object Function]"===qa.apply(e)},Qa=function(e,t,r,n){Ua(t).forEach((function(t){e[n?n(t):t]=r}))},Ya={cssUnitless:ma},Xa=function(e,t,r,n){"string"==typeof e&&(e=function(e){e=(e||"").split(";");var t={};return e.forEach((function(e){var r=e.split(":");2==r.length&&(t[r[0].trim()]=r[1].trim())})),t}(e)),(t=t||Ya).cssUnitless=t.cssUnitless||Ya.cssUnitless,n=n||{};var o,i,a,s,u,c,l,f,h=t.scope||{},d=null!=t.addUnits?t.addUnits:!h||null==h.addUnits||h.addUnits,p=(null!=t.cssUnitless?t.cssUnitless:h?h.cssUnitless:null)||{},v=(t.cssUnit||h?h.cssUnit:null)||"px",y=t.prefixProperties||(h?h.prefixProperties:null)||{},m=t.camelize?Wa:Va;for(a in e)if($a(e,a)){if(s=e[a],i=Va(r?r+a:a),o=!1,f=!1,Ga(s)&&(l=s.call(h||e,s,a,i,e),Ha(l)&&null!=l.value?(s=l.value,f=l.prefix,i=l.name?Va(l.name):i):s=l),c="number"==(u=typeof s)||"string"==u&&""!=s&&1*s==s,null==s||null==i||""===i)continue;if((c||"string"==u)&&(o=!0),!o&&null!=s.value&&s.prefix&&(o=!0,f=s.prefix,s=s.value),o){if(f=f||!!y[i],c&&(s=d&&!(i in p)?s+v:s+""),"border"!=i&&(i.indexOf("border")||~i.indexOf("radius")||~i.indexOf("width"))||!c||(i+="-width"),!i.indexOf("border-radius-")&&(i.replace(/border(-radius)(-(.*))/,(function(e,t,r){var n={"-top":["-top-left","-top-right"],"-left":["-top-left","-bottom-left"],"-right":["-top-right","-bottom-right"],"-bottom":["-bottom-left","-bottom-right"]};r in n?(i=[],n[r].forEach((function(e){i.push("border"+e+t)}))):i="border"+r+t})),Array.isArray(i))){i.forEach((function(e){f?Qa(n,e,s,m):n[m(e)]=s}));continue}f?Qa(n,i,s,m):n[m(i)]=s}else Xa(s,t,i+"-",n)}return n},Za=Xa,es=La,ts={prefixProperties:ya,cssUnitless:ma,object:Xa,string:function(e,t){e=Za(e,t);var r,n=[];for(r in e)es(e,r)&&n.push(r+": "+e[r]);return n.join("; ")}};const rs=e("@pie-lib:mask-markup:serialization"),ns=["span"],os=["em","strong","u"],is=(e,t)=>{const r=e.getAttribute(t);return n=(e=>{const t=/([\w-]*)\s*:\s*([^;]*)/g;let r;const n={};for(;r=t.exec(e);)n[r[1]]=r[2].trim();return n})(r),ts.object(n,{camelize:!0,addUnits:!1});var n},as=["border","class","style"],ss={b:"bold",em:"italic",u:"underline",s:"strikethrough",code:"code",strong:"strong"},us=[{deserialize(e,t){const r=ss[e.tagName.toLowerCase()];if(r)return rs("[deserialize] mark: ",r),{object:"mark",type:r,nodes:t(e.childNodes)}}},{deserialize:(e,t)=>{if(8===e.nodeType)return;if(3===e.nodeType)return{object:"text",leaves:[{text:e.textContent}]};const r=e.tagName.toLowerCase(),n=(e=>{if(!e.attributes||e.attributes.length<=0)return;const t={};let r;for(r=0;r<e.attributes.length;r++){const n=e.attributes[r];t[n.name]=n.value}return t})(e)||{};"audio"==r&&""==n.controls&&(n.controls=!0);const o=as.reduce((e=>(t,r)=>{if(!e.getAttribute)return t;if(e.getAttribute(r))switch(r){case"style":t.style=is(e,r);break;case"class":t.className=((e,t,r)=>{const n=e.getAttribute(r);return delete t.class,n})(e,t,r);break;default:t[r]=e.getAttribute(r)}return t})(e),{...n}),i=(e=>ns.includes(e)?"inline":os.includes(e)?"mark":"block")(r);return"math"===e.tagName.toLowerCase()?{isMath:!0,nodes:[e]}:{object:i,type:r,data:{dataset:{...e.dataset},attributes:{...o}},nodes:t(e.childNodes)}}}],cs=new function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};oa(this,e),la.call(this);var r=t.defaultBlock,n=void 0===r?"paragraph":r,o=t.parseHtml,i=void 0===o?ca:o,a=t.rules,s=void 0===a?[]:a;n=Uo.createProperties(n),this.rules=[].concat(aa(s),[ua]),this.defaultBlock=n,this.parseHtml=i}({rules:us,defaultBlock:"span"}),ls=r,fs=o,{get:hs}=t,{withStyles:ds}=i,ps=a;function vs(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}const ys=ds((e=>({para:{paddingTop:2*e.spacing.unit,paddingBottom:2*e.spacing.unit}})))((e=>ls.createElement("div",{className:e.classes.para},e.children))),ms=ds((()=>({spacer:{display:"inline-block",width:".75em"}})))((e=>ls.createElement("span",{className:e.classes.spacer}))),gs=["tbody","tr"],ks=(e,t,r,n,o,i)=>{if(!t)return null;const a=[];return(e.nodes||[]).forEach(((e,s)=>{const u=e.type?`${e.type}-${s}`:`${s}`;if(e.isMath)return a.push(ls.createElement("span",{dangerouslySetInnerHTML:{__html:`<math displaystyle="true">${e.nodes[0].innerHTML}</math>`}})),a;if(n){const u=n(e,t,r);if(u)return a.push(u),void("td"!==vs([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(ls.createElement(ms,{key:`spacer-${s}`})))}if("text"===e.object){const t=e.leaves.reduce(((e,t)=>{const r=t.text,n=((e,t)=>{const r=""===t.trim(),n=e&&e.type;return r&&gs.includes(n)?void 0:t})(o,r);return n?e+n:e}),""),r=(e=>{const t=e.leaves.find((e=>hs(e,"marks",[]).length));return t?t.marks[0]:null})(e);if(r){let e;for(e in ss)if(ss[e]===r.type){const r=e;a.push(ls.createElement(r,{key:u},t));break}}else t.length>0&&(a.push(t),"td"!==vs([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(ls.createElement(ms,{key:`spacer-${s}`})))}else{const o=ks(e,t,r,n,e,i);if("p"===e.type||"paragraph"===e.type)a.push(ls.createElement(ys,{key:u},o));else{const t=e.type;e.nodes&&e.nodes.length>0?a.push(ls.createElement(t,{key:u,...e.data.attributes},o)):a.push(ls.createElement(t,{key:u,...e.data.attributes}))}}})),a},_s=ds((()=>({main:{display:"initial"},tableStyle:{"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:"8px 12px",textAlign:"left"}}})))((e=>ls.createElement("div",{className:ps(e.classes.main,e.classes.tableStyle)},e.children)));class bs extends ls.Component{constructor(...e){super(...e),bs.prototype.__init.call(this)}static __initStatic(){this.propTypes={renderChildren:fs.func,layout:fs.object,value:fs.object,onChange:fs.func,elementType:fs.string}}__init(){this.handleChange=(e,t)=>{const r={...this.props.value,[e]:t};this.props.onChange(r)}}render(){const{value:e,layout:t,elementType:r}=this.props,n=ks(t,e,this.handleChange,this.props.renderChildren,null,r);return ls.createElement(_s,null,n)}}bs.__initStatic();const ws=/\{\{(\d+)\}\}/g;const xs=r,As=s,Os=o;var Ss;const Es=(e,t)=>{const{markup:r}=(o=t,(n=e)?{markup:n.replace(ws,((e,t)=>`<span data-component="${o}" data-id="${t}"></span>`))}:{markup:""});var n,o;const i=(e=>cs.deserialize(e,{toJSON:!0}))(r);return i.document},Ts=(e,t)=>((Ss=class extends xs.Component{static __initStatic(){this.propTypes={markup:Os.string,layout:Os.object,value:Os.object,onChange:Os.func,customMarkMarkupComponent:Os.func,elementType:Os.string}}componentDidUpdate(e){if(this.props.markup!==e.markup){const e=As.findDOMNode(this);(e&&e.querySelectorAll('[data-latex][data-math-handled="true"]')||[]).forEach((e=>{const t=e.querySelector("mjx-container");t&&e.removeChild(t);const r=e.getAttribute("data-raw");e.innerHTML=r,e.removeAttribute("data-math-handled")}))}}render(){const{markup:r,layout:n,value:o,onChange:i,elementType:a}=this.props,s=n||Es(r,e);return xs.createElement(bs,{elementType:a,layout:s,value:o,onChange:i,renderChildren:t(this.props)})}}).__initStatic(),Ss),Ns=r,Bs=s,zs=o,{withStyles:js}=i,{Chip:Cs}=u,Ps=a,{color:Ks}=c,{renderMath:Fs}=h,{DragSource:Is}=v;class Ms extends Ns.Component{constructor(...e){super(...e),Ms.prototype.__init.call(this),Ms.prototype.__init2.call(this),Ms.prototype.__init3.call(this),Ms.prototype.__init4.call(this)}static __initStatic(){this.propTypes={disabled:zs.bool,choice:zs.object,classes:zs.object,connectDragSource:zs.func}}__init(){this.startDrag=()=>{const{connectDragSource:e,disabled:t}=this.props;t||e(this.dragContainerRef)}}__init2(){this.handleTouchStart=e=>{e.preventDefault(),this.longPressTimer=setTimeout((()=>{this.startDrag(e)}),500)}}__init3(){this.handleTouchEnd=()=>{clearTimeout(this.longPressTimer)}}__init4(){this.handleTouchMove=()=>{clearTimeout(this.longPressTimer)}}componentDidMount(){this.dragContainerRef&&(this.dragContainerRef.addEventListener("touchstart",this.handleTouchStart,{passive:!1}),this.dragContainerRef.addEventListener("touchend",this.handleTouchEnd),this.dragContainerRef.addEventListener("touchmove",this.handleTouchMove))}componentWillUnmount(){this.dragContainerRef&&(this.dragContainerRef.removeEventListener("touchstart",this.handleTouchStart),this.dragContainerRef.removeEventListener("touchend",this.handleTouchEnd),this.dragContainerRef.removeEventListener("touchmove",this.handleTouchMove))}componentDidUpdate(){Fs(this.rootRef)}render(){const{connectDragSource:e,choice:t,classes:r,disabled:n}=this.props;return e(Ns.createElement("span",{className:Ps(r.choice,n&&r.disabled),ref:e=>{this.dragContainerRef=Bs.findDOMNode(e)}},Ns.createElement(Cs,{clickable:!1,disabled:!0,ref:e=>{this.rootRef=Bs.findDOMNode(e)},className:r.chip,label:Ns.createElement("span",{className:r.chipLabel,ref:e=>{e&&(e.innerHTML=t.value||" ")}}," "),variant:n?"outlined":void 0})),{})}}Ms.__initStatic();const Rs=js((e=>({choice:{border:`solid 0px ${e.palette.primary.main}`,borderRadius:2*e.spacing.unit,margin:e.spacing.unit/2,transform:"translate(0, 0)"},chip:{backgroundColor:Ks.white(),border:`1px solid ${Ks.text()}`,color:Ks.text(),alignItems:"center",display:"inline-flex",height:"initial",minHeight:"32px",fontSize:"inherit",whiteSpace:"pre-wrap",maxWidth:"374px",pointerEvents:"none",borderRadius:"3px",paddingTop:"12px",paddingBottom:"12px"},chipLabel:{whiteSpace:"normal","& img":{display:"block",padding:"2px 0"},"& mjx-frac":{fontSize:"120% !important"}},disabled:{opacity:.6}})))(Ms),Ds=Is("MaskBlank",{canDrag:e=>!e.disabled,beginDrag:e=>({choice:e.choice,instanceId:e.instanceId})},((e,t)=>({connectDragSource:e.dragSource(),isDragging:t.isDragging()})))(Rs),Ls=r,Js=o,{findKey:qs}=t,{DragDroppablePlaceholder:Us}=v;class Vs extends Ls.Component{constructor(...e){super(...e),Vs.prototype.__init.call(this)}static __initStatic(){this.propTypes={disabled:Js.bool,duplicates:Js.bool,choices:Js.arrayOf(Js.shape({label:Js.string,value:Js.string})),value:Js.object,choicePosition:Js.string.isRequired}}__init(){this.getStyleForWrapper=()=>{const{choicePosition:e}=this.props;switch(e){case"above":return{margin:"0 0 40px 0"};case"below":return{margin:"40px 0 0 0"};case"right":return{margin:"0 0 0 40px"};default:return{margin:"0 40px 0 0"}}}}render(){const{disabled:e,duplicates:t,choices:r,value:n}=this.props,o=r.filter((e=>{if(!0===t)return!0;return void 0===qs(n,(t=>t===e.id))})),i={...this.getStyleForWrapper(),minWidth:"100px"};return Ls.createElement("div",{style:i},Ls.createElement(Us,{disabled:e},o.map(((t,r)=>Ls.createElement(Ds,{key:`${t.value}-${r}`,disabled:e,choice:t})))))}}Vs.__initStatic();const{colors:{grey:Ws}}=u,{Chip:$s}=u,Hs=r,Gs=s,Qs=o,Ys=e,{withStyles:Xs}=i,Zs=a,{color:eu}=c,{renderMath:tu}=h,{DragSource:ru}=v,{DropTarget:nu}=v;const ou=Ys("pie-lib:mask-markup:blank"),iu=Xs((()=>({content:{border:`solid 0px ${eu.primary()}`,minWidth:"200px",touchAction:"none",overflow:"hidden",whiteSpace:"nowrap"},chip:{backgroundColor:eu.background(),border:`2px dashed ${eu.text()}`,color:eu.text(),fontSize:"inherit",maxWidth:"374px",position:"relative",borderRadius:"3px"},chipLabel:{whiteSpace:"normal",pointerEvents:"none","& img":{display:"block",padding:"2px 0"},"& p":{marginTop:"0",marginBottom:"0"},"& mjx-frac":{fontSize:"120% !important"}},hidden:{color:"transparent",opacity:0},dragged:{position:"absolute",left:16,maxWidth:"60px"},correct:{border:`solid 1px ${eu.correct()}`},incorrect:{border:`solid 1px ${eu.incorrect()}`},over:{whiteSpace:"nowrap",overflow:"hidden"},parentOver:{border:`1px solid ${Ws[500]}`,backgroundColor:`${Ws[300]}`}})));class au extends Hs.Component{constructor(){super(),au.prototype.__init.call(this),au.prototype.__init2.call(this),au.prototype.__init3.call(this),this.state={height:0,width:0}}__init(){this.handleImageLoad=()=>{this.updateDimensions()}}handleElements(){const e=function(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}([this,"access",e=>e.spanRef,"optionalAccess",e=>e.querySelector,"call",e=>e("img")]);e?e.onload=this.handleImageLoad:setTimeout((()=>{this.updateDimensions()}),300)}componentDidMount(){this.handleElements(),this.rootRef&&this.rootRef.addEventListener("touchstart",this.handleTouchStart,{passive:!1})}componentDidUpdate(e){tu(this.rootRef);const{choice:t}=this.props,{choice:r}=e;if(JSON.stringify(t)!==JSON.stringify(r)){if(!t)return void this.setState({height:0,width:0});this.handleElements()}}componentWillUnmount(){this.rootRef&&this.rootRef.removeEventListener("touchstart",this.handleTouchStart)}__init2(){this.handleTouchStart=e=>{e.preventDefault(),this.touchStartTimer=setTimeout((()=>{this.startDrag()}),300)}}__init3(){this.startDrag=()=>{const{connectDragSource:e,disabled:t}=this.props;t||e(this.rootRef)}}updateDimensions(){if(this.spanRef&&this.rootRef){this.rootRef.style.width="auto";const e=(this.spanRef.offsetWidth||0)+24,t=(this.spanRef.offsetHeight||0)+24,r=parseFloat(this.props.emptyResponseAreaWidth)||0,n=parseFloat(this.props.emptyResponseAreaHeight)||0,o=e<=r?r:e,i=t<=n?n:t;this.setState((e=>({width:o>r?o:e.width,height:i>n?i:e.height}))),this.rootRef.style.width=`${o}px`,this.rootRef.style.height=`${i}px`}}addDraggableFalseAttributes(e){e.childNodes.forEach((e=>{(e instanceof Element||e instanceof HTMLDocument)&&e.setAttribute("draggable",!1)}))}getRootDimensions(){const e=isNaN(parseFloat(this.props.emptyResponseAreaWidth))?0:parseFloat(this.props.emptyResponseAreaWidth),t=isNaN(parseFloat(this.props.emptyResponseAreaHeight))?0:parseFloat(this.props.emptyResponseAreaHeight);return{...{height:this.state.height||t,width:this.state.width||e},...e?{}:{minWidth:90},...t?{}:{minHeight:32}}}render(){const{disabled:e,choice:t,classes:r,isOver:n,dragItem:o,correct:i}=this.props,a=o&&n&&o.choice.value,s=t&&t.value;return Hs.createElement($s,{clickable:!1,disabled:!0,ref:e=>{this.rootRef=Gs.findDOMNode(e)},component:"span",label:Hs.createElement(Hs.Fragment,null,Hs.createElement("span",{className:Zs(r.chipLabel,n&&r.over,{[r.hidden]:a}),ref:e=>{e&&(this.spanRef=Gs.findDOMNode(e),e.innerHTML=s||"",this.addDraggableFalseAttributes(e))}}," "),a&&Hs.createElement("span",{className:Zs(r.chipLabel,n&&r.over,r.dragged),ref:e=>{e&&(this.spanRef=Gs.findDOMNode(e),e.innerHTML=a||"",this.addDraggableFalseAttributes(e))}}," ")),className:Zs(r.chip,n&&r.over,n&&r.parentOver,{[r.correct]:void 0!==i&&i,[r.incorrect]:void 0!==i&&!i}),variant:e?"outlined":void 0,style:{...this.getRootDimensions()}})}}au.defaultProps={emptyResponseAreaWidth:0,emptyResponseAreaHeight:0},au.propTypes={id:Qs.oneOfType([Qs.string,Qs.number]),disabled:Qs.bool,duplicates:Qs.bool,choice:Qs.object,classes:Qs.object,isOver:Qs.bool,dragItem:Qs.object,correct:Qs.bool,onChange:Qs.func,emptyResponseAreaWidth:Qs.oneOfType([Qs.string,Qs.number]),emptyResponseAreaHeight:Qs.oneOfType([Qs.string,Qs.number])};const su=iu(au),uu=iu((({connectDragSource:e,connectDropTarget:t,...r})=>{const{classes:n,isOver:o}=r;return t(e(Hs.createElement("span",{className:Zs(n.content,o&&n.over)},Hs.createElement(su,{...r}))))})),cu=nu("MaskBlank",{drop(e,t){const r=t.getItem();return ou("props.instanceId",e.instanceId,"draggedItem.instanceId:",r.instanceId),r.id!==e.id&&e.onChange(e.id,r.choice.id),{dropped:r.id!==e.id}},canDrop:(e,t)=>t.getItem().instanceId===e.instanceId},((e,t)=>({connectDropTarget:e.dropTarget(),isOver:t.isOver(),dragItem:t.getItem()})))(uu),lu=ru("MaskBlank",{canDrag:e=>!e.disabled&&!!e.choice,beginDrag:e=>({id:e.id,choice:e.choice,instanceId:e.instanceId,fromChoice:!0}),endDrag(e,t){const r=t.getDropResult();if(!r||r.dropped){t.getItem().fromChoice&&e.onChange(e.id,void 0)}}},((e,t)=>({connectDragSource:e.dragSource(),isDragging:t.isDragging()})))(cu),fu=r,hu=o,{renderMath:du}=h,pu=Ts("blank",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("blank"===o.component){const{disabled:i,duplicates:a,correctResponse:s,feedback:u,showCorrectAnswer:c,emptyResponseAreaWidth:l,emptyResponseAreaHeight:f}=e,h=c?s[o.id]:r[o.id],d=h&&e.choices.find((e=>e.id===h));return fu.createElement(lu,{key:`${t.type}-${o.id}`,correct:c||u&&u[o.id],disabled:i,duplicates:a,choice:d,id:o.id,emptyResponseAreaWidth:l,emptyResponseAreaHeight:f,onChange:n})}}));class vu extends fu.Component{constructor(...e){super(...e),vu.prototype.__init.call(this)}static __initStatic(){this.propTypes={markup:hu.string,layout:hu.object,choicesPosition:hu.string,choices:hu.arrayOf(hu.shape({label:hu.string,value:hu.string})),value:hu.object,onChange:hu.func,duplicates:hu.bool,disabled:hu.bool,feedback:hu.object,correctResponse:hu.object,showCorrectAnswer:hu.bool,emptyResponseAreaWidth:hu.oneOfType([hu.string,hu.number]),emptyResponseAreaHeight:hu.oneOfType([hu.string,hu.number])}}UNSAFE_componentWillReceiveProps(){this.rootRef&&du(this.rootRef)}componentDidUpdate(){du(this.rootRef)}__init(){this.getPositionDirection=e=>{let t,r,n;switch(e){case"left":t="row",n="center";break;case"right":t="row-reverse",r="flex-end",n="center";break;case"below":t="column-reverse";break;default:t="column"}return{flexDirection:t,justifyContent:r,alignItems:n}}}render(){const{markup:e,duplicates:t,layout:r,value:n,onChange:o,choicesPosition:i,choices:a,correctResponse:s,disabled:u,feedback:c,showCorrectAnswer:l,emptyResponseAreaWidth:f,emptyResponseAreaHeight:h}=this.props,d=i||"below",p={display:"flex",minWidth:"100px",...this.getPositionDirection(d)};return fu.createElement("div",{ref:e=>e&&(this.rootRef=e),style:p},fu.createElement(Vs,{choicePosition:d,duplicates:t,choices:a,value:n,disabled:u}),fu.createElement(pu,{elementType:"drag-in-the-blank",markup:e,layout:r,value:n,choices:a,onChange:o,disabled:u,duplicates:t,feedback:c,correctResponse:s,showCorrectAnswer:l,emptyResponseAreaWidth:f,emptyResponseAreaHeight:h}))}}vu.__initStatic();const yu=r,{withStyles:mu}=i,gu=a,{color:ku}=c,_u=y;function bu(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}mu((()=>({editableHtmlCustom:{display:"inline-block",verticalAlign:"middle",margin:"4px",borderRadius:"4px",border:`1px solid ${ku.black()}`},correct:{border:`1px solid ${ku.correct()}`},incorrect:{border:`1px solid ${ku.incorrect()}`}})))(Ts("input",(e=>(t,r)=>{const{adjustedLimit:n,disabled:o,feedback:i,showCorrectAnswer:a,maxLength:s,spellCheck:u,classes:c,pluginProps:l,onChange:f}=e,h=bu([t,"access",e=>e.data,"optionalAccess",e=>e.dataset])||{};if("input"===h.component){const d=(e.choices&&h&&e.choices[h.id]||[])[0],p=a?d&&d.label:r[h.id]||"",v=s&&s[h.id],y=i&&i[h.id],m=a||"correct"===y,g=!a&&"incorrect"===y,k=e=>{const t={...r,[h.id]:e};f(t)},_=e=>{if("Enter"===e.key||13===e.keyCode)return!1};return yu.createElement(_u,{id:h.id,key:`${t.type}-input-${h.id}`,disabled:a||o,disableUnderline:!0,onChange:k,markup:p||"",charactersLimit:n?v:25,activePlugins:["languageCharacters"],pluginProps:l,languageCharactersProps:[{language:"spanish"}],spellCheck:u,width:`calc(${v}em + 42px)`,onKeyDown:_,autoWidthToolbar:!0,toolbarOpts:{minWidth:"auto",noBorder:!0,isHidden:!!bu([l,"optionalAccess",e=>e.characters,"optionalAccess",e=>e.disabled])},className:gu(c.editableHtmlCustom,{[c.correct]:m,[c.incorrect]:g})})}})));var wu=Ts("input",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("input"===o.component)return e.customMarkMarkupComponent(o.id)}));const xu=r,Au=o,{Button:Ou}=u,{InputLabel:Su}=u,{Menu:Eu}=u,{MenuItem:Tu}=u,{ArrowDropDown:Nu}=l,{ArrowDropUp:Bu}=l,{Close:zu}=l,{Check:ju}=l,{withStyles:Cu}=i,Pu=a,{color:Ku}=c,{renderMath:Fu}=h;class Iu extends xu.Component{static __initStatic(){this.propTypes={id:Au.string,value:Au.string,disabled:Au.bool,onChange:Au.func,classes:Au.object,correct:Au.bool,choices:Au.arrayOf(Au.shape({value:Au.string,label:Au.string})),showCorrectAnswer:Au.bool,singleQuery:Au.bool,correctValue:Au.string}}constructor(e){super(e),Iu.prototype.__init.call(this),Iu.prototype.__init2.call(this),Iu.prototype.__init3.call(this),Iu.prototype.__init4.call(this),Iu.prototype.__init5.call(this),this.state={anchorEl:null,highlightedOptionId:null,menuWidth:null,previewValue:null},this.hiddenRef=xu.createRef(),this.buttonRef=xu.createRef(),this.previewRef=xu.createRef(),this.elementRefs=[]}componentDidMount(){this.hiddenRef.current&&null===this.state.menuWidth&&this.setState({menuWidth:this.hiddenRef.current.clientWidth})}componentDidUpdate(e,t){const r=this.hiddenRef.current;if(!t.anchorEl&&this.state.anchorEl&&this.elementRefs.forEach((e=>{if(!e)return;const t=e.querySelector("[data-latex], [data-raw]"),r=e.querySelector("mjx-container"),n=e.querySelector('[data-math-handled="true"]');!t||n&&r||Fu(e)})),r){const e=r.clientWidth;e!==this.state.menuWidth&&(this.elementRefs.forEach((e=>{e&&Fu(e)})),Fu(r),this.setState({menuWidth:e}))}}__init(){this.handleClick=e=>this.setState({anchorEl:e.currentTarget})}__init2(){this.handleClose=()=>{const{value:e}=this.props;this.setState({anchorEl:null,previewValue:null,highlightedOptionId:null}),!e&&this.previewRef.current&&(this.previewRef.current.innerHTML="")}}__init3(){this.handleHighlight=e=>{const t={highlightedOptionId:`dropdown-option-${this.props.id}-${e}`};this.props.value||(t.previewValue=this.props.choices[e].value),this.setState(t)}}__init4(){this.handleSelect=(e,t)=>{this.props.onChange(this.props.id,e),this.handleHighlight(t),this.handleClose()}}__init5(){this.handleHover=e=>{if(this.props.value)return;const t=`dropdown-option-${this.props.id}-${e}`,r=this.state.previewValue;this.setState({highlightedOptionId:t,previewValue:r},(()=>{const t=this.elementRefs[e],r=this.previewRef.current;t&&r&&(r.innerHTML=t.innerHTML)}))}}getLabel(e,t){const r=(e||[]).find((e=>e.value===t));return r?r.label.trim():void 0}render(){const{classes:e,id:t,correct:r,disabled:n,value:o,choices:i,showCorrectAnswer:a,singleQuery:s,correctValue:u}=this.props,{anchorEl:c}=this.state,l=Boolean(c),f=`dropdown-button-${t}`,h=`dropdown-menu-${t}`,d=`dropdown-value-${t}`;let p;this.elementRefs=[],n&&void 0!==r&&(p=r||a?e.disabledCorrect:e.disabledIncorrect);const v=parseInt(t,10)+1,y=s?"Query-label":`Query-label-${v}`,m=s?"Query":`Query ${v}`;let g=null;return n&&void 0!==r&&(g=r||a?xu.createElement(ju,{className:Pu(e.correctnessIndicatorIcon,e.correctIcon)}):xu.createElement(zu,{className:Pu(e.correctnessIndicatorIcon,e.incorrectIcon)})),xu.createElement(xu.Fragment,null,xu.createElement("div",{ref:this.hiddenRef,style:{position:"absolute",visibility:"hidden",top:0,left:0},tabIndex:-1,"aria-hidden":"true"},(i||[]).map(((t,r)=>xu.createElement(Tu,{key:r,classes:{root:e.menuRoot,selected:e.selected},tabIndex:-1,"aria-hidden":"true"},xu.createElement("span",{className:e.label,dangerouslySetInnerHTML:{__html:t.label}}))))),xu.createElement(Su,{className:e.srOnly,id:y,tabIndex:-1,"aria-hidden":"true"},m),xu.createElement(Ou,{ref:this.buttonRef,style:{...this.state.menuWidth&&{minWidth:`calc(${this.state.menuWidth}px + 8px)`},borderWidth:l?"2px":"1px",transition:"border-width 0.2s ease-in-out"},"aria-controls":l?h:void 0,"aria-haspopup":"listbox","aria-expanded":l?"true":void 0,"aria-activedescendant":this.state.highlightedOptionId,onClick:this.handleClick,classes:{root:e.root,disabled:p},disabled:n,id:f,role:"combobox","aria-label":`Select an option for ${m}`,"aria-labelledby":d},g,xu.createElement("span",{id:d,ref:this.previewRef,className:e.label,dangerouslySetInnerHTML:{__html:u||(l&&this.state.previewValue?this.getLabel(i,this.state.previewValue):this.getLabel(i,o)||"")}}),l?xu.createElement(Bu,null):xu.createElement(Nu,null)),xu.createElement(Eu,{id:h,anchorEl:c,className:e.selectMenu,keepMounted:!0,open:l,onClose:this.handleClose,getContentAnchorEl:null,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},PaperProps:this.state.menuWidth?{style:{minWidth:this.state.menuWidth,padding:"4px"}}:void 0,MenuListProps:{"aria-labelledby":f,role:"listbox",disablePadding:!0}},(i||[]).map(((r,n)=>{const i=`dropdown-option-${t}-${n}`;return xu.createElement(Tu,{id:i,classes:{root:e.menuRoot,selected:e.selected},key:`${r.label}-${n}`,value:r.value,onClick:()=>this.handleSelect(r.value,n),role:"option","aria-selected":this.state.highlightedOptionId===i?"true":void 0,onMouseOver:()=>this.handleHover(n)},xu.createElement("span",{ref:e=>this.elementRefs[n]=e,className:e.label,dangerouslySetInnerHTML:{__html:r.label}}),xu.createElement("span",{className:e.selectedIndicator,dangerouslySetInnerHTML:{__html:r.value===o?" ✓":""}}))}))))}}Iu.__initStatic();var Mu=Cu((()=>({root:{color:Ku.text(),border:`1px solid ${Ku.borderGray()}`,borderRadius:"4px",justifyContent:"space-between",backgroundColor:Ku.background(),position:"relative",height:"45px",width:"fit-content",margin:"2px",textTransform:"none","& span":{paddingRight:"5px"},"& svg":{position:"absolute",right:0,top:"calc(50% - 12px)",pointerEvents:"none",color:Ku.text(),marginLeft:"5px"},"&:focus, &:focus-visible":{outline:`3px solid ${Ku.tertiary()}`,outlineOffset:"2px",borderWidth:"3px"}},disabledCorrect:{borderWidth:"2px",borderColor:Ku.correct(),color:`${Ku.text()} !important`},disabledIncorrect:{borderWidth:"2px",borderColor:Ku.incorrectWithIcon(),color:`${Ku.text()} !important`},selectMenu:{backgroundColor:Ku.background(),border:`1px solid ${Ku.correct()} !important`,"&:hover":{border:`1px solid ${Ku.text()} `,borderColor:"initial"},"&:focus":{border:`1px solid ${Ku.text()}`,borderColor:"initial"},"& .MuiList-root":{padding:0}},selected:{color:`${Ku.text()} !important`,backgroundColor:`${Ku.background()} !important`,"&:hover":{color:Ku.text(),backgroundColor:`${Ku.dropdownBackground()} !important`}},menuRoot:{color:Ku.text(),backgroundColor:Ku.background(),"&:focus, &:focus-visible":{outline:`3px solid ${Ku.tertiary()}`,outlineOffset:"-1px"},"&:focus":{color:Ku.text(),backgroundColor:Ku.background()},"&:hover":{color:Ku.text(),backgroundColor:Ku.dropdownBackground()},boxSizing:"border-box",padding:"25px",borderRadius:"4px"},label:{fontSize:"max(1rem, 14px)"},selectedIndicator:{fontSize:"max(1rem, 14px)",position:"absolute",right:"10px"},srOnly:{position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"},correctnessIndicatorIcon:{color:`${Ku.white()} !important`,position:"absolute",top:"-8px !important",left:"-8px",marginLeft:"0 !important",borderRadius:"50%",fontSize:"16px",padding:"2px"},correctIcon:{backgroundColor:Ku.correct()},incorrectIcon:{backgroundColor:Ku.incorrectWithIcon()}})))(Iu);const Ru=r;Ts("dropdown",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("dropdown"===o.component){const{choices:i,disabled:a,feedback:s,showCorrectAnswer:u}=e,c=i&&i[o.id]&&i[o.id].find((e=>e.correct)),l=u?c&&c.value:r[o.id];return Ru.createElement(Mu,{key:`${t.type}-dropdown-${o.id}`,correct:s&&s[o.id]&&"correct"===s[o.id],disabled:a||u,value:l,correctValue:u?c&&c.label:void 0,id:o.id,onChange:n,choices:i[o.id],showCorrectAnswer:u,singleQuery:1==Object.keys(i).length})}}));const Du=r,Lu=o,Ju=a,{isEqual:qu}=t,{isEmpty:Uu}=t,{withStyles:Vu}=i,{Tooltip:Wu}=u,{color:$u}=c,{Collapsible:Hu}=c,{Readable:Gu}=c,{hasText:Qu}=c,{hasMedia:Yu}=c,{PreviewPrompt:Xu}=c,{UiLayout:Zu}=c,ec=f,tc=s,{mq:rc}=d,{HorizontalKeypad:nc}=d,{updateSpans:oc}=d,ic=p,{renderMath:ac}=h;function sc(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}let uc=!1;const cc=/(\{\{\d+\}\})/gm,lc=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function fc(e=[],t){return 30*Math.floor(e.length/5)+("miscellaneous"===t?600:500)}function hc(e,t){const{responses:r,disabled:n,markup:o,printMode:i,alwaysShowCorrect:a}=e||{};if(o){if(t.showCorrect)return Object.keys(r||{}).reduce(((e,t)=>(e[t]=sc([r,"optionalAccess",e=>e[t],"optionalAccess",e=>e.answer]),e)),{});return o.split(cc).filter((e=>e)).reduce(((e,r)=>{if(r.match(cc)){const o=dc.getResponseKey(r),s=t.session.answers[`r${o}`];if(i&&!a){const t="\\ \\ ".repeat(30)+"\\embed{newLine}[] ";return{...e,[o]:`\\MathQuillMathField[r${o}]{${t.repeat(3)}}`}}return n?{...e,[o]:`\\embed{answerBlock}[r${o}]`}:{...e,[o]:`\\MathQuillMathField[r${o}]{${s&&s.value||""}}`}}return e}),{})}}class dc extends Du.Component{static __initStatic(){this.getResponseKey=e=>(e||"").replaceAll("{{","").replaceAll("}}","")}static __initStatic2(){this.propTypes={classes:Lu.object,session:Lu.object.isRequired,onSessionChange:Lu.func,model:Lu.object.isRequired}}constructor(e){super(e),dc.prototype.__init.call(this),dc.prototype.__init2.call(this),dc.prototype.__init3.call(this),dc.prototype.__init4.call(this),dc.prototype.__init5.call(this),dc.prototype.__init6.call(this),dc.prototype.__init7.call(this),dc.prototype.__init8.call(this),dc.prototype.__init9.call(this),dc.prototype.__init10.call(this),dc.prototype.__init11.call(this),dc.prototype.__init12.call(this),dc.prototype.__init13.call(this);const t={},{model:r,session:n}=e||{},{markup:o,alwaysShowCorrect:i}=r||{},{answers:a}=n||{};o&&(o||"").replace(cc,(e=>{const r=dc.getResponseKey(e),n=a&&a[`r${r}`];t[`r${r}`]={value:sc([n,"optionalAccess",e=>e.value])||""}})),this.state={session:{...e.session,answers:t},activeAnswerBlock:"",showCorrect:i||!1}}UNSAFE_componentWillMount(){const{classes:e}=this.props;if("undefined"!=typeof window){let t=ic.getInterface(2);uc||(t.registerEmbed("answerBlock",(t=>({htmlString:`<div class="${e.blockContainer}">\n <div class="${e.blockResponse}" id="${t}Index">R</div>\n <div class="${e.blockMath}">\n <span id="${t}"></span>\n </div>\n </div>`,text:()=>"text",latex:()=>`\\embed{answerBlock}[${t}]`}))),uc=!0)}}__init(){this.handleAnswerBlockDomUpdate=()=>{const{model:e,classes:t}=this.props,{session:r,showCorrect:n}=this.state,o=r.answers;this.root&&e.disabled&&!n&&Object.keys(o).forEach((r=>{const n=this.root.querySelector(`#${r}`),i=this.root.querySelector(`#${r}Index`);if(n){let a=ic.getInterface(2);const s=o[r];n.textContent=s&&s.value||"",e.view&&(n.parentElement.parentElement.classList.remove(t.correct),n.parentElement.parentElement.classList.remove(t.incorrect)),a.StaticMath(n),i.textContent="R"}})),ac(this.root)}}UNSAFE_componentWillReceiveProps(e){const{model:t}=this.props,{model:r={}}=e||{},{markup:n="",env:o={}}=t||{},{markup:i="",env:a={},alwaysShowCorrect:s=!1}=r,u=e=>e&&"evaluate"===e.mode;u(o)&&u(a)||this.setState((e=>({...e.session,showCorrect:!1}))),s&&this.setState({showCorrect:!0});const c=n.match(cc),l=i.match(cc);if(!qu(c,l)){const e={},t=this.state.session.answers;(l||[]).forEach((r=>{const n=dc.getResponseKey(r),o=t&&t[`r${n}`];e[`r${n}`]={value:sc([o,"optionalAccess",e=>e.value])||""}})),this.setState((t=>({session:{...t.session,answers:e}})),(()=>{this.props.onSessionChange(this.state.session),this.handleAnswerBlockDomUpdate()}))}}shouldComponentUpdate(e,t){const r=qu(this.props.model,e.model),n=qu(this.state,t);return!r||!n}componentDidMount(){this.handleAnswerBlockDomUpdate(),setTimeout((()=>ac(this.root)),100)}componentDidUpdate(){this.handleAnswerBlockDomUpdate()}__init2(){this.onSubFieldFocus=e=>{this.setState({activeAnswerBlock:e})}}__init3(){this.toNodeData=e=>{if(!e)return;const{type:t,value:r}=e;return"command"===t||"cursor"===t?e:"answer"===t?{type:"answer",...e}:"clear"===r?{type:"clear"}:{type:"write",value:r}}}__init4(){this.setInput=e=>{this.input=e}}__init5(){this.onClick=e=>{const t=this.toNodeData(e);"clear"===t.type?this.input.clear():"command"===t.type?Array.isArray(t.value)?t.value.forEach((e=>{this.input.cmd(e)})):this.input.cmd(t.value):"cursor"===t.type?this.input.keystroke(t.value):this.input.write(t.value),this.input.focus()}}__init6(){this.callOnSessionChange=()=>{const{onSessionChange:e}=this.props;e&&e(this.state.session)}}__init7(){this.toggleShowCorrect=e=>{this.setState({showCorrect:e},this.handleAnswerBlockDomUpdate)}}__init8(){this.subFieldChanged=(e,t)=>{oc(),e&&this.setState((r=>({session:{...r.session,answers:{...r.session.answers,[e]:{value:t}}}})),this.callOnSessionChange)}}__init9(){this.getFieldName=(e,t)=>{const{answers:r}=this.state.session;if(Object.keys(r||{}).length){return Object.keys(r).find((r=>{const n=t[r];return n&&n.id==e.id}))}}}__init10(){this.onBlur=e=>{const{relatedTarget:t,currentTarget:r}=e||{};const n=function e(t,r=0){if(!t||r>=16)return null;const n=t.offsetParent;return n?"tooltip"===n.getAttribute("role")?n:e(n,r+1):null}(t),o=n?function e(t,r=0){if(!t||r>=4)return null;const n=sc([t,"optionalAccess",e=>e.children,"optionalAccess",e=>e[0]]);return n?n.attributes&&n.attributes["data-keypad"]?n:e(n,r+1):null}(n):null;t&&r&&sc([o,"optionalAccess",e=>e.attributes,"access",e=>e["data-keypad"]])||this.setState({activeAnswerBlock:""})}}setTooltipRef(e){setTimeout((()=>{if(e&&lc){const e=document.querySelector("[role='tooltip']");if(e){e.firstChild.setAttribute("tabindex","-1")}}}),1)}__init11(){this.renderTeacherInstructions=()=>{const{model:e,classes:t}=this.props,{teacherInstructions:r,animationsDisabled:n}=e||{},o=r&&(Qu(r)||Yu(r)),i=Du.createElement(Xu,{defaultClassName:"teacher-instructions",prompt:r});return o&&Du.createElement("div",{className:t.collapsible},n?i:Du.createElement(Hu,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},i))}}__init12(){this.renderRationale=()=>{const{model:e,classes:t}=this.props,{rationale:r,animationsDisabled:n}=e||{},o=Du.createElement(Xu,{prompt:r});return r&&(Qu(r)||Yu(r))&&Du.createElement("div",{className:t.collapsible},n?o:Du.createElement(Hu,{labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},o))}}__init13(){this.renderPlayerContent=()=>{const{model:e,classes:t}=this.props,{activeAnswerBlock:r,showCorrect:n,session:o}=this.state,{correctness:i,disabled:a,view:s,responses:u,equationEditor:c,customKeys:l,feedback:f,env:{mode:h}={},printMode:d,alwaysShowCorrect:p}=e||{},v=Uu(u),y=function(e=[]){return e.map((e=>({name:e,latex:e,write:e,label:e})))}(l),m=hc(e,this.state)||"",g=d&&!p;return Du.createElement("div",{className:t.inputAndKeypadContainer},Du.createElement(wu,{disabled:a,markup:e.markup,value:{},customMarkMarkupComponent:e=>{const u="evaluate"===h&&f&&f[e],l=Du.createElement(rc.Static,{className:t.static,ref:e=>{this.mqStatic=e||this.mqStatic},latex:m[e],onSubFieldChange:this.subFieldChanged,getFieldName:this.getFieldName,setInput:this.setInput,onSubFieldFocus:this.onSubFieldFocus,onBlur:this.onBlur});return Du.createElement("div",{className:Ju(t.expression,{[t.incorrect]:!v&&!u&&!n,[t.correct]:!v&&(u||n),[t.showCorrectness]:!v&&a&&i&&!s,[t.correctAnswerShown]:n})},Du.createElement(Wu,{ref:e=>this.setTooltipRef(e),enterTouchDelay:0,interactive:!0,open:r===`r${e}`,classes:{tooltip:t.keypadTooltip,popper:t.keypadTooltipPopper},title:Object.keys(o.answers).map((e=>e===r&&!(n||a)&&Du.createElement("div",{"data-keypad":!0,key:e,className:t.responseContainer,style:{width:fc(y,c)}},Du.createElement(nc,{additionalKeys:y,mode:c||6,onClick:this.onClick}))||null))},g?Du.createElement("div",{className:t.printContainer},l):l))}}))}}render(){const{model:e,classes:t}=this.props,{showCorrect:r}=this.state,{prompt:n,env:{mode:o,role:i}={},extraCSSRules:a,correctness:s,responses:u,language:c,showNote:l,note:f}=e||{},h=!Uu(u)&&s&&"correct"!==s.correctness,d=(r||"view"===o&&"instructor"===i)&&l&&f;return Du.createElement(Zu,{extraCSSRules:a,className:t.mainContainer,ref:e=>{const t=tc.findDOMNode(e);this.root=t||this.root}},Du.createElement("div",{className:t.main},"gather"===o&&Du.createElement("h2",{className:t.srOnly},"Math Equation Response Question"),Du.createElement("div",{className:t.main},h&&Du.createElement(ec,{language:c,className:t.toggle,show:!0,toggled:r,onToggle:this.toggleShowCorrect})),this.renderTeacherInstructions(),n&&Du.createElement("div",{className:t.promptContainer},Du.createElement(Xu,{prompt:n})),Du.createElement(Gu,{false:!0},this.renderPlayerContent()),d&&Du.createElement("div",{className:Ju(t.note,"note"),dangerouslySetInnerHTML:{__html:f}}),this.renderRationale()))}}dc.__initStatic(),dc.__initStatic2();var pc=Vu((e=>({mainContainer:{color:$u.text(),backgroundColor:$u.background(),display:"inline-block"},tooltip:{background:`${$u.primaryLight()} !important`,color:$u.text(),padding:2*e.spacing.unit,border:`1px solid ${$u.secondary()}`,fontSize:"16px","& :not(.MathJax) > table tr":{"&:nth-child(2n)":{backgroundColor:"unset !important"}}},tooltipPopper:{opacity:1},keypadTooltip:{fontSize:"initial",background:"transparent",width:"600px",marginTop:0,paddingTop:0},keypadTooltipPopper:{background:"transparent",width:"650px",opacity:1},promptContainer:{marginBottom:2*e.spacing.unit},main:{width:"100%",position:"relative",backgroundColor:$u.background(),color:$u.text()},title:{fontSize:"1.1rem",display:"block",marginTop:2*e.spacing.unit,marginBottom:e.spacing.unit},collapsible:{marginBottom:2*e.spacing.unit},responseContainer:{zIndex:10,minWidth:"400px",marginTop:2*e.spacing.unit},expression:{maxWidth:"fit-content","& > .mq-math-mode":{"& > .mq-root-block":{"& > .mq-editable-field":{minWidth:"10px",padding:e.spacing.unit/4}},"& sup":{top:0}}},static:{"& > .mq-root-block":{"& > .mq-editable-field":{borderColor:$u.text()}}},inputAndKeypadContainer:{position:"relative","& > div > div":{display:"flex",alignItems:"baseline",flexWrap:"wrap"},"& .mq-overarrow-inner":{border:"none !important",padding:"0 !important"},"& .mq-overarrow-inner-right":{display:"none !important"},"& .mq-overarrow-inner-left":{display:"none !important"},"& .mq-overarrow.mq-arrow-both":{minWidth:"1.23em","& *":{lineHeight:"1 !important"},"&:before":{top:"-0.4em",left:"-1px"},"&:after":{top:"-2.4em",right:"-1px"},"&.mq-empty:after":{top:"-0.45em"}},"& .mq-overarrow.mq-arrow-right":{"&:before":{top:"-0.4em",right:"-1px"}},"& .mq-longdiv-inner":{borderTop:"1px solid !important",paddingTop:"1.5px !important"},"& .mq-parallelogram":{lineHeight:.85}},showCorrectness:{border:"2px solid"},correctAnswerShown:{padding:e.spacing.unit,letterSpacing:"0.5px"},correct:{borderColor:`${$u.correct()} !important`},incorrect:{borderColor:`${$u.incorrect()} !important`},blockContainer:{margin:`${e.spacing.unit}px !important`,display:"inline-flex",border:"2px solid grey !important"},blockResponse:{flex:2,color:"grey",background:e.palette.grey.A100,fontSize:"0.8rem !important",padding:e.spacing.unit/2+"px !important",display:"flex",alignItems:"center",justifyContent:"center",borderRight:`2px solid ${$u.disabled()} !important`},toggle:{color:$u.text(),marginBottom:2*e.spacing.unit},blockMath:{color:$u.text(),backgroundColor:$u.background(),padding:e.spacing.unit/2+"px !important",display:"flex",alignItems:"center",justifyContent:"center",flex:8,"& > .mq-math-mode":{"& > .mq-hasCursor":{"& > .mq-cursor":{display:"none"}}}},printContainer:{marginBottom:e.spacing.unit,pointerEvents:"none"},srOnly:{position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"},note:{marginBottom:2*e.spacing.unit}})))(dc);const vc=r,yc=s,{debounce:mc}=t,gc=e,{renderMath:kc}=h,_c=gc("pie-element:math-templated:print");class bc extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._rerender=mc((()=>{if(this._model&&this._session){const e=((e,t)=>{const r="instructor"===t.role;return e.prompt=!1!==e.promptEnabled?e.prompt:void 0,e.teacherInstructions=r&&!1!==e.teacherInstructionsEnabled?e.teacherInstructions:void 0,e.rationale=r&&!1!==e.rationaleEnabled?e.rationale:void 0,e.showTeacherInstructions=r,e.alwaysShowCorrect=r,e.printMode=!0,e.feedback=void 0,e.markup=e.markup||"{{0}}",{...e,disabled:!0,env:{mode:r?"evaluate":e.mode,role:t.role}}})(this._model,this._options),t=this._options&&vc.createElement(pc,{model:e,session:{}});yc.render(t,this,(()=>{_c("render complete - render math"),kc(this)}))}else _c("skip")}),50,{leading:!1,trailing:!0})}set options(e){this._options=e}set model(e){this._model=e,this._rerender()}connectedCallback(){}}export{bc as default};
|