!function(e){function t(t){for(var n,o,i=t[0],a=t[1],s=0,u=[];s(.*?)<\\/"+i+">|<"+i+">|<"+i+"\\s*\\/>)"]=n[i];return g(e,r)}function g(e,t){var n=[e],r=!1;for(var o in t){var i=new RegExp(o),s=!1;for(var l in n){var u=n[l];if("string"==typeof u){var f=u.match(i);if(f){s=!0;var d=f.slice(2),p=u.substr(0,f.index),m=u.substr(f.index+f[0].length),h=void 0;"object"===(void 0===(h=t[o]instanceof Function?t[o].apply(null,d):t[o])?"undefined":(0,a.default)(h))&&(r=!0),n.splice(l,1),""!==m&&n.splice(l,0,m),"string"==typeof h&&""===h||n.splice(l,0,h),""!==p&&n.splice(l,0,p)}}}s||"%\\(count\\)s"!==o&&console.log("Could not find "+i+" in "+e)}return r?c.default.createElement.apply(c.default,["span",null].concat(n)):n.join("")}function v(){return new u.default(function(e,t){(0,s.default)({method:"GET",url:m+"languages.json"},function(n,r,o){n||r.status<200||r.status>=300?t({err:n,response:r}):e(JSON.parse(o))})})}function y(e){return new u.default(function(t,n){(0,s.default)({method:"GET",url:e},function(e,o,a){e||o.status<200||o.status>=300?n({err:e,response:o}):t(function(e){var t={},n=!0,o=!1,a=void 0;try{for(var s,l=(0,r.default)((0,i.default)(e));!(n=(s=l.next()).done);n=!0){var u=s.value,c=u.split("|",2);if(2===c.length){var f=t[c[0]];void 0===f&&(f={},t[c[0]]=f),f[c[1]]=e[u]}else t[u]=e[u]}}catch(e){o=!0,a=e}finally{try{!n&&l.return&&l.return()}finally{if(o)throw a}}return t}(JSON.parse(a)))})})}l.default.setSeparator("|"),l.default.setFallbackLocale("en")},function(e,t,n){"use strict";var r=i(n(1058)),o=i(n(389));function i(e){return e&&e.__esModule?e:{default:e}}e.exports.loadSkin=function(e){r.default.load(e)},e.exports.resetSkin=function(){r.default.reset()},e.exports.getComponent=function(e){return r.default.getComponent(e)},e.exports.setFetch=function(e){o.default.setFetch(e)}},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(223));t.default=function(){function e(e,t){for(var n=0;n>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?w(e)+t:t}function x(){return!0}function R(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function k(e,t){return I(e,t,0)}function N(e,t){return I(e,t,t)}function I(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}var O=0,A=1,M=2,P="function"==typeof Symbol&&Symbol.iterator,L="@@iterator",F=P||L;function U(e){this.next=e}function j(e,t,n,r){var o=0===e?t:1===e?n:[t,n];return r?r.value=o:r={value:o,done:!1},r}function B(){return{value:void 0,done:!0}}function G(e){return!!H(e)}function q(e){return e&&"function"==typeof e.next}function V(e){var t=H(e);return t&&t.call(e)}function H(e){var t=e&&(P&&e[P]||e[L]);if("function"==typeof t)return t}function Y(e){return e&&"number"==typeof e.length}function z(e){return null===e||void 0===e?ie():a(e)?e.toSeq():function(e){var t=le(e)||"object"==typeof e&&new te(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}(e)}function W(e){return null===e||void 0===e?ie().toKeyedSeq():a(e)?s(e)?e.toSeq():e.fromEntrySeq():ae(e)}function K(e){return null===e||void 0===e?ie():a(e)?s(e)?e.entrySeq():e.toIndexedSeq():se(e)}function $(e){return(null===e||void 0===e?ie():a(e)?s(e)?e.entrySeq():e:se(e)).toSetSeq()}U.prototype.toString=function(){return"[Iterator]"},U.KEYS=O,U.VALUES=A,U.ENTRIES=M,U.prototype.inspect=U.prototype.toSource=function(){return this.toString()},U.prototype[F]=function(){return this},t(z,n),z.of=function(){return z(arguments)},z.prototype.toSeq=function(){return this},z.prototype.toString=function(){return this.__toString("Seq {","}")},z.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},z.prototype.__iterate=function(e,t){return ue(this,e,t,!0)},z.prototype.__iterator=function(e,t){return ce(this,e,t,!0)},t(W,z),W.prototype.toKeyedSeq=function(){return this},t(K,z),K.of=function(){return K(arguments)},K.prototype.toIndexedSeq=function(){return this},K.prototype.toString=function(){return this.__toString("Seq [","]")},K.prototype.__iterate=function(e,t){return ue(this,e,t,!1)},K.prototype.__iterator=function(e,t){return ce(this,e,t,!1)},t($,z),$.of=function(){return $(arguments)},$.prototype.toSetSeq=function(){return this},z.isSeq=oe,z.Keyed=W,z.Set=$,z.Indexed=K;var Q,X,J,Z="@@__IMMUTABLE_SEQ__@@";function ee(e){this._array=e,this.size=e.length}function te(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function ne(e){this._iterable=e,this.size=e.length||e.size}function re(e){this._iterator=e,this._iteratorCache=[]}function oe(e){return!(!e||!e[Z])}function ie(){return Q||(Q=new ee([]))}function ae(e){var t=Array.isArray(e)?new ee(e).fromEntrySeq():q(e)?new re(e).fromEntrySeq():G(e)?new ne(e).fromEntrySeq():"object"==typeof e?new te(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function se(e){var t=le(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function le(e){return Y(e)?new ee(e):q(e)?new re(e):G(e)?new ne(e):void 0}function ue(e,t,n,r){var o=e._cache;if(o){for(var i=o.length-1,a=0;a<=i;a++){var s=o[n?i-a:a];if(!1===t(s[1],r?s[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function ce(e,t,n,r){var o=e._cache;if(o){var i=o.length-1,a=0;return new U(function(){var e=o[n?i-a:a];return a++>i?{value:void 0,done:!0}:j(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function fe(e,t){return t?function e(t,n,r,o){return Array.isArray(n)?t.call(o,r,K(n).map(function(r,o){return e(t,r,o,n)})):pe(n)?t.call(o,r,W(n).map(function(r,o){return e(t,r,o,n)})):n}(t,e,"",{"":e}):de(e)}function de(e){return Array.isArray(e)?K(e).map(de).toList():pe(e)?W(e).map(de).toMap():e}function pe(e){return e&&(e.constructor===Object||void 0===e.constructor)}function me(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===t||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function he(e,t){if(e===t)return!0;if(!a(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||s(e)!==s(t)||l(e)!==l(t)||c(e)!==c(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!u(e);if(c(e)){var r=e.entries();return t.every(function(e,t){var o=r.next().value;return o&&me(o[1],e)&&(n||me(o[0],t))})&&r.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 f=!0,d=t.__iterate(function(t,r){if(n?!e.has(t):o?!me(t,e.get(r,v)):!me(e.get(r,v),t))return f=!1,!1});return f&&e.size===d}function _e(e,t){if(!(this instanceof _e))return new _e(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(X)return X;X=this}}function ge(e,t){if(!e)throw new Error(t)}function ve(e,t,n){if(!(this instanceof ve))return new ve(e,t,n);if(ge(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),tr?{value:void 0,done:!0}:j(e,o,n[t?r-o++:o++])})},t(te,W),te.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},te.prototype.has=function(e){return this._object.hasOwnProperty(e)},te.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,o=r.length-1,i=0;i<=o;i++){var a=r[t?o-i:i];if(!1===e(n[a],a,this))return i+1}return i},te.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,o=r.length-1,i=0;return new U(function(){var a=r[t?o-i:i];return i++>o?{value:void 0,done:!0}:j(e,a,n[a])})},te.prototype[m]=!0,t(ne,K),ne.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=V(n),o=0;if(q(r))for(var i;!(i=r.next()).done&&!1!==e(i.value,o++,this););return o},ne.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=V(n);if(!q(r))return new U(B);var o=0;return new U(function(){var t=r.next();return t.done?t:j(e,o++,t.value)})},t(re,K),re.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n,r=this._iterator,o=this._iteratorCache,i=0;i=r.length){var t=n.next();if(t.done)return t;r[o]=t.value}return j(e,o,r[o++])})},t(_e,K),_e.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},_e.prototype.get=function(e,t){return this.has(e)?this._value:t},_e.prototype.includes=function(e){return me(this._value,e)},_e.prototype.slice=function(e,t){var n=this.size;return R(e,t,n)?this:new _e(this._value,N(t,n)-k(e,n))},_e.prototype.reverse=function(){return this},_e.prototype.indexOf=function(e){return me(this._value,e)?0:-1},_e.prototype.lastIndexOf=function(e){return me(this._value,e)?this.size:-1},_e.prototype.__iterate=function(e,t){for(var n=0;n1?" by "+this._step:"")+" ]"},ve.prototype.get=function(e,t){return this.has(e)?this._start+T(this,e)*this._step:t},ve.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t=0&&nn?{value:void 0,done:!0}:j(e,i++,a)})},ve.prototype.equals=function(e){return e instanceof ve?this._start===e._start&&this._end===e._end&&this._step===e._step:he(this,e)},t(ye,n),t(be,ye),t(Ee,ye),t(Ce,ye),ye.Keyed=be,ye.Indexed=Ee,ye.Set=Ce;var Se="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var n=65535&(e|=0),r=65535&(t|=0);return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0};function De(e){return e>>>1&1073741824|3221225471&e}function we(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)n^=e/=4294967295;return De(n)}if("string"===t)return e.length>Ae?function(e){var t=Le[e];return void 0===t&&(t=Te(e),Pe===Me&&(Pe=0,Le={}),Pe++,Le[e]=t),t}(e):Te(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return function(e){var t;if(Ne&&void 0!==(t=xe.get(e)))return t;if(void 0!==(t=e[Oe]))return t;if(!ke){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Oe]))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=++Ie,1073741824&Ie&&(Ie=0),Ne)xe.set(e,t);else{if(void 0!==Re&&!1===Re(e))throw new Error("Non-extensible objects are not allowed as keys.");if(ke)Object.defineProperty(e,Oe,{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[Oe]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[Oe]=t}}return t}(e);if("function"==typeof e.toString)return Te(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function Te(e){for(var t=0,n=0;n>>n)&g,s=(0===n?r:r>>>n)&g,l=a===s?[nt(e,t,n+h,r,o)]:(i=new We(t,r,o),a>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function lt(e,t,n,r){var o=r?e:D(e);return o[t]=n,o}qe[Ge]=!0,qe.delete=qe.remove,qe.removeIn=qe.deleteIn,Ve.prototype.get=function(e,t,n,r){for(var o=this.entries,i=0,a=o.length;i=ut)return function(e,t,n,r){e||(e=new S);for(var o=new We(e,we(n),[n,r]),i=0;i>>e)&g),i=this.bitmap;return 0==(i&o)?r:this.nodes[st(i&o-1)].get(e+h,t,n,r)},He.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=we(r));var s=(0===t?n:n>>>t)&g,l=1<=ct)return function(e,t,n,r,o){for(var i=0,a=new Array(_),s=0;0!==n;s++,n>>>=1)a[s]=1&n?t[i++]:void 0;return a[r]=o,new Ye(e,i+1,a)}(e,d,u,s,m);if(c&&!m&&2===d.length&&tt(d[1^f]))return d[1^f];if(c&&m&&1===d.length&&tt(m))return m;var y=e&&e===this.ownerID,b=c?m?u:u^l:u|l,E=c?m?lt(d,f,m,y):function(e,t,n){var r=e.length-1;if(n&&t===r)return e.pop(),e;for(var o=new Array(r),i=0,a=0;a>>e)&g,i=this.nodes[o];return i?i.get(e+h,t,n,r):r},Ye.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=we(r));var s=(0===t?n:n>>>t)&g,l=o===v,u=this.nodes,c=u[s];if(l&&!c)return this;var f=et(c,e,t+h,n,r,o,i,a);if(f===c)return this;var d=this.count;if(c){if(!f&&--d0&&r<_?Et(0,r,h,null,new _t(n.toArray())):t.withMutations(function(e){e.setSize(r),n.forEach(function(t,n){return e.set(n,t)})}))}function pt(e){return!(!e||!e[mt])}t(dt,Ee),dt.of=function(){return this(arguments)},dt.prototype.toString=function(){return this.__toString("List [","]")},dt.prototype.get=function(e,t){if((e=T(this,e))>=0&&e=e.size||t<0)return e.withMutations(function(e){t<0?Tt(e,t).set(0,n):Tt(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,o=e._root,i=E(b);return t>=Rt(e._capacity)?r=St(r,e.__ownerID,0,t,n,i):o=St(o,e.__ownerID,e._level,t,n,i),i.value?e.__ownerID?(e._root=o,e._tail=r,e.__hash=void 0,e.__altered=!0,e):Et(e._origin,e._capacity,e._level,o,r):e}(this,e,t)},dt.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},dt.prototype.insert=function(e,t){return this.splice(e,0,t)},dt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=h,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Ct()},dt.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations(function(n){Tt(n,0,t+e.length);for(var r=0;r>>t&g;if(r>=this.array.length)return new _t([],e);var o,i=0===r;if(t>0){var a=this.array[r];if((o=a&&a.removeBefore(e,t-h,n))===a&&i)return this}if(i&&!o)return this;var s=Dt(this,e);if(!i)for(var l=0;l>>t&g;if(o>=this.array.length)return this;if(t>0){var i=this.array[o];if((r=i&&i.removeAfter(e,t-h,n))===i&&o===this.array.length-1)return this}var a=Dt(this,e);return a.array.splice(o+1),r&&(a.array[o]=r),a};var gt,vt,yt={};function bt(e,t){var n=e._origin,r=e._capacity,o=Rt(r),i=e._tail;return a(e._root,e._level,0);function a(e,s,l){return 0===s?function(e,a){var s=a===o?i&&i.array:e&&e.array,l=a>n?0:n-a,u=r-a;return u>_&&(u=_),function(){if(l===u)return yt;var e=t?--u:l++;return s&&s[e]}}(e,l):function(e,o,i){var s,l=e&&e.array,u=i>n?0:n-i>>o,c=1+(r-i>>o);return c>_&&(c=_),function(){for(;;){if(s){var e=s();if(e!==yt)return e;s=null}if(u===c)return yt;var n=t?--c:u++;s=a(l&&l[n],o-h,i+(n<>>n&g,l=e&&s0){var u=e&&e.array[s],c=St(u,t,n-h,r,o,i);return c===u?e:((a=Dt(e,t)).array[s]=c,a)}return l&&e.array[s]===o?e:(C(i),a=Dt(e,t),void 0===o&&s===a.array.length-1?a.array.pop():a.array[s]=o,a)}function Dt(e,t){return t&&e&&t===e.ownerID?e:new _t(e?e.array.slice():[],t)}function wt(e,t){if(t>=Rt(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&g],r-=h;return n}}function Tt(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new S,o=e._origin,i=e._capacity,a=o+t,s=void 0===n?i:n<0?i+n:o+n;if(a===o&&s===i)return e;if(a>=s)return e.clear();for(var l=e._level,u=e._root,c=0;a+c<0;)u=new _t(u&&u.array.length?[void 0,u]:[],r),c+=1<<(l+=h);c&&(a+=c,o+=c,s+=c,i+=c);for(var f=Rt(i),d=Rt(s);d>=1<f?new _t([],r):p;if(p&&d>f&&ah;v-=h){var y=f>>>v&g;_=_.array[y]=Dt(_.array[y],r)}_.array[f>>>h&g]=p}if(s=d)a-=d,s-=d,l=h,u=null,m=m&&m.removeBefore(r,0,a);else if(a>o||d>>l&g;if(b!==d>>>l&g)break;b&&(c+=(1<o&&(u=u.removeBefore(r,l,a-c)),u&&di&&(i=u.size),a(l)||(u=u.map(function(e){return fe(e)})),r.push(u)}return i>e.size&&(e=e.setSize(i)),at(e,t,r)}function Rt(e){return e<_?0:e-1>>>h<=_&&a.size>=2*i.size?(o=a.filter(function(e,t){return void 0!==e&&s!==t}),r=o.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=o.__ownerID=e.__ownerID)):(r=i.remove(t),o=s===a.size-1?a.pop():a.set(s,void 0))}else if(l){if(n===a.get(s)[1])return e;r=i,o=a.set(s,[t,n])}else r=i.set(t,a.size),o=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=o,e.__hash=void 0,e):It(r,o)}function Mt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function Pt(e){this._iter=e,this.size=e.size}function Lt(e){this._iter=e,this.size=e.size}function Ft(e){this._iter=e,this.size=e.size}function Ut(e){var t=Zt(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=en,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===M){var r=e.__iterator(t,n);return new U(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===A?O:A,n)},t}function jt(e,t,n){var r=Zt(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,o){var i=e.get(r,v);return i===v?o:t.call(n,i,r,e)},r.__iterateUncached=function(r,o){var i=this;return e.__iterate(function(e,o,a){return!1!==r(t.call(n,e,o,a),o,i)},o)},r.__iteratorUncached=function(r,o){var i=e.__iterator(M,o);return new U(function(){var o=i.next();if(o.done)return o;var a=o.value,s=a[0];return j(r,s,t.call(n,a[1],s,e),o)})},r}function Bt(e,t){var n=Zt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=Ut(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=en,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function Gt(e,t,n,r){var o=Zt(e);return r&&(o.has=function(r){var o=e.get(r,v);return o!==v&&!!t.call(n,o,r,e)},o.get=function(r,o){var i=e.get(r,v);return i!==v&&t.call(n,i,r,e)?i:o}),o.__iterateUncached=function(o,i){var a=this,s=0;return e.__iterate(function(e,i,l){if(t.call(n,e,i,l))return s++,o(e,r?i:s-1,a)},i),s},o.__iteratorUncached=function(o,i){var a=e.__iterator(M,i),s=0;return new U(function(){for(;;){var i=a.next();if(i.done)return i;var l=i.value,u=l[0],c=l[1];if(t.call(n,c,u,e))return j(o,r?u:s++,c,i)}})},o}function qt(e,t,n,r){var o=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n|=0),R(t,n,o))return e;var i=k(t,o),a=N(n,o);if(i!=i||a!=a)return qt(e.toSeq().cacheResult(),t,n,r);var s,l=a-i;l==l&&(s=l<0?0:l);var u=Zt(e);return u.size=0===s?s:e.size&&s||void 0,!r&&oe(e)&&s>=0&&(u.get=function(t,n){return(t=T(this,t))>=0&&ts)return{value:void 0,done:!0};var e=o.next();return r||t===A?e:j(t,l-1,t===O?void 0:e.value[1],e)})},u}function Vt(e,t,n,r){var o=Zt(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var s=!0,l=0;return e.__iterate(function(e,i,u){if(!s||!(s=t.call(n,e,i,u)))return l++,o(e,r?i:l-1,a)}),l},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var s=e.__iterator(M,i),l=!0,u=0;return new U(function(){var e,i,c;do{if((e=s.next()).done)return r||o===A?e:j(o,u++,o===O?void 0:e.value[1],e);var f=e.value;i=f[0],c=f[1],l&&(l=t.call(n,c,i,a))}while(l);return o===M?e:j(o,i,c,e)})},o}function Ht(e,t,n){var r=Zt(e);return r.__iterateUncached=function(r,o){var i=0,s=!1;return function e(l,u){var c=this;l.__iterate(function(o,l){return(!t||u0}function Kt(e,t,r){var o=Zt(e);return o.size=new ee(r).map(function(e){return e.size}).min(),o.__iterate=function(e,t){for(var n,r=this.__iterator(A,t),o=0;!(n=r.next()).done&&!1!==e(n.value,o++,this););return o},o.__iteratorUncached=function(e,o){var i=r.map(function(e){return e=n(e),V(o?e.reverse():e)}),a=0,s=!1;return new U(function(){var n;return s||(n=i.map(function(e){return e.next()}),s=n.some(function(e){return e.done})),s?{value:void 0,done:!0}:j(e,a++,t.apply(null,n.map(function(e){return e.value})))})},o}function $t(e,t){return oe(e)?t:e.constructor(t)}function Qt(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Xt(e){return Fe(e.size),w(e)}function Jt(e){return s(e)?r:l(e)?o:i}function Zt(e){return Object.create((s(e)?W:l(e)?K:$).prototype)}function en(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):z.prototype.cacheResult.call(this)}function tn(e,t){return e>t?1:e=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):xn(e,t)},Cn.prototype.pushAll=function(e){if(0===(e=o(e)).size)return this;Fe(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):xn(t,n)},Cn.prototype.pop=function(){return this.slice(1)},Cn.prototype.unshift=function(){return this.push.apply(this,arguments)},Cn.prototype.unshiftAll=function(e){return this.pushAll(e)},Cn.prototype.shift=function(){return this.pop.apply(this,arguments)},Cn.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):Rn()},Cn.prototype.slice=function(e,t){if(R(e,t,this.size))return this;var n=k(e,this.size),r=N(t,this.size);if(r!==this.size)return Ee.prototype.slice.call(this,e,t);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):xn(o,i)},Cn.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?xn(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Cn.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},Cn.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new U(function(){if(r){var t=r.value;return r=r.next,j(e,n++,t)}return{value:void 0,done:!0}})},Cn.isStack=Sn;var Dn,wn="@@__IMMUTABLE_STACK__@@",Tn=Cn.prototype;function xn(e,t,n,r){var o=Object.create(Tn);return o.size=e,o._head=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function Rn(){return Dn||(Dn=xn(0))}function kn(e,t){var n=function(n){e.prototype[n]=t[n]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}Tn[wn]=!0,Tn.withMutations=qe.withMutations,Tn.asMutable=qe.asMutable,Tn.asImmutable=qe.asImmutable,Tn.wasAltered=qe.wasAltered,n.Iterator=U,kn(n,{toArray:function(){Fe(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new Pt(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new Mt(this,!0)},toMap:function(){return Ue(this.toKeyedSeq())},toObject:function(){Fe(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return kt(this.toKeyedSeq())},toOrderedSet:function(){return _n(s(this)?this.valueSeq():this)},toSet:function(){return ln(s(this)?this.valueSeq():this)},toSetSeq:function(){return new Lt(this)},toSeq:function(){return l(this)?this.toIndexedSeq():s(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Cn(s(this)?this.valueSeq():this)},toList:function(){return dt(s(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){var t=e.call(arguments,0);return $t(this,function(e,t){var n=s(e),o=[e].concat(t).map(function(e){return a(e)?n&&(e=r(e)):e=n?ae(e):se(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===o.length)return e;if(1===o.length){var i=o[0];if(i===e||n&&s(i)||l(e)&&l(i))return i}var u=new ee(o);return n?u=u.toKeyedSeq():l(e)||(u=u.toSetSeq()),(u=u.flatten(!0)).size=o.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),u}(this,t))},includes:function(e){return this.some(function(t){return me(t,e)})},entries:function(){return this.__iterator(M)},every:function(e,t){Fe(this.size);var n=!0;return this.__iterate(function(r,o,i){if(!e.call(t,r,o,i))return n=!1,!1}),n},filter:function(e,t){return $t(this,Gt(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},findEntry:function(e,t){var n;return this.__iterate(function(r,o,i){if(e.call(t,r,o,i))return n=[o,r],!1}),n},findLastEntry:function(e,t){return this.toSeq().reverse().findEntry(e,t)},forEach:function(e,t){return Fe(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Fe(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(O)},map:function(e,t){return $t(this,jt(this,e,t))},reduce:function(e,t,n){var r,o;return Fe(this.size),arguments.length<2?o=!0:r=t,this.__iterate(function(t,i,a){o?(o=!1,r=t):r=e.call(n,r,t,i,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return $t(this,Bt(this,!0))},slice:function(e,t){return $t(this,qt(this,e,t,!0))},some:function(e,t){return!this.every(Mn(e),t)},sort:function(e){return $t(this,Yt(this,e))},values:function(){return this.__iterator(A)},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 w(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,n){var r=Ue().asMutable();return e.__iterate(function(o,i){r.update(t.call(n,o,i,e),0,function(e){return e+1})}),r.asImmutable()}(this,e,t)},equals:function(e){return he(this,e)},entrySeq:function(){var e=this;if(e._cache)return new ee(e._cache);var t=e.toSeq().map(An).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Mn(e),t)},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},first:function(){return this.find(x)},flatMap:function(e,t){return $t(this,function(e,t,n){var r=Jt(e);return e.toSeq().map(function(o,i){return r(t.call(n,o,i,e))}).flatten(!0)}(this,e,t))},flatten:function(e){return $t(this,Ht(this,e,!0))},fromEntrySeq:function(){return new Ft(this)},get:function(e,t){return this.find(function(t,n){return me(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,o=nn(e);!(n=o.next()).done;){var i=n.value;if((r=r&&r.get?r.get(i,v):v)===v)return t}return r},groupBy:function(e,t){return function(e,t,n){var r=s(e),o=(c(e)?kt():Ue()).asMutable();e.__iterate(function(i,a){o.update(t.call(n,i,a,e),function(e){return(e=e||[]).push(r?[a,i]:i),e})});var i=Jt(e);return o.map(function(t){return $t(e,i(t))})}(this,e,t)},has:function(e){return this.get(e,v)!==v},hasIn:function(e){return this.getIn(e,v)!==v},isSubset:function(e){return e="function"==typeof e.includes?e:n(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:n(e)).isSubset(this)},keySeq:function(){return this.toSeq().map(On).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},max:function(e){return zt(this,e)},maxBy:function(e,t){return zt(this,t,e)},min:function(e){return zt(this,e?Pn(e):Un)},minBy:function(e,t){return zt(this,t?Pn(t):Un,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return $t(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return $t(this,Vt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Mn(e),t)},sortBy:function(e,t){return $t(this,Yt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return $t(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return $t(this,function(e,t,n){var r=Zt(e);return r.__iterateUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterate(r,o);var a=0;return e.__iterate(function(e,o,s){return t.call(n,e,o,s)&&++a&&r(e,o,i)}),a},r.__iteratorUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterator(r,o);var a=e.__iterator(M,o),s=!0;return new U(function(){if(!s)return{value:void 0,done:!0};var e=a.next();if(e.done)return e;var o=e.value,l=o[0],u=o[1];return t.call(n,u,l,i)?r===M?e:j(r,l,u,e):(s=!1,{value:void 0,done:!0})})},r}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Mn(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(e){if(e.size===1/0)return 0;var t=c(e),n=s(e),r=t?1:0;return function(e,t){return t=Se(t,3432918353),t=Se(t<<15|t>>>-15,461845907),t=Se(t<<13|t>>>-13,5),t=Se((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=De((t=Se(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(n?t?function(e,t){r=31*r+jn(we(e),we(t))|0}:function(e,t){r=r+jn(we(e),we(t))|0}:t?function(e){r=31*r+we(e)|0}:function(e){r=r+we(e)|0}),r)}(this))}});var Nn=n.prototype;Nn[f]=!0,Nn[F]=Nn.values,Nn.__toJS=Nn.toArray,Nn.__toStringMapper=Ln,Nn.inspect=Nn.toSource=function(){return this.toString()},Nn.chain=Nn.flatMap,Nn.contains=Nn.includes,function(){try{Object.defineProperty(Nn,"length",{get:function(){if(!n.noLengthWarning){var e;try{throw new Error}catch(t){e=t.stack}if(-1===e.indexOf("_wrapObject"))return console&&console.warn&&console.warn("iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. "+e),this.size}}})}catch(e){}}(),kn(r,{flip:function(){return $t(this,Ut(this))},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLastKey:function(e,t){return this.toSeq().reverse().findKey(e,t)},keyOf:function(e){return this.findKey(function(t){return me(t,e)})},lastKeyOf:function(e){return this.findLastKey(function(t){return me(t,e)})},mapEntries:function(e,t){var n=this,r=0;return $t(this,this.toSeq().map(function(o,i){return e.call(t,[i,o],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return $t(this,this.toSeq().flip().map(function(r,o){return e.call(t,r,o,n)}).flip())}});var In=r.prototype;function On(e,t){return t}function An(e,t){return[t,e]}function Mn(e){return function(){return!e.apply(this,arguments)}}function Pn(e){return function(){return-e.apply(this,arguments)}}function Ln(e){return"string"==typeof e?JSON.stringify(e):e}function Fn(){return D(arguments)}function Un(e,t){return et?-1:0}function jn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}return In[d]=!0,In[F]=Nn.entries,In.__toJS=Nn.toObject,In.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+Ln(e)},kn(o,{toKeyedSeq:function(){return new Mt(this,!1)},filter:function(e,t){return $t(this,Gt(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.toKeyedSeq().keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.toKeyedSeq().reverse().keyOf(e);return void 0===t?-1:t},reverse:function(){return $t(this,Bt(this,!1))},slice:function(e,t){return $t(this,qt(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=k(e,e<0?this.count():this.size);var r=this.slice(0,e);return $t(this,1===n?r:r.concat(D(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.toKeyedSeq().findLastKey(e,t);return void 0===n?-1:n},first:function(){return this.get(0)},flatten:function(e){return $t(this,Ht(this,e,!1))},get:function(e,t){return(e=T(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=T(this,e))>=0&&(void 0!==this.size?this.size===1/0||e0;)p(e)}function p(e){var t=e.shift();if("function"!=typeof t)t._settlePromises();else{var n=e.shift(),r=e.shift();t.call(n,r)}}l.prototype.setScheduler=function(e){var t=this._schedule;return this._schedule=e,this._customScheduler=!0,t},l.prototype.hasCustomScheduler=function(){return this._customScheduler},l.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},l.prototype.disableTrampolineIfNecessary=function(){s.hasDevTools&&(this._trampolineEnabled=!1)},l.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},l.prototype.fatalError=function(e,n){n?(t.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),t.exit(2)):this.throwLater(e)},l.prototype.throwLater=function(e,t){if(1===arguments.length&&(t=e,e=function(){throw t}),"undefined"!=typeof setTimeout)setTimeout(function(){e(t)},0);else try{this._schedule(function(){e(t)})}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},s.hasDevTools?(l.prototype.invokeLater=function(e,t,n){this._trampolineEnabled?u.call(this,e,t,n):this._schedule(function(){setTimeout(function(){e.call(t,n)},100)})},l.prototype.invoke=function(e,t,n){this._trampolineEnabled?c.call(this,e,t,n):this._schedule(function(){e.call(t,n)})},l.prototype.settlePromises=function(e){this._trampolineEnabled?f.call(this,e):this._schedule(function(){e._settlePromises()})}):(l.prototype.invokeLater=u,l.prototype.invoke=c,l.prototype.settlePromises=f),l.prototype._drainQueues=function(){d(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,d(this._lateQueue)},l.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},l.prototype._reset=function(){this._isTickUsed=!1},n.exports=l,n.exports.firstLineError=o},{"./queue":26,"./schedule":29,"./util":36}],3:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){var o=!1,i=function(e,t){this._reject(t)},a=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(i,i,null,this,e)},s=function(e,t){0==(50397184&this._bitField)&&this._resolveCallback(t.target)},l=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(i){o||(o=!0,e.prototype._propagateFrom=r.propagateFromFunction(),e.prototype._boundValue=r.boundValueFunction());var u=n(i),c=new e(t);c._propagateFrom(this,1);var f=this._target();if(c._setBoundTo(u),u instanceof e){var d={promiseRejectionQueued:!1,promise:c,target:f,bindingPromise:u};f._then(t,a,void 0,c,d),u._then(s,l,void 0,c,d),c._setOnCancel(u)}else c._resolveCallback(f);return c},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=2097152|this._bitField,this._boundTo=e):this._bitField=-2097153&this._bitField},e.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},e.bind=function(t,n){return e.resolve(n).bind(t)}}},{}],4:[function(e,t,n){"use strict";var r;"undefined"!=typeof Promise&&(r=Promise);var o=e("./promise")();o.noConflict=function(){try{Promise===o&&(Promise=r)}catch(e){}return o},t.exports=o},{"./promise":22}],5:[function(e,t,n){"use strict";var r=Object.create;if(r){var o=r(null),i=r(null);o[" size"]=i[" size"]=0}t.exports=function(t){var n=e("./util"),r=n.canEvaluate;function o(e){var r=this.pop(),o=function(e,r){var o;if(null!=e&&(o=e[r]),"function"!=typeof o){var i="Object "+n.classString(e)+" has no method '"+n.toString(r)+"'";throw new t.TypeError(i)}return o}(e,r);return o.apply(e,this)}function i(e){return e[this]}function a(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}n.isIdentifier,t.prototype.call=function(e){var t=[].slice.call(arguments,1);return t.push(e),this._then(o,void 0,void 0,t,void 0)},t.prototype.get=function(e){var t,n="number"==typeof e;if(n)t=a;else if(r){var o=(void 0)(e);t=null!==o?o:i}else t=i;return this._then(t,void 0,void 0,e,void 0)}}},{"./util":36}],6:[function(e,t,n){"use strict";t.exports=function(t,n,r,o){var i=e("./util"),a=i.tryCatch,s=i.errorObj,l=t._async;t.prototype.break=t.prototype.cancel=function(){if(!o.cancellation())return this._warn("cancellation is disabled");for(var e=this,t=e;e._isCancellable();){if(!e._cancelBy(t)){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}var n=e._cancellationParent;if(null==n||!n._isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),e._setWillBeCancelled(),t=e,e=n}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(e){return e===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),l.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(e,t){if(i.isArray(e))for(var n=0;n=0)return n[e]}return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},r.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,n.push(this._trace))},r.prototype._popContext=function(){if(void 0!==this._trace){var e=n.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},r.CapturedTrace=null,r.create=function(){if(t)return new r},r.deactivateLongStackTraces=function(){},r.activateLongStackTraces=function(){var n=e.prototype._pushContext,i=e.prototype._popContext,a=e._peekContext,s=e.prototype._peekContext,l=e.prototype._promiseCreated;r.deactivateLongStackTraces=function(){e.prototype._pushContext=n,e.prototype._popContext=i,e._peekContext=a,e.prototype._peekContext=s,e.prototype._promiseCreated=l,t=!1},t=!0,e.prototype._pushContext=r.prototype._pushContext,e.prototype._popContext=r.prototype._popContext,e._peekContext=e.prototype._peekContext=o,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},r}},{}],9:[function(e,n,r){"use strict";n.exports=function(n,r){var o,i,a,s=n._getDomain,l=n._async,u=e("./errors").Warning,c=e("./util"),f=e("./es5"),d=c.canAttachTrace,p=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,m=/\((?:timers\.js):\d+:\d+\)/,h=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,_=null,g=null,v=!1,y=!(0==c.env("BLUEBIRD_DEBUG")),b=!(0==c.env("BLUEBIRD_WARNINGS")||!y&&!c.env("BLUEBIRD_WARNINGS")),E=!(0==c.env("BLUEBIRD_LONG_STACK_TRACES")||!y&&!c.env("BLUEBIRD_LONG_STACK_TRACES")),C=0!=c.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(b||!!c.env("BLUEBIRD_W_FORGOTTEN_RETURN"));n.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=-1048577&e._bitField|524288},n.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var e=this;setTimeout(function(){e._notifyUnhandledRejection()},1)}},n.prototype._notifyUnhandledRejectionIsHandled=function(){Y("rejectionHandled",o,void 0,this)},n.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},n.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),Y("unhandledRejection",i,e,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},n.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},n.prototype._warn=function(e,t,n){return G(e,t,n||this)},n.onPossiblyUnhandledRejection=function(e){var t=s();i="function"==typeof e?null===t?e:c.domainBind(t,e):void 0},n.onUnhandledRejectionHandled=function(e){var t=s();o="function"==typeof e?null===t?e:c.domainBind(t,e):void 0};var S=function(){};n.longStackTraces=function(){if(l.haveItemsQueued()&&!Z.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!Z.longStackTraces&&W()){var e=n.prototype._captureStackTrace,t=n.prototype._attachExtraTrace,o=n.prototype._dereferenceTrace;Z.longStackTraces=!0,S=function(){if(l.haveItemsQueued()&&!Z.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");n.prototype._captureStackTrace=e,n.prototype._attachExtraTrace=t,n.prototype._dereferenceTrace=o,r.deactivateLongStackTraces(),l.enableTrampoline(),Z.longStackTraces=!1},n.prototype._captureStackTrace=U,n.prototype._attachExtraTrace=j,n.prototype._dereferenceTrace=B,r.activateLongStackTraces(),l.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return Z.longStackTraces&&W()};var D=function(){try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return c.global.dispatchEvent(e),function(e,t){var n={detail:t,cancelable:!0};f.defineProperty(n,"promise",{value:t.promise}),f.defineProperty(n,"reason",{value:t.reason});var r=new CustomEvent(e.toLowerCase(),n);return!c.global.dispatchEvent(r)}}if("function"==typeof Event){var e=new Event("CustomEvent");return c.global.dispatchEvent(e),function(e,t){var n=new Event(e.toLowerCase(),{cancelable:!0});return n.detail=t,f.defineProperty(n,"promise",{value:t.promise}),f.defineProperty(n,"reason",{value:t.reason}),!c.global.dispatchEvent(n)}}var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),c.global.dispatchEvent(e),function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e.toLowerCase(),!1,!0,t),!c.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),w=c.isNode?function(){return t.emit.apply(t,arguments)}:c.global?function(e){var t="on"+e.toLowerCase(),n=c.global[t];return!!n&&(n.apply(c.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function T(e,t){return{promise:t}}var x={promiseCreated:T,promiseFulfilled:T,promiseRejected:T,promiseResolved:T,promiseCancelled:T,promiseChained:function(e,t,n){return{promise:t,child:n}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,n){return{reason:t,promise:n}},rejectionHandled:T},R=function(e){var t=!1;try{t=w.apply(null,arguments)}catch(e){l.throwLater(e),t=!0}var n=!1;try{n=D(e,x[e].apply(null,arguments))}catch(e){l.throwLater(e),n=!0}return n||t};function k(){return!1}function N(e,t,n){var r=this;try{e(t,n,function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+c.toString(e));r._attachCancellationCallback(e)})}catch(e){return e}}function I(e){if(!this._isCancellable())return this;var t=this._onCancel();void 0!==t?c.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function O(){return this._onCancelField}function A(e){this._onCancelField=e}function M(){this._cancellationParent=void 0,this._onCancelField=void 0}function P(e,t){if(0!=(1&t)){this._cancellationParent=e;var n=e._branchesRemainingToCancel;void 0===n&&(n=0),e._branchesRemainingToCancel=n+1}0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}n.config=function(e){if("longStackTraces"in(e=Object(e))&&(e.longStackTraces?n.longStackTraces():!e.longStackTraces&&n.hasLongStackTraces()&&S()),"warnings"in e){var t=e.warnings;Z.warnings=!!t,C=Z.warnings,c.isObject(t)&&"wForgottenReturn"in t&&(C=!!t.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!Z.cancellation){if(l.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");n.prototype._clearCancellationData=M,n.prototype._propagateFrom=P,n.prototype._onCancel=O,n.prototype._setOnCancel=A,n.prototype._attachCancellationCallback=I,n.prototype._execute=N,L=P,Z.cancellation=!0}return"monitoring"in e&&(e.monitoring&&!Z.monitoring?(Z.monitoring=!0,n.prototype._fireEvent=R):!e.monitoring&&Z.monitoring&&(Z.monitoring=!1,n.prototype._fireEvent=k)),n},n.prototype._fireEvent=k,n.prototype._execute=function(e,t,n){try{e(t,n)}catch(e){return e}},n.prototype._onCancel=function(){},n.prototype._setOnCancel=function(e){},n.prototype._attachCancellationCallback=function(e){},n.prototype._captureStackTrace=function(){},n.prototype._attachExtraTrace=function(){},n.prototype._dereferenceTrace=function(){},n.prototype._clearCancellationData=function(){},n.prototype._propagateFrom=function(e,t){};var L=function(e,t){0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)};function F(){var e=this._boundTo;return void 0!==e&&e instanceof n?e.isFulfilled()?e.value():void 0:e}function U(){this._trace=new X(this._peekContext())}function j(e,t){if(d(e)){var n=this._trace;if(void 0!==n&&t&&(n=n._parent),void 0!==n)n.attachExtraTrace(e);else if(!e.__stackCleaned__){var r=V(e);c.notEnumerableProp(e,"stack",r.message+"\n"+r.stack.join("\n")),c.notEnumerableProp(e,"__stackCleaned__",!0)}}}function B(){this._trace=void 0}function G(e,t,r){if(Z.warnings){var o,i=new u(e);if(t)r._attachExtraTrace(i);else if(Z.longStackTraces&&(o=n._peekContext()))o.attachExtraTrace(i);else{var a=V(i);i.stack=a.message+"\n"+a.stack.join("\n")}R("warning",i)||H(i,"",!0)}}function q(e){for(var t=[],n=0;n0?function(e){for(var t=e.stack.replace(/\s+$/g,"").split("\n"),n=0;n0&&"SyntaxError"!=e.name&&(t=t.slice(n)),t}(e):[" (No stack trace)"],{message:n,stack:"SyntaxError"==e.name?t:q(t)}}function H(e,t,n){if("undefined"!=typeof console){var r;if(c.isObject(e)){var o=e.stack;r=t+g(o,e)}else r=t+String(e);"function"==typeof a?a(r,n):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(r)}}function Y(e,t,n,r){var o=!1;try{"function"==typeof t&&(o=!0,"rejectionHandled"===e?t(r):t(n,r))}catch(e){l.throwLater(e)}"unhandledRejection"===e?R(e,n,r)||o||H(n,"Unhandled rejection "):R(e,r)}function z(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{if(t=e&&"function"==typeof e.toString?e.toString():c.toString(e),/\[object [a-zA-Z0-9$_]+\]/.test(t))try{var n=JSON.stringify(e);t=n}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+function(e){return e.length<41?e:e.substr(0,38)+"..."}(t)+">, no stack trace)"}function W(){return"function"==typeof J}var K=function(){return!1},$=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function Q(e){var t=e.match($);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}function X(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);J(this,X),t>32&&this.uncycle()}c.inherits(X,Error),r.CapturedTrace=X,X.prototype.uncycle=function(){var e=this._length;if(!(e<2)){for(var t=[],n={},r=0,o=this;void 0!==o;++r)t.push(o),o=o._parent;for(var r=(e=this._length=r)-1;r>=0;--r){var i=t[r].stack;void 0===n[i]&&(n[i]=r)}for(var r=0;r0&&(t[s-1]._parent=void 0,t[s-1]._length=1),t[r]._parent=void 0,t[r]._length=1;var l=r>0?t[r-1]:this;s=0;--c)t[c]._length=u,u++;return}}}},X.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=V(e),n=t.message,r=[t.stack],o=this;void 0!==o;)r.push(q(o.stack.split("\n"))),o=o._parent;!function(e){for(var t=e[0],n=1;n=0;--s)if(r[s]===i){a=s;break}for(var s=a;s>=0;--s){var l=r[s];if(t[o]!==l)break;t.pop(),o--}t=r}}(r),function(e){for(var t=0;t=0)return _=/@/,g=t,v=!0,function(e){e.stack=(new Error).stack};try{throw new Error}catch(e){r="stack"in e}return"stack"in o||!r||"number"!=typeof Error.stackTraceLimit?(g=function(e,t){return"string"==typeof e?e:"object"!=typeof t&&"function"!=typeof t||void 0===t.name||void 0===t.message?z(t):t.toString()},null):(_=e,g=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(a=function(e){console.warn(e)},c.isNode&&t.stderr.isTTY?a=function(e,t){var n=t?"":"";console.warn(n+e+"\n")}:c.isNode||"string"!=typeof(new Error).stack||(a=function(e,t){console.warn("%c"+e,t?"color: darkorange":"color: red")}));var Z={warnings:b,longStackTraces:!1,cancellation:!1,monitoring:!1};return E&&n.longStackTraces(),{longStackTraces:function(){return Z.longStackTraces},warnings:function(){return Z.warnings},cancellation:function(){return Z.cancellation},monitoring:function(){return Z.monitoring},propagateFromFunction:function(){return L},boundValueFunction:function(){return F},checkForgottenReturns:function(e,t,n,r,o){if(void 0===e&&null!==t&&C){if(void 0!==o&&o._returnedNonUndefined())return;if(0==(65535&r._bitField))return;n&&(n+=" ");var i="",a="";if(t._trace){for(var s=t._trace.stack.split("\n"),l=q(s),u=l.length-1;u>=0;--u){var c=l[u];if(!m.test(c)){var f=c.match(h);f&&(i="at "+f[1]+":"+f[2]+":"+f[3]+" ");break}}if(l.length>0)for(var d=l[0],u=0;u0&&(a="\n"+s[u-1]);break}}var p="a promise was created in a "+n+"handler "+i+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(p,!0,t)}},setBounds:function(e,t){if(W()){for(var n,r,o=e.stack.split("\n"),i=t.stack.split("\n"),a=-1,s=-1,l=0;l=s||(K=function(e){if(p.test(e))return!0;var t=Q(e);return!!(t&&t.fileName===n&&a<=t.line&&t.line<=s)})}},warn:G,deprecated:function(e,t){var n=e+" is deprecated and will be removed in a future version.";return t&&(n+=" Use "+t+" instead."),G(n)},CapturedTrace:X,fireDomEvent:D,fireGlobalEvent:w}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(e,t,n){"use strict";t.exports=function(e){function t(){return this.value}function n(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(n){return n instanceof e&&n.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:n},void 0)},e.prototype.throw=e.prototype.thenThrow=function(e){return this._then(n,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:e},void 0);var t=arguments[1];return this.caught(e,function(){throw t})},e.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof e&&n.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:n},void 0);var r=arguments[1];return r instanceof e&&r.suppressUnhandledRejections(),this.caught(n,function(){return r})}}},{}],11:[function(e,t,n){"use strict";t.exports=function(e,t){var n=e.reduce,r=e.all;function o(){return r(this)}e.prototype.each=function(e){return n(this,e,t,0)._then(o,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return n(this,e,t,t)},e.each=function(e,r){return n(e,r,t,0)._then(o,void 0,void 0,e,void 0)},e.mapSeries=function(e,r){return n(e,r,t,t)}}},{}],12:[function(e,t,n){"use strict";var r,o,i=e("./es5"),a=i.freeze,s=e("./util"),l=s.inherits,u=s.notEnumerableProp;function c(e,t){function n(r){if(!(this instanceof n))return new n(r);u(this,"message","string"==typeof r?r:t),u(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return l(n,Error),n}var f=c("Warning","warning"),d=c("CancellationError","cancellation error"),p=c("TimeoutError","timeout error"),m=c("AggregateError","aggregate error");try{r=TypeError,o=RangeError}catch(e){r=c("TypeError","type error"),o=c("RangeError","range error")}for(var h="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),_=0;_1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function f(){return p.call(this,this.promise._target()._settledValue())}function d(e){if(!c(this,e))return a.e=e,a}function p(e){var o=this.promise,s=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?s.call(o._boundValue()):s.call(o._boundValue(),e);if(l===r)return l;if(void 0!==l){o._setReturnedNonUndefined();var p=n(l,o);if(p instanceof t){if(null!=this.cancelPromise){if(p._isCancelled()){var m=new i("late cancellation observer");return o._attachExtraTrace(m),a.e=m,a}p.isPending()&&p._attachCancellationCallback(new u(this))}return p._then(f,d,void 0,this,void 0)}}}return o.isRejected()?(c(this),a.e=e,a):(c(this),e)}return l.prototype.isFinallyHandler=function(){return 0===this.type},u.prototype._resultCancelled=function(){c(this.finallyHandler)},t.prototype._passThrough=function(e,t,n,r){return"function"!=typeof e?this.then():this._then(n,r,void 0,new l(this,t,e),void 0)},t.prototype.lastly=t.prototype.finally=function(e){return this._passThrough(e,0,p,p)},t.prototype.tap=function(e){return this._passThrough(e,1,p)},t.prototype.tapCatch=function(e){var n=arguments.length;if(1===n)return this._passThrough(e,1,void 0,p);var r,i=new Array(n-1),a=0;for(r=0;r0&&"function"==typeof arguments[t]&&(e=arguments[t]);var r=[].slice.call(arguments);e&&r.pop();var o=new n(r).promise();return void 0!==e?o.spread(e):o}}},{"./util":36}],18:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,i,a){var s=t._getDomain,l=e("./util"),u=l.tryCatch,c=l.errorObj,f=t._async;function d(e,t,n,r){this.constructor$(e),this._promise._captureStackTrace();var o=s();this._callback=null===o?t:l.domainBind(o,t),this._preservedValues=r===i?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}function p(e,n,o,i){if("function"!=typeof n)return r("expecting a function but got "+l.classString(n));var a=0;if(void 0!==o){if("object"!=typeof o||null===o)return t.reject(new TypeError("options argument must be an object but it is "+l.classString(o)));if("number"!=typeof o.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+l.classString(o.concurrency)));a=o.concurrency}return a="number"==typeof a&&isFinite(a)&&a>=1?a:0,new d(e,n,a,i).promise()}l.inherits(d,n),d.prototype._asyncInit=function(){this._init$(void 0,-2)},d.prototype._init=function(){},d.prototype._promiseFulfilled=function(e,n){var r=this._values,i=this.length(),s=this._preservedValues,l=this._limit;if(n<0){if(r[n=-1*n-1]=e,l>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(l>=1&&this._inFlight>=l)return r[n]=e,this._queue.push(n),!1;null!==s&&(s[n]=e);var f=this._promise,d=this._callback,p=f._boundValue();f._pushContext();var m=u(d).call(p,e,n,i),h=f._popContext();if(a.checkForgottenReturns(m,h,null!==s?"Promise.filter":"Promise.map",f),m===c)return this._reject(m.e),!0;var _=o(m,this._promise);if(_ instanceof t){var g=(_=_._target())._bitField;if(0==(50397184&g))return l>=1&&this._inFlight++,r[n]=_,_._proxy(this,-1*(n+1)),!1;if(0==(33554432&g))return 0!=(16777216&g)?(this._reject(_._reason()),!0):(this._cancel(),!0);m=_._value()}r[n]=m}var v=++this._totalResolved;return v>=i&&(null!==s?this._filter(r,s):this._resolve(r),!0)},d.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,n=this._values;e.length>0&&this._inFlight1){i.deprecated("calling Promise.try with more than 1 argument");var u=arguments[1],c=arguments[2];r=a.isArray(u)?s(e).apply(c,u):s(e).call(c,u)}else r=s(e)();var f=l._popContext();return i.checkForgottenReturns(r,f,"Promise.try",l),l._resolveFromSyncValue(r),l},t.prototype._resolveFromSyncValue=function(e){e===a.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}},{"./util":36}],20:[function(e,t,n){"use strict";var r=e("./util"),o=r.maybeWrapAsError,i=e("./errors"),a=i.OperationalError,s=e("./es5"),l=/^(?:name|message|stack|cause)$/;function u(e){var t;if(function(e){return e instanceof Error&&s.getPrototypeOf(e)===Error.prototype}(e)){(t=new a(e)).name=e.name,t.message=e.message,t.stack=e.stack;for(var n=s.keys(e),o=0;o1){var n,r=new Array(t-1),o=0;for(n=0;n0&&"function"!=typeof e&&"function"!=typeof t){var n=".then() only accepts functions but was passed: "+u.classString(e);arguments.length>1&&(n+=", "+u.classString(t)),this._warn(n)}return this._then(e,t,void 0,void 0,void 0)},k.prototype.done=function(e,t){var n=this._then(e,t,void 0,void 0,void 0);n._setIsFinal()},k.prototype.spread=function(e){return"function"!=typeof e?i("expecting a function but got "+u.classString(e)):this.all()._then(e,void 0,void 0,g,void 0)},k.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},k.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new b(this).promise()},k.prototype.error=function(e){return this.caught(u.originatesFromRejection,e)},k.getNewLibraryCopy=n.exports,k.is=function(e){return e instanceof k},k.fromNode=k.fromCallback=function(e){var t=new k(_);t._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,r=R(e)(T(t,n));return r===x&&t._rejectCallback(r.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},k.all=function(e){return new b(e).promise()},k.cast=function(e){var t=y(e);return t instanceof k||((t=new k(_))._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},k.resolve=k.fulfilled=k.cast,k.reject=k.rejected=function(e){var t=new k(_);return t._captureStackTrace(),t._rejectCallback(e,!0),t},k.setScheduler=function(e){if("function"!=typeof e)throw new m("expecting a function but got "+u.classString(e));return d.setScheduler(e)},k.prototype._then=function(e,t,n,r,o){var i=void 0!==o,a=i?o:new k(_),l=this._target(),c=l._bitField;i||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!=(2097152&this._bitField)&&(r=0!=(50397184&c)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var f=s();if(0!=(50397184&c)){var p,m,g=l._settlePromiseCtx;0!=(33554432&c)?(m=l._rejectionHandler0,p=e):0!=(16777216&c)?(m=l._fulfillmentHandler0,p=t,l._unsetRejectionIsUnhandled()):(g=l._settlePromiseLateCancellationObserver,m=new h("late cancellation observer"),l._attachExtraTrace(m),p=t),d.invoke(g,l,{handler:null===f?p:"function"==typeof p&&u.domainBind(f,p),promise:a,receiver:r,value:m})}else l._addCallbacks(e,t,a,r,f);return a},k.prototype._length=function(){return 65535&this._bitField},k.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},k.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},k.prototype._setLength=function(e){this._bitField=-65536&this._bitField|65535&e},k.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},k.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},k.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},k.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},k.prototype._isFinal=function(){return(4194304&this._bitField)>0},k.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},k.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},k.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},k.prototype._setAsyncGuaranteed=function(){d.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},k.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==l)return void 0===t&&this._isBound()?this._boundValue():t},k.prototype._promiseAt=function(e){return this[4*e-4+2]},k.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},k.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},k.prototype._boundValue=function(){},k.prototype._migrateCallback0=function(e){e._bitField;var t=e._fulfillmentHandler0,n=e._rejectionHandler0,r=e._promise0,o=e._receiverAt(0);void 0===o&&(o=l),this._addCallbacks(t,n,r,o,null)},k.prototype._migrateCallbackAt=function(e,t){var n=e._fulfillmentHandlerAt(t),r=e._rejectionHandlerAt(t),o=e._promiseAt(t),i=e._receiverAt(t);void 0===i&&(i=l),this._addCallbacks(n,r,o,i,null)},k.prototype._addCallbacks=function(e,t,n,r,o){var i=this._length();if(i>=65531&&(i=0,this._setLength(0)),0===i)this._promise0=n,this._receiver0=r,"function"==typeof e&&(this._fulfillmentHandler0=null===o?e:u.domainBind(o,e)),"function"==typeof t&&(this._rejectionHandler0=null===o?t:u.domainBind(o,t));else{var a=4*i-4;this[a+2]=n,this[a+3]=r,"function"==typeof e&&(this[a+0]=null===o?e:u.domainBind(o,e)),"function"==typeof t&&(this[a+1]=null===o?t:u.domainBind(o,t))}return this._setLength(i+1),i},k.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},k.prototype._resolveCallback=function(e,t){if(0==(117506048&this._bitField)){if(e===this)return this._rejectCallback(r(),!1);var n=y(e,this);if(!(n instanceof k))return this._fulfill(e);t&&this._propagateFrom(n,2);var o=n._target();if(o!==this){var i=o._bitField;if(0==(50397184&i)){var a=this._length();a>0&&o._migrateCallback0(this);for(var s=1;s>>16)){if(e===this){var n=r();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=e,(65535&t)>0&&(0!=(134217728&t)?this._settlePromises():d.settlePromises(this),this._dereferenceTrace())}},k.prototype._reject=function(e){var t=this._bitField;if(!((117506048&t)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=e,this._isFinal())return d.fatalError(e,u.isNode);(65535&t)>0?d.settlePromises(this):this._ensurePossibleRejectionHandled()}},k.prototype._fulfillPromises=function(e,t){for(var n=1;n0){if(0!=(16842752&e)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,e),this._rejectPromises(t,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,e),this._fulfillPromises(t,r)}this._setLength(0)}this._clearCancellationData()},k.prototype._settledValue=function(){var e=this._bitField;return 0!=(33554432&e)?this._rejectionHandler0:0!=(16777216&e)?this._fulfillmentHandler0:void 0},k.defer=k.pending=function(){S.deprecated("Promise.defer","new Promise");var e=new k(_);return{promise:e,resolve:N,reject:I}},u.notEnumerableProp(k,"_makeSelfResolutionError",r),e("./method")(k,_,y,i,S),e("./bind")(k,_,y,S),e("./cancel")(k,b,i,S),e("./direct_resolve")(k),e("./synchronous_inspection")(k),e("./join")(k,b,y,_,d,s),k.Promise=k,k.version="3.5.2",e("./map.js")(k,b,i,y,_,S),e("./call_get.js")(k),e("./using.js")(k,i,y,C,_,S),e("./timers.js")(k,_,S),e("./generators.js")(k,i,_,y,a,S),e("./nodeify.js")(k),e("./promisify.js")(k,_),e("./props.js")(k,b,y,i),e("./race.js")(k,_,y,i),e("./reduce.js")(k,b,i,y,_,S),e("./settle.js")(k,b,S),e("./some.js")(k,b,i),e("./filter.js")(k,_),e("./each.js")(k,_),e("./any.js")(k),u.toFastProperties(k),u.toFastProperties(k.prototype),O({a:1}),O({b:2}),O({c:3}),O(1),O(function(){}),O(void 0),O(!1),O(new k(_)),S.setBounds(f.firstLineError,u.lastLineError),k}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,i){var a=e("./util");function s(e){var r=this._promise=new t(n);e instanceof t&&r._propagateFrom(e,3),r._setOnCancel(this),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return a.isArray,a.inherits(s,i),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function e(n,i){var s=r(this._values,this._promise);if(s instanceof t){var l=(s=s._target())._bitField;if(this._values=s,0==(50397184&l))return this._promise._setAsyncGuaranteed(),s._then(e,this._reject,void 0,this,i);if(0==(33554432&l))return 0!=(16777216&l)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=a.asArray(s)))0!==s.length?this._iterate(s):-5===i?this._resolveEmptyArray():this._resolve(function(e){switch(e){case-2:return[];case-3:return{};case-6:return new Map}}(i));else{var u=o("expecting an array or an iterable object but got "+a.classString(s)).reason();this._promise._rejectCallback(u,!1)}},s.prototype._iterate=function(e){var n=this.getActualLength(e.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var o=this._promise,i=!1,a=null,s=0;s=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(e){return this._totalResolved++,this._reject(e),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var e=this._values;if(this._cancel(),e instanceof t)e.cancel();else for(var n=0;n=this._length){var r;if(this._isMap)r=function(e){for(var t=new i,n=e.length/2|0,r=0;r>1},t.prototype.props=function(){return f(this)},t.props=function(e){return f(e)}}},{"./es5":13,"./util":36}],26:[function(e,t,n){"use strict";function r(e){this._capacity=e,this._length=0,this._front=0}r.prototype._willBeOverCapacity=function(e){return this._capacity=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseFulfilled=function(e,t){var n=new o;return n._bitField=33554432,n._settledValueField=e,this._promiseResolved(t,n)},a.prototype._promiseRejected=function(e,t){var n=new o;return n._bitField=16777216,n._settledValueField=e,this._promiseResolved(t,n)},t.settle=function(e){return r.deprecated(".settle()",".reflect()"),new a(e).promise()},t.prototype.settle=function(){return t.settle(this)}}},{"./util":36}],31:[function(e,t,n){"use strict";t.exports=function(t,n,r){var o=e("./util"),i=e("./errors").RangeError,a=e("./errors").AggregateError,s=o.isArray,l={};function u(e){this.constructor$(e),this._howMany=0,this._unwrap=!1,this._initialized=!1}function c(e,t){if((0|t)!==t||t<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new u(e),o=n.promise();return n.setHowMany(t),n.init(),o}o.inherits(u,n),u.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var e=s(this._values);!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},u.prototype.init=function(){this._initialized=!0,this._init()},u.prototype.setUnwrap=function(){this._unwrap=!0},u.prototype.howMany=function(){return this._howMany},u.prototype.setHowMany=function(e){this._howMany=e},u.prototype._promiseFulfilled=function(e){return this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},u.prototype._promiseRejected=function(e){return this._addRejected(e),this._checkOutcome()},u.prototype._promiseCancelled=function(){return this._values instanceof t||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},u.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var e=new a,t=this.length();t0?this._reject(e):this._cancel(),!0}return!1},u.prototype._fulfilled=function(){return this._totalResolved},u.prototype._rejected=function(){return this._values.length-this.length()},u.prototype._addRejected=function(e){this._values.push(e)},u.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},u.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},u.prototype._getRangeError=function(e){var t="Input array must contain at least "+this._howMany+" items but contains only "+e+" items";return new i(t)},u.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},t.some=function(e,t){return c(e,t)},t.prototype.some=function(e){return c(this,e)},t._SomePromiseArray=u}},{"./errors":12,"./util":36}],32:[function(e,t,n){"use strict";t.exports=function(e){function t(e){void 0!==e?(e=e._target(),this._bitField=e._bitField,this._settledValueField=e._isFateSealed()?e._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}t.prototype._settledValue=function(){return this._settledValueField};var n=t.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=t.prototype.error=t.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},o=t.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},i=t.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},a=t.prototype.isPending=function(){return 0==(50397184&this._bitField)},s=t.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};t.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},e.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},e.prototype._isCancelled=function(){return this._target().__isCancelled()},e.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},e.prototype.isPending=function(){return a.call(this._target())},e.prototype.isRejected=function(){return i.call(this._target())},e.prototype.isFulfilled=function(){return o.call(this._target())},e.prototype.isResolved=function(){return s.call(this._target())},e.prototype.value=function(){return n.call(this._target())},e.prototype.reason=function(){var e=this._target();return e._unsetRejectionIsUnhandled(),r.call(e)},e.prototype._value=function(){return this._settledValue()},e.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},e.PromiseInspection=t}},{}],33:[function(e,t,n){"use strict";t.exports=function(t,n){var r=e("./util"),o=r.errorObj,i=r.isObject,a={}.hasOwnProperty;return function(e,s){if(i(e)){if(e instanceof t)return e;var l=function(e){try{return function(e){return e.then}(e)}catch(e){return o.e=e,o}}(e);if(l===o){s&&s._pushContext();var u=t.reject(l.e);return s&&s._popContext(),u}if("function"==typeof l){if(function(e){try{return a.call(e,"_promise0")}catch(e){return!1}}(e)){var u=new t(n);return e._then(u._fulfill,u._reject,void 0,u,null),u}return function(e,i,a){var s=new t(n),l=s;a&&a._pushContext(),s._captureStackTrace(),a&&a._popContext();var u=!0,c=r.tryCatch(i).call(e,function(e){s&&(s._resolveCallback(e),s=null)},function(e){s&&(s._rejectCallback(e,u,!0),s=null)});return u=!1,s&&c===o&&(s._rejectCallback(c.e,!0,!0),s=null),l}(e,l,s)}}return e}}},{"./util":36}],34:[function(e,t,n){"use strict";t.exports=function(t,n,r){var o=e("./util"),i=t.TimeoutError;function a(e){this.handle=e}a.prototype._resultCancelled=function(){clearTimeout(this.handle)};var s=function(e){return l(+this).thenReturn(e)},l=t.delay=function(e,o){var i,l;return void 0!==o?(i=t.resolve(o)._then(s,null,null,e,void 0),r.cancellation()&&o instanceof t&&i._setOnCancel(o)):(i=new t(n),l=setTimeout(function(){i._fulfill()},+e),r.cancellation()&&i._setOnCancel(new a(l)),i._captureStackTrace()),i._setAsyncGuaranteed(),i};function u(e){return clearTimeout(this.handle),e}function c(e){throw clearTimeout(this.handle),e}t.prototype.delay=function(e){return l(e,this)},t.prototype.timeout=function(e,t){var n,s;e=+e;var l=new a(setTimeout(function(){n.isPending()&&function(e,t,n){var r;r="string"!=typeof t?t instanceof Error?t:new i("operation timed out"):new i(t),o.markAsOriginatingFromRejection(r),e._attachExtraTrace(r),e._reject(r),null!=n&&n.cancel()}(n,t,s)},e));return r.cancellation()?(s=this.then(),(n=s._then(u,c,void 0,l,void 0))._setOnCancel(l)):n=this._then(u,c,void 0,l,void 0),n}}},{"./util":36}],35:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,i,a){var s=e("./util"),l=e("./errors").TypeError,u=e("./util").inherits,c=s.errorObj,f=s.tryCatch,d={};function p(e){setTimeout(function(){throw e},0)}function m(e,n){var o=0,a=e.length,s=new t(i);return function i(){if(o>=a)return s._fulfill();var l=function(e){var t=r(e);return t!==e&&"function"==typeof e._isDisposable&&"function"==typeof e._getDisposer&&e._isDisposable()&&t._setDisposable(e._getDisposer()),t}(e[o++]);if(l instanceof t&&l._isDisposable()){try{l=r(l._getDisposer().tryDispose(n),e.promise)}catch(e){return p(e)}if(l instanceof t)return l._then(i,p,null,null,null)}i()}(),s}function h(e,t,n){this._data=e,this._promise=t,this._context=n}function _(e,t,n){this.constructor$(e,t,n)}function g(e){return h.isDisposer(e)?(this.resources[this.index]._setDisposable(e),e.promise()):e}function v(e){this.length=e,this.promise=null,this[e-1]=null}h.prototype.data=function(){return this._data},h.prototype.promise=function(){return this._promise},h.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():d},h.prototype.tryDispose=function(e){var t=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=t!==d?this.doDispose(t,e):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},h.isDisposer=function(e){return null!=e&&"function"==typeof e.resource&&"function"==typeof e.tryDispose},u(_,h),_.prototype.doDispose=function(e,t){var n=this.data();return n.call(e,e,t)},v.prototype._resultCancelled=function(){for(var e=this.length,n=0;n0},t.prototype._getDisposer=function(){return this._disposer},t.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},t.prototype.disposer=function(e){if("function"==typeof e)return new _(e,this,o());throw new l}}},{"./errors":12,"./util":36}],36:[function(e,r,o){"use strict";var i=e("./es5"),a="undefined"==typeof navigator,s={e:{}},l,u="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n?n:void 0!==this?this:null;function c(){try{var e=l;return l=null,e.apply(this,arguments)}catch(e){return s.e=e,s}}function f(e){return l=e,c}var d=function(e,t){var n={}.hasOwnProperty;function r(){for(var r in this.constructor=e,this.constructor$=t,t.prototype)n.call(t.prototype,r)&&"$"!==r.charAt(r.length-1)&&(this[r+"$"]=t.prototype[r])}return r.prototype=t.prototype,e.prototype=new r,e.prototype};function p(e){return null==e||!0===e||!1===e||"string"==typeof e||"number"==typeof e}function m(e){return"function"==typeof e||"object"==typeof e&&null!==e}function h(e){return p(e)?new Error(x(e)):e}function _(e,t){var n,r=e.length,o=new Array(r+1);for(n=0;n1,r=t.length>0&&!(1===t.length&&"constructor"===t[0]),o=E.test(e+"")&&i.names(e).length>0;if(n||r||o)return!0}return!1}catch(e){return!1}}function S(e){function t(){}t.prototype=e;var n=new t;function r(){return typeof n.foo}return r(),r(),e}var D=/^[a-z$_][a-z$_0-9]*$/i;function w(e){return D.test(e)}function T(e,t,n){for(var r=new Array(e),o=0;o10||e[0]>0}(),q.isNode&&q.toFastProperties(t);try{throw new Error}catch(e){q.lastLineError=e}r.exports=q},{"./es5":13}]},{},[4])(4)}(),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,n(54),n(15),n(187).setImmediate)},function(e,t,n){"use strict";(function(t){var r=u(n(11)),o=u(n(4)),i=u(n(5)),a=u(n(12)),s=u(n(233)),l=u(n(13));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(){return(0,o.default)(this,t),(0,a.default)(this,(t.__proto__||(0,r.default)(t)).apply(this,arguments))}return(0,l.default)(t,e),(0,i.default)(t,[{key:"dispatch",value:function(e,n){var o=this;"function"!=typeof e?n?(0,s.default)(t.prototype.__proto__||(0,r.default)(t.prototype),"dispatch",this).call(this,e):setTimeout((0,s.default)(t.prototype.__proto__||(0,r.default)(t.prototype),"dispatch",this).bind(this,e),0):e(function(e){o.dispatch(e,n)})}}]),t}(n(1149).Dispatcher);void 0===t.mxDispatcher&&(t.mxDispatcher=new c),e.exports=t.mxDispatcher}).call(this,n(15))},function(e,t,n){e.exports={default:n(986),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(64));t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,r.default)(t))&&"function"!=typeof t?e:t}},function(e,t,n){"use strict";t.__esModule=!0;var r=a(n(1091)),o=a(n(67)),i=a(n(64));function a(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,i.default)(t)));e.prototype=(0,o.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(r.default?(0,r.default)(e,t):e.__proto__=t)}},function(e,t,n){e.exports={default:n(219),__esModule:!0}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var o=d(n(37)),i=d(n(4)),a=d(n(5)),s=d(n(128)),l=d(n(1)),u=d(n(90)),c=d(n(3)),f=d(n(10));function d(e){return e&&e.__esModule?e:{default:e}}var p=n(0),m=n(41),h=p.createClass({displayName:"AsyncWrapper",propTypes:{loader:l.default.func.isRequired},getInitialState:function(){return{component:null}},componentWillMount:function(){var e=this;this._unmounted=!1,console.log("Starting load of AsyncWrapper for modal"),this.props.loader(function(t){console.log("AsyncWrapper load completed with "+t.displayName),e._unmounted||e.setState({component:t})})},componentWillUnmount:function(){this._unmounted=!0},render:function(){var e=this.props,t=(e.loader,(0,s.default)(e,["loader"]));if(this.state.component){var n=this.state.component;return p.createElement(n,t)}var r=c.default.getComponent("elements.Spinner");return p.createElement(r,null)}}),_=function(){function e(){(0,i.default)(this,e),this._counter=0,this._priorityModal=null,this._modals=[],this.closeAll=this.closeAll.bind(this)}return(0,a.default)(e,[{key:"getOrCreateContainer",value:function(){var e=document.getElementById("mx_Dialog_Container");return e||((e=document.createElement("div")).id="mx_Dialog_Container",document.body.appendChild(e)),e}},{key:"createTrackedDialog",value:function(e,t){u.default.trackEvent("Modal",e,t);for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o1?t-1:0),r=1;r2?n-2:0),o=2;o=0&&i._modals.splice(e,1),i._priorityModal===a&&(i._priorityModal=null,i._modals=[]),i._reRender()},l=this._counter++;return a.elem=p.createElement(h,(0,o.default)({key:l,loader:e},t,{onFinished:s})),a.onFinished=t?t.onFinished:null,a.className=n,r?this._priorityModal=a:this._modals.unshift(a),this._reRender(),{close:s}}},{key:"closeAll",value:function(){var e=this._modals;this._modals=[];for(var t=0;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},T=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},x=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),R=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:{};if(i.Map.isMap(t))return t;if(o()(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 i.Map(e)}}]),e}();k.fromJS=k.fromJSON;var N={data:void 0,key:void 0,nodes:void 0},I=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(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:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isDocument(e))return e;if((i.List.isList(e)||Array.isArray(e))&&(e={nodes:e}),o()(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 n=e.data,r=void 0===n?{}:n,o=e.key,a=void 0===o?y.create():o,s=e.nodes,l=void 0===s?[]:s;return new t({key:a,data:new i.Map(r),nodes:K.createList(l)})}}]),t}(Object(i.Record)(N)),O={data:void 0,key:void 0,nodes:void 0,type:void 0},A=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isInline(e))return e;if("string"==typeof e&&(e={type:e}),o()(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(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));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 n=e.data,r=void 0===n?{}:n,o=e.key,a=void 0===o?y.create():o,s=e.nodes,l=void 0===s?[]:s,u=e.type;if("string"!=typeof u)throw new Error("`Inline.fromJS` requires a `type` string.");return new t({key:a,type:u,data:new i.Map(r),nodes:K.createList(l)})}},{key:"isInlineList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isInline(e)})}}]),t}(Object(i.Record)(O)),M={data:void 0,type:void 0},P=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(t,[{key:"toJSON",value:function(){return{object:this.object,type:this.type,data:this.data.toJSON()}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isMark(e))return e;if("string"==typeof e&&(e={type:e}),o()(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(i.Set.isSet(e)||Array.isArray(e))return new i.Set(e.map(t.create));if(null==e)return Object(i.Set)();throw new Error("`Mark.createSet` only accepts sets, arrays or null, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isMark(e))return{data:e.data,type:e.type};if("string"==typeof e)return{type:e};if(o()(e)){var n={};return"type"in e&&(n.type=e.type),"data"in e&&(n.data=k.create(e.data)),n}throw new Error("`Mark.createProperties` only accepts objects, strings or marks, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.data,r=void 0===n?{}:n,o=e.type;if("string"!=typeof o)throw new Error("`Mark.fromJS` requires a `type` string.");return new t({type:o,data:new i.Map(r)})}},{key:"isMarkSet",value:function(e){return i.Set.isSet(e)&&e.every(function(e){return t.isMark(e)})}}]),t}(Object(i.Record)(M)),L={marks:void 0,text:void 0},F=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(t,[{key:"updateMark",value:function(e,t){var n=this.marks;if(t.equals(e))return this;if(!n.has(e))return this;var r=n.withMutations(function(n){n.remove(e).add(t)});return this.set("marks",r)}},{key:"addMark",value:function(e){var t=this.marks;return this.set("marks",t.add(e))}},{key:"addMarks",value:function(e){var t=this.marks;return this.set("marks",t.union(e))}},{key:"removeMark",value:function(e){var t=this.marks;return this.set("marks",t.remove(e))}},{key:"toJSON",value:function(){return{object:this.object,text:this.text,marks:this.marks.toArray().map(function(e){return e.toJSON()})}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isLeaf(e))return e;if("string"==typeof e&&(e={text:e}),o()(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,n=Object(i.List)().withMutations(function(n){e.findLast(function(e,r){var o=n.first();if(o){if(o.marks.equals(e.marks))return t=!0,void n.set(0,o.set("text",""+e.text+o.text));if(""===o.text)return t=!0,void n.set(0,e);if(""===e.text)return void(t=!0)}n.unshift(e)})});return t?n:e}},{key:"splitLeaves",value:function(e,t){if(t<0)return[Object(i.List)(),e];if(0===e.size)return[Object(i.List)(),Object(i.List)()];var n=0,r=-1,o=void 0,a=void 0;return e.find(function(e){r++;var i=n,s=e.text;if((n+=s.length)t)return!1;var l=t-i;return o=e.set("text",s.slice(0,l)),a=e.set("text",s.slice(l)),!0}),o?""===o.text?0===r?[i.List.of(o),e]:[e.take(r),e.skip(r)]:""===a.text?r===e.size-1?[e,i.List.of(a)]:[e.take(r+1),e.skip(r+1)]:[e.take(r).push(o),e.skip(r+1).unshift(a)]:[e,Object(i.List)()]}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));throw new Error("`Leaf.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.text,r=void 0===n?"":n,o=e.marks,a=void 0===o?[]:o;return new t({text:r,marks:Object(i.Set)(a.map(P.fromJSON))})}},{key:"isLeafList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isLeaf(e)})}}]),t}(Object(i.Record)(L)),U=!0,j=0,B={},G={},q=void 0;function V(e,t){var n=function(t){var n=e[t];if(!n)throw new Error('Object does not have a property named "'+t+'".');e[t]=function(){for(var e=arguments.length,r=Array(e),o=0;o=Number.MAX_SAFE_INTEGER&&(j=0)}function Y(e){U=e}var z={leaves:void 0,key:void 0},W=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(t,[{key:"searchLeafAtOffset",value:function(e){var t=0,n=0,r=-1;return{leaf:this.leaves.find(function(o){return r++,(t=(n=t)+o.text.length)>=e}),endOffset:t,index:r,startOffset:n}}},{key:"addMark",value:function(e,t,n){var r=i.Set.of(n);return this.addMarks(e,t,r)}},{key:"addMarks",value:function(e,t,n){if(""===this.text&&0===t&&0===e){var r=this.leaves.first();if(!r)return this.set("leaves",i.List.of(F.fromJSON({text:"",marks:n})));var o=r.addMarks(n);return o===r?this:this.set("leaves",i.List.of(o))}if(""===this.text)return this;if(0===t)return this;if(e>=this.text.length)return this;var a=F.splitLeaves(this.leaves,e),s=x(a,2),l=s[0],u=s[1],c=F.splitLeaves(u,t),f=x(c,2),d=f[0],p=f[1],m=l.concat(d.map(function(e){return e.addMarks(n)}),p);return this.setLeaves(m)}},{key:"getLeaves",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.leaves;if(0===n.size)return i.List.of(F.create({}));if(!t||0===t.length)return n;if(0===this.text.length)return n;var r=this.key;return t.forEach(function(t){var o=t.start,i=t.end,a=t.mark,s=o.key==r,l=i.key==r;if(s&&l){var u=s?o.offset:0,c=l?i.offset-u:e.text.length-u;if(c<1)return;if(u>=e.text.length)return;if(0!==u||c=this.text.length)return this.getActiveMarks();if(e>=t)return Object(i.Set)();if(""===this.text)return this.getActiveMarks();var n=null,r=0;return this.leaves.forEach(function(o){var i=r;if(!((r=i+o.text.length)<=e)){if(i>=t)return!1;if(n)return(n=n.intersect(o.marks))&&n.size,!1;n=o.marks}}),n||Object(i.Set)()}},{key:"getActiveMarks",value:function(){var e=this;if(0===this.leaves.size)return Object(i.Set)();var t=this.leaves.first().marks;return 0===t.size?t:t.toOrderedSet().withMutations(function(t){e.leaves.forEach(function(e){if(t.intersect(e.marks),0===t.size)return!1})})}},{key:"getMarksBetweenOffsets",value:function(e,t){if(e<=0&&t>=this.text.length)return this.getMarks();if(e>=t)return Object(i.Set)();if(""===this.text)return this.getActiveMarks();var n=null,r=0;return this.leaves.forEach(function(o){var i=r;if(!((r=i+o.text.length)<=e))return!(i>=t)&&void(n=n?n.union(o.marks):o.marks)}),n||Object(i.Set)()}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return new i.OrderedSet(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:Object(i.Set)()}},{key:"insertText",value:function(e,t,n){if(""===this.text)return this.set("leaves",i.List.of(F.create({text:t,marks:n})));if(0===t.length)return this;n||(n=Object(i.Set)());var r=this.searchLeafAtOffset(e),o=r.startOffset,a=r.leaf,s=r.index,l=e-o,u=a.text.slice(0,l),c=a.text.slice(l),f=this.leaves;if(a.marks.equals(n))return this.set("leaves",f.set(s,a.set("text",u+t+c)));var d=f.splice(s,1,a.set("text",u),F.create({text:t,marks:n}),a.set("text",c));return this.setLeaves(d)}},{key:"removeMark",value:function(e,t,n){if(""===this.text&&0===e&&0===t){var r=this.leaves.first();if(!r)return this;var o=r.removeMark(n);return o===r?this:this.set("leaves",i.List.of(o))}if(t<=0)return this;if(e>=this.text.length)return this;var a=F.splitLeaves(this.leaves,e),s=x(a,2),l=s[0],u=s[1],c=F.splitLeaves(u,t),f=x(c,2),d=f[0],p=f[1],m=l.concat(d.map(function(e){return e.removeMark(n)}),p);return this.setLeaves(m)}},{key:"removeText",value:function(e,t){if(t<=0)return this;if(e>=this.text.length)return this;if(1===t){var n=this.searchLeafAtOffset(e+1),r=n.leaf,o=n.index,a=e-n.startOffset;if(r){if(1===r.text.length){var s=this.leaves.remove(o);return this.setLeaves(s)}var l=r.text.slice(0,a)+r.text.slice(a+t);if(l.length>0)return this.set("leaves",this.leaves.set(o,r.set("text",l)))}}var u=F.splitLeaves(this.leaves,e),c=x(u,2),f=c[0],d=c[1],p=F.splitLeaves(d,t)[1],m=F.createLeaves(f.concat(p));if(1===m.size){var h=m.first();if(""===h.text)return this.set("leaves",i.List.of(h.set("marks",this.getActiveMarks())))}return this.set("leaves",m)}},{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:"updateMark",value:function(e,t,n,r){var o=n.merge(r);if(""===this.text&&0===t&&0===e){var a=this.leaves.first();if(!a)return this;var s=a.updateMark(n,o);return s===a?this:this.set("leaves",i.List.of(s))}if(t<=0)return this;if(e>=this.text.length)return this;var l=F.splitLeaves(this.leaves,e),u=x(l,2),c=u[0],f=u[1],d=F.splitLeaves(f,t),p=x(d,2),m=p[0],h=p[1],_=c.concat(m.map(function(e){return e.updateMark(n,o)}),h);return this.setLeaves(_)}},{key:"splitText",value:function(e){var t=F.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:"setLeaves",value:function(e){var t=F.createLeaves(e);if(1===t.size){var n=t.first();if((!n.marks||0===n.marks.size)&&""===n.text)return this.set("leaves",Object(i.List)())}return this.set("leaves",F.createLeaves(e))}}],[{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}]}),o()(e)){if(e.text){var n=e,r=n.text,i=n.marks;e={key:n.key,leaves:[{text:r,marks:i}]}}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(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));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 n=e.key,r=void 0===n?y.create():n,o=e.leaves;if(o||(e.ranges?(Object(a.a)(!1,"As of slate@0.27.0, the `ranges` property of Slate objects has been renamed to `leaves`."),o=e.ranges):o=Object(i.List)()),Array.isArray(o))o=Object(i.List)(o.map(function(e){return F.create(e)}));else{if(!i.List.isList(o))throw new Error("leaves must be either Array or Immutable.List");o=o.map(function(e){return F.create(e)})}return new t({leaves:F.createLeaves(o),key:r})}},{key:"isTextList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isText(e)})}}]),t}(Object(i.Record)(z));V(W.prototype,["getActiveMarks","getMarks","getMarksAsArray"]);var K=function(){function e(){E(this,e)}return C(e,null,[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.isNode(t))return t;if(o()(t)){var n=t.object;switch(!n&&t.kind&&(Object(a.a)(!1,"As of slate@0.32.0, the `kind` property of Slate objects has been renamed to `object`."),n=t.kind),n){case"block":return Q.create(t);case"document":return I.create(t);case"inline":return A.create(t);case"text":return W.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(i.List.isList(t)||Array.isArray(t))return Object(i.List)(t.map(e.create));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(Q.isBlock(e)||A.isInline(e))return{data:e.data,type:e.type};if("string"==typeof e)return{type:e};if(o()(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=k.create(e.data)),t}throw new Error("`Node.createProperties` only accepts objects, strings, blocks or inlines, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.object;switch(!t&&e.kind&&(Object(a.a)(!1,"As of slate@0.32.0, the `kind` property of Slate objects has been renamed to `object`."),t=e.kind),t){case"block":return Q.fromJSON(e);case"document":return I.fromJSON(e);case"inline":return A.fromJSON(e);case"text":return W.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 Q.isBlock(e)||I.isDocument(e)||A.isInline(e)||W.isText(e)}},{key:"isNodeList",value:function(t){return i.List.isList(t)&&t.every(function(t){return e.isNode(t)})}}]),e}(),$={data:void 0,key:void 0,nodes:void 0,type:void 0},Q=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isBlock(e))return e;if("string"==typeof e&&(e={type:e}),o()(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(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));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 n=e.data,r=void 0===n?{}:n,o=e.key,a=void 0===o?y.create():o,s=e.nodes,l=void 0===s?[]:s,u=e.type;if("string"!=typeof u)throw new Error("`Block.fromJSON` requires a `type` string.");return new t({key:a,type:u,data:Object(i.Map)(r),nodes:K.createList(l)})}},{key:"isBlockList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isBlock(e)})}}]),t}(Object(i.Record)($)),X={};["deleteBackward","deleteCharBackward","deleteLineBackward","deleteWordBackward","deleteForward","deleteCharForward","deleteWordForward","deleteLineForward","setBlocks","setInlines","splitInline","unwrapBlock","unwrapInline","wrapBlock","wrapInline"].forEach(function(e){X[e]=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:1,n=e.value,r=n.selection,o=n.document,i=r.marks||o.getInsertMarksAtRange(r);e.splitBlockAtRange(r,t).moveToEnd(),i&&0!==i.size&&e.select({marks:i})},X.toggleMark=function(e,t){t=P.create(t),e.value.activeMarks.has(t)?e.removeMark(t):e.addMark(t)},X.wrapText=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=e.value.selection;e.wrapTextAtRange(r,t,n),r.isCollapsed&&e.moveStartBackward(t.length),e.moveEndBackward(n.length),r.isForward!=e.value.selection.isForward&&e.flip()};var J=55296,Z=57343,ee=/\s/,te=/['\u2018\u2019]/,ne=/[\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 re(e){return J<=e&&e<=Z}function oe(e,t){if(ee.test(e))return!1;if(te.test(e)){var n=t.charAt(0),r=ie(n);if(oe(n=t.slice(0,r),t.slice(r)))return!0}return!ne.test(e)}function ie(e){return re(e.charCodeAt(0))?2:1}function ae(e){return ie(e.charAt(0))}function se(e){for(var t=0,n=0,r=!1,o=void 0;o=e.charAt(n);){var i=ie(o);if(oe(o=e.slice(n,n+i),e.slice(n+i)))r=!0,t+=i;else{if(r)break;t+=i}n+=i}return t}var le={getCharLength:ie,getCharOffset:ae,getCharOffsetBackward:function(e,t){return e=e.slice(0,t),ae(e=Object(s.reverse)(e))},getCharOffsetForward:function(e,t){return ae(e=e.slice(t))},getWordOffset:se,getWordOffsetBackward:function(e,t){return e=e.slice(0,t),se(e=Object(s.reverse)(e))},getWordOffsetForward:function(e,t){return se(e=e.slice(t))},isSurrogate:re,isWord:oe},ue={};function ce(e,t){if(e.size!==t.size)return null;for(var n=0;no)return 1}return 0}function fe(e){if(null==e)return null;if(i.List.isList(e))return e;if(Array.isArray(e))return Object(i.List)(e);throw new Error("Paths can only be created from arrays or lists, but you passed: "+e)}function de(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ve(e,t);return[e.slice(0,n),t.slice(0,n)]}function pe(e){return me(e,0-(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1)}function me(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1,r=e.get(n)+t;return e.set(n,r)}function he(e,t){var n=de(e,t),r=x(n,2),o=r[0],i=r[1];return e.size2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){var r=e.value,o=r.document,i=r.schema,a=t,s=a.start,l=a.focus;if(t.isExpanded)e.deleteAtRange(t);else{var u=o.getClosestVoid(s.key,i);if(u)e.removeNodeByKey(u.key);else{var c=o.getClosestBlock(s.key);if(!c||i.isVoid(c)||""!==c.text||1===o.nodes.size){if(!s.isAtStartOfNode(o)){var f=o.getDescendant(s.key);if(s.isAtStartOfNode(f)){var d=o.getPreviousText(f.key),p=o.getClosestBlock(d.key),m=o.getClosestVoid(d.key,i);if(m)return void e.removeNodeByKey(m.key);if(1==n&&p!=c)return t=t.moveAnchorTo(d.key,d.text.length),void e.deleteAtRange(t)}if(ng;){var v=g+(h=o.getPreviousText(h.key)).text.length;if(n<=v){_=v-n;break}g=v}t=t.moveAnchorTo(h.key,_),e.deleteAtRange(t)}}else e.removeNodeByKey(c.key)}}}},ue.deleteCharForwardAtRange=function(e,t){var n=e.value.document,r=t.start,o=n.getClosestBlock(r.key),i=o.getOffset(r.key)+r.offset,a=o.text,s=le.getCharOffsetForward(a,i);e.deleteForwardAtRange(t,s)},ue.deleteLineForwardAtRange=function(e,t){var n=e.value.document,r=t.start,o=n.getClosestBlock(r.key),i=o.getOffset(r.key)+r.offset;e.deleteForwardAtRange(t,o.text.length-i)},ue.deleteWordForwardAtRange=function(e,t){var n=e.value.document,r=t.start,o=n.getClosestBlock(r.key),i=o.getOffset(r.key)+r.offset,a=o.text,s=le.getWordOffsetForward(a,i);e.deleteForwardAtRange(t,s)},ue.deleteForwardAtRange=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){var r=e.value,o=r.document,i=r.schema,a=t,s=a.start,l=a.focus;if(t.isExpanded)e.deleteAtRange(t);else{var u=o.getClosestVoid(s.key,i);if(u)e.removeNodeByKey(u.key);else{var c=o.getClosestBlock(s.key);if(c&&!i.isVoid(c)&&""===c.text&&1!==o.nodes.size){var f=o.getNextBlock(c.key);return e.removeNodeByKey(c.key),void(f&&f.key&&e.moveToStartOfNode(f))}if(!s.isAtEndOfNode(o)){var d=o.getDescendant(s.key);if(s.isAtEndOfNode(d)){var p=o.getNextText(d.key),m=o.getClosestBlock(p.key),h=o.getClosestVoid(p.key,i);if(h)return void e.removeNodeByKey(h.key);if(1==n&&m!=c)return t=t.moveFocusTo(p.key,0),void e.deleteAtRange(t)}if(n<=d.text.length-l.offset)return t=t.moveFocusForward(n),void e.deleteAtRange(t);for(var _=d,g=l.offset,v=d.text.length-l.offset;n>v;){var y=v+(_=o.getNextText(_.key)).text.length;if(n<=y){g=n-v;break}v=y}t=t.moveFocusTo(_.key,g),e.deleteAtRange(t)}}}}},ue.insertBlockAtRange=function(e,t,n){n=Q.create(n),t.isExpanded&&(e.deleteAtRange(t),t=t.moveToStart());var r=e.value,o=r.document,i=r.schema,a=t.start,s=a.key,l=a.offset,u=o.getClosestBlock(s),c=o.getClosestInline(s),f=o.getParent(u.key),d=f.nodes.indexOf(u);if(i.isVoid(u)){var p=a.isAtEndOfNode(u)?1:0;e.insertNodeByKey(f.key,d+p,n)}else if(c||""!==u.text)if(a.isAtStartOfNode(u))e.insertNodeByKey(f.key,d,n);else if(a.isAtEndOfNode(u))e.insertNodeByKey(f.key,d+1,n);else{if(c&&i.isVoid(c)){var m=a.isAtEndOfNode(c),h=m?o.getNextText(s):o.getPreviousText(s),_=m?t.moveToStartOfNode(h):t.moveToEndOfNode(h);s=_.start.key,l=_.start.offset}e.withoutNormalizing(function(){e.splitDescendantsByKey(u.key,s,l),e.insertNodeByKey(f.key,d+1,n)})}else e.insertNodeByKey(f.key,d+1,n)},ue.insertFragmentAtRange=function(e,t,n){e.withoutNormalizing(function(){if(t.isExpanded&&(e.deleteAtRange(t),t=e.value.document.getDescendant(t.start.key)?t.moveToStart():t.moveTo(t.end.key,0).normalize(e.value.document)),n.nodes.size){n=n.mapDescendants(function(e){return e.regenerateKey()});var r=t.start,o=e.value,a=o.schema,s=o.document,l=s.getDescendant(r.key),u=s.getClosestBlock(l.key),c=u.getFurthestAncestor(l.key),f=r.isAtStartOfNode(u),d=s.getParent(u.key),p=d.nodes.indexOf(u),m=n.getBlocks(),h=n.nodes.first(),_=n.nodes.last(),g=m.first(),v=m.last();if(g===v&&a.isVoid(g))e.insertBlockAtRange(t,g);else if(h.hasBlockChildren()||_.hasBlockChildren())n.nodes.reverse().forEach(function(n){e.insertBlockAtRange(t,n)});else{if(g!=v){var y=n.getFurthest(g.key,function(e){return 1==e.nodes.size})||g,b=d.nodes.indexOf(u);(n=n.removeNode(y.key)).nodes.forEach(function(t,n){var r=b+n+1;e.insertNodeByKey(d.key,r,t)})}if(0!=r.offset&&e.splitDescendantsByKey(c.key,r.key,r.offset),l=(s=e.value.document).getDescendant(r.key),c=(u=s.getClosestBlock(r.key)).getFurthestAncestor(l.key),g!=v){var E=f?c:u.getNextSibling(c.key),C=E?u.nodes.skipUntil(function(e){return e.key==E.key}):Object(i.List)(),S=v.nodes.size;C.forEach(function(t,n){var r=S+n;e.moveNodeByKey(t.key,v.key,r)})}if(a.isVoid(u)||""!==u.text){var D=u.getFurthestAncestor(l.key),w=u.nodes.indexOf(D);g.nodes.forEach(function(t,n){var o=0==r.offset?0:1,i=w+n+o;e.insertNodeByKey(u.key,i,t)})}else e.removeNodeByKey(u.key),e.insertNodeByKey(d.key,p,g)}}})},ue.insertInlineAtRange=function(e,t,n){n=A.create(n),e.withoutNormalizing(function(){t.isExpanded&&(e.deleteAtRange(t),t=t.moveToStart());var r=e.value,o=r.document,i=r.schema,a=t.start,s=o.getParent(a.key),l=o.assertDescendant(a.key),u=s.nodes.indexOf(l);i.isVoid(s)||(e.splitNodeByKey(a.key,a.offset),e.insertNodeByKey(s.key,u+1,n))})},ue.insertTextAtRange=function(e,t,n,r){var o=e.value,i=o.document,a=o.schema,s=t.start,l=s.key,u=s.offset,c=i.getParent(s.key);a.isVoid(c)||e.withoutNormalizing(function(){t.isExpanded&&(e.deleteAtRange(t),e.value.selection.start.key!==l&&(l=e.value.selection.start.key,u=e.value.selection.start.offset)),e.insertTextByKey(l,u,n,r)})},ue.removeMarkAtRange=function(e,t,n){if(!t.isCollapsed){var r=e.value.document.getTextsAtRange(t),o=t.start,i=t.end;e.withoutNormalizing(function(){r.forEach(function(t){var r=t.key,a=0,s=t.text.length;r==o.key&&(a=o.offset),r==i.key&&(s=i.offset),r==o.key&&r==i.key&&(s=i.offset-o.offset),e.removeMarkByKey(r,a,s,n)})})}},ue.setBlocksAtRange=function(e,t,n){var r=e.value,o=r.document,i=r.schema,a=o.getBlocksAtRange(t),s=t.start,l=t.end,u=t.isCollapsed,c=o.hasVoidParent(s.key,i),f=o.getClosestBlock(s.key),d=o.getClosestBlock(l.key),p=0==u&&0==s.offset&&0==l.offset&&0==c&&s.key==f.getFirstText().key&&l.key==d.getFirstText().key?a.slice(0,-1):a;e.withoutNormalizing(function(){p.forEach(function(t){e.setNodeByKey(t.key,n)})})},ue.setInlinesAtRange=function(e,t,n){var r=e.value.document.getInlinesAtRange(t);e.withoutNormalizing(function(){r.forEach(function(t){e.setNodeByKey(t.key,n)})})},ue.splitBlockAtRange=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t,o=r.start,i=r.end,a=e.value,s=a.document,l=s.assertDescendant(o.key),u=s.getClosestBlock(l.key),c=0;u&&"block"==u.object&&c2&&void 0!==arguments[2]?arguments[2]:1/0;t.isExpanded&&(e.deleteAtRange(t),t=t.moveToStart());for(var r=t.start,o=e.value.document,i=o.assertDescendant(r.key),a=o.getClosestInline(i.key),s=0;a&&"inline"==a.object&&s3&&void 0!==arguments[3]?arguments[3]:n,o=t.start,i=t.end,a=t.moveToStart(),s=t.moveToEnd();o.key==i.key&&(s=s.moveForward(n.length)),e.withoutNormalizing(function(){e.insertTextAtRange(a,n,[]),e.insertTextAtRange(s,r,[])})};var ye={compare:ce,create:fe,crop:de,decrement:pe,increment:me,isAbove:he,isAfter:function(e,t){var n=de(e,t),r=x(n,2);return 1===ce(r[0],r[1])},isBefore:function(e,t){var n=de(e,t),r=x(n,2);return-1===ce(r[0],r[1])},isEqual:_e,isOlder:function(e,t){var n=e.size-1,r=de(e,t,n),o=x(r,2),i=o[0],a=o[1],s=e.get(n),l=t.get(n);return _e(i,a)&&s>l},isSibling:function(e,t){if(e.size!==t.size)return!1;var n=e.butLast(),r=t.butLast();return n.equals(r)},isYounger:ge,lift:function(e){return e.slice(0,-1)},max:function(e,t){return Math.max(e.size,t.size)},min:ve,relate:function(e,t){for(var n=[],r=0;r=r&&(e=pe(e=me(e,1,a),r,a+1))),"move_node"===n){var c=t.newPath,f=c.size-1,d=_e(c,e),p=ge(c,e),m=he(c,e);u?e=c.concat(e.slice(o.size)):(s?e=c:l&&(e=pe(e,1,a)),(d||p||m)&&(e=me(e,1,f)))}var h=Array.isArray(e)?e:[e];return Object(i.List)(h)}},be={addMarkByPath:function(e,t,n,r,o){o=P.create(o);var i=e.value,a=[],s=n,l=n+r,u=0;i.document.assertNode(t).getLeaves().forEach(function(e){var n=u,r=n+e.text.length;if(u+=e.text.length,!(rs.text.length&&(r=s.text.length-n);var l=a.createRange({anchor:{path:t,offset:n},focus:{path:t,offset:n+r}}),u=a.getActiveMarksAtRange(l);e.withoutNormalizing(function(){e.removeTextByPath(t,n,r),i?u&&(u=u.filter(function(e){return!i.find(function(t){return e.type===t.type})}),i=u.merge(i)):i=u||[],e.insertTextByPath(t,n,o,i)})},setMarkByPath:function(e,t,n,r,o,i){o=P.create(o),i=P.createProperties(i);var a=e.value;e.applyOperation({type:"set_mark",value:a,path:t,offset:n,length:r,mark:o,properties:i})},setNodeByPath:function(e,t,n){n=K.createProperties(n);var r=e.value,o=r.document.assertNode(t);e.applyOperation({type:"set_node",value:r,path:t,node:o,properties:n})},setTextByPath:function(e,t,n,r){var o=e.value.document.assertNode(t).text.length;e.replaceTextByPath(t,0,o,n,r)},splitNodeByPath:function(e,t,n){var r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).target,o=void 0===r?null:r,i=e.value,a=i.document.getDescendant(t);e.applyOperation({type:"split_node",value:i,path:t,position:n,target:o,properties:{type:a.type,data:a.data}})},splitDescendantsByPath:function(e,t,n,r){if(t.equals(n))e.splitNodeByPath(n,r);else{var o=e.value.document,i=o.assertNode(t),a=o.assertNode(n),s=o.getAncestors(n).skipUntil(function(e){return e.key==i.key}).reverse().unshift(a),l=void 0,u=void 0;e.withoutNormalizing(function(){s.forEach(function(t){var n=null==u?null:u;u=l?t.nodes.indexOf(l)+1:r,l=t,e.splitNodeByKey(t.key,u,{target:n})})})}},unwrapInlineByPath:function(e,t,n){var r=e.value,o=r.document,i=r.selection,a=o.assertNode(t),s=a.getFirstText(),l=a.getLastText(),u=i.moveToRangeOfNode(s,l);e.unwrapInlineAtRange(u,n)},unwrapBlockByPath:function(e,t,n){var r=e.value,o=r.document,i=r.selection,a=o.assertNode(t),s=a.getFirstText(),l=a.getLastText(),u=i.moveToRangeOfNode(s,l);e.unwrapBlockAtRange(u,n)},unwrapNodeByPath:function(e,t){var n=e.value.document;n.assertNode(t);var r=ye.lift(t),o=n.assertNode(r),i=t.last(),a=r.last(),s=ye.lift(r),l=0===i,u=i===o.nodes.size-1;e.withoutNormalizing(function(){if(1===o.nodes.size)e.moveNodeByPath(t,s,a+1),e.removeNodeByPath(r);else if(l)e.moveNodeByPath(t,s,a);else if(u)e.moveNodeByPath(t,s,a+1);else{var n=ye.increment(t,1,r.size-1);n=n.set(n.size-1,0),e.splitNodeByPath(r,i),e.moveNodeByPath(n,s,a+1)}})},wrapBlockByPath:function(e,t,n){n=(n=Q.create(n)).set("nodes",n.nodes.clear());var r=ye.lift(t),o=t.last(),i=ye.increment(t);e.withoutNormalizing(function(){e.insertNodeByPath(r,o,n),e.moveNodeByPath(i,t,0)})},wrapInlineByPath:function(e,t,n){n=(n=A.create(n)).set("nodes",n.nodes.clear());var r=ye.lift(t),o=t.last(),i=ye.increment(t);e.withoutNormalizing(function(){e.insertNodeByPath(r,o,n),e.moveNodeByPath(i,t,0)})},wrapNodeByPath:function(e,t,n){"block"===(n=K.create(n)).object?e.wrapBlockByPath(t,n):"inline"===n.object&&e.wrapInlineByPath(t,n)}},Ee=function(e){be[e+"ByKey"]=function(t,n){for(var r=arguments.length,o=Array(r>2?r-2:0),i=2;i3?r-3:0),i=3;i3?r-3:0),i=3;i0&&void 0!==arguments[0]?arguments[0]:1;return 0===e?this:e<0?this.moveForward(-e):this.setOffset(this.offset-e)}},{key:"moveForward",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return 0===e?this:e<0?this.moveBackward(-e):this.setOffset(this.offset+e)}},{key:"moveTo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.key;return"number"==typeof e?(t=e,e=this.path):"string"==typeof e?e=(n=e)===this.key?this.path:null:n=e.equals(this.path)?this.key:null,this.merge({key:n,path:e,offset:t})}},{key:"moveToStartOfNode",value:function(e){var t=e.getFirstText();return this.moveTo(t.key,0)}},{key:"moveToEndOfNode",value:function(e){var t=e.getLastText();return this.moveTo(t.key,t.text.length)}},{key:"normalize",value:function(e){if(null==this.key&&null==this.path)return this.setOffset(null);var n=this.key,r=this.offset,o=this.path,i=e.getNode(n||o);if(!i){Object(a.a)(!1,"A point's `path` or `key` invalid and was reset!");var s=e.getFirstText();return s?this.merge({key:s.key,offset:0,path:e.getPath(s.key)}):t.create()}if("text"!==i.object){Object(a.a)(!1,"A point should not reference a non-text node!");var l=i.getTextAtOffset(r),u=i.getOffset(l.key);return this.merge({offset:r-u,key:l.key,path:e.getPath(l.key)})}return i&&o&&n&&n!==i.key&&Object(a.a)(!1,"A point's `key` did not match its `path`!"),this.merge({key:i.key,path:null==o?e.getPath(i.key):o,offset:null==r?0:Math.min(r,i.text.length)})}},{key:"setKey",value:function(e){return null!==e&&(e=y.create(e)),this.set("key",e)}},{key:"setOffset",value:function(e){return this.set("offset",e)}},{key:"setPath",value:function(e){return null!==e&&(e=ye.create(e)),this.set("path",e)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,key:this.key,offset:this.offset,path:this.path&&this.path.toArray()};return e.preserveKeys||delete t.key,t}},{key:"unset",value:function(){return this.merge({key:null,offset:null,path:null})}},{key:"isSet",get:function(){return null!=this.key&&null!=this.offset&&null!=this.path}},{key:"isUnset",get:function(){return!this.isSet}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isPoint(e))return e;if(o()(e))return t.fromJSON(e);throw new Error("`Point.create` only accepts objects or points, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isPoint(e))return{key:e.key,offset:e.offset,path:e.path};if(o()(e)){var n={};return"key"in e&&(n.key=e.key),"offset"in e&&(n.offset=e.offset),"path"in e&&(n.path=ye.create(e.path)),"path"in e&&!("key"in e)&&(n.key=null),"key"in e&&!("path"in e)&&(n.path=null),n}throw new Error("`Point.createProperties` only accepts objects or points, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.key,r=void 0===n?null:n,o=e.offset,i=void 0===o?null:o,a=e.path,s=void 0===a?null:a;return new t({key:r,offset:i,path:ye.create(s)})}}]),t}(Object(i.Record)(Re)),Ne={anchor:void 0,focus:void 0,mark:void 0},Ie=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(t,[{key:"setProperties",value:function(e){var n=e=t.createProperties(e),r=n.anchor,o=n.focus,i=n.mark,a={};return r&&(a.anchor=ke.create(r)),o&&(a.focus=ke.create(o)),i&&(a.mark=P.create(i)),this.merge(a)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e),mark:this.mark.toJSON(e)}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isDecoration(e))return e;if(Pe.isRange(e))return t.fromJSON(Pe.createProperties(e));if(o()(e))return t.fromJSON(e);throw new Error("`Decoration.create` only accepts objects or decorations, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));throw new Error("`Decoration.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isDecoration(e))return{anchor:ke.createProperties(e.anchor),focus:ke.createProperties(e.focus),mark:P.create(e.mark)};if(o()(e)){var n={};return"anchor"in e&&(n.anchor=ke.create(e.anchor)),"focus"in e&&(n.focus=ke.create(e.focus)),"mark"in e&&(n.mark=P.create(e.mark)),n}throw new Error("`Decoration.createProperties` only accepts objects or decorations, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.anchor,r=e.focus,o=e.mark;if(!o)throw new Error("Decorations must be created with a `mark`, but you passed: "+JSON.stringify(e));return new t({anchor:ke.fromJSON(n||{}),focus:ke.fromJSON(r||{}),mark:P.fromJSON(o)})}}]),t}(Object(i.Record)(Ne)),Oe={block:"@@__SLATE_BLOCK__@@",change:"@@__SLATE_CHANGE__@@",decoration:"@@__SLATE_DECORATION__@@",document:"@@__SLATE_DOCUMENT__@@",history:"@@__SLATE_HISTORY__@@",inline:"@@__SLATE_INLINE__@@",leaf:"@@__SLATE_LEAF__@@",mark:"@@__SLATE_MARK__@@",operation:"@@__SLATE_OPERATION__@@",point:"@@__SLATE_POINT__@@",range:"@@__SLATE_RANGE__@@",schema:"@@__SLATE_SCHEMA__@@",selection:"@@__SLATE_SELECTION__@@",stack:"@@__SLATE_STACK__@@",text:"@@__SLATE_TEXT__@@",value:"@@__SLATE_VALUE__@@"};function Ae(e,t){return!(!t||!t[Oe[e]])}var Me={anchor:void 0,focus:void 0},Pe=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isRange(e))return"range"===e.object?e:t.fromJSON(t.createProperties(e));if(o()(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(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));throw new Error("`Range.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isRange(e))return{anchor:ke.createProperties(e.anchor),focus:ke.createProperties(e.focus)};if(o()(e)){var n={};return"anchor"in e&&(n.anchor=ke.create(e.anchor)),"focus"in e&&(n.focus=ke.create(e.focus)),n}throw new Error("`Range.createProperties` only accepts objects, decorations, ranges or selections, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.anchor,r=e.focus;return new t({anchor:ke.fromJSON(n||{}),focus:ke.fromJSON(r||{})})}},{key:"isRange",value:function(e){return Ae("range",e)||Ie.isDecoration(e)||Fe.isSelection(e)}}]),t}(Object(i.Record)(Me)),Le={anchor:void 0,focus:void 0,isFocused:void 0,marks:void 0},Fe=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(t,[{key:"setIsFocused",value:function(e){return this.set("isFocused",e)}},{key:"setMarks",value:function(e){return this.set("marks",e)}},{key:"setProperties",value:function(e){var n=e=t.createProperties(e),r=n.anchor,o=n.focus,i=w(n,["anchor","focus"]);return r&&(i.anchor=ke.create(r)),o&&(i.focus=ke.create(o)),this.merge(i)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e),isFocused:this.isFocused,marks:null==this.marks?null:this.marks.toArray().map(function(e){return e.toJSON()})}}},{key:"isBlurred",get:function(){return!this.isFocused}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isSelection(e))return e;if(Pe.isRange(e))return t.fromJSON(Pe.createProperties(e));if(o()(e))return t.fromJSON(e);throw new Error("`Selection.create` only accepts objects, ranges or selections, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isSelection(e))return{anchor:ke.createProperties(e.anchor),focus:ke.createProperties(e.focus),isFocused:e.isFocused,marks:e.marks};if(Pe.isRange(e))return{anchor:ke.createProperties(e.anchor),focus:ke.createProperties(e.focus)};if(o()(e)){var n={};return"anchor"in e&&(n.anchor=ke.create(e.anchor)),"focus"in e&&(n.focus=ke.create(e.focus)),"isFocused"in e&&(n.isFocused=e.isFocused),"marks"in e&&(n.marks=null==e.marks?null:P.createSet(e.marks)),n}throw new Error("`Selection.createProperties` only accepts objects, ranges or selections, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.anchor,r=e.focus,o=e.isFocused,a=void 0!==o&&o,s=e.marks,l=void 0===s?null:s;return new t({anchor:ke.fromJSON(n||{}),focus:ke.fromJSON(r||{}),isFocused:a,marks:null==l?null:new i.Set(l.map(P.fromJSON))})}}]),t}(Object(i.Record)(Le)),Ue={};function je(e,t){for(var n,r=arguments.length,o=Array(r>2?r-2:0),i=2;i2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){if(n<0)return Ve(e,t,-n);var r=t.slice(0,1).toUpperCase()+t.slice(1),o=e.value,i=o.document,a=o.selection,s=o.schema,l=a[t],u=i.hasVoidParent(l.path,s);if(!u&&l.offset-n>=0){var c=a["move"+r+"Backward"](n);e.select(c)}else{var f=i.getPreviousText(l.path);if(f){var d=i.getClosestBlock(l.path).hasNode(f.key),p=f&&i.hasVoidParent(f.key,s);if(e["move"+r+"ToEndOfNode"](f),!u&&!p&&d){var m=e.value.selection["move"+r+"Backward"](n);e.select(m)}}}}}function Ve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){if(n<0)return qe(e,t,-n);var r=t.slice(0,1).toUpperCase()+t.slice(1),o=e.value,i=o.document,a=o.selection,s=o.schema,l=a[t],u=i.getNode(l.path),c=i.hasVoidParent(l.path,s);if(!c&&l.offset+n<=u.text.length){var f=a["move"+r+"Forward"](n);e.select(f)}else{var d=i.getNextText(l.path);if(d){var p=i.getClosestBlock(l.path).hasNode(d.key),m=i.hasVoidParent(d.key,s);if(e["move"+r+"ToStartOfNode"](d),!c&&!m&&p){var h=e.value.selection["move"+r+"Forward"](n);e.select(h)}}}}}Ue.blur=function(e){e.select({isFocused:!1})},Ue.deselect=function(e){var t=Fe.create();e.select(t)},Ue.focus=function(e){e.select({isFocused:!0})},Ue.flip=function(e){e.call(je,"flip")},Ue.moveAnchorBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?n-1:0),o=1;o1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?n-1:0),o=1;o1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:{};t=Fe.createProperties(t);var r=n.snapshot,o=void 0!==r&&r,a=e.value,s=a.document,l=a.selection,u={},c=l.setProperties(t);for(var d in c=s.resolveSelection(c),t=f()(c,Object.keys(t)))!0!==o&&Object(i.is)(t[d],l[d])||(u[d]=t[d]);l.marks&&!u.marks&&(u.anchor||u.focus)&&(u.marks=null),0!==Object.keys(u).length&&e.applyOperation({type:"set_selection",value:a,properties:u,selection:l.toJSON()},o?{skip:!1,merge:!1}:{})},Ue.setAnchor=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:{},n=this,r=n,o=r.undos,a=r.redos,s=t.merge;if(t.skip)return n;var l=o.peek(),u=l&&l.last();if(null==s&&(s=function(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&&e.path.equals(t.path)||"remove_text"==e.type&&"remove_text"==t.type&&e.offset+e.text.length==t.offset&&e.path.equals(t.path))}(e,u)),He("save",{operation:e,merge:s}),s&&l){var c=l.push(e);o=(o=o.pop()).push(c)}else{var f=new i.List([e]);o=o.push(f)}return o.size>100&&(o=o.take(100)),a=a.clear(),n=n.set("undos",o).set("redos",a)}},{key:"toJSON",value:function(){return{object:this.object,redos:this.redos.toJSON(),undos:this.undos.toJSON()}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isHistory(e))return e;if(o()(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(i.List.isList(e))return e;if(Array.isArray(e))return new i.List(e);throw new Error("`History.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.redos,r=void 0===n?[]:n,o=e.undos,a=void 0===o?[]:o;return new t({redos:new i.Stack(r.map(this.createOperationsList)),undos:new i.Stack(a.map(this.createOperationsList))})}}]),t}(Object(i.Record)(Ye));var We={plugins:void 0},Ke=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(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),n=arguments.length,r=Array(n>1?n-1:0),o=1;o1?r-1:0),i=1;i1?n-1:0),o=1;o2?n-2:0),o=2;o0&&void 0!==arguments[0]?arguments[0]:{}).plugins;return new t({plugins:void 0===e?[]:e})}}]),t}(Object(i.Record)(We));V(Ke.prototype,["getPluginsWith"]);var $e=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};E(this,t);var r=T(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));for(var o in r.code=e,n)r[o]=n[o];return Error.captureStackTrace?Error.captureStackTrace(r,r.constructor):r.stack=(new Error).stack,r}return D(t,e),t}(Error),Qe=p()("slate:schema"),Xe=[{match:{object:"document"},nodes:[{match:{object:"block"}}]},{match:{object:"block",first:{object:"block"}},nodes:[{match:{object:"block"}}]},{match:{object:"block",first:[{object:"inline"},{object:"text"}]},nodes:[{match:[{object:"inline"},{object:"text"}]}]},{match:{object:"inline"},nodes:[{match:[{object:"inline"},{object:"text"}]}]},{match:[{object:"block"},{object:"inline"}],nodes:[{min:1}],normalize:function(e,t){var n=t.code,r=t.node;"child_required"===n&&e.insertNodeByKey(r.key,0,W.create(),{normalize:!1})}},{match:{object:"block"},first:[{object:"block"},{object:"text"}],last:[{object:"block"},{object:"text"}],normalize:function(e,t){var n=t.code,r=t.node,o=W.create(),i=void 0;if("first_child_object_invalid"===n)i=0;else{if("last_child_object_invalid"!==n)return;i=r.nodes.size}e.insertNodeByKey(r.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 n=t.code,r=t.node,o=t.index,i=W.create(),a=void 0;if("first_child_object_invalid"===n)a=0;else if("last_child_object_invalid"===n)a=r.nodes.size;else if("previous_sibling_object_invalid"===n)a=o;else{if("next_sibling_object_invalid"!==n)return;a=o+1}e.insertNodeByKey(r.key,a,i,{normalize:!1})}},{match:{object:"text"},next:[{object:"block"},{object:"inline"}],normalize:function(e,t){var n=t.code,r=t.next;"next_sibling_object_invalid"===n&&e.mergeNodeByKey(r.key,{normalize:!1})}}],Je={stack:void 0,rules:void 0},Ze=function(e){function t(){return E(this,t),T(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return D(t,e),C(t,[{key:"getNodeRules",value:function(e){return this.rules.filter(function(t){return et(e,t.match)})}},{key:"validateNode",value:function(e){var t=tt(e,this.getNodeRules(e),this.rules,{every:!0});if(t)return new $e(t.code,t)}},{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 n=this.validateNode(e);if(n)return function(e){Qe("normalizing",{error:n});var t=n.rule,r=e.operations.size;t.normalize&&t.normalize(e,n),e.operations.size===r&&function(e,t){var n=t.code,r=t.node,o=t.child,i=t.next,a=t.previous,s=t.key,l=t.mark;switch(n){case"child_object_invalid":case"child_type_invalid":case"child_unknown":case"first_child_object_invalid":case"first_child_type_invalid":case"last_child_object_invalid":case"last_child_type_invalid":return"text"===o.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key,{normalize:!1}):e.removeNodeByKey(o.key,{normalize:!1});case"previous_sibling_object_invalid":case"previous_sibling_type_invalid":return"text"===a.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key,{normalize:!1}):e.removeNodeByKey(a.key,{normalize:!1});case"next_sibling_object_invalid":case"next_sibling_type_invalid":return"text"===i.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key,{normalize:!1}):e.removeNodeByKey(i.key,{normalize:!1});case"child_required":case"node_text_invalid":case"parent_object_invalid":case"parent_type_invalid":return"document"===r.object?r.nodes.forEach(function(t){return e.removeNodeByKey(t.key,{normalize:!1})}):e.removeNodeByKey(r.key,{normalize:!1});case"node_data_invalid":return void 0===r.data.get(s)&&"document"!==r.object?e.removeNodeByKey(r.key,{normalize:!1}):e.setNodeByKey(r.key,{data:r.data.delete(s)},{normalize:!1});case"node_mark_invalid":return r.getTexts().forEach(function(t){return e.removeMarkByKey(t.key,0,t.text.length,l,{normalize:!1})});default:e.removeNodeByKey(r.key,{normalize:!1})}}(e,n)}}}},{key:"isAtomic",value:function(e){var t=this.rules.find(function(t){return"isAtomic"in t&&et(e,t.match)});return!!t&&t.isAtomic}},{key:"isVoid",value:function(e){var t=this.rules.find(function(t){return"isVoid"in t&&et(e,t.match)});return!!t&&t.isVoid}},{key:"toJSON",value:function(){return{object:this.object,rules:this.rules}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isSchema(e))return e;if(o()(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 n=e.plugins?e.plugins:[{schema:e}],r=[].concat(Xe),o=!0,i=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(o=(s=l.next()).done);o=!0){var u=s.value.schema,c=void 0===u?{}:u,f=c.blocks,d=void 0===f?{}:f,p=c.inlines,m=void 0===p?{}:p,h=c.marks,_=void 0===h?{}:h;for(var g in c.rules&&(r=r.concat(c.rules)),c.document&&r.push(S({match:[{object:"document"}]},c.document)),d)r.push(S({match:[{object:"block",type:g}]},d[g]));for(var v in m)r.push(S({match:[{object:"inline",type:v}]},m[v]));for(var y in _)r.push(S({match:[{object:"mark",type:y}]},_[y]))}}catch(e){i=!0,a=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw a}}return new t({stack:Ke.create({plugins:n}),rules:r})}}]),t}(Object(i.Record)(Je));function et(e,t){return!tt(e,t)}function tt(e,t,n){var r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).every,o=void 0!==r&&r;if(Array.isArray(t)){var i=t.length?t:[{}],a=void 0,s=!0,l=!1,u=void 0;try{for(var c,f=i[Symbol.iterator]();!(s=(c=f.next()).done);s=!0){var d=tt(e,c.value,n);if(a=a||d,o&&d)return d;if(!o&&!d)return}}catch(e){l=!0,u=e}finally{try{!s&&f.return&&f.return()}finally{if(l)throw u}}return a}return function(e,t){if(null==t.object)return;if(t.object===e.object)return;if("function"==typeof t.object&&t.object(e.object))return;return it("node_object_invalid",{rule:t,node:e})}(e,t)||function(e,t){if(null==t.type)return;if(t.type===e.type)return;if("function"==typeof t.type&&t.type(e.type))return;return it("node_type_invalid",{rule:t,node:e})}(e,t)||function(e,t){if(null==t.data)return;if(null==e.data)return;if("function"==typeof t.data){if(t.data(e.data))return;return it("node_data_invalid",{rule:t,node:e})}for(var n in t.data){var r=t.data[n],o=e.data&&e.data.get(n),i="function"==typeof r?r(o):r===o;if(!i)return it("node_data_invalid",{rule:t,node:e,key:n,value:o})}}(e,t)||function(e,t){if(null==t.marks)return;var n=e.getMarks().toArray(),r=function(n){var r=t.marks.some(function(e){return"function"==typeof e.type?e.type(n.type):e.type===n.type});return r?"continue":{v:it("node_mark_invalid",{rule:t,node:e,mark:n})}},o=!0,i=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(o=(s=l.next()).done);o=!0){var u=s.value,c=r(u);switch(c){case"continue":continue;default:if("object"===(void 0===c?"undefined":b(c)))return c.v}}}catch(e){i=!0,a=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw a}}}(e,t)||function(e,t){if(null==t.text)return;var n=e.text;if("function"==typeof t.text?t.text(n):t.text.test(n))return;return it("node_text_invalid",{rule:t,node:e,text:n})}(e,t)||function(e,t){if(null==t.first)return;var n=e.nodes.first();if(!n)return;var r=tt(n,t.first);if(!r)return;return r.rule=t,r.node=e,r.child=n,r.code=r.code.replace("node_","first_child_"),r}(e,t)||function(e,t){if(null==t.last)return;var n=e.nodes.last();if(!n)return;var r=tt(n,t.last);if(!r)return;return r.rule=t,r.node=e,r.child=n,r.code=r.code.replace("node_","last_child_"),r}(e,t)||function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(null==e.nodes)return;var r=e.nodes.toArray(),o=null!=t.nodes?t.nodes.slice():[],i=void 0,a=void 0,s=void 0,l=void 0,u=void 0,c=void 0,f=void 0,d=void 0;function p(){return i=null==i?null:0,l=o.shift(),a=l&&l.min,u=l&&l.max,!!l}function m(){return s=null==s?0:s+1,i=null==i?0:i+1,f=c,c=r[s],d=r[s+1],null!=u&&i==u&&p(),!!c}function h(){i-=1,s-=1}null!=t.nodes&&p();for(;m();){var _=nt(e,c,n)||rt(e,c,f,s,n)||ot(e,c,d,s,n);if(_)return _;if(null!=t.nodes){if(!l)return it("child_unknown",{rule:t,node:e,child:c,index:s});if(l.match){var g=tt(c,l.match);if(g&&i>=a&&p()){h();continue}if(g)return g.rule=t,g.node=e,g.child=c,g.index=s,g.code=g.code.replace("node_","child_"),g}}}if(null!=t.nodes)for(;null!=a;){if(i0&&void 0!==arguments[0]?arguments[0]:{};return new vt(S({},e,{value:this}))}},{key:"addMark",value:function(e,t,n,r){var o=this,i=o.document;return i=i.addMark(e,t,n,r),o=this.set("document",i)}},{key:"insertNode",value:function(e,t){var n=this,r=n.document;return r=r.insertNode(e,t),n=(n=n.set("document",r)).mapRanges(function(e){return e.updatePoints(function(e){return e.setPath(null)})})}},{key:"insertText",value:function(e,t,n,r){var o=this,i=o,a=i.document,s=i.schema;a=a.insertText(e,t,n,r),o=o.set("document",a);var l=a.assertNode(e);return o=(o=o.mapRanges(function(e){var r=e,o=r.anchor,i=r.focus,a=r.isBackward,u=Ie.isDecoration(e)&&s.isAtomic(e.mark);return o.key!==l.key||!(o.offset>t)&&(o.offset!==t||u&&a)||(e=e.moveAnchorForward(n.length)),i.key===l.key&&(i.offset>t||i.offset==t&&(!u||a))&&(e=e.moveFocusForward(n.length)),e})).clearAtomicRanges(l.key,t)}},{key:"mergeNode",value:function(e){var t=this,n=t.document,r=n.mergeNode(e);e=n.resolvePath(e);var o=ye.decrement(e),i=n.getNode(o),a=n.getNode(e);return t=(t=t.set("document",r)).mapRanges(function(e){if("text"===a.object){var t=i.text.length;e.anchor.key===a.key&&(e=e.moveAnchorTo(i.key,t+e.anchor.offset)),e.focus.key===a.key&&(e=e.moveFocusTo(i.key,t+e.focus.offset))}return e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"moveNode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this,o=r.document;return o=o.moveNode(e,t,n),r=(r=r.set("document",o)).mapRanges(function(e){return e.updatePoints(function(e){return e.setPath(null)})})}},{key:"removeMark",value:function(e,t,n,r){var o=this,i=o.document;return i=i.removeMark(e,t,n,r),o=this.set("document",i)}},{key:"removeNode",value:function(e){var t=this,n=t.document,r=n.assertNode(e),o="text"==r.object?r:r.getFirstText()||r,i="text"==r.object?r:r.getLastText()||r,a=n.getPreviousText(o.key),s=n.getNextText(i.key);return n=n.removeNode(e),t=(t=t.set("document",n)).mapRanges(function(e){var t=e,n=t.start,o=t.end;return r.hasNode(n.key)&&(e=a?e.moveStartTo(a.key,a.text.length):s?e.moveStartTo(s.key,0):e.unset()),r.hasNode(o.key)&&(e=a?e.moveEndTo(a.key,a.text.length):s?e.moveEndTo(s.key,0):e.unset()),e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"removeText",value:function(e,t,n){var r=this,o=r.document;o=o.removeText(e,t,n),r=r.set("document",o);var i=o.assertNode(e),a=n.length,s=t+a;return r=(r=r.clearAtomicRanges(i.key,t,t+a)).mapRanges(function(e){var n=e,r=n.anchor,o=n.focus;return r.key===i.key&&(e=r.offset>=s?e.moveAnchorBackward(a):r.offset>t?e.moveAnchorTo(r.key,t):e),o.key===i.key&&(e=o.offset>=s?e.moveFocusBackward(a):o.offset>t?e.moveFocusTo(o.key,t):e),e})}},{key:"setNode",value:function(e,t){var n=this,r=n.document;return r=r.setNode(e,t),n=n.set("document",r)}},{key:"setMark",value:function(e,t,n,r,o){var i=this,a=i.document;return a=a.setMark(e,t,n,r,o),i=i.set("document",a)}},{key:"setProperties",value:function(e){var t=this,n=t.document,r=e.data,o=e.decorations,i=e.history,a=e.schema,s={};return r&&(s.data=r),i&&(s.history=i),a&&(s.schema=a),o&&(s.decorations=o.map(function(e){return e.isSet?e:n.resolveDecoration(e)})),t=t.merge(s)}},{key:"setSelection",value:function(e){var t=this,n=t,r=n.document,o=n.selection,i=o.setProperties(e);return o=r.resolveSelection(i),t=t.set("selection",o)}},{key:"splitNode",value:function(e,t,n){var r=this,o=r.document,i=o.splitNode(e,t,n),a=o.assertNode(e);return r=(r=r.set("document",i)).mapRanges(function(e){var n=i.getNextText(a.key),r=e,o=r.start,s=r.end;return a.key===o.key&&t<=o.offset&&(e=e.moveStartTo(n.key,o.offset-t)),a.key===s.key&&t<=s.offset&&(e=e.moveEndTo(n.key,s.offset-t)),e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"mapRanges",value:function(e){var t=this,n=t,r=n.document,o=n.selection,i=n.decorations,a=o.isSet?e(o):o;a||(a=o.unset()),a!==o&&(a=r.createSelection(a)),t=t.set("selection",a);var s=i.map(function(t){var n=t.isSet?e(t):t;return n&&n!==t&&(n=r.createDecoration(n)),n});return s=s.filter(function(e){return!!e}),t=t.set("decorations",s)}},{key:"clearAtomicRanges",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this,o=r.schema;return r=this.mapRanges(function(r){if(!Ie.isDecoration(r))return r;var i=r.start,a=r.end,s=r.mark;return o.isAtomic(s)?i.key!==e?r:i.offsett)?null:null!=n&&i.offsetn)?null:r:r})}},{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.toArray().map(function(t){return t.toJSON(e)})),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:"startBlock",get:function(){return this.selection.start.key&&this.document.getClosestBlock(this.selection.start.key)}},{key:"endBlock",get:function(){return this.selection.end.key&&this.document.getClosestBlock(this.selection.end.key)}},{key:"anchorBlock",get:function(){return this.selection.anchor.key&&this.document.getClosestBlock(this.selection.anchor.key)}},{key:"focusBlock",get:function(){return this.selection.focus.key&&this.document.getClosestBlock(this.selection.focus.key)}},{key:"startInline",get:function(){return this.selection.start.key&&this.document.getClosestInline(this.selection.start.key)}},{key:"endInline",get:function(){return this.selection.end.key&&this.document.getClosestInline(this.selection.end.key)}},{key:"anchorInline",get:function(){return this.selection.anchor.key&&this.document.getClosestInline(this.selection.anchor.key)}},{key:"focusInline",get:function(){return this.selection.focus.key&&this.document.getClosestInline(this.selection.focus.key)}},{key:"startText",get:function(){return this.selection.start.key&&this.document.getDescendant(this.selection.start.key)}},{key:"endText",get:function(){return this.selection.end.key&&this.document.getDescendant(this.selection.end.key)}},{key:"anchorText",get:function(){return this.selection.anchor.key&&this.document.getDescendant(this.selection.anchor.key)}},{key:"focusText",get:function(){return this.selection.focus.key&&this.document.getDescendant(this.selection.focus.key)}},{key:"nextBlock",get:function(){return this.selection.end.key&&this.document.getNextBlock(this.selection.end.key)}},{key:"previousBlock",get:function(){return this.selection.start.key&&this.document.getPreviousBlock(this.selection.start.key)}},{key:"nextInline",get:function(){return this.selection.end.key&&this.document.getNextInline(this.selection.end.key)}},{key:"previousInline",get:function(){return this.selection.start.key&&this.document.getPreviousInline(this.selection.start.key)}},{key:"nextText",get:function(){return this.selection.end.key&&this.document.getNextText(this.selection.end.key)}},{key:"previousText",get:function(){return this.selection.start.key&&this.document.getPreviousText(this.selection.start.key)}},{key:"marks",get:function(){return this.selection.isUnset?new i.Set:this.selection.marks||this.document.getMarksAtRange(this.selection)}},{key:"activeMarks",get:function(){return this.selection.isUnset?new i.Set:this.selection.marks||this.document.getActiveMarksAtRange(this.selection)}},{key:"blocks",get:function(){return this.selection.isUnset?new i.List:this.document.getBlocksAtRange(this.selection)}},{key:"fragment",get:function(){return this.selection.isUnset?I.create():this.document.getFragmentAtRange(this.selection)}},{key:"inlines",get:function(){return this.selection.isUnset?new i.List:this.document.getInlinesAtRange(this.selection)}},{key:"texts",get:function(){return this.selection.isUnset?new i.List:this.document.getTextsAtRange(this.selection)}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.isValue(e))return e;if(o()(e))return t.fromJSON(e,n);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(o()(e)){var n={};return"data"in e&&(n.data=k.create(e.data)),"decorations"in e&&(n.decorations=Ie.createList(e.decorations)),"schema"in e&&(n.schema=Ze.create(e.schema)),n}throw new Error("`Value.createProperties` only accepts objects or values, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.data,o=void 0===r?{}:r,a=e.decorations,s=void 0===a?[]:a,l=e.document,u=void 0===l?{}:l,c=e.selection,f=void 0===c?{}:c,d=e.schema,p=void 0===d?{}:d,m=e.history,h=void 0===m?{}:m;if(o=k.fromJSON(o),p=Ze.fromJSON(p),h=ze.fromJSON(h),f=(u=I.fromJSON(u)).createSelection(f),s=Object(i.List)(s.map(function(e){return Ie.fromJSON(e)})),f.isUnset){var _=u.getFirstText();_&&(f=f.moveToStartOfNode(_)),f=u.createSelection(f)}var g=new t({data:o,decorations:s,document:u,selection:f,schema:p,history:h});if(!1!==n.normalize){var v=g.change();v.withoutSaving(function(){return v.normalize()}),g=v.value}return g}}]),t}(Object(i.Record)(at)),lt={setValue:function(e,t){t=st.createProperties(t);var n=e.value;e.applyOperation({type:"set_value",properties:t,value:n})}},ut=S({},X,ue,be,xe,Ue,lt),ct=p()("slate:operation:apply");function ft(e,t){var n=(t=_t.create(t)).type;switch(ct(n,t),n){case"add_mark":var r=t,o=r.path,i=r.offset,a=r.length,s=r.mark;return e.addMark(o,i,a,s);case"insert_node":var l=t,u=l.path,c=l.node;return e.insertNode(u,c);case"insert_text":var f=t,d=f.path,p=f.offset,m=f.text,h=f.marks;return e.insertText(d,p,m,h);case"merge_node":var _=t.path;return e.mergeNode(_);case"move_node":var g=t,v=g.path,y=g.newPath;return e.moveNode(v,y);case"remove_mark":var b=t,E=b.path,C=b.offset,S=b.length,D=b.mark;return e.removeMark(E,C,S,D);case"remove_node":var w=t.path;return e.removeNode(w);case"remove_text":var T=t,x=T.path,R=T.offset,k=T.text;return e.removeText(x,R,k);case"set_mark":var N=t,I=N.path,O=N.offset,A=N.length,M=N.mark,P=N.properties;return e.setMark(I,O,A,M,P);case"set_node":var L=t,F=L.path,U=L.properties;return e.setNode(F,U);case"set_selection":var j=t.properties;return e.setSelection(j);case"set_value":var B=t.properties;return e.setProperties(B);case"split_node":var G=t,q=G.path,V=G.position,H=G.properties;return e.splitNode(q,V,H);default:throw new Error('Unknown operation type: "'+n+'".')}}var dt=p()("slate:operation:invert");function pt(e){var t=(e=_t.create(e)).type;switch(dt(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 n=e,r=n.newPath,o=n.path,i=r,a=o,s=o.size-1,l=r.size-1;return o.size0&&void 0!==arguments[0]?arguments[0]:{};if(t.isOperation(e))return e;if(o()(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(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));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 n=e.type,r=mt[n],o={type:n};if(!r)throw new Error('`Operation.fromJSON` was passed an unrecognized operation type: "'+n+'"');var i=!0,a=!1,s=void 0;try{for(var l,u=r[Symbol.iterator]();!(i=(l=u.next()).done);i=!0){var c=l.value,f=e[c];if(void 0===f){if("document"==c)continue;if("selection"==c)continue;if("value"==c)continue;if("node"==c&&"insert_node"!=n)continue;throw new Error('`Operation.fromJSON` was passed a "'+n+'" operation without the required "'+c+'" attribute.')}"path"!==c&&"newPath"!==c||(f=ye.create(f)),"mark"===c&&(f=P.create(f)),"marks"===c&&null!=f&&(f=P.createSet(f)),"node"===c&&(f=K.create(f)),"selection"===c&&(f=Fe.create(f)),"value"===c&&(f=st.create(f)),"properties"===c&&"merge_node"===n&&(f=K.createProperties(f)),"properties"===c&&"set_mark"===n&&(f=P.createProperties(f)),"properties"===c&&"set_node"===n&&(f=K.createProperties(f)),"properties"===c&&"set_selection"===n&&(f=Fe.createProperties(f)),"properties"===c&&"set_value"===n&&(f=st.createProperties(f)),"properties"===c&&"split_node"===n&&(f=K.createProperties(f)),o[c]=f}}catch(e){a=!0,s=e}finally{try{!i&&u.return&&u.return()}finally{if(a)throw s}}return new t(o)}},{key:"isOperationList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isOperation(e)})}}]),t}(Object(i.Record)(ht)),gt=p()("slate:change"),vt=function(){function e(t){E(this,e);var n=t.value;this.value=n,this.operations=new i.List,this.tmp={dirty:[],merge:null,normalize:!0,save:!0}}return C(e,[{key:"applyOperation",value:function(e){var t=this.operations,n=this.value,r=n.history;o()(e)&&(e=S({},e,{value:n})),e=_t.create(e);var i=this.tmp,a=i.merge,s=i.save;null==a&&0!==t.size&&(a=!0),gt("apply",{operation:e,save:s,merge:a}),n=e.apply(n),r&&s&&(r=r.save(e,{merge:a}),n=n.set("history",r));var l=function(e){var t=e.type,n=e.node,r=e.path,o=e.newPath;switch(t){case"add_mark":case"insert_text":case"remove_mark":case"remove_text":case"set_mark":case"set_node":return[r];case"insert_node":var i=n.getKeysToPathsTable(),a=Object.values(i).map(function(e){return r.concat(e)}),s=ye.lift(r);return[s,r].concat(R(a));case"split_node":var l=ye.lift(r),u=ye.increment(r);return[l,r,u];case"merge_node":var c=ye.lift(r),f=ye.decrement(r);return[c,f];case"move_node":var d=ye.lift(r),p=ye.lift(o);return ye.isSibling(r,o)||(p.size&&ye.isYounger(r,o)&&(p=ye.decrement(p,1,r.size-1)),d.size&&ye.isYounger(o,r)&&(d=ye.increment(d,1,o.size-1))),[d,p];case"remove_node":var m=ye.lift(r);return[m];default:return[]}}(e),u=this.tmp.dirty.reduce(function(t,n){n=ye.create(n);var r=ye.transform(n,e);return t=t.concat(r.toArray())},l);return this.tmp.dirty=u,this.value=n,this.operations=t.push(e),this}},{key:"applyOperations",value:function(e,t){var n=this;return e.forEach(function(e){return n.applyOperation(e,t)}),this}},{key:"call",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;rs)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.");n()}}()}),this}},{key:"withoutNormalizing",value:function(e){var t=this.tmp.normalize;return this.tmp.normalize=!1,e(this),this.tmp.normalize=t,this.normalizeDirtyPaths(),this}},{key:"withoutMerging",value:function(e){var t=this.tmp.merge;return this.tmp.merge=!1,e(this),this.tmp.merge=t,this}},{key:"withoutSaving",value:function(e){var t=this.tmp.save;return this.tmp.save=!1,e(this),this.tmp.save=t,this}},{key:"setOperationFlag",value:function(e,t){return Object(a.a)(!1,"As of slate@0.41.0 the `change.setOperationFlag` method has been deprecated."),this.tmp[e]=t,this}},{key:"getFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object(a.a)(!1,"As of slate@0.41.0 the `change.getFlag` method has been deprecated."),void 0!==t[e]?t[e]:this.tmp[e]}},{key:"unsetOperationFlag",value:function(e){return Object(a.a)(!1,"As of slate@0.41.0 the `change.unsetOperationFlag` method has been deprecated."),delete this.tmp[e],this}},{key:"withoutNormalization",value:function(e){return Object(a.a)(!1,"As of slate@0.41.0 the `change.withoutNormalization` helper has been renamed to `change.withoutNormalizing`."),this.withoutNormalizing(e)}}]),e}();function yt(e,t){var n=!0,r=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var s=i.value,l=!0,u=!1,c=void 0;try{for(var f,d=Object.getOwnPropertyNames(e)[Symbol.iterator]();!(l=(f=d.next()).done);l=!0){var p=f.value;if(!s.hasOwnProperty(p)){var m=Object.getOwnPropertyDescriptor(e,p);Object.defineProperty(s,p,m)}}}catch(e){u=!0,c=e}finally{try{!l&&d.return&&d.return()}finally{if(u)throw c}}var h=!0,_=!1,g=void 0;try{for(var v,y=Object.getOwnPropertyNames(e.prototype)[Symbol.iterator]();!(h=(v=y.next()).done);h=!0){var b=v.value;if(!s.prototype.hasOwnProperty(b)){m=Object.getOwnPropertyDescriptor(e.prototype,b);Object.defineProperty(s.prototype,b,m)}}}catch(e){_=!0,g=e}finally{try{!h&&y.return&&y.return()}finally{if(_)throw g}}}}catch(e){r=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw o}}}function bt(e){var t=Oe[e],n="is"+(""+e.charAt(0).toUpperCase()+e.slice(1)),r=function(){function t(){E(this,t)}return C(t,[{key:"object",get:function(){return e}}]),t}();return r[n]=Ae.bind(null,e),r.prototype[t]=!0,r}Object.keys(ut).forEach(function(e){vt.prototype[e]=function(){for(var t=arguments.length,n=Array(t),r=0;r1?r-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:1;return(e=this.resolvePath(e))&&this.getNode(e)?e.size-1+t:null}},{key:"getDescendant",value:function(e){if(!(e=this.resolvePath(e)))return null;var t=e.flatMap(function(e){return["nodes",e]});return this.getIn(t)}},{key:"getFragmentAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)return I.create();for(var t=e,n=t.start,r=t.end,o=this,i=r.path,a=r.offset,s="end";i.size;){var l=i.last();o=o.splitNode(i,a),a=l+1,(i=ye.lift(i)).size||"end"!==s||(i=n.path,a=n.offset,s="start")}var u=n.path.first()+1,c=r.path.first()+2,f=o.nodes.slice(u,c);return I.create({nodes:f})}},{key:"getFurthest",value:function(e,t){var n=this,r=this.getAncestors(e);return r&&r.find(function(e){for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i1}).last()||null}},{key:"getInlines",value:function(){var e=this.getInlinesAsArray();return Object(i.List)(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 Object(i.List)(Object(i.OrderedSet)(t))}},{key:"getInlinesAtRangeAsArray",value:function(e){var t=this;return(e=this.resolveRange(e)).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 Object(i.List)(t)}},{key:"getInlinesByTypeAsArray",value:function(e){return this.nodes.reduce(function(t,n){return"text"==n.object?t:n.isLeafInline()&&n.type==e?(t.push(n),t):t.concat(n.getInlinesByTypeAsArray(e))},[])}},{key:"getInsertMarksAtRange",value:function(e){var t=(e=this.resolveRange(e)).start;return e.isUnset?Object(i.Set)():e.isCollapsed?this.getMarksAtPosition(t.key,t.offset):this.getDescendant(t.key).getMarksAtIndex(t.offset+1)}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return Object(i.Set)(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 n=this.getDescendant(e).getMarksAtIndex(t);if(0!==t)return n;var r=this.getClosestBlock(e);if(""===r.text)return n;var o=this.getPreviousText(e);return o?r.hasDescendant(o.key)?o.getMarksAtIndex(o.text.length):n:Object(i.Set)()}},{key:"getMarksAtRange",value:function(e){return Object(i.Set)(this.getOrderedMarksAtRange(e))}},{key:"getMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return Object(i.Set)(t)}},{key:"getMarksByTypeAsArray",value:function(e){return this.nodes.reduce(function(t,n){return"text"==n.object?t.concat(n.getMarksAsArray().filter(function(t){return t.type==e})):t.concat(n.getMarksByTypeAsArray(e))},[])}},{key:"getNextBlock",value:function(e){var t=this.assertDescendant(e),n=void 0;"block"==t.object?n=t.getLastText():n=this.getClosestBlock(e).getLastText();var r=this.getNextText(n.key);return r?this.getClosestBlock(r.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 n=e.slice(0,t),r=ye.increment(n),o=this.getNode(r);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=ye.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:"getOffset",value:function(e){this.assertDescendant(e);var t=this.getFurthestAncestor(e),n=this.nodes.takeUntil(function(e){return e==t}).reduce(function(e,t){return e+t.text.length},0);return this.hasChild(e)?n:n+t.getOffset(e)}},{key:"getOffsetAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)throw new Error("The range cannot be unset to calculcate its offset.");if(e.isExpanded)throw new Error("The range must be collapsed to calculcate its offset.");var t=e.start;return this.getOffset(t.key)+t.offset}},{key:"getOrderedMarks",value:function(){var e=this.getMarksAsArray();return Object(i.OrderedSet)(e)}},{key:"getOrderedMarksAtRange",value:function(e){var t=e=this.resolveRange(e),n=t.start,r=t.end;return e.isUnset?Object(i.OrderedSet)():e.isCollapsed?this.getMarksAtPosition(n.key,n.offset):this.getOrderedMarksBetweenPositions(n.key,n.offset,r.key,r.offset)}},{key:"getOrderedMarksBetweenPositions",value:function(e,t,n,r){if(e===n)return this.getDescendant(e).getMarksBetweenOffsets(t,r);var o=this.getTextsBetweenPositionsAsArray(e,n);return Object(i.OrderedSet)().withMutations(function(i){o.forEach(function(o){o.key===e?i.union(o.getMarksBetweenOffsets(t,o.text.length)):o.key===n?i.union(o.getMarksBetweenOffsets(0,r)):i.union(o.getMarks())})})}},{key:"getOrderedMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return Object(i.OrderedSet)(t)}},{key:"getParent",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=ye.lift(e);return this.getNode(t)}},{key:"getPreviousBlock",value:function(e){var t=this.assertDescendant(e),n=void 0;"block"==t.object?n=t.getFirstText():n=this.getClosestBlock(e).getFirstText();var r=this.getPreviousText(n.key);return r?this.getClosestBlock(r.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 n=e.slice(0,t);if(0!==n.last()){var r=ye.decrement(n),o=this.getNode(r);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=ye.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],n=e.start,r=e.end;if(!t)return null;if(e.isUnset)return null;if(n.key==r.key){var o=this.getFurthestAncestor(n.key),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==n.key&&(a=t),null==s&&e.key==r.key&&(s=t+1)):(null==a&&e.hasDescendant(n.key)&&(a=t),null==s&&e.hasDescendant(r.key)&&(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:"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(n,r,o){return(t+=n.text.length)>e})}},{key:"getTextDirection",value:function(){var e=h()(this.text);return"neutral"===e?null:e}},{key:"getTexts",value:function(){var e=this.getTextsAsArray();return Object(i.List)(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=this.resolveRange(e)).isUnset)return Object(i.List)();var t=e,n=t.start,r=t.end;return Object(i.List)(this.getTextsBetweenPositionsAsArray(n.key,r.key))}},{key:"getTextsAtRangeAsArray",value:function(e){if((e=this.resolveRange(e)).isUnset)return[];var t=e,n=t.start,r=t.end;return this.getTextsBetweenPositionsAsArray(n.key,r.key)}},{key:"getTextsBetweenPositionsAsArray",value:function(e,t){var n=this.getDescendant(e);if(e==t)return[n];var r=this.getDescendant(t),o=this.getTextsAsArray(),i=o.indexOf(n),a=o.indexOf(r,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:"hasVoidParent",value:function(e,t){return!!this.getClosestVoid(e,t)}},{key:"insertNode",value:function(e,t){var n=(e=this.resolvePath(e)).last(),r=ye.lift(e),o=this.assertNode(r),i=o.nodes.splice(n,0,t);return o=o.set("nodes",i),this.replaceNode(r,o)}},{key:"insertText",value:function(e,t,n,r){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.insertText(t,n,r),this.replaceNode(e,o)}},{key:"isLeafBlock",value:function(){var e=this.object,t=this.nodes.first();return"block"===e&&"block"!==t.object}},{key:"isLeafInline",value:function(){var e=this.object,t=this.nodes.first();return"inline"===e&&"inline"!==t.object}},{key:"mapChildren",value:function(e){var t=this,n=this.nodes;return n.forEach(function(r,o){var i=e(r,o,t.nodes);i!==r&&(n=n.set(i.key,i))}),this.set("nodes",n)}},{key:"mapDescendants",value:function(e){var t=this,n=this.nodes;return n.forEach(function(r,o){var i=r;"text"!==i.object&&(i=i.mapDescendants(e)),(i=e(i,o,t.nodes))!==r&&(n=n.set(o,i))}),this.set("nodes",n)}},{key:"mergeNode",value:function(e){var t=this.assertNode(e);if(0===(e=this.resolvePath(e)).last())throw new Error("Unable to merge node because it has no previous sibling: "+t);var n=ye.decrement(e),r=this.assertNode(n);if(r.object!==t.object)throw new Error("Unable to merge two different kinds of nodes: "+r+" and "+t);var o="text"===r.object?r.mergeText(t):r.set("nodes",r.nodes.concat(t.nodes)),i=this;return i=(i=(i=i.removeNode(e)).removeNode(n)).insertNode(n,o)}},{key:"moveNode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.assertNode(e);e=this.resolvePath(e),t=this.resolvePath(t,n);var o=ye.lift(t);this.assertNode(o);var i=ye.crop(e,t),a=x(i,2),s=a[0],l=a[1],u=ye.compare(s,l);e.size1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:e;return this.setPoints([this.anchor.moveToStartOfNode(e),this.focus.moveToEndOfNode(t)])}},{key:"moveToStart",value:function(){return this.setEnd(this.start)}},{key:"moveToStartOfNode",value:function(e){return this.updatePoints(function(t){return t.moveToStartOfNode(e)})}},{key:"normalize",value:function(e){return this.updatePoints(function(t){return t.normalize(e)})}},{key:"setAnchor",value:function(e){return this.set("anchor",e)}},{key:"setEnd",value:function(e){return this.isBackward?this.setAnchor(e):this.setFocus(e)}},{key:"setFocus",value:function(e){return this.set("focus",e)}},{key:"setPoints",value:function(e){var t=x(e,2),n=t[0],r=t[1];return this.set("anchor",n).set("focus",r)}},{key:"updatePoints",value:function(e){var t=this.anchor,n=this.focus;return t=e(t),n=e(n),this.merge({anchor:t,focus:n})}},{key:"setStart",value:function(e){return this.isBackward?this.setFocus(e):this.setAnchor(e)}},{key:"setProperties",value:function(e){var t=e=Pe.createProperties(e),n=t.anchor,r=t.focus,o=w(t,["anchor","focus"]);return n&&(o.anchor=ke.create(n)),r&&(o.focus=ke.create(r)),this.merge(o)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}},{key:"toRange",value:function(){var e=Pe.createProperties(this);return Pe.create(e)}},{key:"unset",value:function(){return this.updatePoints(function(e){return e.unset()})}},{key:"isCollapsed",get:function(){return this.anchor===this.focus||this.anchor.key===this.focus.key&&this.anchor.offset===this.focus.offset}},{key:"isExpanded",get:function(){return!this.isCollapsed}},{key:"isBackward",get:function(){var e=this.isUnset,t=this.anchor,n=this.focus;return e?null:t.key===n.key?t.offset>n.offset:ye.isBefore(n.path,t.path)}},{key:"isForward",get:function(){var e=this.isBackward;return null==e?null:!e}},{key:"isUnset",get:function(){var e=this.anchor,t=this.focus;return e.isUnset||t.isUnset}},{key:"isSet",get:function(){return!this.isUnset}},{key:"start",get:function(){return this.isBackward?this.focus:this.anchor}},{key:"end",get:function(){return this.isBackward?this.anchor:this.focus}}]),e}(),[Ie,Pe,Fe]);var kt={apply:ft,invert:pt},Nt={Block:Q,Changes:ut,Data:k,Decoration:Ie,Document:I,History:ze,Inline:A,KeyUtils:y,Leaf:F,Mark:P,Node:K,Operation:_t,Operations:kt,PathUtils:ye,Point:ke,Range:Pe,resetMemoization:H,Schema:Ze,Selection:Fe,Stack:Ke,Text:W,TextUtils:le,useMemoization:Y,Value:st};t.default=Nt},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SettingLevel=void 0;var r=b(n(20)),o=b(n(19)),i=n(9),a=b(n(14)),s=b(n(4)),l=b(n(5)),u=b(n(1129)),c=b(n(1130)),f=b(n(1131)),d=b(n(1132)),p=b(n(1133)),m=b(n(1134)),h=b(n(1135)),_=n(2),g=b(n(39)),v=n(1146),y=b(n(1152));function b(e){return e&&e.__esModule?e:{default:e}}t.SettingLevel={DEVICE:"device",ROOM_DEVICE:"room-device",ROOM_ACCOUNT:"room-account",ACCOUNT:"account",ROOM:"room",CONFIG:"config",DEFAULT:"default"};var E={},C=[],S=!0,D=!1,w=void 0;try{for(var T,x=(0,r.default)((0,a.default)(v.SETTINGS));!(S=(T=x.next()).done);S=!0){var R=T.value;E[R]=v.SETTINGS[R].default,v.SETTINGS[R].isFeature&&C.push(R)}}catch(e){D=!0,w=e}finally{try{!S&&x.return&&x.return()}finally{if(D)throw w}}var k={device:new u.default(C),"room-device":new c.default,"room-account":new d.default,account:new p.default,room:new m.default,config:new h.default,default:new f.default(E)},N=!0,I=!1,O=void 0;try{for(var A,M=(0,r.default)((0,a.default)(k));!(N=(A=M.next()).done);N=!0){var P=A.value;k[P]=new y.default(k[P])}}catch(e){I=!0,O=e}finally{try{!N&&M.return&&M.return()}finally{if(I)throw O}}var L=["device","room-device","room-account","account","room","config","default"],F=function(){function e(){(0,s.default)(this,e)}return(0,l.default)(e,null,[{key:"getDisplayName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";if(!v.SETTINGS[e]||!v.SETTINGS[e].displayName)return null;var n=v.SETTINGS[e].displayName;return n instanceof Object&&(n=n[t]?n[t]:n.default),(0,_._t)(n)}},{key:"getLabsFeatures",value:function(){var t=(0,a.default)(v.SETTINGS).filter(function(t){return e.isFeature(t)});return g.default.get().enableLabs?t:t.filter(function(t){return"labs"===e._getFeatureState(t)})}},{key:"isFeature",value:function(e){return!!v.SETTINGS[e]&&v.SETTINGS[e].isFeature}},{key:"isFeatureEnabled",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e.isFeature(t))throw new Error("Setting "+t+" is not a feature");return e.getValue(t,n)}},{key:"setFeatureEnabled",value:function(t,n){if(!v.SETTINGS[t])throw new Error("Setting '"+t+"' does not appear to be a setting.");if(!e.isFeature(t))throw new Error("Setting "+t+" is not a feature");return e.setValue(t,null,"device",n)}},{key:"getValue",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!v.SETTINGS[t])throw new Error("Setting '"+t+"' does not appear to be a setting.");var o=v.SETTINGS[t],i=o.supportedLevelsAreOrdered?o.supportedLevels:L;return e.getValueAt(i[0],t,n,!1,r)}},{key:"getValueAt",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!v.SETTINGS[n])throw new Error("Setting '"+n+"' does not appear to be a setting.");var a=v.SETTINGS[n],s=a.supportedLevelsAreOrdered?a.supportedLevels:L;s.includes("default")||s.push("default");var l=s.indexOf(t);if(-1===l)throw new Error("Level "+t+" is not prioritized");if(e.isFeature(n)){var u=e._getFeatureState(n);if("enable"===u)return!0;if("disable"===u)return!1}var c=e._getHandlers(n);if(o){var f=c[t];if(!f)return e._tryControllerOverride(n,t,r,null,null);var d=f.getValue(n,r);return e._tryControllerOverride(n,t,r,d,t)}for(var p=l;p>>0;if("function"!=typeof e)throw new TypeError;for(var r=[],o=arguments.length>=2?arguments[1]:void 0,i=0;i>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");arguments.length>1&&(n=t);var a=new Array(i);for(r=0;r>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=0;r1){var i=Object(arguments[1]);for(var a in i)t.call(i,a)&&(r[a]=i[a])}return r}}()),e.super_=t,e.prototype=(0,r.default)(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},e.exports.isNumber=function(e){return"number"==typeof e&&isFinite(e)},e.exports.removeHiddenChars=function(e){return e.normalize("NFD").replace(l,"")};var l=/[\u200B-\u200D\u0300-\u036f\uFEFF\s]/g},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){e.exports={default:n(390),__esModule:!0}},function(e,t,n){"use strict";e.exports=function(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */var r=n(1778);function o(e){return!0===r(e)&&"[object Object]"===Object.prototype.toString.call(e)}e.exports=function(e){var t,n;return!1!==o(e)&&("function"==typeof(t=e.constructor)&&(!1!==o(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")))}},function(e,t,n){e.exports=!n(58)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict"; /* object-assign (c) Sindre Sorhus @license MIT */var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,s=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l0?o(r(e),9007199254740991):0}},function(e,t,n){"use strict";t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(211));t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1)for(var n=1;n0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function o(){this.removeListener(e,o),n||(n=!0,t.apply(this,arguments))}return o.listener=t,this.on(e,o),this},n.prototype.removeListener=function(e,t){var n,i,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(n=this._events[e]).length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){var r=n(1812);e.exports=function(e){if(function(e){return e&&e.window===e}(e))return e;var t=r(e);if(o){t.parentWindow.execScript("document._parentWindow = window;","Javascript");var n=t._parentWindow;return t._parentWindow=null,n}return t.defaultView||t.parentWindow};var o=n(1813)},function(e,t,n){var r=n(107);e.exports=function(e){return Object(r(e))}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(163),o=n(112);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(46),o=n(76);e.exports=n(44)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){"use strict";t.a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!e){var n=console.warn||console.log;n("Warning: "+t)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){"use strict";t.__esModule=!0;var r=a(n(361)),o=a(n(365)),i="function"==typeof o.default&&"symbol"==typeof r.default?function(e){return typeof e}:function(e){return e&&"function"==typeof o.default&&e.constructor===o.default&&e!==o.default.prototype?"symbol":typeof e};function a(e){return e&&e.__esModule?e:{default:e}}t.default="function"==typeof o.default&&"symbol"===i(r.default)?function(e){return void 0===e?"undefined":i(e)}:function(e){return e&&"function"==typeof o.default&&e.constructor===o.default&&e!==o.default.prototype?"symbol":void 0===e?"undefined":i(e)}},function(e,t,n){e.exports={default:n(1111),__esModule:!0}},function(e,t,n){var r=n(94);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){e.exports={default:n(357),__esModule:!0}},function(e,t,n){var r=n(26),o=n(18),i=n(58);e.exports=function(e,t){var n=(o.Object||{})[e]||Object[e],a={};a[e]=t(n),r(r.S+r.F*i(function(){n(1)}),"Object",a)}},function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.closest=t.distance=t.patch=t.absolute=t.negate=t.isEqual=t.subtract=t.add=void 0;var r=i(n(51)),o=i(n(47));function i(e){return e&&e.__esModule?e:{default:e}}t.add=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},t.subtract=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},t.isEqual=function(e,t){return e.x===t.x&&e.y===t.y},t.negate=function(e){return{x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}},t.absolute=function(e){return{x:Math.abs(e.x),y:Math.abs(e.y)}},t.patch=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return n={},(0,o.default)(n,e,t),(0,o.default)(n,"x"===e?"y":"x",r),n};var a=t.distance=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))};t.closest=function(e,t){return Math.min.apply(Math,(0,r.default)(t.map(function(t){return a(e,t)})))}},function(e,t,n){"use strict";(function(t){var r=i(n(4)),o=i(n(5));function i(e){return e&&e.__esModule?e:{default:e}}var a=function(){function e(){(0,r.default)(this,e),this.platform=null}return(0,o.default)(e,[{key:"get",value:function(){return this.platform}},{key:"set",value:function(e){this.platform=e}}]),e}();t.mxPlatformPeg||(t.mxPlatformPeg=new a),e.exports=t.mxPlatformPeg}).call(this,n(15))},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(49),o=n(150);e.exports=n(48)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(28),o=n(73),i=n(72),a=n(151)("src"),s=Function.toString,l=(""+s).split("toString");n(105).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,n,s){var u="function"==typeof n;u&&(i(n,"name")||o(n,"name",t)),e[t]!==n&&(u&&(i(n,a)||o(n,a,e[t]?""+e[t]:l.join(String(t)))),e===r?e[t]=n:s?e[t]?e[t]=n:o(e,t,n):(delete e[t],o(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[a]||s.call(this)})},function(e,t,n){var r=n(7),o=n(30),i=n(107),a=/"/g,s=function(e,t,n,r){var o=String(i(e)),s="<"+t;return""!==n&&(s+=" "+n+'="'+String(r).replace(a,""")+'"'),s+">"+o+""};e.exports=function(e,t){var n={};n[e]=t(s),r(r.P+r.F*o(function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}),"String",n)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){e.exports={}},function(e,t,n){var r=n(162),o=n(121);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeEventPermalink=function(e,t){return o+"/#/"+e+"/"+t},t.makeUserPermalink=function(e){return o+"/#/"+e},t.makeRoomPermalink=function(e){return o+"/#/"+e},t.makeGroupPermalink=function(e){return o+"/#/"+e};var r=t.host="matrix.to",o=t.baseUrl="https://"+r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isOnlyCtrlOrCmdKeyEvent=function(e){return navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey:e.ctrlKey&&!e.altKey&&!e.metaKey&&!e.shiftKey},t.isOnlyCtrlOrCmdIgnoreShiftKeyEvent=function(e){return navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey&&!e.altKey&&!e.ctrlKey:e.ctrlKey&&!e.altKey&&!e.metaKey};t.KeyCode={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,ESCAPE:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,KEY_A:65,KEY_B:66,KEY_C:67,KEY_D:68,KEY_E:69,KEY_F:70,KEY_G:71,KEY_H:72,KEY_I:73,KEY_J:74,KEY_K:75,KEY_L:76,KEY_M:77,KEY_N:78,KEY_O:79,KEY_P:80,KEY_Q:81,KEY_R:82,KEY_S:83,KEY_T:84,KEY_U:85,KEY_V:86,KEY_W:87,KEY_X:88,KEY_Y:89,KEY_Z:90}},function(e,t,n){"use strict";var r=g(n(47)),o=g(n(11)),i=g(n(4)),a=g(n(5)),s=g(n(12)),l=g(n(13)),u=g(n(19)),c=g(n(65)),f=n(9),d=function(){var e=(0,f.coroutine)(u.default.mark(function e(t){return u.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(b>=E)){e.next=3;break}return e.next=3,(0,f.resolve)(new c.default(function(e,t){C.push(e)}));case 3:return b++,e.prev=4,e.next=7,(0,f.resolve)(t());case 7:return e.abrupt("return",e.sent);case 10:throw e.prev=10,e.t0=e.catch(4),e.t0;case 13:return e.prev=13,b--,S(),e.finish(13);case 17:case"end":return e.stop()}},e,this,[[4,10,13,17]])}));return function(t){return e.apply(this,arguments)}}(),p=g(n(55)),m=n(243),h=g(n(145)),_=g(n(8));function g(e){return e&&e.__esModule?e:{default:e}}function v(e){return e.chunk.map(function(e){return(0,m.groupMemberFromApiObject)(e)})}function y(e){return e.chunk.map(function(e){return(0,m.groupRoomFromApiObject)(e)})}var b=0,E=3,C=[];function S(){var e=C.shift();"function"==typeof e&&e()}var D=function(e){function t(){var e,n;(0,i.default)(this,t);var a=(0,s.default)(this,(t.__proto__||(0,o.default)(t)).call(this));return a.STATE_KEY={GroupMembers:"GroupMembers",GroupInvitedMembers:"GroupInvitedMembers",Summary:"Summary",GroupRooms:"GroupRooms"},a._state={},a._state[a.STATE_KEY.Summary]={},a._state[a.STATE_KEY.GroupRooms]={},a._state[a.STATE_KEY.GroupMembers]={},a._state[a.STATE_KEY.GroupInvitedMembers]={},a._ready={},a._ready[a.STATE_KEY.Summary]={},a._ready[a.STATE_KEY.GroupRooms]={},a._ready[a.STATE_KEY.GroupMembers]={},a._ready[a.STATE_KEY.GroupInvitedMembers]={},a._fetchResourcePromise=(e={},(0,r.default)(e,a.STATE_KEY.Summary,{}),(0,r.default)(e,a.STATE_KEY.GroupRooms,{}),(0,r.default)(e,a.STATE_KEY.GroupMembers,{}),(0,r.default)(e,a.STATE_KEY.GroupInvitedMembers,{}),e),a._resourceFetcher=(n={},(0,r.default)(n,a.STATE_KEY.Summary,function(e){return d(function(){return _.default.get().getGroupSummary(e)})}),(0,r.default)(n,a.STATE_KEY.GroupRooms,function(e){return d(function(){return _.default.get().getGroupRooms(e).then(y)})}),(0,r.default)(n,a.STATE_KEY.GroupMembers,function(e){return d(function(){return _.default.get().getGroupUsers(e).then(v)})}),(0,r.default)(n,a.STATE_KEY.GroupInvitedMembers,function(e){return d(function(){return _.default.get().getGroupInvitedUsers(e).then(v)})}),n),a.on("error",function(e,t){console.error("GroupStore encountered error whilst fetching data for "+t,e)}),a}return(0,l.default)(t,e),(0,a.default)(t,[{key:"_fetchResource",value:function(e,t){var n=this;if(!this._fetchResourcePromise[e][t]){var r=this._resourceFetcher[e](t);return this._fetchResourcePromise[e][t]=r,r.then(function(r){n._state[e][t]=r,n._ready[e][t]=!0,n._notifyListeners()}).catch(function(r){e===n.STATE_KEY.GroupInvitedMembers&&403===r.httpStatus||(console.error("Failed to get resource "+e+" for "+t,r),n.emit("error",r,t))}).finally(function(){delete n._fetchResourcePromise[e][t]}),r}}},{key:"_notifyListeners",value:function(){this.emit("update")}},{key:"registerListener",value:function(e,t){var n=this;return this.on("update",t),this.emit("update"),e&&(this._fetchResource(this.STATE_KEY.Summary,e),this._fetchResource(this.STATE_KEY.GroupRooms,e),this._fetchResource(this.STATE_KEY.GroupMembers,e),this._fetchResource(this.STATE_KEY.GroupInvitedMembers,e)),{unregister:function(){n.unregisterListener(t)}}}},{key:"unregisterListener",value:function(e){this.removeListener("update",e)}},{key:"isStateReady",value:function(e,t){return this._ready[t][e]}},{key:"getSummary",value:function(e){return this._state[this.STATE_KEY.Summary][e]||{}}},{key:"getGroupRooms",value:function(e){return this._state[this.STATE_KEY.GroupRooms][e]||[]}},{key:"getGroupMembers",value:function(e){return this._state[this.STATE_KEY.GroupMembers][e]||[]}},{key:"getGroupInvitedMembers",value:function(e){return this._state[this.STATE_KEY.GroupInvitedMembers][e]||[]}},{key:"getGroupPublicity",value:function(e){return(this._state[this.STATE_KEY.Summary][e]||{}).user?(this._state[this.STATE_KEY.Summary][e]||{}).user.is_publicised:null}},{key:"isUserPrivileged",value:function(e){return(this._state[this.STATE_KEY.Summary][e]||{}).user?(this._state[this.STATE_KEY.Summary][e]||{}).user.is_privileged:null}},{key:"refreshGroupRooms",value:function(e){return this._fetchResource(this.STATE_KEY.GroupRooms,e)}},{key:"refreshGroupMembers",value:function(e){return this._fetchResource(this.STATE_KEY.GroupMembers,e)}},{key:"addRoomToGroup",value:function(e,t,n){return _.default.get().addRoomToGroup(e,t,n).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e))}},{key:"updateGroupRoomVisibility",value:function(e,t,n){return _.default.get().updateGroupRoomVisibility(e,t,n).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e))}},{key:"removeRoomFromGroup",value:function(e,t){return _.default.get().removeRoomFromGroup(e,t).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e))}},{key:"inviteUserToGroup",value:function(e,t){return _.default.get().inviteUserToGroup(e,t).then(this._fetchResource.bind(this,this.STATE_KEY.GroupInvitedMembers,e))}},{key:"acceptGroupInvite",value:function(e){return _.default.get().acceptGroupInvite(e).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupMembers,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupInvitedMembers,e))}},{key:"joinGroup",value:function(e){return _.default.get().joinGroup(e).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupMembers,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupInvitedMembers,e))}},{key:"leaveGroup",value:function(e){return _.default.get().leaveGroup(e).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupMembers,e))}},{key:"addRoomToGroupSummary",value:function(e,t,n){return _.default.get().addRoomToGroupSummary(e,t,n).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e))}},{key:"addUserToGroupSummary",value:function(e,t,n){return _.default.get().addUserToGroupSummary(e,t,n).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e))}},{key:"removeRoomFromGroupSummary",value:function(e,t){return _.default.get().removeRoomFromGroupSummary(e,t).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e))}},{key:"removeUserFromGroupSummary",value:function(e,t){return _.default.get().removeUserFromGroupSummary(e,t).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e))}},{key:"setGroupPublicity",value:function(e,t){return _.default.get().setGroupPublicity(e,t).then(function(){h.default.invalidatePublicisedGroups(_.default.get().credentials.userId)}).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e))}}]),t}(p.default),w=null;w||(w=new D),e.exports=w},function(e,t,n){"use strict";n.r(t);var r=function(e,t){return e===t};t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n=void 0,o=[],i=void 0,a=!1,s=function(e,n){return t(e,o[n])};return function(){for(var t=arguments.length,r=Array(t),l=0;l=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var r=n(112);e.exports=function(e){return Object(r(e))}},function(e,t,n){"use strict";e.exports={debugTool:null}},function(e,t,n){"use strict";var r=n(1095),o=n(1096);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=y,t.resolve=function(e,t){return y(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?y(e,!1,!0).resolveObject(t):t},t.format=function(e){o.isString(e)&&(e=y(e));return e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),f=["%","/","?",";","#"].concat(c),d=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,h={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=n(401);function y(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?A+="x":A+=O[M];if(!A.match(p)){var L=N.slice(0,x),F=N.slice(x+1),U=O.match(m);U&&(L.push(U[1]),F.unshift(U[2])),F.length&&(y="/"+F.join(".")+y),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),k||(this.hostname=r.toASCII(this.hostname));var j=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+j,this.href+=this.host,k&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!h[C])for(x=0,I=c.length;x0)&&n.host.split("@"))&&(n.auth=k.shift(),n.host=n.hostname=k.shift());return n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!S.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var w=S.slice(-1)[0],T=(n.host||e.host||S.length>1)&&("."===w||".."===w)||""===w,x=0,R=S.length;R>=0;R--)"."===(w=S[R])?S.splice(R,1):".."===w?(S.splice(R,1),x++):x&&(S.splice(R,1),x--);if(!E&&!C)for(;x--;x)S.unshift("..");!E||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),T&&"/"!==S.join("/").substr(-1)&&S.push("");var k,N=""===S[0]||S[0]&&"/"===S[0].charAt(0);D&&(n.hostname=n.host=N?"":S.length?S.shift():"",(k=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=k.shift(),n.host=n.hostname=k.shift()));return(E=E||n.host&&S.length)&&!N&&S.unshift(""),S.length?n.pathname=S.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";(function(t){var r=d(n(14)),o=d(n(126)),i=d(n(4)),a=d(n(5)),s=n(2),l=d(n(71)),u=d(n(39)),c=d(n(16)),f=d(n(3));function d(e){return e&&e.__esModule?e:{default:e}}var p=/#\/(groups?|room|user|settings|register|login|forgot_password|home|directory)/,m=/#\/(group|room|user)\/.*$/;function h(){var e=window.location,t=e.origin,n=e.hash,r=window.location.pathname;return t.startsWith("file://")&&(r="//"),t+r+function(e){return p.exec(e)?m.test(e)?e.replace(m,"#/$1/"):e.replace(p,"#/$1"):(console.warn('Unexpected hash location "'+e+'"'),"#/")}(n)}var _={"App Platform":{id:1,expl:(0,s._td)("The platform you're on"),example:"Electron Platform"},"App Version":{id:2,expl:(0,s._td)("The version of Riot.im"),example:"15.0.0"},"User Type":{id:3,expl:(0,s._td)("Whether or not you're logged in (we don't record your user name)"),example:"Logged In"},"Chosen Language":{id:4,expl:(0,s._td)("Your language of choice"),example:"en"},Instance:{id:5,expl:(0,s._td)("Which officially provided instance you are using, if any"),example:"app"},"RTE: Uses Richtext Mode":{id:6,expl:(0,s._td)("Whether or not you're using the Richtext mode of the Rich Text Editor"),example:"off"},"Homeserver URL":{id:7,expl:(0,s._td)("Your homeserver's URL"),example:"https://matrix.org"},"Identity Server URL":{id:8,expl:(0,s._td)("Your identity server's URL"),example:"https://vector.im"}};function g(e,t){return e.includes(t)?t:""}var v=function(){function e(){(0,i.default)(this,e),this._paq=null,this.disabled=!0,this.firstPage=!0}return(0,a.default)(e,[{key:"enable",value:function(){(this._paq||this._init())&&(this.disabled=!1)}},{key:"disable",value:function(){this.trackEvent("Analytics","opt-out"),this._paq.push(["disableHeartBeatTimer"]),this.disabled=!0}},{key:"_init",value:function(){var e=this,t=u.default.get();if(t&&t.piwik&&t.piwik.url&&t.piwik.siteId){var n=t.piwik.url,r=t.piwik.siteId,o=this;window._paq=this._paq=window._paq||[],this._paq.push(["setTrackerUrl",n+"piwik.php"]),this._paq.push(["setSiteId",r]),this._paq.push(["trackAllContentImpressions"]),this._paq.push(["discardHashTag",!1]),this._paq.push(["enableHeartBeatTimer"]);var i=l.default.get();return this._setVisitVariable("App Platform",i.getHumanReadableName()),i.getAppVersion().then(function(t){e._setVisitVariable("App Version",t)}).catch(function(){e._setVisitVariable("App Version","unknown")}),this._setVisitVariable("Chosen Language",(0,s.getCurrentLanguage)()),"riot.im"===window.location.hostname&&this._setVisitVariable("Instance",window.location.pathname),function(){var e=document.createElement("script"),t=document.getElementsByTagName("script")[0];e.type="text/javascript",e.async=!0,e.defer=!0,e.src=n+"piwik.js",e.onload=function(){console.log("Initialised anonymous analytics"),o._paq=window._paq},t.parentNode.insertBefore(e,t)}(),!0}}},{key:"trackPageChange",value:function(e){this.disabled||(this.firstPage?this.firstPage=!1:("number"==typeof e?this._paq.push(["setGenerationTimeMs",e]):console.warn("Analytics.trackPageChange: expected generationTimeMs to be a number"),this._paq.push(["setCustomUrl",h()]),this._paq.push(["trackPageView"])))}},{key:"trackEvent",value:function(e,t,n,r){this.disabled||this._paq.push(["trackEvent",e,t,n,r])}},{key:"logout",value:function(){this.disabled||this._paq.push(["deleteCookies"])}},{key:"_setVisitVariable",value:function(e,t){this.disabled||this._paq.push(["setCustomVariable",_[e].id,e,t,"visit"])}},{key:"setLoggedIn",value:function(e,t,n){if(!this.disabled){var r=u.default.get();if(r.piwik){var o=r.piwik.whitelistedHSUrls||[],i=r.piwik.whitelistedISUrls||[];this._setVisitVariable("User Type",e?"Guest":"Logged In"),this._setVisitVariable("Homeserver URL",g(o,t)),this._setVisitVariable("Identity Server URL",g(i,n))}}}},{key:"setRichtextMode",value:function(e){this.disabled||this._setVisitVariable("RTE: Uses Richtext Mode",e?"on":"off")}},{key:"showDetailsModal",value:function(){var e=[];if(window.Piwik){var t=window.Piwik.getAsyncTracker();e=(0,o.default)(_).map(function(e){return t.getCustomVariable(e.id)}).filter(Boolean)}else e=(0,r.default)(_).map(function(e){return[e,(0,s._t)("e.g. %(exampleValue)s",{exampleValue:_[e].example})]});var n=window.screen.width+"x"+window.screen.height,i=[{expl:(0,s._td)("Every page you use in the app"),value:(0,s._t)("e.g. ",{},{CurrentPageURL:h()})},{expl:(0,s._td)("Your User Agent"),value:navigator.userAgent},{expl:(0,s._td)("Your device resolution"),value:n}],a=f.default.getComponent("dialogs.ErrorDialog");c.default.createTrackedDialog("Analytics Details","",a,{title:(0,s._t)("Analytics"),description:React.createElement("div",{className:"mx_UserSettings_analyticsModal"},React.createElement("div",null,(0,s._t)("The information being sent to us to help make Riot.im better includes:")),React.createElement("table",null,e.map(function(e){return React.createElement("tr",{key:e[0]},React.createElement("td",null,(0,s._t)(_[e[0]].expl)),void 0!==e[1]&&React.createElement("td",null,React.createElement("code",null,e[1])))}),i.map(function(e,t){return React.createElement("tr",{key:t},React.createElement("td",null,(0,s._t)(e.expl)),React.createElement("td",null,React.createElement("code",null,e.value)))})),React.createElement("div",null,(0,s._t)("Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.")))})}}]),e}();t.mxAnalytics||(t.mxAnalytics=new v),e.exports=t.mxAnalytics}).call(this,n(15))},function(e,t,n){var r=n(63);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){"use strict";var r=n(30);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";var r=n(32),o=n(45),i=n(541),a=n(168),s=n(542),l=n(169),u=n(279),c=n(23),f=[],d=0,p=i.getPooled(),m=!1,h=null;function _(){C.ReactReconcileTransaction&&h||r("123")}var g=[{initialize:function(){this.dirtyComponentsLength=f.length},close:function(){this.dirtyComponentsLength!==f.length?(f.splice(0,this.dirtyComponentsLength),E()):f.length=0}},{initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}}];function v(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=i.getPooled(),this.reconcileTransaction=C.ReactReconcileTransaction.getPooled(!0)}function y(e,t){return e._mountOrder-t._mountOrder}function b(e){var t=e.dirtyComponentsLength;t!==f.length&&r("124",t,f.length),f.sort(y),d++;for(var n=0;n>18&63,i=l>>12&63,a=l>>6&63,s=63&l,p[f++]=u.charAt(o)+u.charAt(i)+u.charAt(a)+u.charAt(s)}while(c299)&&r.error){for(var o in e=new Error("CouchDB error: "+(r.error.reason||r.error.error)),r)e[o]=r[o];return n(e,t,r)}return n(e,t,r)})},t})?r.apply(t,o):r)||(e.exports=i)},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){var r=n(628),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){"use strict";var r=_(n(31)),o=_(n(40)),i=_(n(11)),a=_(n(4)),s=_(n(5)),l=_(n(12)),u=_(n(13)),c=_(n(10)),f=n(246),d=_(n(8)),p=_(n(3)),m=_(n(16)),h=n(2);function _(e){return e&&e.__esModule?e:{default:e}}var g={joining:!1,joinError:null,roomId:null,initialEventId:null,isInitialEventHighlighted:!1,roomAlias:null,roomLoading:!1,roomLoadError:null,forwardingEvent:null,quotingEvent:null,isEditingSettings:!1},v=function(e){function t(){(0,a.default)(this,t);var e=(0,l.default)(this,(t.__proto__||(0,i.default)(t)).call(this,c.default));return e._state=g,e}return(0,u.default)(t,e),(0,s.default)(t,[{key:"_setState",value:function(e){this._state=(0,o.default)(this._state,e),this.__emitChange()}},{key:"__onDispatch",value:function(e){switch(e.action){case"view_room":this._viewRoom(e);break;case"view_my_groups":case"view_group":this._setState({roomId:null,roomAlias:null});break;case"view_room_error":this._viewRoomError(e);break;case"will_join":this._setState({joining:!0});break;case"cancel_join":this._setState({joining:!1});break;case"join_room":this._joinRoom(e);break;case"join_room_error":this._joinRoomError(e);break;case"on_logged_out":this.reset();break;case"forward_event":this._setState({forwardingEvent:e.event});break;case"reply_to_event":this._setState({replyingToEvent:e.event});break;case"open_room_settings":this._setState({isEditingSettings:!0});break;case"close_settings":this._setState({isEditingSettings:!1})}}},{key:"_viewRoom",value:function(e){if(e.room_id){var t={roomId:e.room_id,roomAlias:e.room_alias,initialEventId:e.event_id,isInitialEventHighlighted:e.highlighted,forwardingEvent:null,roomLoading:!1,roomLoadError:null,shouldPeek:void 0===e.should_peek||e.should_peek,joining:e.joining||!1,replyingToEvent:null,isEditingSettings:!1};this._state.forwardingEvent&&c.default.dispatch({action:"send_event",room_id:t.roomId,event:this._state.forwardingEvent}),this._setState(t),e.auto_join&&this._joinRoom(e)}else e.room_alias&&(this._setState({roomId:null,initialEventId:null,initialEventPixelOffset:null,isInitialEventHighlighted:null,roomAlias:e.room_alias,roomLoading:!0,roomLoadError:null}),d.default.get().getRoomIdForAlias(e.room_alias).done(function(t){c.default.dispatch({action:"view_room",room_id:t.room_id,event_id:e.event_id,highlighted:e.highlighted,room_alias:e.room_alias,auto_join:e.auto_join,oob_data:e.oob_data})},function(t){c.default.dispatch({action:"view_room_error",room_id:null,room_alias:e.room_alias,err:t})}))}},{key:"_viewRoomError",value:function(e){this._setState({roomId:e.room_id,roomAlias:e.room_alias,roomLoading:!1,roomLoadError:e.err})}},{key:"_joinRoom",value:function(e){this._setState({joining:!0}),d.default.get().joinRoom(this._state.roomAlias||this._state.roomId,e.opts).done(function(){},function(e){c.default.dispatch({action:"join_room_error",err:e});var t=e.message?e.message:(0,r.default)(e);"M_INCOMPATIBLE_ROOM_VERSION"===e.errcode&&(t=React.createElement("div",null,(0,h._t)("Sorry, your homeserver is too old to participate in this room."),React.createElement("br",null),(0,h._t)("Please contact your homeserver administrator.")));var n=p.default.getComponent("dialogs.ErrorDialog");m.default.createTrackedDialog("Failed to join room","",n,{title:(0,h._t)("Failed to join room"),description:t})})}},{key:"_joinRoomError",value:function(e){this._setState({joining:!1,joinError:e.err})}},{key:"reset",value:function(){this._state=(0,o.default)({},g)}},{key:"getRoomId",value:function(){return this._state.roomId}},{key:"getInitialEventId",value:function(){return this._state.initialEventId}},{key:"isInitialEventHighlighted",value:function(){return this._state.isInitialEventHighlighted}},{key:"getRoomAlias",value:function(){return this._state.roomAlias}},{key:"isRoomLoading",value:function(){return this._state.roomLoading}},{key:"getRoomLoadError",value:function(){return this._state.roomLoadError}},{key:"isJoining",value:function(){return this._state.joining}},{key:"getJoinError",value:function(){return this._state.joinError}},{key:"getForwardingEvent",value:function(){return this._state.forwardingEvent}},{key:"getQuotingEvent",value:function(){return this._state.replyingToEvent}},{key:"isEditingSettings",value:function(){return this._state.isEditingSettings}},{key:"shouldPeek",value:function(){return this._state.shouldPeek}}]),t}(f.Store),y=null;y||(y=new v),e.exports=y},function(e,t){var n=e.exports={version:"2.5.1"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(33);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(7),o=n(105),i=n(30);e.exports=function(e,t){var n=(o.Object||{})[e]||Object[e],a={};a[e]=t(n),r(r.S+r.F*i(function(){n(1)}),"Object",a)}},function(e,t,n){var r=n(91),o=n(208),i=n(57),a=n(50),s=n(345);e.exports=function(e,t){var n=1==e,l=2==e,u=3==e,c=4==e,f=6==e,d=5==e||f,p=t||s;return function(t,s,m){for(var h,_,g=i(t),v=o(g),y=r(s,m,3),b=a(v.length),E=0,C=n?p(t,b):l?p(t,0):void 0;b>E;E++)if((d||E in v)&&(_=y(h=v[E],E,g),e))if(n)C[E]=_;else if(_)switch(e){case 3:return!0;case 5:return h;case 6:return E;case 2:C.push(h)}else if(c)return!1;return f?-1:u||c?c:C}}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){n(363);for(var r=n(34),o=n(60),i=n(77),a=n(38)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),l=0;ln;)o[n]=t[n++];return o},ke=function(e,t,n){G(e,t,{get:function(){return this._d[n]}})},Ne=function(e){var t,n,r,o,i,a,s=C(e),l=arguments.length,c=l>1?arguments[1]:void 0,f=void 0!==c,d=x(s);if(void 0!=d&&!S(d)){for(a=d.call(s),r=[],t=0;!(i=a.next()).done;t++)r.push(i.value);s=r}for(f&&l>2&&(c=u(c,arguments[2],2)),t=0,n=h(s.length),o=Te(this,n);n>t;t++)o[t]=f?c(s[t],t):s[t];return o},Ie=function(){for(var e=0,t=arguments.length,n=Te(this,t);t>e;)n[e]=arguments[e++];return n},Oe=!!Y&&i(function(){pe.call(new Y(1))}),Ae=function(){return pe.apply(Oe?fe.call(we(this)):we(this),arguments)},Me={copyWithin:function(e,t){return U.call(we(this),e,t,arguments.length>2?arguments[2]:void 0)},every:function(e){return J(we(this),e,arguments.length>1?arguments[1]:void 0)},fill:function(e){return F.apply(we(this),arguments)},filter:function(e){return xe(this,Q(we(this),e,arguments.length>1?arguments[1]:void 0))},find:function(e){return Z(we(this),e,arguments.length>1?arguments[1]:void 0)},findIndex:function(e){return ee(we(this),e,arguments.length>1?arguments[1]:void 0)},forEach:function(e){$(we(this),e,arguments.length>1?arguments[1]:void 0)},indexOf:function(e){return ne(we(this),e,arguments.length>1?arguments[1]:void 0)},includes:function(e){return te(we(this),e,arguments.length>1?arguments[1]:void 0)},join:function(e){return ue.apply(we(this),arguments)},lastIndexOf:function(e){return ae.apply(we(this),arguments)},map:function(e){return Ee(we(this),e,arguments.length>1?arguments[1]:void 0)},reduce:function(e){return se.apply(we(this),arguments)},reduceRight:function(e){return le.apply(we(this),arguments)},reverse:function(){for(var e,t=we(this).length,n=Math.floor(t/2),r=0;r1?arguments[1]:void 0)},sort:function(e){return ce.call(we(this),e)},subarray:function(e,t){var n=we(this),r=n.length,o=g(e,r);return new(O(n,n[ge]))(n.buffer,n.byteOffset+o*n.BYTES_PER_ELEMENT,h((void 0===t?r:g(t,r))-o))}},Pe=function(e,t){return xe(this,fe.call(we(this),e,t))},Le=function(e){we(this);var t=De(arguments[1],1),n=this.length,r=C(e),o=h(r.length),i=0;if(o+t>n)throw V("Wrong length!");for(;i255?255:255&r),o.v[p](n*t+o.o,r,Ce)}(this,n,e)},enumerable:!0})};y?(m=n(function(e,n,r,o){c(e,m,u,"_d");var i,a,s,l,f=0,p=0;if(E(n)){if(!(n instanceof W||"ArrayBuffer"==(l=b(n))||"SharedArrayBuffer"==l))return ye in n?Re(m,n):Ne.call(m,n);i=n,p=De(r,t);var g=n.byteLength;if(void 0===o){if(g%t)throw V("Wrong length!");if((a=g-p)<0)throw V("Wrong length!")}else if((a=h(o)*t)+p>g)throw V("Wrong length!");s=a/t}else s=_(n),i=new W(a=s*t);for(d(e,"_d",{b:i,o:p,l:a,e:s,v:new K(i)});fdocument.F=Object<\/script>"),e.close(),l=e.F;r--;)delete l.prototype[i[r]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[a]=e):n=l(),void 0===t?n:o(n,t)}},function(e,t,n){var r=n(111),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(120)("keys"),o=n(96);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(34),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(46).f,o=n(61),i=n(38)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){"use strict";e.exports={current:null}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";var r=n(45),o=n(168),i=n(97),a=(n(36),["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),s={type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};function l(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){0;var s=o[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var l=null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue;return this.isDefaultPrevented=l?i.thatReturnsTrue:i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse,this}r(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n0)){e.next=27;break}return console.warn("Refusing to start conference call widget in "+t+" a conference call widget is already present"),b=c.default.getComponent("dialogs.ErrorDialog"),u.default.createTrackedDialog("Already have Jitsi Widget","",b,{title:(0,f._t)("Call in Progress"),description:(0,f._t)("A call is already in progress!")}),e.abrupt("return");case 27:E=Math.random().toString(36).substring(2),C=d.roomId.replace(/[^A-Za-z0-9]/g,"")+E,S=["confId="+encodeURIComponent(C),"isAudioConf="+("voice"===n?"true":"false"),"displayName=$matrix_display_name","avatarUrl=$matrix_avatar_url","email=$matrix_user_id"].join("&"),D=void 0,D=m.default.get().integrations_jitsi_widget_url?m.default.get().integrations_jitsi_widget_url+"?"+S:m.default.get().integrations_rest_url+"/widgets/jitsi.html?"+S,w={widgetSessionId:E},T="jitsi_"+s.default.get().credentials.userId+"_"+Date.now(),_.default.setRoomWidget(t,T,"jitsi",D,"Jitsi",w).then(function(){console.log("Jitsi widget added")}).catch(function(e){if("M_FORBIDDEN"===e.errcode){var t=c.default.getComponent("dialogs.ErrorDialog");u.default.createTrackedDialog("Call Failed","",t,{title:(0,f._t)("Permission Required"),description:(0,f._t)("You do not have permission to start a conference call in this room")})}console.error(e)});case 35:case"end":return e.stop()}},e,this,[[2,8]])}));return function(t,n){return e.apply(this,arguments)}}(),s=y(n(8)),l=y(n(71)),u=y(n(16)),c=y(n(3)),f=n(2),d=y(n(17)),p=y(n(10)),m=y(n(39)),h=n(410),_=y(n(142)),g=y(n(292)),v=y(n(173));function y(e){return e&&e.__esModule?e:{default:e}}t.mxCalls={};var b=t.mxCalls,E=null,C={};function S(e){var t=document.getElementById(e);t&&(C[e]?C[e]=C[e].then(function(){return t.load(),t.play()}):C[e]=t.play())}function D(e){var t=document.getElementById(e);t&&(C[e]?C[e]=C[e].then(function(){return t.pause()}):C[e]=t.pause())}function w(e){e.on("error",function(t){if(console.error("Call error: %s",t),console.error(t.stack),"unknown_devices"===t.code){var n=c.default.getComponent("dialogs.QuestionDialog");u.default.createTrackedDialog("Call Failed","",n,{title:(0,f._t)("Call Failed"),description:(0,f._t)("There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call."),button:(0,f._t)("Review Devices"),onFinished:function(t){if(t){var n=s.default.get().getRoom(e.roomId);(0,h.showUnknownDeviceDialogForCalls)(s.default.get(),n,function(){!function(e){"outbound"===e.direction?p.default.dispatch({action:"place_call",room_id:e.roomId,type:e.type}):e.answer()}(e)},"outbound"===e.direction?(0,f._t)("Call Anyway"):(0,f._t)("Answer Anyway"),"outbound"===e.direction?(0,f._t)("Call"):(0,f._t)("Answer"))}}})}else{var r=c.default.getComponent("dialogs.ErrorDialog");u.default.createTrackedDialog("Call Failed","",r,{title:(0,f._t)("Call Failed"),description:t.message})}}),e.on("hangup",function(){T(void 0,e.roomId,"ended")}),e.on("state",function(t,n){if("ringing"===t)T(e,e.roomId,"ringing"),D("ringbackAudio");else if("invite_sent"===t)T(e,e.roomId,"ringback"),S("ringbackAudio");else if("ended"===t&&"connected"===n)T(void 0,e.roomId,"ended"),D("ringbackAudio"),S("callendAudio");else if("ended"===t&&"invite_sent"===n&&("remote"===e.hangupParty||"local"===e.hangupParty&&"invite_timeout"===e.hangupReason)){T(e,e.roomId,"busy"),D("ringbackAudio"),S("busyAudio");var r=c.default.getComponent("dialogs.ErrorDialog");u.default.createTrackedDialog("Call Handler","Call Timeout",r,{title:(0,f._t)("Call Timeout"),description:(0,f._t)("The remote side failed to pick up")+"."})}else"invite_sent"===n?(T(e,e.roomId,"stop_ringback"),D("ringbackAudio")):"ringing"===n?(T(e,e.roomId,"stop_ringing"),D("ringbackAudio")):"connected"===t&&(T(e,e.roomId,"connected"),D("ringbackAudio"))})}function T(e,t,n){console.log("Call state in %s changed to %s (%s)",t,n,e?e.call_state:"-"),b[t]=e,"ringing"===n?S("ringAudio"):e&&"ringing"===e.call_state&&D("ringAudio"),e&&(e.call_state=n),p.default.dispatch({action:"call_state",room_id:t,state:n})}t.mxCallHandler||p.default.register(function(t){switch(t.action){case"place_call":if(e.exports.getAnyActiveCall()){var n=c.default.getComponent("dialogs.ErrorDialog");return void u.default.createTrackedDialog("Call Handler","Existing Call",n,{title:(0,f._t)("Existing Call"),description:(0,f._t)("You are already in a call.")})}if(!s.default.get().supportsVoip()){var r=c.default.getComponent("dialogs.ErrorDialog");return void u.default.createTrackedDialog("Call Handler","VoIP is unsupported",r,{title:(0,f._t)("VoIP is unsupported"),description:(0,f._t)("You cannot place VoIP calls in this browser.")})}var o=s.default.get().getRoom(t.room_id);if(!o)return void console.error("Room %s does not exist.",t.room_id);var i=o.getJoinedMembers();if(i.length<=1){var m=c.default.getComponent("dialogs.ErrorDialog");return void u.default.createTrackedDialog("Call Handler","Cannot place call with self",m,{description:(0,f._t)("You cannot place a call with yourself.")})}2===i.length?(console.log("Place %s call in %s",t.type,t.room_id),function(e){if(w(e),"voice"===t.type)e.placeVoiceCall();else if("video"===t.type)e.placeVideoCall(t.remote_element,t.local_element);else if("screensharing"===t.type){var n=l.default.get().screenCaptureErrorString();if(n){T(void 0,e.roomId,"ended"),console.log("Can't capture screen: "+n);var r=c.default.getComponent("dialogs.ErrorDialog");return void u.default.createTrackedDialog("Call Handler","Unable to capture screen",r,{title:(0,f._t)("Unable to capture screen"),description:n})}e.placeScreenSharingCall(t.remote_element,t.local_element)}else console.error("Unknown conf call type: %s",t.type)}(d.default.createNewMatrixCall(s.default.get(),t.room_id))):p.default.dispatch({action:"place_conference_call",room_id:t.room_id,type:t.type,remote_element:t.remote_element,local_element:t.local_element});break;case"place_conference_call":console.log("Place conference call in %s",t.room_id),a(t.room_id,t.type);break;case"incoming_call":if(e.exports.getAnyActiveCall())return;if(!s.default.get().supportsVoip())return;var h=t.call;w(h),T(h,h.roomId,"ringing");break;case"hangup":if(!b[t.room_id])return;b[t.room_id].hangup(),T(null,t.room_id,"ended");break;case"answer":if(!b[t.room_id])return;b[t.room_id].answer(),T(b[t.room_id],t.room_id,"connected"),p.default.dispatch({action:"view_room",room_id:t.room_id})}});var x={getCallForRoom:function(t){var n=e.exports.getCall(t);return n||(E&&(n=E.getConferenceCallForRoom(t)),n||null)},getCall:function(e){return b[e]||null},getAnyActiveCall:function(){for(var e=(0,r.default)(b),t=0;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){"use strict";var r=n(79);function o(e){var t=e.scanner.TOKENS,n=e.parser.TOKENS.Base,r=e.parser.start;if(void 0===t.UNDERSCORE)throw new Error("linkify-matrix requires linkifyjs 2.1.1: this version is too old.");var o=function(e){n.call(this,e),this.type="roomalias",this.isLink=!0};o.prototype=new n;var i=r.jump(t.POUND),a=new e.parser.State,s=new e.parser.State,l=new e.parser.State,u=new e.parser.State,c=new e.parser.State(o),f=new e.parser.State,d=new e.parser.State(o),p=[t.DOT,t.PLUS,t.NUM,t.DOMAIN,t.TLD,t.UNDERSCORE,t.POUND,t.LOCALHOST];i.on(p,a),a.on(p,a),a.on(t.DOMAIN,a),a.on(t.COLON,s),s.on(t.DOMAIN,l),s.on(t.LOCALHOST,c),s.on(t.TLD,c),l.on(t.DOT,u),u.on(t.DOMAIN,l),u.on(t.TLD,c),c.on(t.DOT,u),c.on(t.COLON,f),f.on(t.NUM,d);var m=function(e){n.call(this,e),this.type="userid",this.isLink=!0};m.prototype=new n;var h=r.jump(t.AT),_=new e.parser.State,g=new e.parser.State,v=new e.parser.State,y=new e.parser.State,b=new e.parser.State(m),E=new e.parser.State,C=new e.parser.State(m),S=[t.DOT,t.UNDERSCORE,t.PLUS,t.NUM,t.DOMAIN,t.TLD,t.LOCALHOST];h.on(S,_),_.on(S,_),_.on(t.DOMAIN,_),_.on(t.COLON,g),g.on(t.DOMAIN,v),g.on(t.LOCALHOST,b),g.on(t.TLD,b),v.on(t.DOT,y),y.on(t.DOMAIN,v),y.on(t.TLD,b),b.on(t.DOT,y),b.on(t.COLON,E),E.on(t.NUM,C);var D=function(e){n.call(this,e),this.type="groupid",this.isLink=!0};D.prototype=new n;var w=r.jump(t.PLUS),T=new e.parser.State,x=new e.parser.State,R=new e.parser.State,k=new e.parser.State,N=new e.parser.State(D),I=new e.parser.State,O=new e.parser.State(D),A=[t.DOT,t.UNDERSCORE,t.PLUS,t.NUM,t.DOMAIN,t.TLD,t.LOCALHOST];w.on(A,T),T.on(A,T),T.on(t.DOMAIN,T),T.on(t.COLON,x),x.on(t.DOMAIN,R),x.on(t.LOCALHOST,N),x.on(t.TLD,N),R.on(t.DOT,k),k.on(t.DOMAIN,R),k.on(t.TLD,N),N.on(t.DOT,k),N.on(t.COLON,I),I.on(t.NUM,O)}o.onUserClick=function(e,t){e.preventDefault()},o.onAliasClick=function(e,t){e.preventDefault()},o.onGroupClick=function(e,t){e.preventDefault()};o.VECTOR_URL_PATTERN="^(?:https?://)?(?:"+function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(window.location.host+window.location.pathname)+"|(?:www\\.)?(?:riot|vector)\\.im/(?:app|beta|staging|develop)/)(#.*)",o.MATRIXTO_URL_PATTERN="^(?:https?://)?(?:www\\.)?matrix\\.to/#/(([#@!+]).*)",o.MATRIXTO_MD_LINK_PATTERN="\\[([^\\]]*)\\]\\((?:https?://)?(?:www\\.)?matrix\\.to/#/([#@!+][^\\)]*)\\)",o.MATRIXTO_BASE_URL=r.baseUrl;var i={"@":"#/user/","#":"#/room/","!":"#/room/","+":"#/group/"};o.options={events:function(e,t){switch(t){case"userid":return{click:function(t){o.onUserClick(t,e)}};case"roomalias":return{click:function(t){o.onAliasClick(t,e)}};case"groupid":return{click:function(t){o.onGroupClick(t,e)}}}},formatHref:function(e,t){switch(t){case"roomalias":case"userid":case"groupid":return o.MATRIXTO_BASE_URL+"/#/"+e;default:var n=e.match(o.VECTOR_URL_PATTERN);if(n)return n[1];if(n=e.match(o.MATRIXTO_URL_PATTERN)){var r=n[1];if(i[r[0]])return i[r[0]]+r}return e}},linkAttributes:{rel:"noopener"},target:function(e,t){return"url"===t?e.match(o.VECTOR_URL_PATTERN)||e.match(o.MATRIXTO_URL_PATTERN)?null:"_blank":null}},e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(14)),o=u(n(20)),i=u(n(4)),a=u(n(5)),s=u(n(8)),l=u(n(428));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(t){(0,i.default)(this,e),this.matrixClient=t,this.roomToUser=null,this._hasSentOutPatchDirectAccountDataPatch=!1,this._onAccountData=this._onAccountData.bind(this);var n=t.getAccountData("m.direct");this.mDirectEvent=n?n.getContent():{},this.userToRooms=null}return(0,a.default)(e,[{key:"start",value:function(){this._populateRoomToUser(),this.matrixClient.on("accountData",this._onAccountData)}},{key:"stop",value:function(){this.matrixClient.removeListener("accountData",this._onAccountData)}},{key:"_onAccountData",value:function(e){"m.direct"==e.getType()&&(this.mDirectEvent=this.matrixClient.getAccountData("m.direct").getContent()||{},this.userToRooms=null,this.roomToUser=null)}},{key:"_patchUpSelfDMs",value:function(e){var t=this,n=this.matrixClient.getUserId(),r=e[n];if(r){var o=r.map(function(e){var r=t.matrixClient.getRoom(e);if(r){var o=r.guessDMUserId();if(o&&o!==n)return{userId:o,roomId:e}}}).filter(function(e){return!!e});return!!o.length&&(e[n]=r.filter(function(e){return!o.some(function(t){return t.roomId===e})}),o.forEach(function(t){var n=t.userId,r=t.roomId,o=e[n];o?(o.push(r),e[n]=(0,l.default)(o)):e[n]=[r]}),!0)}}},{key:"getDMRoomsForUserId",value:function(e){return this._getUserToRooms()[e]||[]}},{key:"getUserIdForRoomId",value:function(e){if(null==this.roomToUser&&this._populateRoomToUser(),void 0===this.roomToUser[e]){var t=this.matrixClient.getRoom(e);if(t)return t.getDMInviter()}return this.roomToUser[e]}},{key:"_getUserToRooms",value:function(){if(!this.userToRooms){var e=this.mDirectEvent,t=e[this.matrixClient.getUserId()];if(t&&t.length){var n=this._patchUpSelfDMs(e);console.warn("Invalid m.direct account data detected (self-chats that shouldn't be), patching it up."),n&&!this._hasSentOutPatchDirectAccountDataPatch&&(this._hasSentOutPatchDirectAccountDataPatch=!0,this.matrixClient.setAccountData("m.direct",e))}this.userToRooms=e}return this.userToRooms}},{key:"_populateRoomToUser",value:function(){this.roomToUser={};var e=!0,t=!1,n=void 0;try{for(var i,a=(0,o.default)((0,r.default)(this._getUserToRooms()));!(e=(i=a.next()).done);e=!0){var s=i.value,l=!0,u=!1,c=void 0;try{for(var f,d=(0,o.default)(this.userToRooms[s]);!(l=(f=d.next()).done);l=!0){var p=f.value;this.roomToUser[p]=s}}catch(e){u=!0,c=e}finally{try{!l&&d.return&&d.return()}finally{if(u)throw c}}}}catch(e){t=!0,n=e}finally{try{!e&&a.return&&a.return()}finally{if(t)throw n}}}}],[{key:"makeShared",value:function(){return e._sharedInstance=new e(s.default.get()),e._sharedInstance}},{key:"shared",value:function(){return e._sharedInstance}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){"use strict";(function(r){function o(e){return(o="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})(e)}t.log=function(){var e;return"object"===("undefined"==typeof console?"undefined":o(console))&&console.log&&(e=console).log.apply(e,arguments)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&"%c"===e&&(o=++r)}),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){var e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==r&&"env"in r&&(e=Object({NODE_ENV:"production"}).DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=n(1776)(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,n(54))},,function(e,t,n){var r=n(151)("meta"),o=n(33),i=n(72),a=n(49).f,s=0,l=Object.isExtensible||function(){return!0},u=!n(30)(function(){return l(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},f=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[r].i},getWeak:function(e,t){if(!i(e,r)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[r].w},onFreeze:function(e){return u&&f.NEED&&l(e)&&!i(e,r)&&c(e),e}}},function(e,t,n){var r=n(42)("unscopables"),o=Array.prototype;void 0==o[r]&&n(73)(o,r,{}),e.exports=function(e){o[r][e]=!0}},function(e,t){e.exports=!0},function(e,t,n){var r=n(35),o=n(34).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var r=n(96)("meta"),o=n(35),i=n(61),a=n(46).f,s=0,l=Object.isExtensible||function(){return!0},u=!n(58)(function(){return l(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},f=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[r].i},getWeak:function(e,t){if(!i(e,r)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[r].w},onFreeze:function(e){return u&&f.NEED&&l(e)&&!i(e,r)&&c(e),e}}},function(e,t,n){e.exports={default:n(1080),__esModule:!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(4)),o=a(n(5)),i=a(n(9));function a(e){return e&&e.__esModule?e:{default:e}}var s=function(){function e(){(0,r.default)(this,e)}return(0,o.default)(e,[{key:"getValue",value:function(e,t){return console.error("Invalid operation: getValue was not overridden"),null}},{key:"setValue",value:function(e,t,n){return console.error("Invalid operation: setValue was not overridden"),i.default.reject()}},{key:"canSetValue",value:function(e,t){return!1}},{key:"isSupported",value:function(){return!1}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";(function(t){var r=h(n(20)),o=h(n(8)),i=h(n(71)),a=h(n(409)),s=h(n(90)),l=h(n(290)),u=h(n(10)),c=h(n(3)),f=n(2),d=h(n(16)),p=n(22),m=h(p);function h(e){return e&&e.__esModule?e:{default:e}}var _={notifsByRoom:{},pendingEncryptedEventIds:[],notificationMessageForEvent:function(e){return a.default.textForEvent(e)},_displayPopupNotification:function(e,n){var r=i.default.get();if(r&&r.supportsNotifications()&&r.maySendNotifications()&&!t.document.hasFocus()){var o=this.notificationMessageForEvent(e);if(o){var a=void 0;e.sender&&n.name!==e.sender.name?"m.room.member"===e.getType()?a=n.name:e.sender&&(a=e.sender.name+" ("+n.name+")",e.getContent().body&&(o=e.getContent().body)):(a=n.name,e.getContent().body&&(o=e.getContent().body)),this.isBodyEnabled()||(o="");var s=e.sender?l.default.avatarUrlForMember(e.sender,40,40,"crop"):null,u=r.displayNotification(a,o,s,n);u&&(void 0===this.notifsByRoom[e.getRoomId()]&&(this.notifsByRoom[e.getRoomId()]=[]),this.notifsByRoom[e.getRoomId()].push(u))}}},_playAudioNotification:function(e,t){var n=document.getElementById("messageAudio");n&&n.play()},start:function(){this.boundOnEvent=this.onEvent.bind(this),this.boundOnSyncStateChange=this.onSyncStateChange.bind(this),this.boundOnRoomReceipt=this.onRoomReceipt.bind(this),this.boundOnEventDecrypted=this.onEventDecrypted.bind(this),o.default.get().on("event",this.boundOnEvent),o.default.get().on("Room.receipt",this.boundOnRoomReceipt),o.default.get().on("Event.decrypted",this.boundOnEventDecrypted),o.default.get().on("sync",this.boundOnSyncStateChange),this.toolbarHidden=!1,this.isSyncing=!1},stop:function(){o.default.get()&&this.boundOnRoomTimeline&&(o.default.get().removeListener("Event",this.boundOnEvent),o.default.get().removeListener("Room.receipt",this.boundOnRoomReceipt),o.default.get().removeListener("Event.decrypted",this.boundOnEventDecrypted),o.default.get().removeListener("sync",this.boundOnSyncStateChange)),this.isSyncing=!1},supportsDesktopNotifications:function(){var e=i.default.get();return e&&e.supportsNotifications()},setEnabled:function(e,t){var n=i.default.get();n&&(s.default.trackEvent("Notifier","Set Enabled",e),m.default.isLevelSupported(p.SettingLevel.DEVICE)&&m.default.setValue("audioNotificationsEnabled",null,p.SettingLevel.DEVICE,this.isEnabled()),e?n.requestNotificationPermission().done(function(e){if("granted"===e)t&&t(),u.default.dispatch({action:"notifier_enabled",value:!0});else{var n="denied"===e?(0,f._t)("Riot does not have permission to send you notifications - please check your browser settings"):(0,f._t)("Riot was not given permission to send notifications - please try again"),r=c.default.getComponent("dialogs.ErrorDialog");d.default.createTrackedDialog("Unable to enable Notifications",e,r,{title:(0,f._t)("Unable to enable Notifications"),description:n})}}):u.default.dispatch({action:"notifier_enabled",value:!1}),this.setToolbarHidden(!0))},isEnabled:function(){return this.isPossible()&&m.default.getValue("notificationsEnabled")},isPossible:function(){var e=i.default.get();return!!e&&(!!e.supportsNotifications()&&!!e.maySendNotifications())},isBodyEnabled:function(){return this.isEnabled()&&m.default.getValue("notificationBodyEnabled")},isAudioEnabled:function(){return this.isEnabled()&&m.default.getValue("audioNotificationsEnabled")},setToolbarHidden:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.toolbarHidden=e,s.default.trackEvent("Notifier","Set Toolbar Hidden",e),u.default.dispatch({action:"notifier_enabled",value:this.isEnabled()}),n&&t.localStorage&&t.localStorage.setItem("notifications_hidden",e)},isToolbarHidden:function(){return t.localStorage?"true"===t.localStorage.getItem("notifications_hidden"):this.toolbarHidden},onSyncStateChange:function(e){"SYNCING"===e?this.isSyncing=!0:"STOPPED"!==e&&"ERROR"!==e||(this.isSyncing=!1)},onEvent:function(e){if(this.isSyncing&&(!e.sender||e.sender.userId!==o.default.get().credentials.userId))if(e.isBeingDecrypted()||e.isDecryptionFailure())for(this.pendingEncryptedEventIds.push(e.getId());this.pendingEncryptedEventIds.length>20;)this.pendingEncryptedEventIds.shift();else this._evaluateEvent(e)},onEventDecrypted:function(e){if(!e.isDecryptionFailure()){var t=this.pendingEncryptedEventIds.indexOf(e.getId());-1!==t&&(this.pendingEncryptedEventIds.splice(t,1),this._evaluateEvent(e))}},onRoomReceipt:function(e,t){if(0===t.getUnreadNotificationCount()){var n=i.default.get();if(!n)return;if(void 0===this.notifsByRoom[t.roomId])return;var o=!0,a=!1,s=void 0;try{for(var l,u=(0,r.default)(this.notifsByRoom[t.roomId]);!(o=(l=u.next()).done);o=!0){var c=l.value;n.clearNotification(c)}}catch(e){a=!0,s=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw s}}delete this.notifsByRoom[t.roomId]}},_evaluateEvent:function(e){var t=o.default.get().getRoom(e.getRoomId()),n=o.default.get().getPushActionsForEvent(e);n&&n.notify&&(this.isEnabled()&&this._displayPopupNotification(e,t),n.tweaks.sound&&this.isAudioEnabled()&&(i.default.get().loudNotification(e,t),this._playAudioNotification(e,t)))}};t.mxNotifier||(t.mxNotifier=_),e.exports=t.mxNotifier}).call(this,n(15))},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,i,a,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,o,i,a,s],c=0;l=new Error("Invariant Violation: "+t.replace(/%s/g,function(){return u[c++]}))}throw l.framesToPop=1,l}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=_(n(14)),o=_(n(149)),i=_(n(576)),a=_(n(126)),s=_(n(65)),l=_(n(4)),u=_(n(5)),c=_(n(8)),f=_(n(39)),d=_(n(10)),p=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(89)),m=_(n(292)),h=_(n(22));function _(e){return e&&e.__esModule?e:{default:e}}var g=function(){function e(){(0,l.default)(this,e)}return(0,u.default)(e,null,[{key:"canUserModifyWidgets",value:function(e){if(!e)return console.warn("No room ID specified"),!1;var t=c.default.get();if(!t)return console.warn("User must be be logged in"),!1;var n=t.getRoom(e);if(!n)return console.warn("Room ID "+e+" is not recognised"),!1;var r=t.credentials.userId;return r?"join"!==n.getMyMembership()?(console.warn("User "+r+" is not in room "+e),!1):n.currentState.maySendStateEvent("im.vector.modular.widgets",r):(console.warn("Failed to get user ID"),!1)}},{key:"isScalarUrl",value:function(e){if(!e)return console.error("Scalar URL check failed. No URL specified"),!1;var t=p.parse(e),n=f.default.get().integrations_widgets_urls;n&&0!==n.length||(n=[f.default.get().integrations_rest_url]);for(var r=0;r1&&void 0!==arguments[1]&&arguments[1],n=new Date,a=o(),s=i();if(e.toDateString()===n.toDateString())return c(e,t);if(n.getTime()-e.getTime()<5184e5)return(0,r._t)("%(weekDayName)s %(time)s",{weekDayName:a[e.getDay()],time:c(e,t)});if(n.getFullYear()===e.getFullYear())return(0,r._t)("%(weekDayName)s, %(monthName)s %(day)s %(time)s",{weekDayName:a[e.getDay()],monthName:s[e.getMonth()],day:e.getDate(),time:c(e,t)});return l(e,t)},t.formatFullDateNoTime=function(e){var t=o(),n=i();return(0,r._t)("%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s",{weekDayName:t[e.getDay()],monthName:n[e.getMonth()],day:e.getDate(),fullYear:e.getFullYear()})},t.formatFullDate=l,t.formatFullTime=u,t.formatTime=c,t.wantsDateSeparator=function(e,t){if(!t||!e)return!1;if(Math.abs(e.getTime()-t.getTime())>f)return!0;return e.getDay()!==t.getDay()};var r=n(2);function o(){return[(0,r._t)("Sun"),(0,r._t)("Mon"),(0,r._t)("Tue"),(0,r._t)("Wed"),(0,r._t)("Thu"),(0,r._t)("Fri"),(0,r._t)("Sat")]}function i(){return[(0,r._t)("Jan"),(0,r._t)("Feb"),(0,r._t)("Mar"),(0,r._t)("Apr"),(0,r._t)("May"),(0,r._t)("Jun"),(0,r._t)("Jul"),(0,r._t)("Aug"),(0,r._t)("Sep"),(0,r._t)("Oct"),(0,r._t)("Nov"),(0,r._t)("Dec")]}function a(e){return(e<10?"0":"")+e}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.getHours()%12,o=a(e.getMinutes()),i=e.getHours()>=12?(0,r._t)("PM"):(0,r._t)("AM");return n=n||12,t?n+":"+o+":"+a(e.getSeconds())+i:n+":"+o+i}function l(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=o(),a=i();return(0,r._t)("%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s",{weekDayName:n[e.getDay()],monthName:a[e.getMonth()],day:e.getDate(),fullYear:e.getFullYear(),time:u(e,t)})}function u(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?s(e,!0):a(e.getHours())+":"+a(e.getMinutes())+":"+a(e.getSeconds())}function c(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?s(e):a(e.getHours())+":"+a(e.getMinutes())}var f=864e5},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var o=p(n(19)),i=p(n(14)),a=n(9),s=p(a),l=p(n(11)),u=p(n(4)),c=p(n(5)),f=p(n(12)),d=p(n(13));function p(e){return e&&e.__esModule?e:{default:e}}var m=!0,h=function(e){function t(e){(0,u.default)(this,t);var n=(0,f.default)(this,(t.__proto__||(0,l.default)(t)).call(this));return n._matrixClient=e,n._userGroups={},n._groupProfiles={},n._groupProfilesPromise={},n._usersPending={},n._usersInFlight={},n._debounceTimeoutID=null,n}return(0,d.default)(t,e),(0,c.default)(t,[{key:"groupSupport",value:function(){return m}},{key:"invalidatePublicisedGroups",value:function(e){delete this._userGroups[e]}},{key:"getPublicisedGroupsCached",value:function(e,t){var n=this;return this._userGroups[t]?s.default.resolve(this._userGroups[t]):this._usersPending[t]?this._usersPending[t].prom:this._usersInFlight[t]?this._usersInFlight[t].prom:(this._usersPending[t]={},this._usersPending[t].prom=new s.default(function(e,r){n._usersPending[t].resolve=e,n._usersPending[t].reject=r}).then(function(e){return n._userGroups[t]=e,setTimeout(function(){delete n._userGroups[t]},18e5),n._userGroups[t]}).catch(function(e){if("M_UNRECOGNIZED"===e.errcode)return console.warn("Cannot display flair, server does not support groups"),void(m=!1);throw console.error("Could not get groups for user",t,e),e}).finally(function(){delete n._usersInFlight[t]}),this._debounceTimeoutID&&clearTimeout(this._debounceTimeoutID),this._debounceTimeoutID=setTimeout(function(){n._batchedGetPublicGroups(e)},200),this._usersPending[t].prom)}},{key:"_batchedGetPublicGroups",value:function(){var e=(0,a.coroutine)(o.default.mark(function e(t){var n,r,s=this;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this._usersInFlight=this._usersPending,this._usersPending={},n={users:[]},e.prev=3,e.next=6,(0,a.resolve)(t.getPublicisedGroups((0,i.default)(this._usersInFlight)));case 6:n=e.sent,e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(3),(0,i.default)(this._usersInFlight).forEach(function(t){s._usersInFlight[t]&&s._usersInFlight[t].reject(e.t0)}),e.abrupt("return");case 13:r=n.users,(0,i.default)(this._usersInFlight).forEach(function(e){s._usersInFlight[e]&&s._usersInFlight[e].resolve(r[e]||[])});case 15:case"end":return e.stop()}},e,this,[[3,9]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getGroupProfileCached",value:function(){var e=(0,a.coroutine)(o.default.mark(function e(t,n){var r,i=this;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._groupProfiles[n]){e.next=2;break}return e.abrupt("return",this._groupProfiles[n]);case 2:if(!this._groupProfilesPromise[n]){e.next=12;break}return e.prev=3,e.next=6,(0,a.resolve)(this._groupProfilesPromise[n]);case 6:e.next=11;break;case 8:return e.prev=8,e.t0=e.catch(3),e.abrupt("return",null);case 11:return e.abrupt("return",this._groupProfiles[n]);case 12:return console.log("FlairStore: Request group profile of "+n),this._groupProfilesPromise[n]=t.getGroupProfile(n),r=void 0,e.prev=15,e.next=18,(0,a.resolve)(this._groupProfilesPromise[n]);case 18:r=e.sent,e.next=26;break;case 21:return e.prev=21,e.t1=e.catch(15),console.log("FlairStore: Failed to get group profile for "+n,e.t1),delete this._groupProfilesPromise[n],e.abrupt("return",null);case 26:return this._groupProfiles[n]={groupId:n,avatarUrl:r.avatar_url,name:r.name,shortDescription:r.short_description},delete this._groupProfilesPromise[n],console.log("FlairStore: Emit updateGroupProfile for "+n),this.emit("updateGroupProfile"),setTimeout(function(){i.refreshGroupProfile(t,n)},18e5),e.abrupt("return",this._groupProfiles[n]);case 32:case"end":return e.stop()}},e,this,[[3,8],[15,21]])}));return function(t,n){return e.apply(this,arguments)}}()},{key:"refreshGroupProfile",value:function(e,t){return delete this._groupProfiles[t],this.getGroupProfileCached(e,t)}}]),t}(p(n(55)).default);void 0===r.singletonFlairStore&&(r.singletonFlairStore=new h),t.default=r.singletonFlairStore,e.exports=t.default}).call(this,n(15))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(20)),o=s(n(14));t.getDisplayAliasForRoom=function(e){return e.getCanonicalAlias()||e.getAliases()[0]},t.getOnlyOtherMember=l,t.isConfCallRoom=function(e,t,n){if(void 0!==u[e.roomId])return u[e.roomId];var r=function(e,t,n){if(!n)return!1;if("join"!=e.getMyMembership())return!1;var r=l(e,t);if(!r)return!1;if(n.isConferenceUser(r.userId))return!0;return!1}(e,t,n);return u[e.roomId]=r,r},t.looksLikeDirectMessageRoom=function(e,t){var n=e.getMyMembership(),r=e.getMember(t);if("join"==n||"ban"===n||r&&r.isKicked()){var i=(0,o.default)(e.tags),a=e.currentState.getJoinedMemberCount()+e.currentState.getInvitedMemberCount();if(2===a&&!i.length)return!0}return!1},t.guessAndSetDMRoom=function(e,t){var n=void 0;if(t){var o=function(e,t){var n=void 0,o=void 0,i=!0,a=!1,s=void 0;try{for(var l,u=(0,r.default)(e.getJoinedMembers());!(i=(l=u.next()).done);i=!0){var c=l.value;c.userId!=t&&((void 0===n||c.events.member&&c.events.member.getTs()-1&&m.splice(h,1)}}}catch(e){u=!0,c=e}finally{try{!l&&d.return&&d.return()}finally{if(u)throw c}}if(t){var _=s[t]||[];-1==_.indexOf(e)&&_.push(e),s[t]=_}return i.default.get().setAccountData("m.direct",s)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(n(198));t.default=function(){var e=window.pageYOffset,t=window.pageXOffset,n=t+window.innerWidth,o=e+window.innerHeight;return(0,r.default)({top:e,left:t,right:n,bottom:o})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return"private-react-beautiful-dnd-key-do-not-use-"+e};t.storeKey=r("store"),t.droppableIdKey=r("droppable-id"),t.dimensionMarshalKey=r("dimension-marshal"),t.styleContextKey=r("style-context"),t.canLiftContextKey=r("can-lift")},function(e,t,n){"use strict";t.__esModule=!0;var r=i(n(393)),o=i(n(20));function i(e){return e&&e.__esModule?e:{default:e}}t.default=function(){return function(e,t){if(Array.isArray(e))return e;if((0,r.default)(Object(e)))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var s,l=(0,o.default)(e);!(r=(s=l.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&l.return&&l.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports=!1},function(e,t,n){var r=n(496),o=n(329);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(108),o=Math.max,i=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):i(e,t)}},function(e,t,n){var r=n(25),o=n(497),i=n(329),a=n(328)("IE_PROTO"),s=function(){},l=function(){var e,t=n(326)("iframe"),r=i.length;for(t.style.display="none",n(330).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("