UNPKG

tanglepay-sdk-monorepo

Version:

DApp SDK to interact with TanglePay wallets

13 lines 69.8 kB
/** * @license * author: TanglePay * tanglepaysdk-ethereumprovider.js v0.1.9 * Released under the Apache-2.0 license. */ "use strict";var e=require("tanglepaysdk-client"),t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function i(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function o(){}function s(){s.init.call(this)}function a(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,n,r){var i,s,u;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),u=s[t]):(s=e._events=new o,e._eventsCount=0),u){if("function"==typeof u?u=s[t]=r?[n,u]:[u,n]:r?u.unshift(n):u.push(n),!u.warned&&(i=a(e))&&i>0&&u.length>i){u.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=u.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(f)}}else u=s[t]=n,++e._eventsCount;return e}function f(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function h(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function c(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}o.prototype=Object.create(null),s.EventEmitter=s,s.usingDomains=!1,s.prototype.domain=void 0,s.prototype._events=void 0,s.prototype._maxListeners=void 0,s.defaultMaxListeners=10,s.init=function(){this.domain=null,s.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new o,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return a(this)},s.prototype.emit=function(e){var t,n,r,i,o,s,a,u="error"===e;if(s=this._events)u=u&&null==s.error;else if(!u)return!1;if(a=this.domain,u){if(t=arguments[1],!a){if(t instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=s[e]))return!1;var h="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=c(e,r),o=0;o<r;++o)i[o].call(n)}(n,h,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=c(e,i),s=0;s<i;++s)o[s].call(n,r)}(n,h,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,s=c(e,o),a=0;a<o;++a)s[a].call(n,r,i)}(n,h,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var s=e.length,a=c(e,s),u=0;u<s;++u)a[u].call(n,r,i,o)}(n,h,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=c(e,i),s=0;s<i;++s)o[s].apply(n,r)}(n,h,this,i)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,f(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,f(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,s,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new o:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){a=n[s].listener,i=s;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new o,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.off=function(e,t){return this.removeListener(e,t)},s.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new o,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new o:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),s=0;s<i.length;++s)"removeListener"!==(r=i[s])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new o,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},s.prototype.listeners=function(e){var t,n,r=this._events;return n=r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t} /** * @license * author: * tanglepaysdk-common.js v0.1.9 * Released under the ISC license. */(t):[],n},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},l(e,t)};function d(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function p(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function g(){}function v(){v.init.call(this)}function y(e){return void 0===e._maxListeners?v.defaultMaxListeners:e._maxListeners}function w(e,t,n,r){var i,o,s,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]):(o=e._events=new g,e._eventsCount=0),s){if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),!s.warned&&(i=y(e))&&i>0&&s.length>i){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,a=u,"function"==typeof console.warn?console.warn(a):console.log(a)}}else s=o[t]=n,++e._eventsCount;return e}function b(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function m(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function _(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}g.prototype=Object.create(null),v.EventEmitter=v,v.usingDomains=!1,v.prototype.domain=void 0,v.prototype._events=void 0,v.prototype._maxListeners=void 0,v.defaultMaxListeners=10,v.init=function(){this.domain=null,v.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new g,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},v.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},v.prototype.getMaxListeners=function(){return y(this)},v.prototype.emit=function(e){var t,n,r,i,o,s,a,u="error"===e;if(s=this._events)u=u&&null==s.error;else if(!u)return!1;if(a=this.domain,u){if(t=arguments[1],!a){if(t instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=s[e]))return!1;var h="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=_(e,r),o=0;o<r;++o)i[o].call(n)}(n,h,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=_(e,i),s=0;s<i;++s)o[s].call(n,r)}(n,h,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,s=_(e,o),a=0;a<o;++a)s[a].call(n,r,i)}(n,h,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var s=e.length,a=_(e,s),u=0;u<s;++u)a[u].call(n,r,i,o)}(n,h,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=_(e,i),s=0;s<i;++s)o[s].apply(n,r)}(n,h,this,i)}return!0},v.prototype.addListener=function(e,t){return w(this,e,t,!1)},v.prototype.on=v.prototype.addListener,v.prototype.prependListener=function(e,t){return w(this,e,t,!0)},v.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,b(this,e,t)),this},v.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,b(this,e,t)),this},v.prototype.removeListener=function(e,t){var n,r,i,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new g:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new g,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,s||t)}return this},v.prototype.off=function(e,t){return this.removeListener(e,t)},v.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new g,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new g:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new g,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},v.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},v.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},v.prototype.listenerCount=m,v.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var E="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},R=[],L=[],S="undefined"!=typeof Uint8Array?Uint8Array:Array,A=!1;function k(){A=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)R[t]=e[t],L[e.charCodeAt(t)]=t;L["-".charCodeAt(0)]=62,L["_".charCodeAt(0)]=63}function T(e,t,n){for(var r,i,o=[],s=t;s<n;s+=3)r=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(R[(i=r)>>18&63]+R[i>>12&63]+R[i>>6&63]+R[63&i]);return o.join("")}function C(e){var t;A||k();for(var n=e.length,r=n%3,i="",o=[],s=16383,a=0,u=n-r;a<u;a+=s)o.push(T(e,a,a+s>u?u:a+s));return 1===r?(t=e[n-1],i+=R[t>>2],i+=R[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=R[t>>10],i+=R[t>>4&63],i+=R[t<<2&63],i+="="),o.push(i),o.join("")}function x(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,f=u>>1,h=-7,c=n?i-1:0,l=n?-1:1,d=e[t+c];for(c+=l,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=256*o+e[t+c],c+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+e[t+c],c+=l,h-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=f}return(d?-1:1)*s*Math.pow(2,o-r)}function M(e,t,n,r,i,o){var s,a,u,f=8*o-i-1,h=(1<<f)-1,c=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(t*u-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;e[n+d]=255&s,d+=p,s/=256,f-=8);e[n+d-p]|=128*g}var O={}.toString,P=Array.isArray||function(e){return"[object Array]"==O.call(e)};function j(){return U.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(e,t){if(j()<t)throw new RangeError("Invalid typed array length");return U.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=U.prototype:(null===e&&(e=new U(t)),e.length=t),e}function U(e,t,n){if(!(U.TYPED_ARRAY_SUPPORT||this instanceof U))return new U(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 Y(this,e)}return D(this,e,t,n)}function D(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");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),U.TYPED_ARRAY_SUPPORT?(e=t).__proto__=U.prototype:e=q(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!U.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|W(t,n),i=(e=B(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(N(t)){var n=0|z(t.length);return 0===(e=B(e,n)).length||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?B(e,0):q(e,t);if("Buffer"===t.type&&P(t.data))return q(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function I(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 Y(e,t){if(I(t),e=B(e,t<0?0:0|z(t)),!U.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function q(e,t){var n=t.length<0?0:0|z(t.length);e=B(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function z(e){if(e>=j())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+j().toString(16)+" bytes");return 0|e}function N(e){return!(null==e||!e._isBuffer)}function W(e,t){if(N(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 ve(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ye(e).length;default:if(r)return ve(e).length;t=(""+t).toLowerCase(),r=!0}}function F(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 oe(this,t,n);case"utf8":case"utf-8":return te(this,t,n);case"ascii":return re(this,t,n);case"latin1":case"binary":return ie(this,t,n);case"base64":return ee(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return se(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function H(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function G(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=U.from(t,r)),N(t))return 0===t.length?-1:J(e,t,n,r,i);if("number"==typeof t)return t&=255,U.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):J(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function J(e,t,n,r,i){var o,s=1,a=e.length,u=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,u/=2,n/=2}function f(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var h=-1;for(o=n;o<a;o++)if(f(e,o)===f(t,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var c=!0,l=0;l<u;l++)if(f(e,o+l)!==f(t,l)){c=!1;break}if(c)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 we(ve(t,e.length-n),e,n,r)}function Z(e,t,n,r){return we(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function K(e,t,n,r){return Z(e,t,n,r)}function Q(e,t,n,r){return we(ye(t),e,n,r)}function X(e,t,n,r){return we(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function ee(e,t,n){return 0===t&&n===e.length?C(e):C(e.slice(t,n))}function te(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,u,f=e[i],h=null,c=f>239?4:f>223?3:f>191?2:1;if(i+c<=n)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&f)<<6|63&o)>127&&(h=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&f)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),i+=c}return function(e){var t=e.length;if(t<=ne)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ne));return n}(r)}U.TYPED_ARRAY_SUPPORT=void 0===E.TYPED_ARRAY_SUPPORT||E.TYPED_ARRAY_SUPPORT,j(),U.poolSize=8192,U._augment=function(e){return e.__proto__=U.prototype,e},U.from=function(e,t,n){return D(null,e,t,n)},U.TYPED_ARRAY_SUPPORT&&(U.prototype.__proto__=Uint8Array.prototype,U.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&U[Symbol.species]),U.alloc=function(e,t,n){return function(e,t,n,r){return I(t),t<=0?B(e,t):void 0!==n?"string"==typeof r?B(e,t).fill(n,r):B(e,t).fill(n):B(e,t)}(null,e,t,n)},U.allocUnsafe=function(e){return Y(null,e)},U.allocUnsafeSlow=function(e){return Y(null,e)},U.isBuffer=function(e){return null!=e&&(!!e._isBuffer||be(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&be(e.slice(0,0))}(e))},U.compare=function(e,t){if(!N(e)||!N(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},U.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}},U.concat=function(e,t){if(!P(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return U.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=U.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!N(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},U.byteLength=W,U.prototype._isBuffer=!0,U.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)H(this,t,t+1);return this},U.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)H(this,t,t+3),H(this,t+1,t+2);return this},U.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)H(this,t,t+7),H(this,t+1,t+6),H(this,t+2,t+5),H(this,t+3,t+4);return this},U.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?te(this,0,e):F.apply(this,arguments)},U.prototype.equals=function(e){if(!N(e))throw new TypeError("Argument must be a Buffer");return this===e||0===U.compare(this,e)},U.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},U.prototype.compare=function(e,t,n,r,i){if(!N(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),u=this.slice(r,i),f=e.slice(t,n),h=0;h<a;++h)if(u[h]!==f[h]){o=u[h],s=f[h];break}return o<s?-1:s<o?1:0},U.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},U.prototype.indexOf=function(e,t,n){return G(this,e,t,n,!0)},U.prototype.lastIndexOf=function(e,t,n){return G(this,e,t,n,!1)},U.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 Z(this,e,t,n);case"latin1":case"binary":return K(this,e,t,n);case"base64":return Q(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},U.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ne=4096;function re(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 ie(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 oe(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+=ge(e[o]);return i}function se(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 ae(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 ue(e,t,n,r,i,o){if(!N(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 fe(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 he(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 ce(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 le(e,t,n,r,i){return i||ce(e,0,n,4),M(e,t,n,r,23,4),n+4}function de(e,t,n,r,i){return i||ce(e,0,n,8),M(e,t,n,r,52,8),n+8}U.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),U.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=U.prototype;else{var i=t-e;n=new U(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},U.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||ae(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},U.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||ae(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},U.prototype.readUInt8=function(e,t){return t||ae(e,1,this.length),this[e]},U.prototype.readUInt16LE=function(e,t){return t||ae(e,2,this.length),this[e]|this[e+1]<<8},U.prototype.readUInt16BE=function(e,t){return t||ae(e,2,this.length),this[e]<<8|this[e+1]},U.prototype.readUInt32LE=function(e,t){return t||ae(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},U.prototype.readUInt32BE=function(e,t){return t||ae(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},U.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||ae(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},U.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||ae(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},U.prototype.readInt8=function(e,t){return t||ae(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},U.prototype.readInt16LE=function(e,t){t||ae(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},U.prototype.readInt16BE=function(e,t){t||ae(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},U.prototype.readInt32LE=function(e,t){return t||ae(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},U.prototype.readInt32BE=function(e,t){return t||ae(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},U.prototype.readFloatLE=function(e,t){return t||ae(e,4,this.length),x(this,e,!0,23,4)},U.prototype.readFloatBE=function(e,t){return t||ae(e,4,this.length),x(this,e,!1,23,4)},U.prototype.readDoubleLE=function(e,t){return t||ae(e,8,this.length),x(this,e,!0,52,8)},U.prototype.readDoubleBE=function(e,t){return t||ae(e,8,this.length),x(this,e,!1,52,8)},U.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||ue(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},U.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||ue(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},U.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||ue(this,e,t,1,255,0),U.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},U.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||ue(this,e,t,2,65535,0),U.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):fe(this,e,t,!0),t+2},U.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||ue(this,e,t,2,65535,0),U.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):fe(this,e,t,!1),t+2},U.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||ue(this,e,t,4,4294967295,0),U.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):he(this,e,t,!0),t+4},U.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||ue(this,e,t,4,4294967295,0),U.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):he(this,e,t,!1),t+4},U.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ue(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},U.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ue(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},U.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||ue(this,e,t,1,127,-128),U.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},U.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||ue(this,e,t,2,32767,-32768),U.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):fe(this,e,t,!0),t+2},U.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||ue(this,e,t,2,32767,-32768),U.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):fe(this,e,t,!1),t+2},U.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||ue(this,e,t,4,2147483647,-2147483648),U.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):he(this,e,t,!0),t+4},U.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||ue(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),U.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):he(this,e,t,!1),t+4},U.prototype.writeFloatLE=function(e,t,n){return le(this,e,t,!0,n)},U.prototype.writeFloatBE=function(e,t,n){return le(this,e,t,!1,n)},U.prototype.writeDoubleLE=function(e,t,n){return de(this,e,t,!0,n)},U.prototype.writeDoubleBE=function(e,t,n){return de(this,e,t,!1,n)},U.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||!U.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},U.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&&!U.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=N(e)?e:ve(new U(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var pe=/[^+\/0-9A-Za-z-_]/g;function ge(e){return e<16?"0"+e.toString(16):e.toString(16)}function ve(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 ye(e){return function(e){var t,n,r,i,o,s;A||k();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new S(3*a/4-o),r=o>0?a-4:a;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=L[e.charCodeAt(t)]<<18|L[e.charCodeAt(t+1)]<<12|L[e.charCodeAt(t+2)]<<6|L[e.charCodeAt(t+3)],s[u++]=i>>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=L[e.charCodeAt(t)]<<2|L[e.charCodeAt(t+1)]>>4,s[u++]=255&i):1===o&&(i=L[e.charCodeAt(t)]<<10|L[e.charCodeAt(t+1)]<<4|L[e.charCodeAt(t+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(pe,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function we(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}function be(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function me(){throw new Error("setTimeout has not been defined")}function _e(){throw new Error("clearTimeout has not been defined")}var Ee=me,Re=_e;function Le(e){if(Ee===setTimeout)return setTimeout(e,0);if((Ee===me||!Ee)&&setTimeout)return Ee=setTimeout,setTimeout(e,0);try{return Ee(e,0)}catch(t){try{return Ee.call(null,e,0)}catch(t){return Ee.call(this,e,0)}}}"function"==typeof E.setTimeout&&(Ee=setTimeout),"function"==typeof E.clearTimeout&&(Re=clearTimeout);var Se,Ae=[],ke=!1,Te=-1;function Ce(){ke&&Se&&(ke=!1,Se.length?Ae=Se.concat(Ae):Te=-1,Ae.length&&xe())}function xe(){if(!ke){var e=Le(Ce);ke=!0;for(var t=Ae.length;t;){for(Se=Ae,Ae=[];++Te<t;)Se&&Se[Te].run();Te=-1,t=Ae.length}Se=null,ke=!1,function(e){if(Re===clearTimeout)return clearTimeout(e);if((Re===_e||!Re)&&clearTimeout)return Re=clearTimeout,clearTimeout(e);try{return Re(e)}catch(t){try{return Re.call(null,e)}catch(t){return Re.call(this,e)}}}(e)}}function Me(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];Ae.push(new Oe(e,t)),1!==Ae.length||ke||Le(xe)}function Oe(e,t){this.fun=e,this.array=t}function Pe(){}Oe.prototype.run=function(){this.fun.apply(null,this.array)};var je=Pe,Be=Pe,Ue=Pe,De=Pe,Ie=Pe,Ye=Pe,qe=Pe,ze=E.performance||{},Ne=ze.now||ze.mozNow||ze.msNow||ze.oNow||ze.webkitNow||function(){return(new Date).getTime()},We=new Date,Fe={nextTick:Me,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:je,addListener:Be,once:Ue,off:De,removeListener:Ie,removeAllListeners:Ye,emit:qe,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Ne.call(ze),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-We)/1e3}},He="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},Ge=/%[sdj%]/g;function Je(e){if(!ot(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(Ke(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(Ge,(function(e){if("%%"===e)return"%";if(n>=i)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}})),s=r[n];n<i;s=r[++n])it(s)||!ut(s)?o+=" "+s:o+=" "+Ke(s);return o}function $e(e,t){if(st(E.process))return function(){return $e(e,t).apply(this,arguments)};if(!0===Fe.noDeprecation)return e;var n=!1;return function(){if(!n){if(Fe.throwDeprecation)throw new Error(t);Fe.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var Ve,Ze={};function Ke(e,t){var n={seen:[],stylize:Xe};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),rt(t)?n.showHidden=t:t&&function(e,t){if(!t||!ut(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]]}(n,t),st(n.showHidden)&&(n.showHidden=!1),st(n.depth)&&(n.depth=2),st(n.colors)&&(n.colors=!1),st(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Qe),et(n,e,n.depth)}function Qe(e,t){var n=Ke.styles[t];return n?"["+Ke.colors[n][0]+"m"+e+"["+Ke.colors[n][1]+"m":e}function Xe(e,t){return e}function et(e,t,n){if(e.customInspect&&t&&ct(t.inspect)&&t.inspect!==Ke&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return ot(r)||(r=et(e,r,n)),r}var i=function(e,t){if(st(t))return e.stylize("undefined","undefined");if(ot(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return"number"==typeof t?e.stylize(""+t,"number"):rt(t)?e.stylize(""+t,"boolean"):it(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o=Object.keys(t),s=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),ht(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return tt(t);if(0===o.length){if(ct(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(at(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(ft(t))return e.stylize(Date.prototype.toString.call(t),"date");if(ht(t))return tt(t)}var u,f,h="",c=!1,l=["{","}"];return u=t,Array.isArray(u)&&(c=!0,l=["[","]"]),ct(t)&&(h=" [Function"+(t.name?": "+t.name:"")+"]"),at(t)&&(h=" "+RegExp.prototype.toString.call(t)),ft(t)&&(h=" "+Date.prototype.toUTCString.call(t)),ht(t)&&(h=" "+tt(t)),0!==o.length||c&&0!=t.length?n<0?at(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),f=c?function(e,t,n,r,i){for(var o=[],s=0,a=t.length;s<a;++s)dt(t,String(s))?o.push(nt(e,t,n,r,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(nt(e,t,n,r,i,!0))})),o}(e,t,n,s,o):o.map((function(r){return nt(e,t,n,s,r,c)})),e.seen.pop(),function(e,t,n){var r=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);return r>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(f,h,l)):l[0]+h+l[1]}function tt(e){return"["+Error.prototype.toString.call(e)+"]"}function nt(e,t,n,r,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),dt(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=it(n)?et(e,u.value,null):et(e,u.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")),st(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 rt(e){return"boolean"==typeof e}function it(e){return null===e}function ot(e){return"string"==typeof e}function st(e){return void 0===e}function at(e){return ut(e)&&"[object RegExp]"===lt(e)}function ut(e){return"object"==typeof e&&null!==e}function ft(e){return ut(e)&&"[object Date]"===lt(e)}function ht(e){return ut(e)&&("[object Error]"===lt(e)||e instanceof Error)}function ct(e){return"function"==typeof e}function lt(e){return Object.prototype.toString.call(e)}function dt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function pt(){this.head=null,this.tail=null,this.length=0}Ke.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]},Ke.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},pt.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},pt.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},pt.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},pt.prototype.clear=function(){this.head=this.tail=null,this.length=0},pt.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},pt.prototype.concat=function(e){if(0===this.length)return U.alloc(0);if(1===this.length)return this.head.data;for(var t=U.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var gt=U.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function vt(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!gt(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=wt;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=bt;break;default:return void(this.write=yt)}this.charBuffer=new U(6),this.charReceived=0,this.charLength=0}function yt(e){return e.toString(this.encoding)}function wt(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function bt(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}vt.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((r=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},vt.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},vt.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t},Et.ReadableState=_t;var mt=function(e){return st(Ve)&&(Ve=Fe.env.NODE_DEBUG||""),e=e.toUpperCase(),Ze[e]||(new RegExp("\\b"+e+"\\b","i").test(Ve)?Ze[e]=function(){var t=Je.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:Ze[e]=function(){}),Ze[e]}("stream");function _t(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Zt&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new pt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new vt(e.encoding),this.encoding=e.encoding)}function Et(e){if(!(this instanceof Et))return new Et(e);this._readableState=new _t(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),v.call(this)}function Rt(e,t,n,r,i){var o=function(e,t){var n=null;return U.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,At(e)}}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&At(e))),function(e,t){t.readingMore||(t.readingMore=!0,Me(Tt,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}He(Et,v),Et.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding)!==n.encoding&&(e=U.from(e,t),t=""),Rt(this,n,e,t,!1)},Et.prototype.unshift=function(e){return Rt(this,this._readableState,e,"",!0)},Et.prototype.isPaused=function(){return!1===this._readableState.flowing},Et.prototype.setEncoding=function(e){return this._readableState.decoder=new vt(e),this._readableState.encoding=e,this};var Lt=8388608;function St(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=Lt?e=Lt:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function At(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(mt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Me(kt,e):kt(e))}function kt(e){mt("emit readable"),e.emit("readable"),Mt(e)}function Tt(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(mt("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function Ct(e){mt("readable nexttick read 0"),e.read(0)}function xt(e,t){t.reading||(mt("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.await