ocrcc-chatbox/dist/chatbox.js
Sharon Kennedy 55d6cf818e latest build
2020-05-06 21:26:53 -04:00

60 lines
1.6 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

window.EmbeddableChatbox=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=159)}([function(e,t,n){"use strict";e.exports=n(162)},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var r=n(10),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";var r=n(16);Object.defineProperty(t,"__esModule",{value:!0}),t.logger=void 0;var i=r(n(265));const o=i.default.getLogger("matrix");t.logger=o,o.setLevel(i.default.levels.DEBUG)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){var r=n(87);function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}e.exports=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var a=o?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n.default=e,t&&t.set(e,n),n}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){"use strict";var r=n(16);Object.defineProperty(t,"__esModule",{value:!0}),t.encodeParams=function(e){let t="";for(const n in e)e.hasOwnProperty(n)&&(t+="&"+encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t.substring(1)},t.encodeUri=function(e,t){for(const n in t)t.hasOwnProperty(n)&&(e=e.replace(n,encodeURIComponent(t[n])));return e},t.map=function(e,t){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=t(e[r]);return n},t.filter=function(e,t){const n=[];for(let r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n},t.keys=function(e){const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(n);return t},t.values=function(e){const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t},t.forEach=function(e,t){for(let n=0;n<e.length;n++)t(e[n],n)},t.findElement=function(e,t,n){let r;if(n){for(r=e.length-1;r>=0;r--)if(t(e[r],r,e))return e[r]}else for(r=0;r<e.length;r++)if(t(e[r],r,e))return e[r]},t.removeElement=function(e,t,n){let r,i;if(n){for(r=e.length-1;r>=0;r--)if(t(e[r],r,e))return i=e[r],e.splice(r,1),i}else for(r=0;r<e.length;r++)if(t(e[r],r,e))return i=e[r],e.splice(r,1),i;return!1},t.isFunction=function(e){return"[object Function]"==Object.prototype.toString.call(e)},t.isArray=function(e){return Array.isArray?Array.isArray(e):Boolean(e&&e.constructor===Array)},t.checkObjectHasKeys=function(e,t){for(let n=0;n<t.length;n++)if(!e.hasOwnProperty(t[n]))throw new Error("Missing required key: "+t[n])},t.checkObjectHasNoAdditionalKeys=function(e,t){for(const n in e)if(e.hasOwnProperty(n)&&-1===t.indexOf(n))throw new Error("Unknown key: "+n)},t.deepCopy=function(e){return JSON.parse(JSON.stringify(e))},t.deepCompare=function e(t,n){if(t===n)return!0;if(typeof t!=typeof n)return!1;if("number"==typeof t&&isNaN(t)&&isNaN(n))return!0;if(null===t||null===n)return t===n;if(!(t instanceof Object))return!1;if(t.constructor!==n.constructor||t.prototype!==n.prototype)return!1;if(t instanceof RegExp||t instanceof Date)return t.toString()===n.toString();if(t instanceof Array){if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1}else{let r;for(r in n)if(n.hasOwnProperty(r)!==t.hasOwnProperty(r))return!1;for(r in n){if(n.hasOwnProperty(r)!==t.hasOwnProperty(r))return!1;if(!e(t[r],n[r]))return!1}}return!0},t.extend=function(){const e=arguments[0]||{};for(let t=1;t<arguments.length;t++){const n=arguments[t];for(const t in n)e[t]=n[t]}return e},t.runPolyfills=function(){Array.prototype.filter||(Array.prototype.filter=function(e){if(null==this)throw new TypeError;const t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError;const r=[],i=arguments.length>=2?arguments[1]:void 0;for(let o=0;o<n;o++)if(o in t){const n=t[o];e.call(i,n,o,t)&&r.push(n)}return r});Array.prototype.map||(Array.prototype.map=function(e,t){let n,r;if(null==this)throw new TypeError(" this is null or not defined");const i=Object(this),o=i.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");arguments.length>1&&(n=t);const s=new Array(o);for(r=0;r<o;){var a,c;r in i&&(a=i[r],c=e.call(n,a,r,i),s[r]=c),r++}return s});Array.prototype.forEach||(Array.prototype.forEach=function(e,t){let n,r;if(null==this)throw new TypeError(" this is null or not defined");const i=Object(this),o=i.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=0;r<o;){var s;r in i&&(s=i[r],e.call(n,s,r,i)),r++}})},t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.polyfillSuper=function(e,t,...n){try{t.call(e,...n)}catch(r){const i=new t(...n);Object.assign(e,i)}},t.isNumber=function(e){return"number"==typeof e&&isFinite(e)},t.removeHiddenChars=function(e){return(0,i.default)(e.normalize("NFD").replace(o,""))},t.escapeRegExp=s,t.globToRegexp=function(e,t){t="boolean"!=typeof t||t;let n=s(e);n=n.replace(/\\\*/g,".*"),n=n.replace(/\?/g,"."),t&&(n=n.replace(/\\\[(!|)(.*)\\]/g,(function(e,t,n,r,i){return"["+(t?"^":"")+n.replace(/\\-/,"-")+"]"})));return n},t.ensureNoTrailingSlash=function(e){return e&&e.endsWith("/")?e.substr(0,e.length-1):e},t.sleep=function(e,t){return new Promise(n=>{setTimeout(n,e,t)})},t.isNullOrUndefined=function(e){return null==e},t.defer=function(){let e,t;const n=new Promise((n,r)=>{e=n,t=r});return{resolve:e,reject:t,promise:n}},t.promiseMapSeries=async function(e,t){for(const n of await e)await t(await n)},t.promiseTry=function(e){return new Promise(t=>t(e()))};var i=r(n(266));const o=/[\u2000-\u200F\u202A-\u202F\u0300-\u036f\uFEFF\s]/g;function s(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function f(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var i,o,s,a;if(f(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=u(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):g(i,i.length)}function m(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function g(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)o(c,this,t);else{var f=c.length,u=g(c,f);for(n=0;n<f;++n)o(u[n],this,t)}return!0},a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)},a.prototype.once=function(e,t){return f(t),this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return f(t),this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,i,o,s;if(f(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";(function(e){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var r=n(175),i=n(176),o=n(88);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return l(this,e)}return f(this,e,t,n)}function f(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=d(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(t,n),i=(e=a(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|h(t.length);return 0===(e=a(e,n)).length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):d(e,t);if("Buffer"===t.type&&o(t.data))return d(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function l(e,t){if(u(t),e=a(e,t<0?0:0|h(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function d(e,t){var n=t.length<0?0:0|h(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function h(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return F(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return S(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){var o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function f(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var u=-1;for(o=n;o<a;o++)if(f(e,o)===f(t,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===c)return u*s}else-1!==u&&(o-=o-u),u=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var l=!0,d=0;d<c;d++)if(f(e,o+d)!==f(t,d)){l=!1;break}if(l)return o}return-1}function _(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function v(e,t,n,r){return K(F(t,e.length-n),e,n,r)}function A(e,t,n,r){return K(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function w(e,t,n,r){return A(e,t,n,r)}function E(e,t,n,r){return K(q(t),e,n,r)}function k(e,t,n,r){return K(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function S(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,c,f=e[i],u=null,l=f>239?4:f>223?3:f>191?2:1;if(i+l<=n)switch(l){case 1:f<128&&(u=f);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&f)<<6|63&o)>127&&(u=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&f)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,l=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=l}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return f(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,r){return u(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return l(null,e)},c.allocUnsafeSlow=function(e){return l(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=c.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?I(this,0,e):m.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),f=this.slice(r,i),u=e.slice(t,n),l=0;l<a;++l)if(f[l]!==u[l]){o=f[l],s=u[l];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":return A(this,e,t,n);case"latin1":case"binary":return w(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function R(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function O(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=L(e[o]);return i}function x(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function C(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function D(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function B(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(e,t,n,r,o){return o||B(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function j(e,t,n,r,o){return o||B(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var i=t-e;n=new c(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||C(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||C(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||C(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||C(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||C(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):D(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):D(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return j(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=c.isBuffer(e)?e:F(new c(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var U=/[^+\/0-9A-Za-z-_]/g;function L(e){return e<16?"0"+e.toString(16):e.toString(16)}function F(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(5))},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s=n(222).Buffer}catch(e){}function a(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o<i;o++){var s=e.charCodeAt(o)-48;r<<=4,r|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return r}function c(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s<o;s++){var a=e.charCodeAt(s)-48;i*=r,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)s=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,o=0;for(n=e.length-6,r=0;n>=t;n-=6)i=a(e,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==t&&(i=a(e,t,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,f=0,u=n;u<a;u+=r)f=c(e,u,u+r,t),this.imuln(i),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(0!==s){var l=1;for(f=c(e,u,e.length,t),u=0;u<s;u++)l*=t;this.imuln(l),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;n.words[0]=a;for(var f=1;f<r;f++){for(var u=c>>>26,l=67108863&c,d=Math.min(f,t.length-1),h=Math.max(0,f-e.length+1);h<=d;h++){var p=f-h|0;u+=(s=(i=0|e.words[p])*(o=0|t.words[h])+l)/67108864|0,l=67108863&s}n.words[f]=0|l,c=0|u}return 0!==c?n.words[f]=0|c:n.length--,n.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],c=(16777215&(a<<i|o)).toString(16);n=0!==(o=a>>>24-i&16777215)||s!==this.length-1?f[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var d=u[e],h=l[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?m+n:f[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r(void 0!==s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===t,f=new e(o),u=this.clone();if(c){for(a=0;!u.isZero();a++)s=u.andln(255),u.iushrn(8),f[a]=s;for(;a<o;a++)f[a]=0}else{for(a=0;a<o-i;a++)f[a]=0;for(a=0;!u.isZero();a++)s=u.andln(255),u.iushrn(8),f[o-a-1]=s}return f},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s<r.length;s++)o=(t=(0|n.words[s])-(0|r.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<n.length;s++)o=(t=(0|n.words[s])+o)>>26,this.words[s]=67108863&t;if(0===o&&s<n.length&&n!==this)for(;s<n.length;s++)this.words[s]=n.words[s];return this.length=Math.max(this.length,s),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,n){var r,i,o,s=e.words,a=t.words,c=n.words,f=0,u=0|s[0],l=8191&u,d=u>>>13,h=0|s[1],p=8191&h,m=h>>>13,g=0|s[2],y=8191&g,b=g>>>13,_=0|s[3],v=8191&_,A=_>>>13,w=0|s[4],E=8191&w,k=w>>>13,S=0|s[5],I=8191&S,T=S>>>13,R=0|s[6],O=8191&R,x=R>>>13,C=0|s[7],P=8191&C,M=C>>>13,D=0|s[8],B=8191&D,N=D>>>13,j=0|s[9],U=8191&j,L=j>>>13,F=0|a[0],q=8191&F,K=F>>>13,z=0|a[1],G=8191&z,H=z>>>13,V=0|a[2],Q=8191&V,W=V>>>13,Y=0|a[3],X=8191&Y,J=Y>>>13,Z=0|a[4],$=8191&Z,ee=Z>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,fe=ae>>>13,ue=0|a[8],le=8191&ue,de=ue>>>13,he=0|a[9],pe=8191&he,me=he>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(f+(r=Math.imul(l,q))|0)+((8191&(i=(i=Math.imul(l,K))+Math.imul(d,q)|0))<<13)|0;f=((o=Math.imul(d,K))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,q),i=(i=Math.imul(p,K))+Math.imul(m,q)|0,o=Math.imul(m,K);var ye=(f+(r=r+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,H)|0)+Math.imul(d,G)|0))<<13)|0;f=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(y,q),i=(i=Math.imul(y,K))+Math.imul(b,q)|0,o=Math.imul(b,K),r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,H)|0;var be=(f+(r=r+Math.imul(l,Q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(d,Q)|0))<<13)|0;f=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(v,q),i=(i=Math.imul(v,K))+Math.imul(A,q)|0,o=Math.imul(A,K),r=r+Math.imul(y,G)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,H)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,W)|0;var _e=(f+(r=r+Math.imul(l,X)|0)|0)+((8191&(i=(i=i+Math.imul(l,J)|0)+Math.imul(d,X)|0))<<13)|0;f=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(E,q),i=(i=Math.imul(E,K))+Math.imul(k,q)|0,o=Math.imul(k,K),r=r+Math.imul(v,G)|0,i=(i=i+Math.imul(v,H)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,H)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,W)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,J)|0;var ve=(f+(r=r+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(d,$)|0))<<13)|0;f=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(I,q),i=(i=Math.imul(I,K))+Math.imul(T,q)|0,o=Math.imul(T,K),r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,H)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,W)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,W)|0,r=r+Math.imul(y,X)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,ee)|0;var Ae=(f+(r=r+Math.imul(l,ne)|0)|0)+((8191&(i=(i=i+Math.imul(l,re)|0)+Math.imul(d,ne)|0))<<13)|0;f=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(O,q),i=(i=Math.imul(O,K))+Math.imul(x,q)|0,o=Math.imul(x,K),r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,W)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,W)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,J)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,J)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var we=(f+(r=r+Math.imul(l,oe)|0)|0)+((8191&(i=(i=i+Math.imul(l,se)|0)+Math.imul(d,oe)|0))<<13)|0;f=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(P,q),i=(i=Math.imul(P,K))+Math.imul(M,q)|0,o=Math.imul(M,K),r=r+Math.imul(O,G)|0,i=(i=i+Math.imul(O,H)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,H)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,W)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,J)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(y,ne)|0,i=(i=i+Math.imul(y,re)|0)+Math.imul(b,ne)|0,o=o+Math.imul(b,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ee=(f+(r=r+Math.imul(l,ce)|0)|0)+((8191&(i=(i=i+Math.imul(l,fe)|0)+Math.imul(d,ce)|0))<<13)|0;f=((o=o+Math.imul(d,fe)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(B,q),i=(i=Math.imul(B,K))+Math.imul(N,q)|0,o=Math.imul(N,K),r=r+Math.imul(P,G)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(I,X)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(T,X)|0,o=o+Math.imul(T,J)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0,r=r+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,fe)|0;var ke=(f+(r=r+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,de)|0)+Math.imul(d,le)|0))<<13)|0;f=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(U,q),i=(i=Math.imul(U,K))+Math.imul(L,q)|0,o=Math.imul(L,K),r=r+Math.imul(B,G)|0,i=(i=i+Math.imul(B,H)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,W)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,J)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(k,ne)|0,o=o+Math.imul(k,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,r=r+Math.imul(y,ce)|0,i=(i=i+Math.imul(y,fe)|0)+Math.imul(b,ce)|0,o=o+Math.imul(b,fe)|0,r=r+Math.imul(p,le)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,de)|0;var Se=(f+(r=r+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,me)|0)+Math.imul(d,pe)|0))<<13)|0;f=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(U,G),i=(i=Math.imul(U,H))+Math.imul(L,G)|0,o=Math.imul(L,H),r=r+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,W)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,W)|0,r=r+Math.imul(P,X)|0,i=(i=i+Math.imul(P,J)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,J)|0,r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(T,ne)|0,o=o+Math.imul(T,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,se)|0,r=r+Math.imul(v,ce)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,fe)|0,r=r+Math.imul(y,le)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(b,le)|0,o=o+Math.imul(b,de)|0;var Ie=(f+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;f=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,Q),i=(i=Math.imul(U,W))+Math.imul(L,Q)|0,o=Math.imul(L,W),r=r+Math.imul(B,X)|0,i=(i=i+Math.imul(B,J)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,J)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,se)|0,r=r+Math.imul(E,ce)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(k,ce)|0,o=o+Math.imul(k,fe)|0,r=r+Math.imul(v,le)|0,i=(i=i+Math.imul(v,de)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,de)|0;var Te=(f+(r=r+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,me)|0)+Math.imul(b,pe)|0))<<13)|0;f=((o=o+Math.imul(b,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,X),i=(i=Math.imul(U,J))+Math.imul(L,X)|0,o=Math.imul(L,J),r=r+Math.imul(B,$)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,se)|0,r=r+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,fe)|0)+Math.imul(T,ce)|0,o=o+Math.imul(T,fe)|0,r=r+Math.imul(E,le)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(k,le)|0,o=o+Math.imul(k,de)|0;var Re=(f+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(A,pe)|0))<<13)|0;f=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(U,$),i=(i=Math.imul(U,ee))+Math.imul(L,$)|0,o=Math.imul(L,ee),r=r+Math.imul(B,ne)|0,i=(i=i+Math.imul(B,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,r=r+Math.imul(O,ce)|0,i=(i=i+Math.imul(O,fe)|0)+Math.imul(x,ce)|0,o=o+Math.imul(x,fe)|0,r=r+Math.imul(I,le)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(T,le)|0,o=o+Math.imul(T,de)|0;var Oe=(f+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(k,pe)|0))<<13)|0;f=((o=o+Math.imul(k,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,ne),i=(i=Math.imul(U,re))+Math.imul(L,ne)|0,o=Math.imul(L,re),r=r+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(P,ce)|0,i=(i=i+Math.imul(P,fe)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,fe)|0,r=r+Math.imul(O,le)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(x,le)|0,o=o+Math.imul(x,de)|0;var xe=(f+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(T,pe)|0))<<13)|0;f=((o=o+Math.imul(T,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(L,oe)|0,o=Math.imul(L,se),r=r+Math.imul(B,ce)|0,i=(i=i+Math.imul(B,fe)|0)+Math.imul(N,ce)|0,o=o+Math.imul(N,fe)|0,r=r+Math.imul(P,le)|0,i=(i=i+Math.imul(P,de)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,de)|0;var Ce=(f+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,me)|0)+Math.imul(x,pe)|0))<<13)|0;f=((o=o+Math.imul(x,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,ce),i=(i=Math.imul(U,fe))+Math.imul(L,ce)|0,o=Math.imul(L,fe),r=r+Math.imul(B,le)|0,i=(i=i+Math.imul(B,de)|0)+Math.imul(N,le)|0,o=o+Math.imul(N,de)|0;var Pe=(f+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(M,pe)|0))<<13)|0;f=((o=o+Math.imul(M,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,le),i=(i=Math.imul(U,de))+Math.imul(L,le)|0,o=Math.imul(L,de);var Me=(f+(r=r+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,me)|0)+Math.imul(N,pe)|0))<<13)|0;f=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863;var De=(f+(r=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,me))+Math.imul(L,pe)|0))<<13)|0;return f=((o=Math.imul(L,me))+(i>>>13)|0)+(De>>>26)|0,De&=67108863,c[0]=ge,c[1]=ye,c[2]=be,c[3]=_e,c[4]=ve,c[5]=Ae,c[6]=we,c[7]=Ee,c[8]=ke,c[9]=Se,c[10]=Ie,c[11]=Te,c[12]=Re,c[13]=Oe,c[14]=xe,c[15]=Ce,c[16]=Pe,c[17]=Me,c[18]=De,0!==f&&(c[19]=f,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=d),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?h(this,e,t):n<63?d(this,e,t):n<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var s=i;i=0;for(var a=67108863&r,c=Math.min(o,t.length-1),f=Math.max(0,o-e.length+1);f<=c;f++){var u=o-f,l=(0|e.words[u])*(0|t.words[f]),d=67108863&l;a=67108863&(d=d+a|0),i+=(s=(s=s+(l/67108864|0)|0)+(d>>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},m.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s<o;s++)r[s]=t[e[s]],i[s]=n[e[s]]},m.prototype.transform=function(e,t,n,r,i,o){this.permute(o,e,t,n,r,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,c=Math.cos(2*Math.PI/a),f=Math.sin(2*Math.PI/a),u=0;u<i;u+=a)for(var l=c,d=f,h=0;h<s;h++){var p=n[u+h],m=r[u+h],g=n[u+h+s],y=r[u+h+s],b=l*g-d*y;y=l*y+d*g,g=b,n[u+h]=p+g,r[u+h]=m+y,n[u+h+s]=p-g,r[u+h+s]=m-y,h!==a&&(b=c*l-f*d,d=c*d+f*l,l=b)}},m.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},m.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=8192*Math.round(e[2*r+1]/t)+Math.round(e[2*r]/t)+n;e[r]=67108863&i,n=i<67108864?0:i/67108864|0}return e},m.prototype.convert13b=function(e,t,n,i){for(var o=0,s=0;s<t;s++)o+=0|e[s],n[2*s]=8191&o,o>>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s<i;++s)n[s]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},m.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),o=this.stub(r),s=new Array(r),a=new Array(r),c=new Array(r),f=new Array(r),u=new Array(r),l=new Array(r),d=n.words;d.length=r,this.convert13b(e.words,e.length,s,r),this.convert13b(t.words,t.length,f,r),this.transform(s,o,a,c,r,i),this.transform(f,o,u,l,r,i);for(var h=0;h<r;h++){var p=a[h]*u[h]-c[h]*l[h];c[h]=a[h]*l[h]+c[h]*u[h],a[h]=p}return this.conjugate(a,c,r),this.transform(a,c,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),p(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&o,c=(0|this.words[t])-a<<n;this.words[t]=c|s,s=a>>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,c=n;if(i-=s,i=Math.max(0,i),c){for(var f=0;f<s;f++)c.words[f]=this.words[f];c.length=s}if(0===s);else if(this.length>s)for(this.length-=s,f=0;f<this.length;f++)this.words[f]=this.words[f+s];else this.words[0]=0,this.length=1;var u=0;for(f=this.length-1;f>=0&&(0!==u||f>=i);f--){var l=0|this.words[f];this.words[f]=u<<26-o|l>>>o,u=l&a}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var i,o,s=e.length+n;this._expand(s);var a=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+a;var c=(0|e.words[i])*t;a=((o-=67108863&c)>>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!==(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,c=r.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var f=0;f<a.length;f++)a.words[f]=0}var u=r.clone()._ishlnsubmul(i,1,c);0===u.negative&&(r=u,a&&(a.words[c]=1));for(var l=c-1;l>=0;l--){var d=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(i,d,l);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=d)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),f=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++f;for(var u=n.clone(),l=t.clone();!t.isZero();){for(var d=0,h=1;0==(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(u),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(u),c.isub(l)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(f)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var f=0,u=1;0==(t.words[0]&u)&&f<26;++f,u<<=1);if(f>0)for(t.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var l=0,d=1;0==(n.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(n.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new w(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){w.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},i(b,y),b.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r<n;r++)t.words[r]=e.words[r];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=4194303&i,r=10;r<e.length;r++){var o=0|e.words[r];e.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(_,y),i(v,y),i(A,y),A.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new _;else if("p192"===e)t=new v;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return g[e]=t,t},w.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},w.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},w.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},w.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},w.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},w.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},w.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},w.prototype.isqr=function(e){return this.imul(e,e.clone())},w.prototype.sqr=function(e){return this.mul(e,e)},w.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),f=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new o(2*u*u).toRed(this);0!==this.pow(u,f).cmp(c);)u.redIAdd(c);for(var l=this.pow(u,i),d=this.pow(e,i.addn(1).iushrn(1)),h=this.pow(e,i),p=s;0!==h.cmp(a);){for(var m=h,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var y=this.pow(l,new o(1).iushln(p-g-1));d=d.redMul(y),l=y.redSqr(),h=h.redMul(l),p=g}return d},w.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},w.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],s=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),r=t.length-1;r>=0;r--){for(var f=t.words[r],u=c-1;u>=0;u--){var l=f>>u&1;i!==n[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===r&&0===u)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}c=26}return i},w.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},w.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new E(e)},i(E,w),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,n(112)(e))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,f=[],u=!1,l=-1;function d(){u&&c&&(u=!1,c.length?f=c.concat(f):l=-1,f.length&&h())}function h(){if(!u){var e=a(d);u=!0;for(var t=f.length;t;){for(c=f,f=[];++l<t;)c&&c[l].run();l=-1,t=f.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new p(e,t)),1!==f.length||u||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){e.exports=n(170)()},function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=n,n.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},function(e,t,n){"use strict";var r=t,i=n(11),o=n(14),s=n(114);r.assert=o,r.toArray=s.toArray,r.zero2=s.zero2,r.toHex=s.toHex,r.encode=s.encode,r.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<<t+1,o=e.clone(),s=0;s<r.length;s++){var a,c=o.andln(i-1);o.isOdd()?(a=c>(i>>1)-1?(i>>1)-c:c,o.isubn(a)):a=0,r[s]=a,o.iushrn(1)}return r},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r=0,i=0;e.cmpn(-r)>0||t.cmpn(-i)>0;){var o,s,a,c=e.andln(3)+r&3,f=t.andln(3)+i&3;if(3===c&&(c=-1),3===f&&(f=-1),0==(1&c))o=0;else o=3!==(a=e.andln(7)+r&7)&&5!==a||2!==f?c:-c;if(n[0].push(o),0==(1&f))s=0;else s=3!==(a=t.andln(7)+i&7)&&5!==a||2!==c?f:-f;n[1].push(s),2*r===o+1&&(r=1-r),2*i===s+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";var r=n(14),i=n(1);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)n.push(parseInt(e[i]+e[i+1],16))}else for(var r=0,i=0;i<e.length;i++){var s=e.charCodeAt(i);s<128?n[r++]=s:s<2048?(n[r++]=s>>6|192,n[r++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128,n[r++]=s>>6&63|128,n[r++]=63&s|128):(n[r++]=s>>12|224,n[r++]=s>>6&63|128,n[r++]=63&s|128)}else for(i=0;i<e.length;i++)n[i]=0|e[i];return n},t.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=a(e[n].toString(16));return t},t.htonl=s,t.toHex32=function(e,t){for(var n="",r=0;r<e.length;r++){var i=e[r];"little"===t&&(i=s(i)),n+=c(i.toString(16))}return n},t.zero2=a,t.zero8=c,t.join32=function(e,t,n,i){var o=n-t;r(o%4==0);for(var s=new Array(o/4),a=0,c=t;a<s.length;a++,c+=4){var f;f="big"===i?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c],s[a]=f>>>0}return s},t.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4){var o=e[r];"big"===t?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},t.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},t.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,s=(o<r?1:0)+n+i;e[t]=s>>>0,e[t+1]=o},t.sum64_hi=function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0},t.sum64_lo=function(e,t,n,r){return t+r>>>0},t.sum64_4_hi=function(e,t,n,r,i,o,s,a){var c=0,f=t;return c+=(f=f+r>>>0)<t?1:0,c+=(f=f+o>>>0)<o?1:0,e+n+i+s+(c+=(f=f+a>>>0)<a?1:0)>>>0},t.sum64_4_lo=function(e,t,n,r,i,o,s,a){return t+r+o+a>>>0},t.sum64_5_hi=function(e,t,n,r,i,o,s,a,c,f){var u=0,l=t;return u+=(l=l+r>>>0)<t?1:0,u+=(l=l+o>>>0)<o?1:0,u+=(l=l+a>>>0)<a?1:0,e+n+i+s+c+(u+=(l=l+f>>>0)<f?1:0)>>>0},t.sum64_5_lo=function(e,t,n,r,i,o,s,a,c,f){return t+r+o+a+f>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},function(e,t,n){var r=n(3).Buffer,i=n(42).Transform,o=n(61).StringDecoder;function s(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(1)(s,i),s.prototype.update=function(e,t,n){"string"==typeof e&&(e=r.from(e,t));var i=this._update(e);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},s.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},s.prototype._finalOrDigest=function(e){var t=this.__final()||r.alloc(0);return e&&(t=this._toString(t,e,!0)),t},s.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r},e.exports=s},function(e,t,n){"use strict";var r=n(6);Object.defineProperty(t,"__esModule",{value:!0}),t.MatrixEvent=t.EventStatus=void 0;var i=n(9),o=r(n(8)),s=n(4);t.EventStatus={NOT_SENT:"not_sent",ENCRYPTING:"encrypting",SENDING:"sending",QUEUED:"queued",SENT:"sent",CANCELLED:"cancelled"};const a={};function c(e){return a[e]||(a[e]=e),a[e]}const f=function(e){["state_key","type","sender","room_id","membership"].forEach(t=>{e[t]&&(e[t]=c(e[t]))}),["membership","avatar_url","displayname"].forEach(t=>{e.content&&e.content[t]&&(e.content[t]=c(e.content[t]))}),["rel_type"].forEach(t=>{e.content&&e.content["m.relates_to"]&&e.content["m.relates_to"][t]&&(e.content["m.relates_to"][t]=c(e.content["m.relates_to"][t]))}),this.event=e||{},this.sender=null,this.target=null,this.status=null,this.error=null,this.forwardLooking=!0,this._pushActions=null,this._replacingEvent=null,this._localRedactionEvent=null,this._isCancelled=!1,this._clearEvent={},this._senderCurve25519Key=null,this._claimedEd25519Key=null,this._forwardingCurve25519KeyChain=[],this._decryptionPromise=null,this._retryDecryption=!1};t.MatrixEvent=f,o.inherits(f,i.EventEmitter),o.extend(f.prototype,{getId:function(){return this.event.event_id},getSender:function(){return this.event.sender||this.event.user_id},getType:function(){return this._clearEvent.type||this.event.type},getWireType:function(){return this.event.type},getRoomId:function(){return this.event.room_id},getTs:function(){return this.event.origin_server_ts},getDate:function(){return this.event.origin_server_ts?new Date(this.event.origin_server_ts):null},getOriginalContent:function(){return this._localRedactionEvent?{}:this._clearEvent.content||this.event.content||{}},getContent:function(){return this._localRedactionEvent?{}:this._replacingEvent?this._replacingEvent.getContent()["m.new_content"]||{}:this.getOriginalContent()},getWireContent:function(){return this.event.content||{}},getPrevContent:function(){return this.getUnsigned().prev_content||this.event.prev_content||{}},getDirectionalContent:function(){return this.forwardLooking?this.getContent():this.getPrevContent()},getAge:function(){return this.getUnsigned().age||this.event.age},getLocalAge:function(){return Date.now()-this.getTs()},getStateKey:function(){return this.event.state_key},isState:function(){return void 0!==this.event.state_key},makeEncrypted:function(e,t,n,r){this._clearEvent={type:this.event.type,content:this.event.content},this.event.type=e,this.event.content=t,this._senderCurve25519Key=n,this._claimedEd25519Key=r},isBeingDecrypted:function(){return null!=this._decryptionPromise},isDecryptionFailure:function(){return this._clearEvent&&this._clearEvent.content&&"m.bad.encrypted"===this._clearEvent.content.msgtype},attemptDecryption:async function(e){if(!this.isEncrypted())throw new Error("Attempt to decrypt event which isn't encrypted");if(this._clearEvent&&this._clearEvent.content&&"m.bad.encrypted"!==this._clearEvent.content.msgtype)throw new Error("Attempt to decrypt event which has already been encrypted");return this._decryptionPromise?(s.logger.log(`Event ${this.getId()} already being decrypted; queueing a retry`),this._retryDecryption=!0,this._decryptionPromise):(this._decryptionPromise=this._decryptionLoop(e),this._decryptionPromise)},cancelAndResendKeyRequest:function(e,t){const n=this.getWireContent();return e.requestRoomKey({algorithm:n.algorithm,room_id:this.getRoomId(),session_id:n.session_id,sender_key:n.sender_key},this.getKeyRequestRecipients(t),!0)},getKeyRequestRecipients:function(e){const t=this.getWireContent(),n=[{userId:e,deviceId:"*"}],r=this.getSender();return r!==e&&n.push({userId:r,deviceId:t.device_id}),n},_decryptionLoop:async function(e){for(await Promise.resolve();;){let t,n;this._retryDecryption=!1;try{t=e?await e.decryptEvent(this):this._badEncryptedMessage("Encryption not enabled")}catch(e){if("DecryptionError"!==e.name)return s.logger.error(`Error decrypting event (id=${this.getId()}): ${e.stack||e}`),this._decryptionPromise=null,void(this._retryDecryption=!1);if(n=e,this._retryDecryption){s.logger.log(`Got error decrypting event (id=${this.getId()}: `+`${e}), but retrying`);continue}s.logger.warn(`Error decrypting event (id=${this.getId()}): ${e.detailedString}`),t=this._badEncryptedMessage(e.message)}return this._decryptionPromise=null,this._retryDecryption=!1,this._setClearData(t),this.setPushActions(null),void this.emit("Event.decrypted",this,n)}},_badEncryptedMessage:function(e){return{clearEvent:{type:"m.room.message",content:{msgtype:"m.bad.encrypted",body:"** Unable to decrypt: "+e+" **"}}}},_setClearData:function(e){this._clearEvent=e.clearEvent,this._senderCurve25519Key=e.senderCurve25519Key||null,this._claimedEd25519Key=e.claimedEd25519Key||null,this._forwardingCurve25519KeyChain=e.forwardingCurve25519KeyChain||[]},getClearContent:function(){const e=this._clearEvent;return e&&e.content?e.content:null},isEncrypted:function(){return"m.room.encrypted"===this.event.type},getSenderKey:function(){return this._senderCurve25519Key},getKeysClaimed:function(){return{ed25519:this._claimedEd25519Key}},getClaimedEd25519Key:function(){return this._claimedEd25519Key},getForwardingCurve25519KeyChain:function(){return this._forwardingCurve25519KeyChain},getUnsigned:function(){return this.event.unsigned||{}},unmarkLocallyRedacted:function(){const e=this._localRedactionEvent;return this._localRedactionEvent=null,this.event.unsigned&&(this.event.unsigned.redacted_because=null),!!e},markLocallyRedacted:function(e){this._localRedactionEvent||(this.emit("Event.beforeRedaction",this,e),this._localRedactionEvent=e,this.event.unsigned||(this.event.unsigned={}),this.event.unsigned.redacted_because=e.event)},makeRedacted:function(e){if(!e.event)throw new Error("invalid redaction_event in makeRedacted");let t;for(t in this._localRedactionEvent=null,this.emit("Event.beforeRedaction",this,e),this._replacingEvent=null,this.event.unsigned||(this.event.unsigned={}),this.event.unsigned.redacted_because=e.event,this.event)this.event.hasOwnProperty(t)&&(u[t]||delete this.event[t]);const n=l[this.getType()]||{},r=this.getContent();for(t in r)r.hasOwnProperty(t)&&(n[t]||delete r[t])},isRedacted:function(){return Boolean(this.getUnsigned().redacted_because)},isRedaction:function(){return"m.room.redaction"===this.getType()},getPushActions:function(){return this._pushActions},setPushActions:function(e){this._pushActions=e},handleRemoteEcho:function(e){const t=this.getUnsigned(),n=this.getId();this.event=e,t.redacted_because&&(this.event.unsigned||(this.event.unsigned={}),this.event.unsigned.redacted_because=t.redacted_because),this.setStatus(null),this.getId()!==n&&this.emit("Event.localEventIdReplaced",this)},isSending(){return!!this.status},setStatus(e){this.status=e,this.emit("Event.status",this,e)},replaceLocalEventId(e){this.event.event_id=e,this.emit("Event.localEventIdReplaced",this)},isRelation(e){const t=this.getWireContent(),n=t&&t["m.relates_to"];return n&&n.rel_type&&n.event_id&&(e&&n.rel_type===e||!e)},getRelation(){return this.isRelation()?this.getWireContent()["m.relates_to"]:null},makeReplaced(e){this.isRedacted()&&e||this._replacingEvent!==e&&(this._replacingEvent=e,this.emit("Event.replaced",this))},getAssociatedStatus(){return this._replacingEvent?this._replacingEvent.status:this._localRedactionEvent?this._localRedactionEvent.status:this.status},getServerAggregatedRelation(e){const t=this.getUnsigned()["m.relations"];if(t)return t[e]},replacingEventId(){const e=this.getServerAggregatedRelation("m.replace");return e?e.event_id:this._replacingEvent?this._replacingEvent.getId():void 0},replacingEvent(){return this._replacingEvent},replacingEventDate(){const e=this.getServerAggregatedRelation("m.replace");if(e){const t=e.origin_server_ts;if(Number.isFinite(t))return new Date(t)}else if(this._replacingEvent)return this._replacingEvent.getDate()},localRedactionEvent(){return this._localRedactionEvent},getAssociatedId(){const e=this.getRelation();return e?e.event_id:this.isRedaction()?this.event.redacts:void 0},hasAssocation(){return!!this.getAssociatedId()},updateAssociatedId(e){const t=this.getRelation();t?t.event_id=e:this.isRedaction()&&(this.event.redacts=e)},flagCancelled(e=!0){this._isCancelled=e},isCancelled(){return this._isCancelled},toJSON(){const e={type:this.getType(),sender:this.getSender(),content:this.getContent(),event_id:this.getId(),origin_server_ts:this.getTs(),unsigned:this.getUnsigned(),room_id:this.getRoomId()};return this.isRedaction()&&(e.redacts=this.event.redacts),this.isEncrypted()?{decrypted:e,encrypted:this.event}:e}});const u=["event_id","type","room_id","user_id","sender","state_key","prev_state","content","unsigned","origin_server_ts"].reduce((function(e,t){return e[t]=1,e}),{}),l={"m.room.member":{membership:1},"m.room.create":{creator:1},"m.room.join_rules":{join_rule:1},"m.room.power_levels":{ban:1,events:1,events_default:1,kick:1,redact:1,state_default:1,users:1,users_default:1},"m.room.aliases":{aliases:1}}},function(e,t,n){"use strict";var r=n(43),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var o=Object.create(n(30));o.inherits=n(1);var s=n(89),a=n(60);o.inherits(l,s);for(var c=i(a.prototype),f=0;f<c.length;f++){var u=c[f];l.prototype[u]||(l.prototype[u]=a.prototype[u])}function l(e){if(!(this instanceof l))return new l(e);s.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",d)}function d(){this.allowHalfOpen||this._writableState.ended||r.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),l.prototype._destroy=function(e,t){this.push(null),this.end(),r.nextTick(t,e)}},function(e,t,n){"use strict";(function(e,r){var i=n(16),o=n(6);Object.defineProperty(t,"__esModule",{value:!0}),t.encryptMessageForDevice=async function(e,t,n,r,i,o,c){const f=o.getIdentityKey(),u=await r.getSessionIdForDevice(f);if(null===u)return;s.logger.log("Using sessionid "+u+" for device "+i+":"+o.deviceId);const l={sender:t,sender_device:n,keys:{ed25519:r.deviceEd25519Key},recipient:i,recipient_keys:{ed25519:o.getFingerprint()}};a.extend(l,c),e[f]=await r.encryptMessage(f,u,JSON.stringify(l))},t.ensureOlmSessionsForDevices=async function(e,t,n,r){const i=[],o={},a={};for(const t in n){if(!n.hasOwnProperty(t))continue;o[t]={};const s=n[t];for(let n=0;n<s.length;n++){const c=s[n],f=c.deviceId,u=c.getIdentityKey();e._sessionsInProgress[u]||(e._sessionsInProgress[u]=new Promise((t,n)=>{a[u]={resolve:(...n)=>{delete e._sessionsInProgress[u],t(...n)},reject:(...t)=>{delete e._sessionsInProgress[u],n(...t)}}}));const l=await e.getSessionIdForDevice(u,a[u]);null!==l&&a[u]&&(delete e._sessionsInProgress[u],a[u].resolve(),delete a[u]),(null===l||r)&&i.push([t,f]),o[t][f]={device:c,sessionId:l}}}if(0===i.length)return o;let c;try{c=await t.claimOneTimeKeys(i,"signed_curve25519")}catch(e){for(const e of Object.values(a))e.resolve();throw s.logger.log("failed to claim one-time keys",e,i),e}const u=c.one_time_keys||{},l=[];for(const t in n){if(!n.hasOwnProperty(t))continue;const i=u[t]||{},c=n[t];for(let n=0;n<c.length;n++){const u=c[n],d=u.deviceId,h=u.getIdentityKey();if(o[t][d].sessionId&&!r)continue;const p=i[d]||{};let m=null;for(const e in p)0===e.indexOf("signed_curve25519:")&&(m=p[e]);if(m)l.push(f(e,m,t,u).then(e=>{a[h]&&a[h].resolve(e),o[t][d].sessionId=e},e=>{throw a[h]&&a[h].resolve(),e}));else{const e="No one-time keys (alg=signed_curve25519) for device "+t+":"+d;s.logger.warn(e),a[h]&&a[h].resolve()}}}return await Promise.all(l),o},t.verifySignature=u,t.pkSign=function(t,n,r,i){let o=!1;if(n instanceof Uint8Array){const t=new e.Olm.PkSigning;i=t.init_with_seed(n),n=t,o=!0}const s=t.signatures||{};delete t.signatures;const a=t.unsigned;t.unsigned&&delete t.unsigned;try{const e=s[r]||{};return s[r]=e,e["ed25519:"+i]=n.sign(c.default.stringify(t))}finally{t.signatures=s,a&&(t.unsigned=a),o&&n.free()}},t.pkVerify=function(t,n,r){const i="ed25519:"+n;if(!(t.signatures&&t.signatures[r]&&t.signatures[r][i]))throw new Error("No signature");const o=t.signatures[r][i],s=new e.Olm.Utility,a=t.signatures;delete t.signatures;const f=t.unsigned;t.unsigned&&delete t.unsigned;try{s.ed25519_verify(n,c.default.stringify(t),o)}finally{t.signatures=a,f&&(t.unsigned=f),s.free()}},t.encodeBase64=function(e){return r.from(e).toString("base64")},t.decodeBase64=function(e){return r.from(e,"base64")},t.MEGOLM_BACKUP_ALGORITHM=t.MEGOLM_ALGORITHM=t.OLM_ALGORITHM=void 0;var s=n(4),a=o(n(8)),c=i(n(80));t.OLM_ALGORITHM="m.olm.v1.curve25519-aes-sha2";t.MEGOLM_ALGORITHM="m.megolm.v1.aes-sha2";async function f(e,t,n,r){const i=r.deviceId;try{await u(e,t,n,i,r.getFingerprint())}catch(e){return s.logger.error("Unable to verify signature on one-time key for device "+n+":"+i+":",e),null}let o;try{o=await e.createOutboundSession(r.getIdentityKey(),t.key)}catch(e){return s.logger.error("Error starting olm session with device "+n+":"+i+": "+e),null}return s.logger.log("Started new olm sessionid "+o+" for device "+n+":"+i),o}async function u(e,t,n,r,i){const o="ed25519:"+r,s=((t.signatures||{})[n]||{})[o];if(!s)throw Error("No signature");const a=Object.assign({},t);delete a.unsigned,delete a.signatures;const f=c.default.stringify(a);e.verifySignature(i,f,s)}t.MEGOLM_BACKUP_ALGORITHM="m.megolm_backup.v1.curve25519-aes-sha2"}).call(this,n(5),n(10).Buffer)},function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE){0;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}}(),e.exports=n(163)},function(e,t,n){"use strict";(function(t,r){var i=n(3).Buffer,o=t.crypto||t.msCrypto;o&&o.getRandomValues?e.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var n=i.allocUnsafe(e);if(e>0)if(e>65536)for(var s=0;s<e;s+=65536)o.getRandomValues(n.slice(s,s+65536));else o.getRandomValues(n);if("function"==typeof t)return r.nextTick((function(){t(null,n)}));return n}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,n(5),n(12))},function(e,t,n){var r=n(3).Buffer;function i(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,i=this._blockSize,o=e.length,s=this._len,a=0;a<o;){for(var c=s%i,f=Math.min(o-a,i-c),u=0;u<f;u++)n[c+u]=e[a+u];a+=f,(s+=f)%i==0&&this._update(n)}return this._len+=o,this},i.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventTimeline=i;var r=n(132);function i(e){this._eventTimelineSet=e,this._roomId=e.room?e.room.roomId:null,this._events=[],this._baseIndex=0,this._startState=new r.RoomState(this._roomId),this._startState.paginationToken=null,this._endState=new r.RoomState(this._roomId),this._endState.paginationToken=null,this._prevTimeline=null,this._nextTimeline=null,this._paginationRequests={b:null,f:null},this._name=this._roomId+":"+(new Date).toISOString()}i.BACKWARDS="b",i.FORWARDS="f",i.prototype.initialiseState=function(e){if(this._events.length>0)throw new Error("Cannot initialise state after events are added");for(const t of e)Object.freeze(t);this._startState.setStateEvents(e),this._endState.setStateEvents(e)},i.prototype.forkLive=function(e){const t=this.getState(e),n=new i(this._eventTimelineSet);return n._startState=t.clone(),n._endState=t,this._endState=t.clone(),n},i.prototype.fork=function(e){const t=this.getState(e),n=new i(this._eventTimelineSet);return n._startState=t.clone(),n._endState=t.clone(),n},i.prototype.getRoomId=function(){return this._roomId},i.prototype.getFilter=function(){return this._eventTimelineSet.getFilter()},i.prototype.getTimelineSet=function(){return this._eventTimelineSet},i.prototype.getBaseIndex=function(){return this._baseIndex},i.prototype.getEvents=function(){return this._events},i.prototype.getState=function(e){if(e==i.BACKWARDS)return this._startState;if(e==i.FORWARDS)return this._endState;throw new Error("Invalid direction '"+e+"'")},i.prototype.getPaginationToken=function(e){return this.getState(e).paginationToken},i.prototype.setPaginationToken=function(e,t){this.getState(t).paginationToken=e},i.prototype.getNeighbouringTimeline=function(e){if(e==i.BACKWARDS)return this._prevTimeline;if(e==i.FORWARDS)return this._nextTimeline;throw new Error("Invalid direction '"+e+"'")},i.prototype.setNeighbouringTimeline=function(e,t){if(this.getNeighbouringTimeline(t))throw new Error("timeline already has a neighbouring timeline - cannot reset neighbour (direction: "+t+")");if(t==i.BACKWARDS)this._prevTimeline=e;else{if(t!=i.FORWARDS)throw new Error("Invalid direction '"+t+"'");this._nextTimeline=e}this.setPaginationToken(null,t)},i.prototype.addEvent=function(e,t){const n=t?this._startState:this._endState,r=this.getTimelineSet();let o;r.room&&r.room.getUnfilteredTimelineSet()===r&&(i.setEventMetadata(e,n,t),e.isState()&&(n.setStateEvents([e]),e.sender&&("m.room.member"!==e.getType()||t)||i.setEventMetadata(e,n,t))),o=t?0:this._events.length,this._events.splice(o,0,e),t&&this._baseIndex++},i.setEventMetadata=function(e,t,n){e.sender=t.getSentinelMember(e.getSender()),"m.room.member"===e.getType()&&(e.target=t.getSentinelMember(e.getStateKey())),e.isState()&&n&&(e.forwardLooking=!1)},i.prototype.removeEvent=function(e){for(let t=this._events.length-1;t>=0;t--){const n=this._events[t];if(n.getId()==e)return this._events.splice(t,1),t<this._baseIndex&&this._baseIndex--,n}return null},i.prototype.toString=function(){return this._name}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(166),i=n(167),o=n(168);e.exports=function(e){return r(e)||i(e)||o()}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(312)),o=r(n(314));t.uuid=function(){return i.default()};const s={v4:/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,v5:/(?:^[a-f0-9]{8}-[a-f0-9]{4}-5[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u};t.regex=s;t.isUuid=function(e){return s.v4.test(e)||s.v5.test(e)};t.empty=function(){return"00000000-0000-0000-0000-000000000000"};t.fromString=function(e){return o.default(e,"bb5d0ffa-9a4c-4d7c-8fc2-0a7d2220ba45")}},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(10).Buffer)},function(e,t,n){"use strict";var r=n(1),i=n(62),o=n(63),s=n(64),a=n(18);function c(e){a.call(this,"digest"),this._hash=e}r(c,a),c.prototype._update=function(e){this._hash.update(e)},c.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new i:"rmd160"===e||"ripemd160"===e?new o:new c(s(e))}},function(e,t,n){(function(t){e.exports=function(e,n){for(var r=Math.min(e.length,n.length),i=new t(r),o=0;o<r;++o)i[o]=e[o]^n[o];return i}}).call(this,n(10).Buffer)},function(e,t,n){"use strict";var r=n(17),i=n(14);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=r.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=r.join32(e,0,e.length-n,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},o.prototype.digest=function(e){return this.update(this._pad()),i(null===this.pending),this._digest(e)},o.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r}},function(e,t,n){var r=t;r.bignum=n(11),r.define=n(247).define,r.base=n(35),r.constants=n(120),r.decoders=n(252),r.encoders=n(254)},function(e,t,n){var r=t;r.Reporter=n(249).Reporter,r.DecoderBuffer=n(119).DecoderBuffer,r.EncoderBuffer=n(119).EncoderBuffer,r.Node=n(250)},function(e,t,n){"use strict";(function(e){var r=n(6);Object.defineProperty(t,"__esModule",{value:!0}),t.IndexedDBCryptoStore=void 0;var i=n(4),o=n(286),s=n(73),a=r(n(287)),c=n(79),f=r(n(136));class u{constructor(e,t){this._indexedDB=e,this._dbName=t,this._backendPromise=null}static exists(e,t){return f.exists(e,t)}_connect(){return this._backendPromise?this._backendPromise:(this._backendPromise=new Promise((e,t)=>{if(!this._indexedDB)return void t(new Error("no indexeddb support available"));i.logger.log(`connecting to indexeddb ${this._dbName}`);const n=this._indexedDB.open(this._dbName,a.VERSION);n.onupgradeneeded=e=>{const t=e.target.result,n=e.oldVersion;a.upgradeDatabase(t,n)},n.onblocked=()=>{i.logger.log("can't yet open IndexedDBCryptoStore because it is open elsewhere")},n.onerror=e=>{i.logger.log("Error connecting to indexeddb",e),t(e.target.error)},n.onsuccess=t=>{const n=t.target.result;i.logger.log(`connected to indexeddb ${this._dbName}`),e(new a.Backend(n))}}).then(e=>e.doTxn("readonly",[u.STORE_INBOUND_GROUP_SESSIONS,u.STORE_INBOUND_GROUP_SESSIONS_WITHHELD],t=>{e.getEndToEndInboundGroupSession("","",t,()=>{})}).then(()=>e)).catch(t=>{if("VersionError"===t.name)throw i.logger.warn("Crypto DB is too new for us to use!",t),new c.InvalidCryptoStoreError(c.InvalidCryptoStoreError.TOO_NEW);i.logger.warn(`unable to connect to indexeddb ${this._dbName}`+`: falling back to localStorage store: ${t}`);try{return new o.LocalStorageCryptoStore(e.localStorage)}catch(t){return i.logger.warn(`unable to open localStorage: falling back to in-memory store: ${t}`),new s.MemoryCryptoStore}}),this._backendPromise)}deleteAllData(){return new Promise((e,t)=>{if(!this._indexedDB)return void t(new Error("no indexeddb support available"));i.logger.log(`Removing indexeddb instance: ${this._dbName}`);const n=this._indexedDB.deleteDatabase(this._dbName);n.onblocked=()=>{i.logger.log("can't yet delete IndexedDBCryptoStore because it is open elsewhere")},n.onerror=e=>{i.logger.log("Error deleting data from indexeddb",e),t(e.target.error)},n.onsuccess=()=>{i.logger.log(`Removed indexeddb instance: ${this._dbName}`),e()}}).catch(e=>{i.logger.warn(`unable to delete IndexedDBCryptoStore: ${e}`)})}getOrAddOutgoingRoomKeyRequest(e){return this._connect().then(t=>t.getOrAddOutgoingRoomKeyRequest(e))}getOutgoingRoomKeyRequest(e){return this._connect().then(t=>t.getOutgoingRoomKeyRequest(e))}getOutgoingRoomKeyRequestByState(e){return this._connect().then(t=>t.getOutgoingRoomKeyRequestByState(e))}getOutgoingRoomKeyRequestsByTarget(e,t,n){return this._connect().then(r=>r.getOutgoingRoomKeyRequestsByTarget(e,t,n))}updateOutgoingRoomKeyRequest(e,t,n){return this._connect().then(r=>r.updateOutgoingRoomKeyRequest(e,t,n))}deleteOutgoingRoomKeyRequest(e,t){return this._connect().then(n=>n.deleteOutgoingRoomKeyRequest(e,t))}getAccount(e,t){this._backendPromise.then(n=>{n.getAccount(e,t)})}storeAccount(e,t){this._backendPromise.then(n=>{n.storeAccount(e,t)})}getCrossSigningKeys(e,t){this._backendPromise.then(n=>{n.getCrossSigningKeys(e,t)})}storeCrossSigningKeys(e,t){this._backendPromise.then(n=>{n.storeCrossSigningKeys(e,t)})}countEndToEndSessions(e,t){this._backendPromise.then(n=>{n.countEndToEndSessions(e,t)})}getEndToEndSession(e,t,n,r){this._backendPromise.then(i=>{i.getEndToEndSession(e,t,n,r)})}getEndToEndSessions(e,t,n){this._backendPromise.then(r=>{r.getEndToEndSessions(e,t,n)})}getAllEndToEndSessions(e,t){this._backendPromise.then(n=>{n.getAllEndToEndSessions(e,t)})}storeEndToEndSession(e,t,n,r){this._backendPromise.then(i=>{i.storeEndToEndSession(e,t,n,r)})}storeEndToEndSessionProblem(e,t,n){return this._backendPromise.then(async r=>{await r.storeEndToEndSessionProblem(e,t,n)})}getEndToEndSessionProblem(e,t){return this._backendPromise.then(async n=>await n.getEndToEndSessionProblem(e,t))}filterOutNotifiedErrorDevices(e){return this._backendPromise.then(async t=>await t.filterOutNotifiedErrorDevices(e))}getEndToEndInboundGroupSession(e,t,n,r){this._backendPromise.then(i=>{i.getEndToEndInboundGroupSession(e,t,n,r)})}getAllEndToEndInboundGroupSessions(e,t){this._backendPromise.then(n=>{n.getAllEndToEndInboundGroupSessions(e,t)})}addEndToEndInboundGroupSession(e,t,n,r){this._backendPromise.then(i=>{i.addEndToEndInboundGroupSession(e,t,n,r)})}storeEndToEndInboundGroupSession(e,t,n,r){this._backendPromise.then(i=>{i.storeEndToEndInboundGroupSession(e,t,n,r)})}storeEndToEndInboundGroupSessionWithheld(e,t,n,r){this._backendPromise.then(i=>{i.storeEndToEndInboundGroupSessionWithheld(e,t,n,r)})}storeEndToEndDeviceData(e,t){this._backendPromise.then(n=>{n.storeEndToEndDeviceData(e,t)})}getEndToEndDeviceData(e,t){this._backendPromise.then(n=>{n.getEndToEndDeviceData(e,t)})}storeEndToEndRoom(e,t,n){this._backendPromise.then(r=>{r.storeEndToEndRoom(e,t,n)})}getEndToEndRooms(e,t){this._backendPromise.then(n=>{n.getEndToEndRooms(e,t)})}getSessionsNeedingBackup(e){return this._connect().then(t=>t.getSessionsNeedingBackup(e))}countSessionsNeedingBackup(e){return this._connect().then(t=>t.countSessionsNeedingBackup(e))}unmarkSessionsNeedingBackup(e,t){return this._connect().then(n=>n.unmarkSessionsNeedingBackup(e,t))}markSessionsNeedingBackup(e,t){return this._connect().then(n=>n.markSessionsNeedingBackup(e,t))}doTxn(e,t,n){return this._connect().then(r=>r.doTxn(e,t,n))}}t.IndexedDBCryptoStore=u,u.STORE_ACCOUNT="account",u.STORE_SESSIONS="sessions",u.STORE_INBOUND_GROUP_SESSIONS="inbound_group_sessions",u.STORE_INBOUND_GROUP_SESSIONS_WITHHELD="inbound_group_sessions_withheld",u.STORE_DEVICE_DATA="device_data",u.STORE_ROOMS="rooms",u.STORE_BACKUP="sessions_needing_backup"}).call(this,n(5))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.newVerificationError=i,t.errorFactory=o,t.errorFromEvent=function(e){const t=e.getContent();if(t){const{code:e,reason:n}=t;return{code:e,reason:n}}return{code:"Unknown error",reason:"m.unknown"}},t.newInvalidMessageError=t.newUserMismatchError=t.newKeyMismatchError=t.newUnexpectedMessageError=t.newUnknownMethodError=t.newUnknownTransactionError=t.newTimeoutError=t.newUserCancelledError=void 0;var r=n(19);function i(e,t,n){return(n=n||{}).code=e,n.reason=t,new r.MatrixEvent({type:"m.key.verification.cancel",content:n})}function o(e,t){return function(n){return i(e,t,n)}}const s=o("m.user","Cancelled by user");t.newUserCancelledError=s;const a=o("m.timeout","Timed out");t.newTimeoutError=a;const c=o("m.unknown_transaction","Unknown transaction");t.newUnknownTransactionError=c;const f=o("m.unknown_method","Unknown method");t.newUnknownMethodError=f;const u=o("m.unexpected_message","Unexpected message");t.newUnexpectedMessageError=u;const l=o("m.key_mismatch","Key mismatch");t.newKeyMismatchError=l;const d=o("m.user_error","User mismatch");t.newUserMismatchError=d;const h=o("m.invalid_message","Invalid message");t.newInvalidMessageError=h},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}t.resolve=function(){for(var t="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,i="/"===s.charAt(0))}return(i?"/":"")+(t=n(r(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var o=t.isAbsolute(e),s="/"===i(e,-1);return(e=n(r(e.split("/"),(function(e){return!!e})),!o).join("/"))||o||(e="."),e&&s&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,c=0;c<s;c++)if(i[c]!==o[c]){a=c;break}var f=[];for(c=a;c<i.length;c++)f.push("..");return(f=f.concat(o.slice(a))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,r=-1,i=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=function(e){"string"!=typeof e&&(e+="");var t,n=0,r=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){n=t+1;break}}else-1===r&&(i=!1,r=t+1);return-1===r?"":e.slice(n,r)}(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===r&&(i=!1,r=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){n=s+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===n+1?"":e.slice(t,r)};var i="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(12))},function(e,t,n){"use strict";(function(e){var r=n(16),i=n(6);Object.defineProperty(t,"__esModule",{value:!0});var o={};t.default=void 0;var s=i(n(127));Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(o,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}}))}));var a=r(n(308)),c=r(n(309));let f;s.request((function(e,t){return e.qs=c.default.stringify(e.qs||{},e.qsStringifyOptions),(0,a.default)(e,t)}));try{f=e.indexedDB}catch(e){}f&&s.setCryptoStoreFactory((function(){return new s.IndexedDBCryptoStore(f,"matrix-js-sdk:crypto")}));var u=s;t.default=u,e.matrixcs=s}).call(this,n(5))},function(e,t,n){(function(e){var r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++)n[t[r]]=Object.getOwnPropertyDescriptor(e,t[r]);return n},i=/%[sdj%]/g;t.format=function(e){if(!y(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(a(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,o=r.length,s=String(e).replace(i,(function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),c=r[n];n<o;c=r[++n])m(c)||!v(c)?s+=" "+c:s+=" "+a(c);return s},t.deprecate=function(n,r){if(void 0!==e&&!0===e.noDeprecation)return n;if(void 0===e)return function(){return t.deprecate(n,r).apply(this,arguments)};var i=!1;return function(){if(!i){if(e.throwDeprecation)throw new Error(r);e.traceDeprecation?console.trace(r):console.error(r),i=!0}return n.apply(this,arguments)}};var o,s={};function a(e,n){var r={seen:[],stylize:f};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),p(n)?r.showHidden=n:n&&t._extend(r,n),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=c),u(r,e,r.depth)}function c(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function f(e,t){return e}function u(e,n,r){if(e.customInspect&&n&&E(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return y(i)||(i=u(e,i,r)),i}var o=function(e,t){if(b(t))return e.stylize("undefined","undefined");if(y(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,n);if(o)return o;var s=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),w(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(n);if(0===s.length){if(E(n)){var c=n.name?": "+n.name:"";return e.stylize("[Function"+c+"]","special")}if(_(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(A(n))return e.stylize(Date.prototype.toString.call(n),"date");if(w(n))return l(n)}var f,v="",k=!1,S=["{","}"];(h(n)&&(k=!0,S=["[","]"]),E(n))&&(v=" [Function"+(n.name?": "+n.name:"")+"]");return _(n)&&(v=" "+RegExp.prototype.toString.call(n)),A(n)&&(v=" "+Date.prototype.toUTCString.call(n)),w(n)&&(v=" "+l(n)),0!==s.length||k&&0!=n.length?r<0?_(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),f=k?function(e,t,n,r,i){for(var o=[],s=0,a=t.length;s<a;++s)R(t,String(s))?o.push(d(e,t,n,r,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(d(e,t,n,r,i,!0))})),o}(e,n,r,a,s):s.map((function(t){return d(e,n,r,a,t,k)})),e.seen.pop(),function(e,t,n){if(e.reduce((function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(f,v,S)):S[0]+v+S[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i,o){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),R(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(c.value)<0?(a=m(n)?u(e,c.value,null):u(e,c.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),b(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function h(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function m(e){return null===e}function g(e){return"number"==typeof e}function y(e){return"string"==typeof e}function b(e){return void 0===e}function _(e){return v(e)&&"[object RegExp]"===k(e)}function v(e){return"object"==typeof e&&null!==e}function A(e){return v(e)&&"[object Date]"===k(e)}function w(e){return v(e)&&("[object Error]"===k(e)||e instanceof Error)}function E(e){return"function"==typeof e}function k(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(b(o)&&(o=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!s[n])if(new RegExp("\\b"+n+"\\b","i").test(o)){var r=e.pid;s[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else s[n]=function(){};return s[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=p,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=y,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=b,t.isRegExp=_,t.isObject=v,t.isDate=A,t.isError=w,t.isFunction=E,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(172);var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),I[e.getMonth()],t].join(" ")}function R(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",T(),t.format.apply(t,arguments))},t.inherits=n(173),t._extend=function(e,t){if(!t||!v(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var O="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function x(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(O&&e[O]){var t;if("function"!=typeof(t=e[O]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,O,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(e,r){e?n(e):t(r)}));try{e.apply(this,i)}catch(e){n(e)}return r}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),O&&Object.defineProperty(t,O,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,r(e))},t.promisify.custom=O,t.callbackify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function n(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var i=n.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return i.apply(o,arguments)};t.apply(this,n).then((function(t){e.nextTick(s,null,t)}),(function(t){e.nextTick(x,t,s)}))}return Object.setPrototypeOf(n,Object.getPrototypeOf(t)),Object.defineProperties(n,r(t)),n}}).call(this,n(12))},function(e,t){},function(e,t,n){e.exports=i;var r=n(9).EventEmitter;function i(){r.call(this)}n(1)(i,r),i.Readable=n(58),i.Writable=n(188),i.Duplex=n(189),i.Transform=n(190),i.PassThrough=n(191),i.Stream=i,i.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",c));var s=!1;function a(){s||(s=!0,e.end())}function c(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function f(e){if(u(),0===r.listenerCount(this,"error"))throw e}function u(){n.removeListener("data",i),e.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",c),n.removeListener("error",f),e.removeListener("error",f),n.removeListener("end",u),n.removeListener("close",u),e.removeListener("close",u)}return n.on("error",f),e.on("error",f),n.on("end",u),n.on("close",u),e.on("close",u),e.emit("pipe",n),e}},function(e,t,n){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,n)}));case 3:return t.nextTick((function(){e.call(null,n,r)}));case 4:return t.nextTick((function(){e.call(null,n,r,i)}));default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return t.nextTick((function(){e.apply(null,o)}))}}}:e.exports=t}).call(this,n(12))},function(e,t,n){var r=n(3).Buffer;function i(e){r.isBuffer(e)||(e=r.from(e));for(var t=e.length/4|0,n=new Array(t),i=0;i<t;i++)n[i]=e.readUInt32BE(4*i);return n}function o(e){for(;0<e.length;e++)e[0]=0}function s(e,t,n,r,i){for(var o,s,a,c,f=n[0],u=n[1],l=n[2],d=n[3],h=e[0]^t[0],p=e[1]^t[1],m=e[2]^t[2],g=e[3]^t[3],y=4,b=1;b<i;b++)o=f[h>>>24]^u[p>>>16&255]^l[m>>>8&255]^d[255&g]^t[y++],s=f[p>>>24]^u[m>>>16&255]^l[g>>>8&255]^d[255&h]^t[y++],a=f[m>>>24]^u[g>>>16&255]^l[h>>>8&255]^d[255&p]^t[y++],c=f[g>>>24]^u[h>>>16&255]^l[p>>>8&255]^d[255&m]^t[y++],h=o,p=s,m=a,g=c;return o=(r[h>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^t[y++],s=(r[p>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&h])^t[y++],a=(r[m>>>24]<<24|r[g>>>16&255]<<16|r[h>>>8&255]<<8|r[255&p])^t[y++],c=(r[g>>>24]<<24|r[h>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^t[y++],[o>>>=0,s>>>=0,a>>>=0,c>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,c=0;c<256;++c){var f=a^a<<1^a<<2^a<<3^a<<4;f=f>>>8^255&f^99,n[s]=f,r[f]=s;var u=e[s],l=e[u],d=e[l],h=257*e[f]^16843008*f;i[0][s]=h<<24|h>>>8,i[1][s]=h<<16|h>>>16,i[2][s]=h<<8|h>>>24,i[3][s]=h,h=16843009*d^65537*l^257*u^16843008*s,o[0][f]=h<<24|h>>>8,o[1][f]=h<<16|h>>>16,o[2][f]=h<<8|h>>>24,o[3][f]=h,0===s?s=a=1:(s=u^e[e[e[d^u]]],a^=e[e[a]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function f(e){this._key=i(e),this._reset()}f.blockSize=16,f.keySize=32,f.prototype.blockSize=f.blockSize,f.prototype.keySize=f.keySize,f.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o<t;o++)i[o]=e[o];for(o=t;o<r;o++){var s=i[o-1];o%t==0?(s=s<<8|s>>>24,s=c.SBOX[s>>>24]<<24|c.SBOX[s>>>16&255]<<16|c.SBOX[s>>>8&255]<<8|c.SBOX[255&s],s^=a[o/t|0]<<24):t>6&&o%t==4&&(s=c.SBOX[s>>>24]<<24|c.SBOX[s>>>16&255]<<16|c.SBOX[s>>>8&255]<<8|c.SBOX[255&s]),i[o]=i[o-t]^s}for(var f=[],u=0;u<r;u++){var l=r-u,d=i[l-(u%4?0:4)];f[u]=u<4||l<=4?d:c.INV_SUB_MIX[0][c.SBOX[d>>>24]]^c.INV_SUB_MIX[1][c.SBOX[d>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[d>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&d]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=f},f.prototype.encryptBlockRaw=function(e){return s(e=i(e),this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},f.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=r.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},f.prototype.decryptBlock=function(e){var t=(e=i(e))[1];e[1]=e[3],e[3]=t;var n=s(e,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},f.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=f},function(e,t,n){var r=n(3).Buffer,i=n(62);e.exports=function(e,t,n,o){if(r.isBuffer(e)||(e=r.from(e,"binary")),t&&(r.isBuffer(t)||(t=r.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=n/8,a=r.alloc(s),c=r.alloc(o||0),f=r.alloc(0);s>0||o>0;){var u=new i;u.update(f),u.update(e),t&&u.update(t),f=u.digest();var l=0;if(s>0){var d=a.length-s;l=Math.min(s,f.length),f.copy(a,d,0,l),s-=l}if(l<f.length&&o>0){var h=c.length-o,p=Math.min(o,f.length-l);f.copy(c,h,l,l+p),o-=p}}return f.fill(0),{key:a,iv:c}}},function(e,t,n){"use strict";var r=n(11),i=n(15),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new r(t.p,16),this.red=t.prime?r.red(t.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=t.n&&new r(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var n=e._getDoubles(),r=o(t,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;for(var s=[],c=0;c<r.length;c+=n.step){var f=0;for(t=c+n.step-1;t>=c;t--)f=(f<<1)+r[t];s.push(f)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(c=0;c<s.length;c++){(f=s[c])===d?l=l.mixedAdd(n.points[c]):f===-d&&(l=l.mixedAdd(n.points[c].neg()))}u=u.add(l)}return u.toP()},c.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,s=o(t,n,this._bitLength),c=this.jpoint(null,null,null),f=s.length-1;f>=0;f--){for(t=0;f>=0&&0===s[f];f--)t++;if(f>=0&&t++,c=c.dblp(t),f<0)break;var u=s[f];a(0!==u),c="affine"===e.type?u>0?c.mixedAdd(i[u-1>>1]):c.mixedAdd(i[-u-1>>1].neg()):u>0?c.add(i[u-1>>1]):c.add(i[-u-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,n,r,i){for(var a=this._wnafT1,c=this._wnafT2,f=this._wnafT3,u=0,l=0;l<r;l++){var d=(S=t[l])._getNAFPoints(e);a[l]=d.wnd,c[l]=d.points}for(l=r-1;l>=1;l-=2){var h=l-1,p=l;if(1===a[h]&&1===a[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=s(n[h],n[p]);u=Math.max(y[0].length,u),f[h]=new Array(u),f[p]=new Array(u);for(var b=0;b<u;b++){var _=0|y[0][b],v=0|y[1][b];f[h][b]=g[3*(_+1)+(v+1)],f[p][b]=0,c[h]=m}}else f[h]=o(n[h],a[h],this._bitLength),f[p]=o(n[p],a[p],this._bitLength),u=Math.max(f[h].length,u),u=Math.max(f[p].length,u)}var A=this.jpoint(null,null,null),w=this._wnafT4;for(l=u;l>=0;l--){for(var E=0;l>=0;){var k=!0;for(b=0;b<r;b++)w[b]=0|f[b][l],0!==w[b]&&(k=!1);if(!k)break;E++,l--}if(l>=0&&E++,A=A.dblp(E),l<0)break;for(b=0;b<r;b++){var S,I=w[b];0!==I&&(I>0?S=c[b][I-1>>1]:I<0&&(S=c[b][-I-1>>1].neg()),A="affine"===S.type?A.mixedAdd(S):A.add(S))}}for(l=0;l<r;l++)c[l]=null;return i?A:A.toP()},c.BasePoint=f,f.prototype.eq=function(){throw new Error("Not implemented")},f.prototype.validate=function(){return this.curve.validate(this)},c.prototype.decodePoint=function(e,t){e=i.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?a(e[e.length-1]%2==0):7===e[0]&&a(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},f.prototype.encodeCompressed=function(e){return this.encode(e,!0)},f.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},f.prototype.encode=function(e,t){return i.encode(this._encode(t),e)},f.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},f.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},f.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)r=r.dbl();n.push(r)}return{step:e,points:n}},f.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},f.prototype._getBeta=function(){return null},f.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}},function(e,t,n){var r=n(246),i=n(257),o=n(258),s=n(66),a=n(100),c=n(3).Buffer;function f(e){var t;"object"!=typeof e||c.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=c.from(e));var n,f,u=o(e,t),l=u.tag,d=u.data;switch(l){case"CERTIFICATE":f=r.certificate.decode(d,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(f||(f=r.PublicKey.decode(d,"der")),n=f.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(f.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return f.subjectPrivateKey=f.subjectPublicKey,{type:"ec",data:f};case"1.2.840.10040.4.1":return f.algorithm.params.pub_key=r.DSAparam.decode(f.subjectPublicKey.data,"der"),{type:"dsa",data:f.algorithm.params};default:throw new Error("unknown key id "+n)}throw new Error("unknown key type "+l);case"ENCRYPTED PRIVATE KEY":d=function(e,t){var n=e.algorithm.decrypt.kde.kdeparams.salt,r=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=i[e.algorithm.decrypt.cipher.algo.join(".")],f=e.algorithm.decrypt.cipher.iv,u=e.subjectPrivateKey,l=parseInt(o.split("-")[1],10)/8,d=a.pbkdf2Sync(t,n,r,l,"sha1"),h=s.createDecipheriv(o,d,f),p=[];return p.push(h.update(u)),p.push(h.final()),c.concat(p)}(d=r.EncryptedPrivateKey.decode(d,"der"),t);case"PRIVATE KEY":switch(n=(f=r.PrivateKey.decode(d,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(f.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:f.algorithm.curve,privateKey:r.ECPrivateKey.decode(f.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return f.algorithm.params.priv_key=r.DSAparam.decode(f.subjectPrivateKey,"der"),{type:"dsa",params:f.algorithm.params};default:throw new Error("unknown key id "+n)}throw new Error("unknown key type "+l);case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(d,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(d,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(d,"der")};case"EC PRIVATE KEY":return{curve:(d=r.ECPrivateKey.decode(d,"der")).parameters.value,privateKey:d.privateKey};default:throw new Error("unknown key type "+l)}}e.exports=f,f.signature=r.signature},function(e,t,n){"use strict";var r=n(6);Object.defineProperty(t,"__esModule",{value:!0}),t.User=s;var i=r(n(8)),o=n(9);function s(e){this.userId=e,this.presence="offline",this.presenceStatusMsg=null,this._unstable_statusMessage="",this.displayName=e,this.rawDisplayName=e,this.avatarUrl=null,this.lastActiveAgo=0,this.lastPresenceTs=0,this.currentlyActive=!1,this.events={presence:null,profile:null},this._updateModifiedTime()}i.inherits(s,o.EventEmitter),s.prototype.setPresenceEvent=function(e){if("m.presence"!==e.getType())return;const t=null===this.events.presence;this.events.presence=e;const n=[];(e.getContent().presence!==this.presence||t)&&n.push("User.presence"),e.getContent().avatar_url&&e.getContent().avatar_url!==this.avatarUrl&&n.push("User.avatarUrl"),e.getContent().displayname&&e.getContent().displayname!==this.displayName&&n.push("User.displayName"),void 0!==e.getContent().currently_active&&e.getContent().currently_active!==this.currentlyActive&&n.push("User.currentlyActive"),this.presence=e.getContent().presence,n.push("User.lastPresenceTs"),e.getContent().status_msg&&(this.presenceStatusMsg=e.getContent().status_msg),e.getContent().displayname&&(this.displayName=e.getContent().displayname),e.getContent().avatar_url&&(this.avatarUrl=e.getContent().avatar_url),this.lastActiveAgo=e.getContent().last_active_ago,this.lastPresenceTs=Date.now(),this.currentlyActive=e.getContent().currently_active,this._updateModifiedTime();for(let t=0;t<n.length;t++)this.emit(n[t],e,this)},s.prototype.setDisplayName=function(e){const t=this.displayName;this.displayName=e,e!==t&&this._updateModifiedTime()},s.prototype.setRawDisplayName=function(e){this.rawDisplayName=e},s.prototype.setAvatarUrl=function(e){const t=this.avatarUrl;this.avatarUrl=e,e!==t&&this._updateModifiedTime()},s.prototype._updateModifiedTime=function(){this._modified=Date.now()},s.prototype.getLastModifiedTime=function(){return this._modified},s.prototype.getLastActiveTs=function(){return this.lastPresenceTs-this.lastActiveAgo},s.prototype._unstable_updateStatusMessage=function(e){e.getContent()?this._unstable_statusMessage=e.getContent().status:this._unstable_statusMessage="",this._updateModifiedTime(),this.emit("User._unstable_statusMessage",this)}},function(e,t,n){"use strict";(function(e){var r=n(6);Object.defineProperty(t,"__esModule",{value:!0}),t.MatrixHttpApi=c,t.MatrixError=u,t.PREFIX_MEDIA_R0=t.PREFIX_IDENTITY_V2=t.PREFIX_IDENTITY_V1=t.PREFIX_UNSTABLE=t.PREFIX_R0=void 0;var i=n(276),o=r(n(8)),s=n(4),a=r(n(277));t.PREFIX_R0="/_matrix/client/r0";t.PREFIX_UNSTABLE="/_matrix/client/unstable";t.PREFIX_IDENTITY_V1="/_matrix/identity/api/v1";t.PREFIX_IDENTITY_V2="/_matrix/identity/v2";function c(e,t){o.checkObjectHasKeys(t,["baseUrl","request","prefix"]),t.onlyData=t.onlyData||!1,this.event_emitter=e,this.opts=t,this.useAuthorizationHeader=Boolean(t.useAuthorizationHeader),this.uploads=[]}t.PREFIX_MEDIA_R0="/_matrix/media/r0",c.prototype={setIdBaseUrl:function(e){this.opts.idBaseUrl=e},getContentUri:function(){const e={access_token:this.opts.accessToken};return{base:this.opts.baseUrl,path:"/_matrix/media/r0/upload",params:e}},uploadContent:function(t,n){o.isFunction(n)?n={callback:n}:void 0===n&&(n={});const r=!1!==n.includeFilename,i=n.type||t.type||"application/octet-stream",c=n.name||t.name;let u=t;u.stream&&"function"!=typeof u.stream&&(s.logger.warn("Using `file.stream` as the content to upload. Future versions of the js-sdk will change this to expect `file` to be the content directly."),u=u.stream);let l=n.rawResponse;void 0===l&&(e.XMLHttpRequest?l=!1:(s.logger.warn("Returning the raw JSON from uploadContent(). Future versions of the js-sdk will change this default, to return the parsed object. Set opts.rawResponse=false to change this behaviour now."),l=!0));let d=n.onlyContentUri;l||void 0!==d||(e.XMLHttpRequest?(s.logger.warn("Returning only the content-uri from uploadContent(). Future versions of the js-sdk will change this default, to return the whole response object. Set opts.onlyContentUri=false to change this behaviour now."),d=!0):d=!1);const h={loaded:0,total:0};let p,m=null;if(l||(m=function(e){let t=JSON.parse(e);if(d&&(t=t.content_uri,void 0===t))throw Error("Bad response");return t}),e.XMLHttpRequest){const t=o.defer(),s=new e.XMLHttpRequest;h.xhr=s;const l=f(t,n.callback,this.opts.onlyData),d=function(){s.abort(),l(new Error("Timeout"))};s.timeout_timer=a.setTimeout(d,3e4),s.onreadystatechange=function(){switch(s.readyState){case e.XMLHttpRequest.DONE:var t;a.clearTimeout(s.timeout_timer);try{if(!s.responseText)throw new Error("No response body.");t=s.responseText,m&&(t=m(t))}catch(e){return e.http_status=s.status,void l(e)}l(void 0,s,t)}},s.upload.addEventListener("progress",(function(e){a.clearTimeout(s.timeout_timer),h.loaded=e.loaded,h.total=e.total,s.timeout_timer=a.setTimeout(d,3e4),n.progressHandler&&n.progressHandler({loaded:e.loaded,total:e.total})}));let g=this.opts.baseUrl+"/_matrix/media/r0/upload";const y=[];r&&c&&y.push("filename="+encodeURIComponent(c)),this.useAuthorizationHeader||y.push("access_token="+encodeURIComponent(this.opts.accessToken)),y.length>0&&(g+="?"+y.join("&")),s.open("POST",g),this.useAuthorizationHeader&&s.setRequestHeader("Authorization","Bearer "+this.opts.accessToken),s.setRequestHeader("Content-Type",i),s.send(u),p=t.promise,p.abort=s.abort.bind(s)}else{const e={};r&&c&&(e.filename=c),p=this.authedRequest(n.callback,"POST","/upload",e,u,{prefix:"/_matrix/media/r0",headers:{"Content-Type":i},json:!1,bodyParser:m})}const g=this,y=p.finally((function(){for(let e=0;e<g.uploads.length;++e)if(g.uploads[e]===h)return void g.uploads.splice(e,1)}));return y.abort=p.abort,h.promise=y,this.uploads.push(h),y},cancelUpload:function(e){return!!e.abort&&(e.abort(),!0)},getCurrentUploads:function(){return this.uploads},idServerRequest:function(e,t,n,r,i,s){if(!this.opts.idBaseUrl)throw new Error("No Identity Server base URL set");const a=this.opts.idBaseUrl+i+n;if(void 0!==e&&!o.isFunction(e))throw Error("Expected callback to be a function but got "+typeof e);const c={uri:a,method:t,withCredentials:!1,json:!0,_matrix_opts:this.opts,headers:{}};"GET"===t?c.qs=r:"object"==typeof r&&(c.json=r),s&&(c.headers.Authorization=`Bearer ${s}`);const u=o.defer();return this.opts.request(c,f(u,e,this.opts.onlyData)),u.promise},authedRequest:function(e,t,n,r,i,o){r||(r={}),this.useAuthorizationHeader?(isFinite(o)&&(o={localTimeoutMs:o}),o||(o={}),o.headers||(o.headers={}),o.headers.Authorization||(o.headers.Authorization="Bearer "+this.opts.accessToken),r.access_token&&delete r.access_token):r.access_token||(r.access_token=this.opts.accessToken);const s=this.request(e,t,n,r,i,o),a=this;return s.catch((function(e){"M_UNKNOWN_TOKEN"==e.errcode?a.event_emitter.emit("Session.logged_out",e):"M_CONSENT_NOT_GIVEN"==e.errcode&&a.event_emitter.emit("no_consent",e.message,e.data.consent_uri)})),s},request:function(e,t,n,r,i,o){const s=void 0!==(o=o||{}).prefix?o.prefix:this.opts.prefix,a=this.opts.baseUrl+s+n;return this.requestOtherUrl(e,t,a,r,i,o)},requestOtherUrl:function(e,t,n,r,i,o){return null==o?o={}:isFinite(o)&&(o={localTimeoutMs:o}),this._request(e,t,n,r,i,o)},getUrl:function(e,t,n){let r="";return t&&(r="?"+o.encodeParams(t)),this.opts.baseUrl+n+e+r},_request:function(e,t,n,r,i,s){if(void 0!==e&&!o.isFunction(e))throw Error("Expected callback to be a function but got "+typeof e);s=s||{};const c=this;if(this.opts.extraParams)for(const e in this.opts.extraParams)this.opts.extraParams.hasOwnProperty(e)&&(r[e]=this.opts.extraParams[e]);const l=o.extend({},s.headers||{}),d=void 0===s.json||s.json;let h=s.bodyParser;d&&(i&&(i=JSON.stringify(i),l["content-type"]="application/json"),l.accept||(l.accept="application/json"),void 0===h&&(h=function(e){return JSON.parse(e)}));const p=o.defer();let m,g,y=!1;const b=s.localTimeoutMs||this.opts.localTimeoutMs,_=()=>{b&&(m&&a.clearTimeout(m),m=a.setTimeout((function(){y=!0,g&&g.abort&&g.abort(),p.reject(new u({error:"Locally timed out waiting for a response",errcode:"ORG.MATRIX.JSSDK_TIMEOUT",timeout:b}))}),b))};_();const v=p.promise;try{g=this.opts.request({uri:n,method:t,withCredentials:!1,qs:r,qsStringifyOptions:s.qsStringifyOptions,useQuerystring:!0,body:i,json:!1,timeout:b,headers:l||{},_matrix_opts:this.opts},(function(t,n,r){if(b&&(a.clearTimeout(m),y))return;f(p,e,c.opts.onlyData,h)(t,n,r)})),g&&("onprogress"in g&&(g.onprogress=e=>{_()}),g.abort&&(v.abort=g.abort.bind(g)))}catch(t){p.reject(t),e&&e(t)}return v}};const f=function(e,t,n,r){return t=t||function(){},function(o,s,a){if(!o)try{s.statusCode>=400?o=function(e,t){const n=e.statusCode,r=function(e){let t;e.getResponseHeader?t=e.getResponseHeader("Content-Type"):e.headers&&(t=e.headers["content-type"]||null);if(!t)return null;try{return(0,i.parse)(t)}catch(e){throw new Error(`Error parsing Content-Type '${t}': ${e}`)}}(e);let o;if(r)if("application/json"===r.type){const e="object"==typeof t?t:JSON.parse(t);o=new u(e)}else"text/plain"===r.type&&(o=new Error(`Server returned ${n} error: ${t}`));o||(o=new Error(`Server returned ${n} error`));return o.httpStatus=n,o}(s,a):r&&(a=r(a))}catch(e){o=new Error(`Error parsing server response: ${e}`)}if(o)e.reject(o),t(o);else{const r={code:s.statusCode,headers:s.headers,data:a};e.resolve(n?a:r),t(null,n?a:r)}}};function u(e){e=e||{},this.errcode=e.errcode,this.name=e.errcode||"Unknown error code",this.message=e.error||"Unknown message",this.data=e}u.prototype=Object.create(Error.prototype),u.prototype.constructor=u}).call(this,n(5))},function(e,t,n){"use strict";var r=n(6);Object.defineProperty(t,"__esModule",{value:!0}),t.getHttpUriForMxc=function(e,t,n,r,o,s){if("string"!=typeof t||!t)return"";if(0!==t.indexOf("mxc://"))return s?t:"";let a=t.slice(6),c="/_matrix/media/r0/download/";const f={};n&&(f.width=Math.round(n));r&&(f.height=Math.round(r));o&&(f.method=o);i.keys(f).length>0&&(c="/_matrix/media/r0/thumbnail/");const u=a.indexOf("#");let l="";u>=0&&(l=a.substr(u),a=a.substr(0,u));return e+c+a+(0===i.keys(f).length?"":"?"+i.encodeParams(f))+l},t.getIdenticonUri=function(e,t,n,r){if(!t)return null;n||(n=96);r||(r=96);const o={width:n,height:r},s=i.encodeUri("/_matrix/media/unstable/identicon/$ident",{$ident:t});return e+s+(0===i.keys(o).length?"":"?"+i.encodeParams(o))};var i=r(n(8))},function(e,t,n){"use strict";function r(e){Object.defineProperty(this,"deviceId",{enumerable:!0,value:e}),this.algorithms=[],this.keys={},this.verified=i.UNVERIFIED,this.known=!1,this.unsigned={},this.signatures={}}Object.defineProperty(t,"__esModule",{value:!0}),t.DeviceInfo=r,r.fromStorage=function(e,t){const n=new r(t);for(const t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},r.prototype.toStorage=function(){return{algorithms:this.algorithms,keys:this.keys,verified:this.verified,known:this.known,unsigned:this.unsigned,signatures:this.signatures}},r.prototype.getFingerprint=function(){return this.keys["ed25519:"+this.deviceId]},r.prototype.getIdentityKey=function(){return this.keys["curve25519:"+this.deviceId]},r.prototype.getDisplayName=function(){return this.unsigned.device_display_name||null},r.prototype.isBlocked=function(){return this.verified==i.BLOCKED},r.prototype.isVerified=function(){return this.verified==i.VERIFIED},r.prototype.isUnverified=function(){return this.verified==i.UNVERIFIED},r.prototype.isKnown=function(){return 1==this.known},r.DeviceVerification={VERIFIED:1,UNVERIFIED:0,BLOCKED:-1};const i=r.DeviceVerification},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomString=function(e){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let r=0;r<e;++r)t+=n.charAt(Math.floor(Math.random()*n.length));return t}},function(e,t,n){"use strict";t.__esModule=!0,t.inherits=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r.constructor=t,t.prototype=r,t}},function(e,t,n){var r=n(87),i=n(7);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var r=n(169);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){"use strict";