Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@trezor/blockchain-link

Package Overview
Dependencies
Maintainers
5
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trezor/blockchain-link - npm Package Compare versions

Comparing version 1.0.11 to 1.0.12

2

build/web/blockbook-worker.js

@@ -1,1 +0,1 @@

!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="./",r(r.s=447)}({18:function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=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 o=Number.isNaN||function(e){return e!=e};function c(){c.init.call(this)}e.exports=c,c.EventEmitter=c,c.prototype._events=void 0,c.prototype._eventsCount=0,c.prototype._maxListeners=void 0;var u=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function f(e){return void 0===e._maxListeners?c.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var i,s,o,c;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=f(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,c=u,console&&console.warn&&console.warn(c)}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 p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):y(i,i.length)}function v(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(c,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),c.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},c.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(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},c.prototype.getMaxListeners=function(){return f(this)},c.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var c=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw c.context=o,c}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)s(u,this,t);else{var a=u.length,f=y(u,a);for(r=0;r<a;++r)s(f[r],this,t)}return!0},c.prototype.addListener=function(e,t){return l(this,e,t,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function(e,t){return l(this,e,t,!0)},c.prototype.once=function(e,t){return a(t),this.on(e,p(this,e,t)),this},c.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,p(this,e,t)),this},c.prototype.removeListener=function(e,t){var r,n,i,s,o;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},c.prototype.off=c.prototype.removeListener,c.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(i=s[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},c.prototype.listeners=function(e){return h(this,e,!0)},c.prototype.rawListeners=function(e){return h(this,e,!1)},c.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):v.call(e,t)},c.prototype.listenerCount=v,c.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},26:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var s="blockchain_link/",o={worker_not_found:"Worker not found",worker_invalid:"Invalid worker object",worker_timeout:"Worker timeout",worker_unknown_request:"Unknown message type:",worker_runtime:void 0,invalid_param:"Invalid parameter:",websocket_not_initialized:"WebSocket not initialized",websocket_no_url:"Cannot connect because no server was specified",websocket_timeout:"Websocket timeout",websocket_error_message:void 0,websocket_runtime_error:void 0},c=function(e){function t(t,r){void 0===r&&(r="");var n=e.call(this,r)||this;if(n.message="",n.message=r,"string"==typeof t){var i=0===t.indexOf(s)?t.substring(s.length,t.length):t;n.code=""+s+i;var c=o[i];"string"==typeof c&&(""===n.message?n.message=c:0===r.indexOf("+")&&(n.message=c+" "+r.substr(1,r.length)))}return"string"==typeof n.message&&""!==n.message||(n.message="Message not set"),n}return i(t,e),t}(Error);t.CustomError=c},39: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}},447:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function c(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}u((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var u,a=r(26),f=r(45),l=o(r(448)),d=c(r(450)),p=new(o(r(85)).default)(postMessage),h=[],v=function(){u&&(u.dispose(),u.removeAllListeners(),u=void 0),h=[],p.removeAccounts(p.getAccounts()),p.removeAddresses(p.getAddresses()),p.clearSubscriptions()},y=function(){return i(void 0,void 0,void 0,(function(){var e,t,r,n,i,o;return s(this,(function(s){switch(s.label){case 0:if(u&&u.isConnected())return[2,u];if(e=p.getSettings(),t=e.server,r=e.timeout,n=e.pingTimeout,i=e.keepAlive,!t||!Array.isArray(t)||t.length<1)throw new a.CustomError("connect","Endpoint not set");h.length<1&&(h=p.shuffleEndpoints(t.slice(0))),p.debug("Connecting to",h[0]),o=new l.default({url:h[0],timeout:r,pingTimeout:n,keepAlive:i}),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,o.connect()];case 2:return s.sent(),u=o,[3,4];case 3:if(s.sent(),p.debug("Websocket connection failed"),u=void 0,h.splice(0,1),h.length<1)throw new a.CustomError("connect","All backends are down");return[2,y()];case 4:return o.on("disconnected",(function(){p.response({id:-1,type:f.RESPONSES.DISCONNECTED,payload:!0}),v()})),p.response({id:-1,type:f.RESPONSES.CONNECTED}),p.debug("Connected"),[2,o]}}))}))},b=function(e){p.response({id:-1,type:f.RESPONSES.NOTIFICATION,payload:{type:"block",payload:{blockHeight:e.height,blockHash:e.hash}}})},g=function(e){if(e.tx){var t=e.address,r=p.getAccount(t);p.response({id:-1,type:f.RESPONSES.NOTIFICATION,payload:{type:"notification",payload:{descriptor:r?r.descriptor:t,tx:r?d.transformTransaction(r.descriptor,r.addresses,e.tx):d.transformTransaction(t,void 0,e.tx)}}})}},m=function(e){p.response({id:-1,type:f.RESPONSES.NOTIFICATION,payload:{type:"fiatRates",payload:{rates:e.rates}}})};onmessage=function(e){if(e.data){var t=e.data,r=t.id,o=t.type;switch(p.debug("onmessage",t),t.type){case f.MESSAGES.HANDSHAKE:p.setSettings(t.settings);break;case f.MESSAGES.CONNECT:y().then((function(){return i(void 0,void 0,void 0,(function(){return s(this,(function(e){return p.response({id:r,type:f.RESPONSES.CONNECT,payload:!0}),[2]}))}))})).catch((function(e){return p.errorHandler({id:r,error:e})}));break;case f.MESSAGES.GET_INFO:!function(e){i(void 0,void 0,void 0,(function(){var t,r,i;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),[4,y()];case 1:return[4,(t=s.sent()).getServerInfo()];case 2:return r=s.sent(),p.response({id:e.id,type:f.RESPONSES.GET_INFO,payload:n({url:t.options.url},d.transformServerInfo(r))}),[3,4];case 3:return i=s.sent(),p.errorHandler({id:e.id,error:i}),[3,4];case 4:return[2]}}))}))}(t);break;case f.MESSAGES.GET_BLOCK_HASH:!function(e){i(void 0,void 0,void 0,(function(){var t,r;return s(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,y()];case 1:return[4,n.sent().getBlockHash(e.payload)];case 2:return t=n.sent(),p.response({id:e.id,type:f.RESPONSES.GET_BLOCK_HASH,payload:t.hash}),[3,4];case 3:return r=n.sent(),p.errorHandler({id:e.id,error:r}),[3,4];case 4:return[2]}}))}))}(t);break;case f.MESSAGES.GET_ACCOUNT_INFO:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getAccountInfo(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_ACCOUNT_INFO,payload:d.transformAccountInfo(r)}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_ACCOUNT_UTXO:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getAccountUtxo(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_ACCOUNT_UTXO,payload:d.transformAccountUtxo(r)}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_TRANSACTION:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getTransaction(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_TRANSACTION,payload:{type:"blockbook",tx:r}}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_ACCOUNT_BALANCE_HISTORY:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getAccountBalanceHistory(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_ACCOUNT_BALANCE_HISTORY,payload:r}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_CURRENT_FIAT_RATES:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getCurrentFiatRates(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_CURRENT_FIAT_RATES,payload:r}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_FIAT_RATES_FOR_TIMESTAMPS:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getFiatRatesForTimestamps(t)];case 3:return r=i.sent().tickers,p.response({id:e.id,type:f.RESPONSES.GET_FIAT_RATES_FOR_TIMESTAMPS,payload:{tickers:r}}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_FIAT_RATES_TICKERS_LIST:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getFiatRatesTickersList(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_FIAT_RATES_TICKERS_LIST,payload:{ts:r.ts,availableCurrencies:r.available_currencies}}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.ESTIMATE_FEE:!function(e){i(void 0,void 0,void 0,(function(){var t,r;return s(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,y()];case 1:return[4,n.sent().estimateFee(e.payload)];case 2:return t=n.sent(),p.response({id:e.id,type:f.RESPONSES.ESTIMATE_FEE,payload:t}),[3,4];case 3:return r=n.sent(),p.errorHandler({id:e.id,error:r}),[3,4];case 4:return[2]}}))}))}(t);break;case f.MESSAGES.PUSH_TRANSACTION:!function(e){i(void 0,void 0,void 0,(function(){var t,r;return s(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,y()];case 1:return[4,n.sent().pushTransaction(e.payload)];case 2:return t=n.sent(),p.response({id:e.id,type:f.RESPONSES.PUSH_TRANSACTION,payload:t.result}),[3,4];case 3:return r=n.sent(),p.errorHandler({id:e.id,error:r}),[3,4];case 4:return[2]}}))}))}(t);break;case f.MESSAGES.SUBSCRIBE:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(o){switch(o.label){case 0:t=e.payload,o.label=1;case 1:return o.trys.push([1,11,,12]),r=void 0,"accounts"!==t.type?[3,3]:[4,(l=t.accounts,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return p.addAccounts(l),[4,y()];case 1:return e=t.sent(),p.getSubscription("notification")||(e.on("notification",g),p.addSubscription("notification")),[2,e.subscribeAddresses(p.getAddresses())]}}))})))];case 2:return r=o.sent(),[3,10];case 3:return"addresses"!==t.type?[3,5]:[4,(u=t.addresses,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return p.addAddresses(u),[4,y()];case 1:return e=t.sent(),p.getSubscription("notification")||(e.on("notification",g),p.addSubscription("notification")),[2,e.subscribeAddresses(p.getAddresses())]}}))})))];case 4:return r=o.sent(),[3,10];case 5:return"block"!==t.type?[3,7]:[4,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return p.getSubscription("block")?[2,{subscribed:!0}]:[4,y()];case 1:return e=t.sent(),p.addSubscription("block"),e.on("block",b),[2,e.subscribeBlock()]}}))}))];case 6:return r=o.sent(),[3,10];case 7:return"fiatRates"!==t.type?[3,9]:[4,(c=t.currency,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,y()];case 1:return e=t.sent(),p.getSubscription("fiatRates")||(p.addSubscription("fiatRates"),e.on("fiatRates",m)),[2,e.subscribeFiatRates(c)]}}))})))];case 8:return r=o.sent(),[3,10];case 9:throw new a.CustomError("invalid_param","+type");case 10:return p.response({id:e.id,type:f.RESPONSES.SUBSCRIBE,payload:r}),[3,12];case 11:return n=o.sent(),p.errorHandler({id:e.id,error:n}),[3,12];case 12:return[2]}var c,u,l}))}))}(t);break;case f.MESSAGES.UNSUBSCRIBE:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(o){switch(o.label){case 0:t=e.payload,o.label=1;case 1:return o.trys.push([1,11,,12]),r=void 0,"accounts"!==t.type?[3,3]:[4,(u=t.accounts,i(void 0,void 0,void 0,(function(){var e,t;return s(this,(function(r){switch(r.label){case 0:return p.removeAccounts(u||p.getAccounts()),[4,y()];case 1:return e=r.sent(),(t=p.getAddresses()).length<1?(e.removeListener("notification",g),p.removeSubscription("notification"),[2,e.unsubscribeAddresses()]):[2,e.subscribeAddresses(t)]}}))})))];case 2:return r=o.sent(),[3,10];case 3:return"addresses"!==t.type?[3,5]:[4,(c=t.addresses,i(void 0,void 0,void 0,(function(){var e,t;return s(this,(function(r){switch(r.label){case 0:return[4,y()];case 1:return e=r.sent(),c||p.removeAccounts(p.getAccounts()),(t=p.removeAddresses(c||p.getAddresses())).length<1?(e.removeListener("notification",g),p.removeSubscription("notification"),[2,e.unsubscribeAddresses()]):[2,e.subscribeAddresses(t)]}}))})))];case 4:return r=o.sent(),[3,10];case 5:return"block"!==t.type?[3,7]:[4,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return p.getSubscription("block")?[4,y()]:[2,{subscribed:!1}];case 1:return(e=t.sent()).removeListener("block",b),p.removeSubscription("block"),[2,e.unsubscribeBlock()]}}))}))];case 6:return r=o.sent(),[3,10];case 7:return"fiatRates"!==t.type?[3,9]:[4,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return p.getSubscription("fiatRates")?[4,y()]:[2,{subscribed:!1}];case 1:return(e=t.sent()).removeListener("fiatRates",b),p.removeSubscription("fiatRates"),[2,e.unsubscribeFiatRates()]}}))}))];case 8:return r=o.sent(),[3,10];case 9:throw new a.CustomError("invalid_param","+type");case 10:return p.response({id:e.id,type:f.RESPONSES.UNSUBSCRIBE,payload:r}),[3,12];case 11:return n=o.sent(),p.errorHandler({id:e.id,error:n}),[3,12];case 12:return[2]}var c,u}))}))}(t);break;case f.MESSAGES.DISCONNECT:!function(e){i(void 0,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:if(!u)return p.response({id:e.id,type:f.RESPONSES.DISCONNECTED,payload:!0}),[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,u.disconnect()];case 2:return r.sent(),p.response({id:e.id,type:f.RESPONSES.DISCONNECTED,payload:!0}),[3,4];case 3:return t=r.sent(),p.errorHandler({id:e.id,error:t}),[3,4];case 4:return[2]}}))}))}(t);break;case"terminate":v();break;default:p.errorHandler({id:r,error:new a.CustomError("worker_unknown_request","+"+o)})}}},p.handshake()},448:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function c(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=c(r(66)),a=r(18),f=r(26),l=r(449),d=new f.CustomError("websocket_not_initialized"),p=function(e){function t(t){var r=e.call(this)||this;return r.messageID=0,r.messages=[],r.subscriptions=[],r.send=function(e,t){var n=r.ws;if(!n)throw d;var i=r.messageID.toString(),s=l.create(i),o={id:i,method:e,params:t};return r.messageID++,r.messages.push(s),r.setConnectionTimeout(),r.setPingTimeout(),n.send(JSON.stringify(o)),s.promise},r.setMaxListeners(1/0),r.options=t,r}return i(t,e),t.prototype.setConnectionTimeout=function(){this.clearConnectionTimeout(),this.connectionTimeout=setTimeout(this.onTimeout.bind(this),this.options.timeout||2e4)},t.prototype.clearConnectionTimeout=function(){this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=void 0)},t.prototype.setPingTimeout=function(){this.pingTimeout&&clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(this.onPing.bind(this),this.options.pingTimeout||5e4)},t.prototype.onTimeout=function(){var e=this.ws;if(e)if(e.listenerCount("open")>0){e.emit("error","Websocket timeout");try{e.close()}catch(e){}}else this.messages.forEach((function(e){return e.reject(new f.CustomError("websocket_timeout"))})),e.close()},t.prototype.onPing=function(){return s(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.ws&&this.isConnected()?this.subscriptions.length>0||this.options.keepAlive?[4,this.getBlockHash(0)]:[3,2]:[3,3];case 1:return e.sent(),[3,3];case 2:try{this.ws.close()}catch(e){}e.label=3;case 3:return[2]}}))}))},t.prototype.onError=function(){this.dispose()},t.prototype.onmessage=function(e){try{var t=JSON.parse(e),r=t.id,n=t.data,i=this.messages.find((function(e){return e.id===r}));if(i)n.error?i.reject(new f.CustomError("websocket_error_message",n.error.message)):i.resolve(n),this.messages.splice(this.messages.indexOf(i),1);else{var s=this.subscriptions.find((function(e){return e&&e.id===r}));s&&s.callback(n)}}catch(e){}0===this.messages.length&&this.clearConnectionTimeout(),this.setPingTimeout()},t.prototype.connect=function(){var e=this,t=this.options.url;if("string"!=typeof t)throw new f.CustomError("websocket_no_url");if(t.startsWith("https")&&(t=t.replace("https","wss")),t.startsWith("http")&&(t=t.replace("http","ws")),!t.endsWith("/websocket")){var r=t.endsWith("/")?"websocket":"/websocket";t+=r}this.setConnectionTimeout();var n=l.create(-1),i=new u.default(t);return"function"==typeof i.setMaxListeners&&i.setMaxListeners(1/0),i.once("error",(function(t){e.dispose(),n.reject(new f.CustomError("websocket_runtime_error",t.message))})),i.on("open",(function(){e.init(),n.resolve()})),this.ws=i,n.promise},t.prototype.init=function(){var e=this,t=this.ws;if(!t||!this.isConnected())throw Error("Blockbook websocket init cannot be called");this.clearConnectionTimeout(),t.removeAllListeners(),t.on("error",this.onError.bind(this)),t.on("message",this.onmessage.bind(this)),t.on("close",(function(){e.emit("disconnected"),e.dispose()}))},t.prototype.disconnect=function(){this.ws&&this.ws.close()},t.prototype.isConnected=function(){var e=this.ws;return e&&e.readyState===u.default.OPEN},t.prototype.getServerInfo=function(){return this.send("getInfo",{})},t.prototype.getBlockHash=function(e){return this.send("getBlockHash",{height:e})},t.prototype.getAccountInfo=function(e){return this.send("getAccountInfo",e)},t.prototype.getAccountUtxo=function(e){return this.send("getAccountUtxo",{descriptor:e})},t.prototype.getTransaction=function(e){return this.send("getTransaction",{txid:e})},t.prototype.pushTransaction=function(e){return this.send("sendTransaction",{hex:e})},t.prototype.estimateFee=function(e){return this.send("estimateFee",e)},t.prototype.getCurrentFiatRates=function(e){return this.send("getCurrentFiatRates",e)},t.prototype.getAccountBalanceHistory=function(e){return this.send("getBalanceHistory",e)},t.prototype.getFiatRatesForTimestamps=function(e){return this.send("getFiatRatesForTimestamps",e)},t.prototype.getFiatRatesTickersList=function(e){return this.send("getFiatRatesTickersList",e)},t.prototype.subscribeAddresses=function(e){var t=this,r=this.subscriptions.findIndex((function(e){return"notification"===e.type}));r>=0&&this.subscriptions.splice(r,1);var n=this.messageID.toString();return this.subscriptions.push({id:n,type:"notification",callback:function(e){t.emit("notification",e)}}),this.send("subscribeAddresses",{addresses:e})},t.prototype.unsubscribeAddresses=function(){var e=this.subscriptions.findIndex((function(e){return"notification"===e.type}));return e>=0?(this.subscriptions.splice(e,1),this.send("unsubscribeAddresses",{})):{subscribed:!1}},t.prototype.subscribeBlock=function(){var e=this,t=this.subscriptions.findIndex((function(e){return"block"===e.type}));t>=0&&this.subscriptions.splice(t,1);var r=this.messageID.toString();return this.subscriptions.push({id:r,type:"block",callback:function(t){e.emit("block",t)}}),this.send("subscribeNewBlock",{})},t.prototype.unsubscribeBlock=function(){var e=this.subscriptions.findIndex((function(e){return"block"===e.type}));return e>=0?(this.subscriptions.splice(e,1),this.send("unsubscribeNewBlock",{})):{subscribed:!1}},t.prototype.subscribeFiatRates=function(e){var t=this,r=this.subscriptions.findIndex((function(e){return"fiatRates"===e.type}));r>=0&&this.subscriptions.splice(r,1);var n=this.messageID.toString();return this.subscriptions.push({id:n,type:"fiatRates",callback:function(e){t.emit("fiatRates",e)}}),this.send("subscribeFiatRates",{currency:e})},t.prototype.unsubscribeFiatRates=function(){var e=this.subscriptions.findIndex((function(e){return"fiatRates"===e.type}));return e>=0?(this.subscriptions.splice(e,1),this.send("unsubscribeFiatRates",{})):{subscribed:!1}},t.prototype.dispose=function(){this.pingTimeout&&clearTimeout(this.pingTimeout),this.connectionTimeout&&clearTimeout(this.connectionTimeout);var e=this.ws;this.isConnected()&&this.disconnect(),e&&e.removeAllListeners(),this.removeAllListeners()},t}(a.EventEmitter);t.default=p},449:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.create=function(e){var t=function(){},r=function(){},n=new Promise((function(e,n){t=e,r=n}));return{id:e,resolve:t,reject:r,promise:n}}},45:function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=n(r(83));t.MESSAGES=i;var s=n(r(84));t.RESPONSES=s,t.NETWORKS={RIPPLE:"ripple",BLOCKBOOK:"blockbook"}},450:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(r(7));t.transformServerInfo=function(e){return{name:e.name,shortcut:e.shortcut,testnet:e.testnet,version:e.version,decimals:e.decimals,blockHeight:e.bestHeight,blockHash:e.bestHash}},t.filterTargets=function(e,t){if("string"==typeof e&&(e=[e]),!(e&&Array.isArray(e)&&t&&Array.isArray(t)))return[];var r=e.map((function(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.address?e.address:null}));return t.filter((function(e){return!(!e||!Array.isArray(e.addresses))&&e.addresses.filter((function(e){return r.indexOf(e)>=0})).length>0}))},t.filterTokenTransfers=function(e,t){if("string"==typeof e&&(e=[e]),!(e&&Array.isArray(e)&&t&&Array.isArray(t)))return[];var r=e.map((function(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.address?e.address:null}));return t.filter((function(e){return!(!e||"object"!=typeof e)&&(e.from&&r.indexOf(e.from)>=0||e.to&&r.indexOf(e.to)>=0)})).map((function(e){var t=e.from&&r.indexOf(e.from)>=0,n=e.to&&r.indexOf(e.to)>=0,i="unknown";return t&&n?i="self":(t&&(i="sent"),n&&(i="recv")),{type:i,name:e.name,symbol:e.symbol,address:e.token,decimals:e.decimals||0,amount:e.value,from:e.from,to:e.to}}))};t.transformTransaction=function(e,r,n){var i,o,c=r?r.change.concat(r.used,r.unused):[e],u=Array.isArray(n.vin)?n.vin.length:0,a=Array.isArray(n.vout)?n.vout.length:0,f=t.filterTargets(c,n.vin),l=t.filterTargets(c,n.vout),d=r?t.filterTargets(r.change,n.vout):[],p=t.filterTokenTransfers(c,n.tokenTransfers),h=[],v=n.value;if(0===f.length&&0===l.length&&0===p.length)i="unknown";else if(u>0&&a>0&&f.length===u&&l.length===a)i="self",h=n.vout.filter((function(e){return d.indexOf(e)<0})),v=n.fees;else if(0===f.length&&(l.length>0||p.length>0))i="recv",v="0",l.length>0&&(h=l,v=l.reduce((function(e,t){return"string"!=typeof t.value?e:new s.default(e).plus(t.value).toString()}),v));else if(i="sent",0===p.length&&Array.isArray(n.vout)&&(h=n.vout.filter((function(e){return d.indexOf(e)<0}))),n.ethereumSpecific)v=p.length>0||0===n.ethereumSpecific.status?n.fees:n.value;else if(Array.isArray(n.vout)){var y=f.reduce((function(e,t){return"string"!=typeof t.value?e:new s.default(e).plus(t.value).toString()}),"0");v=l.reduce((function(e,t){return"string"!=typeof t.value?e:new s.default(e).minus(t.value).toString()}),y)}return Array.isArray(n.vin)&&n.vin.forEach((function(e){"number"==typeof e.sequence&&e.sequence<4294967294&&(o=!0)})),{type:i,txid:n.txid,blockTime:n.blockTime,blockHeight:n.blockHeight,blockHash:n.blockHash,amount:v,fee:n.fees,targets:h.filter((function(e){return"object"==typeof e})).map((function(e){return function(e,t){return{addresses:e.addresses,isAddress:e.isAddress,amount:e.value,coinbase:e.coinbase,isAccountTarget:!!t.includes(e)||void 0}}(e,l)})),tokens:p,rbf:o,ethereumSpecific:n.ethereumSpecific}},t.transformTokenInfo=function(e){if(e&&Array.isArray(e)){var t=e.reduce((function(e,t){return"ERC20"!==t.type?e:e.concat([{type:t.type,name:t.name,symbol:t.symbol,address:t.contract,balance:t.balance,decimals:t.decimals||0}])}),[]);return t.length>0?t:void 0}},t.transformAddresses=function(e){if(e&&Array.isArray(e)){var t=e.reduce((function(e,t){return"XPUBAddress"!==t.type?e:e.concat([{address:t.name,path:t.path,transfers:t.transfers,balance:t.balance,sent:t.totalSent,received:t.totalReceived}])}),[]);if(!(t.length<1)){var r=t.filter((function(e){return"1"===e.path.split("/")[4]})),n=t.filter((function(e){return r.indexOf(e)<0}));return{change:r,used:n.filter((function(e){return e.transfers>0})),unused:n.filter((function(e){return 0===e.transfers}))}}}},t.transformAccountInfo=function(e){var r;"number"==typeof e.page&&(r={index:e.page,size:e.itemsOnPage,total:e.totalPages});var i={};if("string"==typeof e.nonce&&(i.nonce=e.nonce),e.erc20Contract){var o=t.transformTokenInfo([n({type:"ERC20"},e.erc20Contract)]);if(o){var c=o[0];i.erc20Contract=c}}Object.keys(i).length<1&&(i=void 0);var u=e.address,a=t.transformAddresses(e.tokens),f=t.transformTokenInfo(e.tokens),l=0===e.txs&&0===e.unconfirmedTxs,d=new s.default(e.unconfirmedBalance),p=d.isNaN()||d.isZero()?e.balance:d.plus(e.balance).toString();return{descriptor:u,balance:e.balance,availableBalance:p,empty:l,tokens:f,addresses:a,history:{total:e.txs,tokens:"number"==typeof e.nonTokenTxs?e.txs-e.nonTokenTxs:void 0,unconfirmed:e.unconfirmedTxs,transactions:e.transactions?e.transactions.map((function(e){return t.transformTransaction(u,a,e)})):void 0},misc:i,page:r}},t.transformAccountUtxo=function(e){return e.map((function(e){return{txid:e.txid,vout:e.vout,amount:e.value,blockHeight:e.height,address:e.address,path:e.path,confirmations:e.confirmations,coinbase:e.coinbase}}))}},66:function(e,t,r){var n=r(67),i=r(39),s=(r(68),r(70),r(71)),o=r(72);var c=function(e){"use strict";s(t,e);!function(e){function t(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}}(t);function t(t){var r;return r=e.call(this)||this,o(i(r),"ws",void 0),r.setMaxListeners(1/0),r.ws=new WebSocket(t),r.ws.onclose=function(){r.emit("close")},r.ws.onopen=function(){r.emit("open")},r.ws.onerror=function(e){r.emit("error",e)},r.ws.onmessage=function(e){r.emit("message",e.data)},r}var r=t.prototype;return r.close=function(){1===this.readyState&&this.ws.close()},r.send=function(e){this.ws.send(e)},n(t,[{key:"readyState",get:function(){return this.ws.readyState}}]),t}(r(18).EventEmitter);c.CONNECTING=0,c.OPEN=1,c.CLOSING=2,c.CLOSED=3,e.exports=c},67:function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},68:function(e,t,r){var n=r(69),i=r(39);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?i(e):t}},69:function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=r=function(e){return typeof e}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(t)}e.exports=r},7:function(e,t,r){var n;!function(i){"use strict";var s,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,c=Math.ceil,u=Math.floor,a="[BigNumber Error] ",f=a+"Number primitive has more than 15 significant digits: ",l=1e14,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e9;function h(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,s=e[0]+"";n<i;){for(r=14-(t=e[n++]+"").length;r--;t="0"+t);s+=t}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function y(e,t){var r,n,i=e.c,s=t.c,o=e.s,c=t.s,u=e.e,a=t.e;if(!o||!c)return null;if(r=i&&!i[0],n=s&&!s[0],r||n)return r?n?0:-c:o;if(o!=c)return o;if(r=o<0,n=u==a,!i||!s)return n?0:!i^r?1:-1;if(!n)return u>a^r?1:-1;for(c=(u=i.length)<(a=s.length)?u:a,o=0;o<c;o++)if(i[o]!=s[o])return i[o]>s[o]^r?1:-1;return u==a?0:u>a^r?1:-1}function b(e,t,r,n){if(e<t||e>r||e!==u(e))throw Error(a+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function g(e){var t=e.c.length-1;return h(e.e/14)==t&&e.c[t]%2!=0}function m(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(s=function e(t){var r,n,i,s,S,E,w,A,T,O=U.prototype={constructor:U,toString:null,valueOf:null},N=new U(1),k=20,C=4,R=-7,I=21,x=-1e7,P=1e7,L=!1,M=1,G=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz";function U(e,t){var r,s,c,a,l,d,p,h,v=this;if(!(v instanceof U))return new U(e,t);if(null==t){if(e&&!0===e._isBigNumber)return v.s=e.s,void(!e.c||e.e>P?v.c=v.e=null:e.e<x?v.c=[v.e=0]:(v.e=e.e,v.c=e.c.slice()));if((d="number"==typeof e)&&0*e==0){if(v.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,l=e;l>=10;l/=10,a++);return void(a>P?v.c=v.e=null:(v.e=a,v.c=[e]))}h=String(e)}else{if(!o.test(h=String(e)))return i(v,h,d);v.s=45==h.charCodeAt(0)?(h=h.slice(1),-1):1}(a=h.indexOf("."))>-1&&(h=h.replace(".","")),(l=h.search(/e/i))>0?(a<0&&(a=l),a+=+h.slice(l+1),h=h.substring(0,l)):a<0&&(a=h.length)}else{if(b(t,2,j.length,"Base"),10==t)return W(v=new U(e),k+v.e+1,C);if(h=String(e),d="number"==typeof e){if(0*e!=0)return i(v,h,d,t);if(v.s=1/e<0?(h=h.slice(1),-1):1,U.DEBUG&&h.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else v.s=45===h.charCodeAt(0)?(h=h.slice(1),-1):1;for(r=j.slice(0,t),a=l=0,p=h.length;l<p;l++)if(r.indexOf(s=h.charAt(l))<0){if("."==s){if(l>a){a=p;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,l=-1,a=0;continue}return i(v,String(e),d,t)}d=!1,(a=(h=n(h,t,10,v.s)).indexOf("."))>-1?h=h.replace(".",""):a=h.length}for(l=0;48===h.charCodeAt(l);l++);for(p=h.length;48===h.charCodeAt(--p););if(h=h.slice(l,++p)){if(p-=l,d&&U.DEBUG&&p>15&&(e>9007199254740991||e!==u(e)))throw Error(f+v.s*e);if((a=a-l-1)>P)v.c=v.e=null;else if(a<x)v.c=[v.e=0];else{if(v.e=a,v.c=[],l=(a+1)%14,a<0&&(l+=14),l<p){for(l&&v.c.push(+h.slice(0,l)),p-=14;l<p;)v.c.push(+h.slice(l,l+=14));l=14-(h=h.slice(l)).length}else l-=p;for(;l--;h+="0");v.c.push(+h)}}else v.c=[v.e=0]}function B(e,t,r,n){var i,s,o,c,u;if(null==r?r=C:b(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)u=v(e.c),u=1==n||2==n&&(o<=R||o>=I)?m(u,o):_(u,o,"0");else if(s=(e=W(new U(e),t,r)).e,c=(u=v(e.c)).length,1==n||2==n&&(t<=s||s<=R)){for(;c<t;u+="0",c++);u=m(u,s)}else if(t-=o,u=_(u,s,"0"),s+1>c){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=s-c)>0)for(s+1==c&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function H(e,t){for(var r,n=1,i=new U(e[0]);n<e.length;n++){if(!(r=new U(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function D(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+14*r-1)>P?e.c=e.e=null:r<x?e.c=[e.e=0]:(e.e=r,e.c=t),e}function W(e,t,r,n){var i,s,o,a,f,p,h,v=e.c,y=d;if(v){e:{for(i=1,a=v[0];a>=10;a/=10,i++);if((s=t-i)<0)s+=14,o=t,h=(f=v[p=0])/y[i-o-1]%10|0;else if((p=c((s+1)/14))>=v.length){if(!n)break e;for(;v.length<=p;v.push(0));f=h=0,i=1,o=(s%=14)-14+1}else{for(f=a=v[p],i=1;a>=10;a/=10,i++);h=(o=(s%=14)-14+i)<0?0:f/y[i-o-1]%10|0}if(n=n||t<0||null!=v[p+1]||(o<0?f:f%y[i-o-1]),n=r<4?(h||n)&&(0==r||r==(e.s<0?3:2)):h>5||5==h&&(4==r||n||6==r&&(s>0?o>0?f/y[i-o]:0:v[p-1])%10&1||r==(e.s<0?8:7)),t<1||!v[0])return v.length=0,n?(t-=e.e+1,v[0]=y[(14-t%14)%14],e.e=-t||0):v[0]=e.e=0,e;if(0==s?(v.length=p,a=1,p--):(v.length=p+1,a=y[14-s],v[p]=o>0?u(f/y[i-o]%y[o])*a:0),n)for(;;){if(0==p){for(s=1,o=v[0];o>=10;o/=10,s++);for(o=v[0]+=a,a=1;o>=10;o/=10,a++);s!=a&&(e.e++,v[0]==l&&(v[0]=1));break}if(v[p]+=a,v[p]!=l)break;v[p--]=0,a=1}for(s=v.length;0===v[--s];v.pop());}e.e>P?e.c=e.e=null:e.e<x&&(e.c=[e.e=0])}return e}function K(e){var t,r=e.e;return null===r?e.toString():(t=v(e.c),t=r<=R||r>=I?m(t,r):_(t,r,"0"),e.s<0?"-"+t:t)}return U.clone=e,U.ROUND_UP=0,U.ROUND_DOWN=1,U.ROUND_CEIL=2,U.ROUND_FLOOR=3,U.ROUND_HALF_UP=4,U.ROUND_HALF_DOWN=5,U.ROUND_HALF_EVEN=6,U.ROUND_HALF_CEIL=7,U.ROUND_HALF_FLOOR=8,U.EUCLID=9,U.config=U.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(a+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(b(r=e[t],0,p,t),k=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(b(r=e[t],0,8,t),C=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(b(r[0],-p,0,t),b(r[1],0,p,t),R=r[0],I=r[1]):(b(r,-p,p,t),R=-(I=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)b(r[0],-p,-1,t),b(r[1],1,p,t),x=r[0],P=r[1];else{if(b(r,-p,p,t),!r)throw Error(a+t+" cannot be zero: "+r);x=-(P=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(a+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!r,Error(a+"crypto unavailable");L=r}else L=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(b(r=e[t],0,9,t),M=r),e.hasOwnProperty(t="POW_PRECISION")&&(b(r=e[t],0,p,t),G=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(a+t+" not an object: "+r);F=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(a+t+" invalid: "+r);j=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:C,EXPONENTIAL_AT:[R,I],RANGE:[x,P],CRYPTO:L,MODULO_MODE:M,POW_PRECISION:G,FORMAT:F,ALPHABET:j}},U.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!U.DEBUG)return!0;var t,r,n=e.c,i=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===s||-1===s)&&i>=-p&&i<=p&&i===u(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%14)<1&&(t+=14),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=l||r!==u(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===s||1===s||-1===s))return!0;throw Error(a+"Invalid BigNumber: "+e)},U.maximum=U.max=function(){return H(arguments,O.lt)},U.minimum=U.min=function(){return H(arguments,O.gt)},U.random=(s=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,f=0,l=[],h=new U(N);if(null==e?e=k:b(e,0,p),i=c(e/14),L)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));f<i;)(o=131072*t[f]+(t[f+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(l.push(o%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw L=!1,Error(a+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f<i;)(o=281474976710656*(31&t[f])+1099511627776*t[f+1]+4294967296*t[f+2]+16777216*t[f+3]+(t[f+4]<<16)+(t[f+5]<<8)+t[f+6])>=9e15?crypto.randomBytes(7).copy(t,f):(l.push(o%1e14),f+=7);f=i/7}if(!L)for(;f<i;)(o=s())<9e15&&(l[f++]=o%1e14);for(e%=14,(i=l[--f])&&e&&(o=d[14-e],l[f]=u(i/o)*o);0===l[f];l.pop(),f--);if(f<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=14);for(f=1,o=l[0];o>=10;o/=10,f++);f<14&&(n-=14-f)}return h.e=n,h.c=l,h}),U.sum=function(){for(var e=1,t=arguments,r=new U(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){function e(e,t,r,n){for(var i,s,o=[0],c=0,u=e.length;c<u;){for(s=o.length;s--;o[s]*=t);for(o[0]+=n.indexOf(e.charAt(c++)),i=0;i<o.length;i++)o[i]>r-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(t,n,i,s,o){var c,u,a,f,l,d,p,h,y=t.indexOf("."),b=k,g=C;for(y>=0&&(f=G,G=0,t=t.replace(".",""),d=(h=new U(n)).pow(t.length-y),G=f,h.c=e(_(v(d.c),d.e,"0"),10,i,"0123456789"),h.e=h.c.length),a=f=(p=e(t,n,i,o?(c=j,"0123456789"):(c="0123456789",j))).length;0==p[--f];p.pop());if(!p[0])return c.charAt(0);if(y<0?--a:(d.c=p,d.e=a,d.s=s,p=(d=r(d,h,b,g,i)).c,l=d.r,a=d.e),y=p[u=a+b+1],f=i/2,l=l||u<0||null!=p[u+1],l=g<4?(null!=y||l)&&(0==g||g==(d.s<0?3:2)):y>f||y==f&&(4==g||l||6==g&&1&p[u-1]||g==(d.s<0?8:7)),u<1||!p[0])t=l?_(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(p.length=u,l)for(--i;++p[--u]>i;)p[u]=0,u||(++a,p=[1].concat(p));for(f=p.length;!p[--f];);for(y=0,t="";y<=f;t+=c.charAt(p[y++]));t=_(t,a,c.charAt(0))}return t}}(),r=function(){function e(e,t,r){var n,i,s,o,c=0,u=e.length,a=t%1e7,f=t/1e7|0;for(e=e.slice();u--;)c=((i=a*(s=e[u]%1e7)+(n=f*s+(o=e[u]/1e7|0)*a)%1e7*1e7+c)/r|0)+(n/1e7|0)+f*o,e[u]=i%r;return c&&(e=[c].concat(e)),e}function t(e,t,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(e[i]!=t[i]){s=e[i]>t[i]?1:-1;break}return s}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,s,o,c){var a,f,d,p,v,y,b,g,m,_,S,E,w,A,T,O,N,k=n.s==i.s?1:-1,C=n.c,R=i.c;if(!(C&&C[0]&&R&&R[0]))return new U(n.s&&i.s&&(C?!R||C[0]!=R[0]:R)?C&&0==C[0]||!R?0*k:k/0:NaN);for(m=(g=new U(k)).c=[],k=s+(f=n.e-i.e)+1,c||(c=l,f=h(n.e/14)-h(i.e/14),k=k/14|0),d=0;R[d]==(C[d]||0);d++);if(R[d]>(C[d]||0)&&f--,k<0)m.push(1),p=!0;else{for(A=C.length,O=R.length,d=0,k+=2,(v=u(c/(R[0]+1)))>1&&(R=e(R,v,c),C=e(C,v,c),O=R.length,A=C.length),w=O,S=(_=C.slice(0,O)).length;S<O;_[S++]=0);N=R.slice(),N=[0].concat(N),T=R[0],R[1]>=c/2&&T++;do{if(v=0,(a=t(R,_,O,S))<0){if(E=_[0],O!=S&&(E=E*c+(_[1]||0)),(v=u(E/T))>1)for(v>=c&&(v=c-1),b=(y=e(R,v,c)).length,S=_.length;1==t(y,_,b,S);)v--,r(y,O<b?N:R,b,c),b=y.length,a=1;else 0==v&&(a=v=1),b=(y=R.slice()).length;if(b<S&&(y=[0].concat(y)),r(_,y,S,c),S=_.length,-1==a)for(;t(R,_,O,S)<1;)v++,r(_,O<S?N:R,S,c),S=_.length}else 0===a&&(v++,_=[0]);m[d++]=v,_[0]?_[S++]=C[w]||0:(_=[C[w]],S=1)}while((w++<A||null!=_[0])&&k--);p=null!=_[0],m[0]||m.splice(0,1)}if(c==l){for(d=1,k=m[0];k>=10;k/=10,d++);W(g,s+(g.e=d+14*f-1)+1,o,p)}else g.e=f,g.r=+p;return g}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,w=/^\.([^.]+)$/,A=/^-?(Infinity|NaN)$/,T=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,s=r?t:t.replace(T,"");if(A.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(S,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,s=s.replace(E,"$1").replace(w,"0.$1")),t!=s))return new U(s,i);if(U.DEBUG)throw Error(a+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},O.absoluteValue=O.abs=function(){var e=new U(this);return e.s<0&&(e.s=1),e},O.comparedTo=function(e,t){return y(this,new U(e,t))},O.decimalPlaces=O.dp=function(e,t){var r,n,i,s=this;if(null!=e)return b(e,0,p),null==t?t=C:b(t,0,8),W(new U(s),e+s.e+1,t);if(!(r=s.c))return null;if(n=14*((i=r.length-1)-h(this.e/14)),i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},O.dividedBy=O.div=function(e,t){return r(this,new U(e,t),k,C)},O.dividedToIntegerBy=O.idiv=function(e,t){return r(this,new U(e,t),0,1)},O.exponentiatedBy=O.pow=function(e,t){var r,n,i,s,o,f,l,d,p=this;if((e=new U(e)).c&&!e.isInteger())throw Error(a+"Exponent not an integer: "+K(e));if(null!=t&&(t=new U(t)),o=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return d=new U(Math.pow(+K(p),o?2-g(e):+K(e))),t?d.mod(t):d;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new U(NaN);(n=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||o&&p.c[1]>=24e7:p.c[0]<8e13||o&&p.c[0]<=9999975e7)))return s=p.s<0&&g(e)?-0:0,p.e>-1&&(s=1/s),new U(f?1/s:s);G&&(s=c(G/14+2))}for(o?(r=new U(.5),f&&(e.s=1),l=g(e)):l=(i=Math.abs(+K(e)))%2,d=new U(N);;){if(l){if(!(d=d.times(p)).c)break;s?d.c.length>s&&(d.c.length=s):n&&(d=d.mod(t))}if(i){if(0===(i=u(i/2)))break;l=i%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)l=g(e);else{if(0===(i=+K(e)))break;l=i%2}p=p.times(p),s?p.c&&p.c.length>s&&(p.c.length=s):n&&(p=p.mod(t))}return n?d:(f&&(d=N.div(d)),t?d.mod(t):s?W(d,G,C,void 0):d)},O.integerValue=function(e){var t=new U(this);return null==e?e=C:b(e,0,8),W(t,t.e+1,e)},O.isEqualTo=O.eq=function(e,t){return 0===y(this,new U(e,t))},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(e,t){return y(this,new U(e,t))>0},O.isGreaterThanOrEqualTo=O.gte=function(e,t){return 1===(t=y(this,new U(e,t)))||0===t},O.isInteger=function(){return!!this.c&&h(this.e/14)>this.c.length-2},O.isLessThan=O.lt=function(e,t){return y(this,new U(e,t))<0},O.isLessThanOrEqualTo=O.lte=function(e,t){return-1===(t=y(this,new U(e,t)))||0===t},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&0==this.c[0]},O.minus=function(e,t){var r,n,i,s,o=this,c=o.s;if(t=(e=new U(e,t)).s,!c||!t)return new U(NaN);if(c!=t)return e.s=-t,o.plus(e);var u=o.e/14,a=e.e/14,f=o.c,d=e.c;if(!u||!a){if(!f||!d)return f?(e.s=-t,e):new U(d?o:NaN);if(!f[0]||!d[0])return d[0]?(e.s=-t,e):new U(f[0]?o:3==C?-0:0)}if(u=h(u),a=h(a),f=f.slice(),c=u-a){for((s=c<0)?(c=-c,i=f):(a=u,i=d),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(n=(s=(c=f.length)<(t=d.length))?c:t,c=t=0;t<n;t++)if(f[t]!=d[t]){s=f[t]<d[t];break}if(s&&(i=f,f=d,d=i,e.s=-e.s),(t=(n=d.length)-(r=f.length))>0)for(;t--;f[r++]=0);for(t=l-1;n>c;){if(f[--n]<d[n]){for(r=n;r&&!f[--r];f[r]=t);--f[r],f[n]+=l}f[n]-=d[n]}for(;0==f[0];f.splice(0,1),--a);return f[0]?D(e,f,a):(e.s=3==C?-1:1,e.c=[e.e=0],e)},O.modulo=O.mod=function(e,t){var n,i,s=this;return e=new U(e,t),!s.c||!e.s||e.c&&!e.c[0]?new U(NaN):!e.c||s.c&&!s.c[0]?new U(s):(9==M?(i=e.s,e.s=1,n=r(s,e,0,3),e.s=i,n.s*=i):n=r(s,e,0,M),(e=s.minus(n.times(e))).c[0]||1!=M||(e.s=s.s),e)},O.multipliedBy=O.times=function(e,t){var r,n,i,s,o,c,u,a,f,d,p,v,y,b,g=this,m=g.c,_=(e=new U(e,t)).c;if(!(m&&_&&m[0]&&_[0]))return!g.s||!e.s||m&&!m[0]&&!_||_&&!_[0]&&!m?e.c=e.e=e.s=null:(e.s*=g.s,m&&_?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=h(g.e/14)+h(e.e/14),e.s*=g.s,(u=m.length)<(d=_.length)&&(y=m,m=_,_=y,i=u,u=d,d=i),i=u+d,y=[];i--;y.push(0));for(b=l,1e7,i=d;--i>=0;){for(r=0,p=_[i]%1e7,v=_[i]/1e7|0,s=i+(o=u);s>i;)r=((a=p*(a=m[--o]%1e7)+(c=v*a+(f=m[o]/1e7|0)*p)%1e7*1e7+y[s]+r)/b|0)+(c/1e7|0)+v*f,y[s--]=a%b;y[s]=r}return r?++n:y.splice(0,1),D(e,y,n)},O.negated=function(){var e=new U(this);return e.s=-e.s||null,e},O.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new U(e,t)).s,!i||!t)return new U(NaN);if(i!=t)return e.s=-t,n.minus(e);var s=n.e/14,o=e.e/14,c=n.c,u=e.c;if(!s||!o){if(!c||!u)return new U(i/0);if(!c[0]||!u[0])return u[0]?e:new U(c[0]?n:0*i)}if(s=h(s),o=h(o),c=c.slice(),i=s-o){for(i>0?(o=s,r=u):(i=-i,r=c),r.reverse();i--;r.push(0));r.reverse()}for((i=c.length)-(t=u.length)<0&&(r=u,u=c,c=r,t=i),i=0;t;)i=(c[--t]=c[t]+u[t]+i)/l|0,c[t]=l===c[t]?0:c[t]%l;return i&&(c=[i].concat(c),++o),D(e,c,o)},O.precision=O.sd=function(e,t){var r,n,i,s=this;if(null!=e&&e!==!!e)return b(e,1,p),null==t?t=C:b(t,0,8),W(new U(s),e,t);if(!(r=s.c))return null;if(n=14*(i=r.length-1)+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&s.e+1>n&&(n=s.e+1),n},O.shiftedBy=function(e){return b(e,-9007199254740991,9007199254740991),this.times("1e"+e)},O.squareRoot=O.sqrt=function(){var e,t,n,i,s,o=this,c=o.c,u=o.s,a=o.e,f=k+4,l=new U("0.5");if(1!==u||!c||!c[0])return new U(!u||u<0&&(!c||c[0])?NaN:c?o:1/0);if(0==(u=Math.sqrt(+K(o)))||u==1/0?(((t=v(c)).length+a)%2==0&&(t+="0"),u=Math.sqrt(+t),a=h((a+1)/2)-(a<0||a%2),n=new U(t=u==1/0?"1e"+a:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+a)):n=new U(u+""),n.c[0])for((u=(a=n.e)+f)<3&&(u=0);;)if(s=n,n=l.times(s.plus(r(o,s,f,1))),v(s.c).slice(0,u)===(t=v(n.c)).slice(0,u)){if(n.e<a&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(W(n,n.e+k+2,1),e=!n.times(n).eq(o));break}if(!i&&(W(s,s.e+k+2,0),s.times(s).eq(o))){n=s;break}f+=4,u+=4,i=1}return W(n,n.e+k+1,C,e)},O.toExponential=function(e,t){return null!=e&&(b(e,0,p),e++),B(this,e,t,1)},O.toFixed=function(e,t){return null!=e&&(b(e,0,p),e=e+this.e+1),B(this,e,t)},O.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=F;else if("object"!=typeof r)throw Error(a+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var s,o=n.split("."),c=+r.groupSize,u=+r.secondaryGroupSize,f=r.groupSeparator||"",l=o[0],d=o[1],p=i.s<0,h=p?l.slice(1):l,v=h.length;if(u&&(s=c,c=u,u=s,v-=s),c>0&&v>0){for(s=v%c||c,l=h.substr(0,s);s<v;s+=c)l+=f+h.substr(s,c);u>0&&(l+=f+h.slice(s)),p&&(l="-"+l)}n=d?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):l}return(r.prefix||"")+n+(r.suffix||"")},O.toFraction=function(e){var t,n,i,s,o,c,u,f,l,p,h,y,b=this,g=b.c;if(null!=e&&(!(u=new U(e)).isInteger()&&(u.c||1!==u.s)||u.lt(N)))throw Error(a+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+K(u));if(!g)return new U(b);for(t=new U(N),l=n=new U(N),i=f=new U(N),y=v(g),o=t.e=y.length-b.e-1,t.c[0]=d[(c=o%14)<0?14+c:c],e=!e||u.comparedTo(t)>0?o>0?t:l:u,c=P,P=1/0,u=new U(y),f.c[0]=0;p=r(u,t,0,1),1!=(s=n.plus(p.times(i))).comparedTo(e);)n=i,i=s,l=f.plus(p.times(s=l)),f=s,t=u.minus(p.times(s=t)),u=s;return s=r(e.minus(n),i,0,1),f=f.plus(s.times(l)),n=n.plus(s.times(i)),f.s=l.s=b.s,h=r(l,i,o*=2,C).minus(b).abs().comparedTo(r(f,n,o,C).minus(b).abs())<1?[l,i]:[f,n],P=c,h},O.toNumber=function(){return+K(this)},O.toPrecision=function(e,t){return null!=e&&b(e,1,p),B(this,e,t,2)},O.toString=function(e){var t,r=this,i=r.s,s=r.e;return null===s?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=s<=R||s>=I?m(v(r.c),s):_(v(r.c),s,"0"):10===e?t=_(v((r=W(new U(r),k+s+1,C)).c),r.e,"0"):(b(e,2,j.length,"Base"),t=n(_(v(r.c),s,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},O.valueOf=O.toJSON=function(){return K(this)},O._isBigNumber=!0,null!=t&&U.set(t),U}()).default=s.BigNumber=s,void 0===(n=function(){return s}.call(t,r,t,e))||(e.exports=n)}()},70:function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},71:function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},72:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},83:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HANDSHAKE="m_handshake",t.INIT="m_init",t.CONNECT="m_connect",t.DISCONNECT="m_disconnect",t.GET_INFO="m_get_info",t.GET_CURRENT_FIAT_RATES="m_get_current_fiat_rates",t.GET_FIAT_RATES_FOR_TIMESTAMPS="m_get_fiat_rates_for_timestamps",t.GET_ACCOUNT_BALANCE_HISTORY="m_get_account_balance_history",t.GET_FIAT_RATES_TICKERS_LIST="m_get_fiat_rates_tickers_list",t.GET_BLOCK_HASH="m_get_block_hash",t.GET_ACCOUNT_INFO="m_get_account_info",t.GET_ACCOUNT_UTXO="m_get_account_utxo",t.GET_TRANSACTION="m_get_transaction",t.ESTIMATE_FEE="m_estimate_fee",t.SUBSCRIBE="m_subscribe",t.UNSUBSCRIBE="m_unsubscribe",t.PUSH_TRANSACTION="m_push_tx"},84:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERROR="r_error",t.CONNECT="r_connect",t.GET_INFO="r_info",t.GET_BLOCK_HASH="r_get_block_hash",t.GET_CURRENT_FIAT_RATES="r_get_current_fiat_rates",t.GET_FIAT_RATES_FOR_TIMESTAMPS="r_get_fiat_rates_for_timestamps",t.GET_FIAT_RATES_TICKERS_LIST="r_GET_FIAT_RATES_TICKERS_LIST",t.GET_ACCOUNT_INFO="r_account_info",t.GET_ACCOUNT_UTXO="r_get_account_utxo",t.GET_ACCOUNT_BALANCE_HISTORY="r_get_account_balance_history",t.GET_TRANSACTION="r_get_transaction",t.ESTIMATE_FEE="r_estimate_fee",t.SUBSCRIBE="r_subscribe",t.UNSUBSCRIBE="r_unsubscribe",t.PUSH_TRANSACTION="r_push_tx",t.CONNECTED="r_connected",t.DISCONNECTED="r_disconnected",t.NOTIFICATION="r_notification"},85:function(e,t,r){"use strict";var n=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var s=arguments[t],o=0,c=s.length;o<c;o++,i++)n[i]=s[o];return n};Object.defineProperty(t,"__esModule",{value:!0});var i=r(45),s=r(26),o=function(){function e(e){this.addresses=[],this.accounts=[],this.subscription={},this.settings={name:"unknown",worker:"unknown",server:[]},this.debugPrefix="[UnknownWorker]",this.post=function(){return console.warn("BlockchainLink:workers.common: postMessage method is not set")},void 0!==e&&(this.post=e)}return e.prototype.handshake=function(){this.post.call(null,{id:-1,type:i.MESSAGES.HANDSHAKE})},e.prototype.setSettings=function(e){this.settings=e,this.debugPrefix='[Worker "'+e.name+'"]:'},e.prototype.getSettings=function(){return this.settings},e.prototype.errorHandler=function(e){var t=e.id,r=e.error,n="blockchain_link/unknown",s=r.message;r.code&&(n=r.code),this.post.call(null,{id:t,type:i.RESPONSES.ERROR,payload:{code:n,message:s}})},e.prototype.response=function(e){this.post.call(null,this.removeEmpty(e))},e.prototype.validateAddresses=function(e){if(!Array.isArray(e))throw new s.CustomError("invalid_param","+addresses");var t=[];return e.filter((function(e){return"string"==typeof e&&(!(t.indexOf(e)>=0)&&(t.push(e),!0))}))},e.prototype.addAddresses=function(e){var t=this,r=this.validateAddresses(e).filter((function(e){return t.addresses.indexOf(e)<0}));return this.addresses=this.addresses.concat(r),r},e.prototype.getAddresses=function(){return this.addresses},e.prototype.removeAddresses=function(e){var t=this.validateAddresses(e);return this.addresses=this.addresses.filter((function(e){return t.indexOf(e)<0})),this.addresses},e.prototype.validateAccounts=function(e){if(!Array.isArray(e))throw new s.CustomError("invalid_param","+accounts");var t=[];return e.filter((function(e){return!(!e||"object"!=typeof e||"string"!=typeof e.descriptor)&&(!(t.indexOf(e.descriptor)>=0)&&(t.push(e.descriptor),!0))}))},e.prototype.getAccountAddresses=function(e){if(e.addresses){var t=e.addresses,r=t.change,n=t.used,i=t.unused;return r.concat(n,i).map((function(e){return e.address}))}return[e.descriptor]},e.prototype.addAccounts=function(e){var t=this,r=this.validateAccounts(e),n=this.accounts.filter((function(e){return!r.find((function(t){return t.descriptor===e.descriptor}))}));this.accounts=n.concat(r);var i=this.accounts.reduce((function(e,r){return e.concat(t.getAccountAddresses(r))}),[]);return this.addAddresses(i),r},e.prototype.getAccount=function(e){return this.accounts.find((function(t){if(t.descriptor===e)return!0;if(t.addresses){var r=t.addresses,n=r.change,i=r.used,s=r.unused;if(n.find((function(t){return t.address===e})))return!0;if(i.find((function(t){return t.address===e})))return!0;if(s.find((function(t){return t.address===e})))return!0}return!1}))},e.prototype.getAccounts=function(){return this.accounts},e.prototype.removeAccounts=function(e){var t=this,r=this.validateAccounts(e),n=this.accounts.filter((function(e){return r.find((function(t){return t.descriptor===e.descriptor}))})),i=n.reduce((function(e,r){return e.concat(t.getAccountAddresses(r))}),[]);return this.accounts=this.accounts.filter((function(e){return n.indexOf(e)<0})),this.removeAddresses(i),this.accounts},e.prototype.addSubscription=function(e){this.subscription[e]=!0},e.prototype.getSubscription=function(e){return this.subscription[e]},e.prototype.hasSubscriptions=function(){return Object.keys(this.subscription).length>0},e.prototype.removeSubscription=function(e){delete this.subscription[e]},e.prototype.clearSubscriptions=function(){var e=this;Object.keys(this.subscription).forEach((function(t){delete e.subscription[t]}))},e.prototype.shuffleEndpoints=function(e){for(var t,r=e.length-1;r>0;r--){var n=Math.floor(Math.random()*(r+1));t=[e[n],e[r]],e[r]=t[0],e[n]=t[1]}return e},e.prototype.removeEmpty=function(e){var t=this;return Object.keys(e).forEach((function(r){Array.isArray(e[r])&&e[r].map((function(e){return t.removeEmpty(e)})),e[r]&&"object"==typeof e[r]?t.removeEmpty(e[r]):void 0===e[r]&&delete e[r]})),e},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.settings&&this.settings.debug&&("warn"===e[0]||"error"===e[0]?console[e[0]].apply(console,n([this.debugPrefix],e.slice(1))):console.log.apply(console,n([this.debugPrefix],e)))},e}();t.default=o}});
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="./",r(r.s=451)}({17:function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=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 o=Number.isNaN||function(e){return e!=e};function c(){c.init.call(this)}e.exports=c,c.EventEmitter=c,c.prototype._events=void 0,c.prototype._eventsCount=0,c.prototype._maxListeners=void 0;var u=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function f(e){return void 0===e._maxListeners?c.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var i,s,o,c;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=f(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,c=u,console&&console.warn&&console.warn(c)}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 p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):y(i,i.length)}function v(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(c,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),c.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},c.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(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},c.prototype.getMaxListeners=function(){return f(this)},c.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var c=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw c.context=o,c}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)s(u,this,t);else{var a=u.length,f=y(u,a);for(r=0;r<a;++r)s(f[r],this,t)}return!0},c.prototype.addListener=function(e,t){return l(this,e,t,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function(e,t){return l(this,e,t,!0)},c.prototype.once=function(e,t){return a(t),this.on(e,p(this,e,t)),this},c.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,p(this,e,t)),this},c.prototype.removeListener=function(e,t){var r,n,i,s,o;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},c.prototype.off=c.prototype.removeListener,c.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(i=s[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},c.prototype.listeners=function(e){return h(this,e,!0)},c.prototype.rawListeners=function(e){return h(this,e,!1)},c.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):v.call(e,t)},c.prototype.listenerCount=v,c.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},26:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var s="blockchain_link/",o={worker_not_found:"Worker not found",worker_invalid:"Invalid worker object",worker_timeout:"Worker timeout",worker_unknown_request:"Unknown message type:",worker_runtime:void 0,invalid_param:"Invalid parameter:",websocket_not_initialized:"WebSocket not initialized",websocket_no_url:"Cannot connect because no server was specified",websocket_timeout:"Websocket timeout",websocket_error_message:void 0,websocket_runtime_error:void 0},c=function(e){function t(t,r){void 0===r&&(r="");var n=e.call(this,r)||this;if(n.message="",n.message=r,"string"==typeof t){var i=0===t.indexOf(s)?t.substring(s.length,t.length):t;n.code=""+s+i;var c=o[i];"string"==typeof c&&(""===n.message?n.message=c:0===r.indexOf("+")&&(n.message=c+" "+r.substr(1,r.length)))}return"string"==typeof n.message&&""!==n.message||(n.message="Message not set"),n}return i(t,e),t}(Error);t.CustomError=c},39: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}},451:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function c(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}u((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var u,a=r(26),f=r(46),l=o(r(452)),d=c(r(454)),p=new(o(r(85)).default)(postMessage),h=[],v=function(){u&&(u.dispose(),u.removeAllListeners(),u=void 0),h=[],p.removeAccounts(p.getAccounts()),p.removeAddresses(p.getAddresses()),p.clearSubscriptions()},y=function(){return i(void 0,void 0,void 0,(function(){var e,t,r,n,i,o;return s(this,(function(s){switch(s.label){case 0:if(u&&u.isConnected())return[2,u];if(e=p.getSettings(),t=e.server,r=e.timeout,n=e.pingTimeout,i=e.keepAlive,!t||!Array.isArray(t)||t.length<1)throw new a.CustomError("connect","Endpoint not set");h.length<1&&(h=p.shuffleEndpoints(t.slice(0))),p.debug("Connecting to",h[0]),o=new l.default({url:h[0],timeout:r,pingTimeout:n,keepAlive:i}),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,o.connect()];case 2:return s.sent(),u=o,[3,4];case 3:if(s.sent(),p.debug("Websocket connection failed"),u=void 0,h.splice(0,1),h.length<1)throw new a.CustomError("connect","All backends are down");return[2,y()];case 4:return o.on("disconnected",(function(){p.response({id:-1,type:f.RESPONSES.DISCONNECTED,payload:!0}),v()})),p.response({id:-1,type:f.RESPONSES.CONNECTED}),p.debug("Connected"),[2,o]}}))}))},b=function(e){p.response({id:-1,type:f.RESPONSES.NOTIFICATION,payload:{type:"block",payload:{blockHeight:e.height,blockHash:e.hash}}})},g=function(e){if(e.tx){var t=e.address,r=p.getAccount(t);p.response({id:-1,type:f.RESPONSES.NOTIFICATION,payload:{type:"notification",payload:{descriptor:r?r.descriptor:t,tx:r?d.transformTransaction(r.descriptor,r.addresses,e.tx):d.transformTransaction(t,void 0,e.tx)}}})}},m=function(e){p.response({id:-1,type:f.RESPONSES.NOTIFICATION,payload:{type:"fiatRates",payload:{rates:e.rates}}})};onmessage=function(e){if(e.data){var t=e.data,r=t.id,o=t.type;switch(p.debug("onmessage",t),t.type){case f.MESSAGES.HANDSHAKE:p.setSettings(t.settings);break;case f.MESSAGES.CONNECT:y().then((function(){return i(void 0,void 0,void 0,(function(){return s(this,(function(e){return p.response({id:r,type:f.RESPONSES.CONNECT,payload:!0}),[2]}))}))})).catch((function(e){return p.errorHandler({id:r,error:e})}));break;case f.MESSAGES.GET_INFO:!function(e){i(void 0,void 0,void 0,(function(){var t,r,i;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),[4,y()];case 1:return[4,(t=s.sent()).getServerInfo()];case 2:return r=s.sent(),p.response({id:e.id,type:f.RESPONSES.GET_INFO,payload:n({url:t.options.url},d.transformServerInfo(r))}),[3,4];case 3:return i=s.sent(),p.errorHandler({id:e.id,error:i}),[3,4];case 4:return[2]}}))}))}(t);break;case f.MESSAGES.GET_BLOCK_HASH:!function(e){i(void 0,void 0,void 0,(function(){var t,r;return s(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,y()];case 1:return[4,n.sent().getBlockHash(e.payload)];case 2:return t=n.sent(),p.response({id:e.id,type:f.RESPONSES.GET_BLOCK_HASH,payload:t.hash}),[3,4];case 3:return r=n.sent(),p.errorHandler({id:e.id,error:r}),[3,4];case 4:return[2]}}))}))}(t);break;case f.MESSAGES.GET_ACCOUNT_INFO:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getAccountInfo(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_ACCOUNT_INFO,payload:d.transformAccountInfo(r)}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_ACCOUNT_UTXO:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getAccountUtxo(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_ACCOUNT_UTXO,payload:d.transformAccountUtxo(r)}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_TRANSACTION:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getTransaction(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_TRANSACTION,payload:{type:"blockbook",tx:r}}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_ACCOUNT_BALANCE_HISTORY:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getAccountBalanceHistory(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_ACCOUNT_BALANCE_HISTORY,payload:r}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_CURRENT_FIAT_RATES:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getCurrentFiatRates(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_CURRENT_FIAT_RATES,payload:r}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_FIAT_RATES_FOR_TIMESTAMPS:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getFiatRatesForTimestamps(t)];case 3:return r=i.sent().tickers,p.response({id:e.id,type:f.RESPONSES.GET_FIAT_RATES_FOR_TIMESTAMPS,payload:{tickers:r}}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.GET_FIAT_RATES_TICKERS_LIST:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(i){switch(i.label){case 0:t=e.payload,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,y()];case 2:return[4,i.sent().getFiatRatesTickersList(t)];case 3:return r=i.sent(),p.response({id:e.id,type:f.RESPONSES.GET_FIAT_RATES_TICKERS_LIST,payload:{ts:r.ts,availableCurrencies:r.available_currencies}}),[3,5];case 4:return n=i.sent(),p.errorHandler({id:e.id,error:n}),[3,5];case 5:return[2]}}))}))}(t);break;case f.MESSAGES.ESTIMATE_FEE:!function(e){i(void 0,void 0,void 0,(function(){var t,r;return s(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,y()];case 1:return[4,n.sent().estimateFee(e.payload)];case 2:return t=n.sent(),p.response({id:e.id,type:f.RESPONSES.ESTIMATE_FEE,payload:t}),[3,4];case 3:return r=n.sent(),p.errorHandler({id:e.id,error:r}),[3,4];case 4:return[2]}}))}))}(t);break;case f.MESSAGES.PUSH_TRANSACTION:!function(e){i(void 0,void 0,void 0,(function(){var t,r;return s(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,y()];case 1:return[4,n.sent().pushTransaction(e.payload)];case 2:return t=n.sent(),p.response({id:e.id,type:f.RESPONSES.PUSH_TRANSACTION,payload:t.result}),[3,4];case 3:return r=n.sent(),p.errorHandler({id:e.id,error:r}),[3,4];case 4:return[2]}}))}))}(t);break;case f.MESSAGES.SUBSCRIBE:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(o){switch(o.label){case 0:t=e.payload,o.label=1;case 1:return o.trys.push([1,11,,12]),r=void 0,"accounts"!==t.type?[3,3]:[4,(l=t.accounts,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return p.addAccounts(l),[4,y()];case 1:return e=t.sent(),p.getSubscription("notification")||(e.on("notification",g),p.addSubscription("notification")),[2,e.subscribeAddresses(p.getAddresses())]}}))})))];case 2:return r=o.sent(),[3,10];case 3:return"addresses"!==t.type?[3,5]:[4,(u=t.addresses,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return p.addAddresses(u),[4,y()];case 1:return e=t.sent(),p.getSubscription("notification")||(e.on("notification",g),p.addSubscription("notification")),[2,e.subscribeAddresses(p.getAddresses())]}}))})))];case 4:return r=o.sent(),[3,10];case 5:return"block"!==t.type?[3,7]:[4,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return p.getSubscription("block")?[2,{subscribed:!0}]:[4,y()];case 1:return e=t.sent(),p.addSubscription("block"),e.on("block",b),[2,e.subscribeBlock()]}}))}))];case 6:return r=o.sent(),[3,10];case 7:return"fiatRates"!==t.type?[3,9]:[4,(c=t.currency,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,y()];case 1:return e=t.sent(),p.getSubscription("fiatRates")||(p.addSubscription("fiatRates"),e.on("fiatRates",m)),[2,e.subscribeFiatRates(c)]}}))})))];case 8:return r=o.sent(),[3,10];case 9:throw new a.CustomError("invalid_param","+type");case 10:return p.response({id:e.id,type:f.RESPONSES.SUBSCRIBE,payload:r}),[3,12];case 11:return n=o.sent(),p.errorHandler({id:e.id,error:n}),[3,12];case 12:return[2]}var c,u,l}))}))}(t);break;case f.MESSAGES.UNSUBSCRIBE:!function(e){i(void 0,void 0,void 0,(function(){var t,r,n;return s(this,(function(o){switch(o.label){case 0:t=e.payload,o.label=1;case 1:return o.trys.push([1,11,,12]),r=void 0,"accounts"!==t.type?[3,3]:[4,(u=t.accounts,i(void 0,void 0,void 0,(function(){var e,t;return s(this,(function(r){switch(r.label){case 0:return p.removeAccounts(u||p.getAccounts()),[4,y()];case 1:return e=r.sent(),(t=p.getAddresses()).length<1?(e.removeListener("notification",g),p.removeSubscription("notification"),[2,e.unsubscribeAddresses()]):[2,e.subscribeAddresses(t)]}}))})))];case 2:return r=o.sent(),[3,10];case 3:return"addresses"!==t.type?[3,5]:[4,(c=t.addresses,i(void 0,void 0,void 0,(function(){var e,t;return s(this,(function(r){switch(r.label){case 0:return[4,y()];case 1:return e=r.sent(),c||p.removeAccounts(p.getAccounts()),(t=p.removeAddresses(c||p.getAddresses())).length<1?(e.removeListener("notification",g),p.removeSubscription("notification"),[2,e.unsubscribeAddresses()]):[2,e.subscribeAddresses(t)]}}))})))];case 4:return r=o.sent(),[3,10];case 5:return"block"!==t.type?[3,7]:[4,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return p.getSubscription("block")?[4,y()]:[2,{subscribed:!1}];case 1:return(e=t.sent()).removeListener("block",b),p.removeSubscription("block"),[2,e.unsubscribeBlock()]}}))}))];case 6:return r=o.sent(),[3,10];case 7:return"fiatRates"!==t.type?[3,9]:[4,i(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return p.getSubscription("fiatRates")?[4,y()]:[2,{subscribed:!1}];case 1:return(e=t.sent()).removeListener("fiatRates",b),p.removeSubscription("fiatRates"),[2,e.unsubscribeFiatRates()]}}))}))];case 8:return r=o.sent(),[3,10];case 9:throw new a.CustomError("invalid_param","+type");case 10:return p.response({id:e.id,type:f.RESPONSES.UNSUBSCRIBE,payload:r}),[3,12];case 11:return n=o.sent(),p.errorHandler({id:e.id,error:n}),[3,12];case 12:return[2]}var c,u}))}))}(t);break;case f.MESSAGES.DISCONNECT:!function(e){i(void 0,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:if(!u)return p.response({id:e.id,type:f.RESPONSES.DISCONNECTED,payload:!0}),[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,u.disconnect()];case 2:return r.sent(),p.response({id:e.id,type:f.RESPONSES.DISCONNECTED,payload:!0}),[3,4];case 3:return t=r.sent(),p.errorHandler({id:e.id,error:t}),[3,4];case 4:return[2]}}))}))}(t);break;case"terminate":v();break;default:p.errorHandler({id:r,error:new a.CustomError("worker_unknown_request","+"+o)})}}},p.handshake()},452:function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function c(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=c(r(66)),a=r(17),f=r(26),l=r(453),d=new f.CustomError("websocket_not_initialized"),p=function(e){function t(t){var r=e.call(this)||this;return r.messageID=0,r.messages=[],r.subscriptions=[],r.send=function(e,t){var n=r.ws;if(!n)throw d;var i=r.messageID.toString(),s=l.create(i),o={id:i,method:e,params:t};return r.messageID++,r.messages.push(s),r.setConnectionTimeout(),r.setPingTimeout(),n.send(JSON.stringify(o)),s.promise},r.setMaxListeners(1/0),r.options=t,r}return i(t,e),t.prototype.setConnectionTimeout=function(){this.clearConnectionTimeout(),this.connectionTimeout=setTimeout(this.onTimeout.bind(this),this.options.timeout||2e4)},t.prototype.clearConnectionTimeout=function(){this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=void 0)},t.prototype.setPingTimeout=function(){this.pingTimeout&&clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(this.onPing.bind(this),this.options.pingTimeout||5e4)},t.prototype.onTimeout=function(){var e=this.ws;if(e)if(e.listenerCount("open")>0){e.emit("error","Websocket timeout");try{e.close()}catch(e){}}else this.messages.forEach((function(e){return e.reject(new f.CustomError("websocket_timeout"))})),e.close()},t.prototype.onPing=function(){return s(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.ws&&this.isConnected()?this.subscriptions.length>0||this.options.keepAlive?[4,this.getBlockHash(0)]:[3,2]:[3,3];case 1:return e.sent(),[3,3];case 2:try{this.ws.close()}catch(e){}e.label=3;case 3:return[2]}}))}))},t.prototype.onError=function(){this.dispose()},t.prototype.onmessage=function(e){try{var t=JSON.parse(e),r=t.id,n=t.data,i=this.messages.find((function(e){return e.id===r}));if(i)n.error?i.reject(new f.CustomError("websocket_error_message",n.error.message)):i.resolve(n),this.messages.splice(this.messages.indexOf(i),1);else{var s=this.subscriptions.find((function(e){return e&&e.id===r}));s&&s.callback(n)}}catch(e){}0===this.messages.length&&this.clearConnectionTimeout(),this.setPingTimeout()},t.prototype.connect=function(){var e=this,t=this.options.url;if("string"!=typeof t)throw new f.CustomError("websocket_no_url");if(t.startsWith("https")&&(t=t.replace("https","wss")),t.startsWith("http")&&(t=t.replace("http","ws")),!t.endsWith("/websocket")){var r=t.endsWith("/")?"websocket":"/websocket";t+=r}this.setConnectionTimeout();var n=l.create(-1),i=new u.default(t);return"function"==typeof i.setMaxListeners&&i.setMaxListeners(1/0),i.once("error",(function(t){e.dispose(),n.reject(new f.CustomError("websocket_runtime_error",t.message))})),i.on("open",(function(){e.init(),n.resolve()})),this.ws=i,n.promise},t.prototype.init=function(){var e=this,t=this.ws;if(!t||!this.isConnected())throw Error("Blockbook websocket init cannot be called");this.clearConnectionTimeout(),t.removeAllListeners(),t.on("error",this.onError.bind(this)),t.on("message",this.onmessage.bind(this)),t.on("close",(function(){e.emit("disconnected"),e.dispose()}))},t.prototype.disconnect=function(){this.ws&&this.ws.close()},t.prototype.isConnected=function(){var e=this.ws;return e&&e.readyState===u.default.OPEN},t.prototype.getServerInfo=function(){return this.send("getInfo",{})},t.prototype.getBlockHash=function(e){return this.send("getBlockHash",{height:e})},t.prototype.getAccountInfo=function(e){return this.send("getAccountInfo",e)},t.prototype.getAccountUtxo=function(e){return this.send("getAccountUtxo",{descriptor:e})},t.prototype.getTransaction=function(e){return this.send("getTransaction",{txid:e})},t.prototype.pushTransaction=function(e){return this.send("sendTransaction",{hex:e})},t.prototype.estimateFee=function(e){return this.send("estimateFee",e)},t.prototype.getCurrentFiatRates=function(e){return this.send("getCurrentFiatRates",e)},t.prototype.getAccountBalanceHistory=function(e){return this.send("getBalanceHistory",e)},t.prototype.getFiatRatesForTimestamps=function(e){return this.send("getFiatRatesForTimestamps",e)},t.prototype.getFiatRatesTickersList=function(e){return this.send("getFiatRatesTickersList",e)},t.prototype.subscribeAddresses=function(e){var t=this,r=this.subscriptions.findIndex((function(e){return"notification"===e.type}));r>=0&&this.subscriptions.splice(r,1);var n=this.messageID.toString();return this.subscriptions.push({id:n,type:"notification",callback:function(e){t.emit("notification",e)}}),this.send("subscribeAddresses",{addresses:e})},t.prototype.unsubscribeAddresses=function(){var e=this.subscriptions.findIndex((function(e){return"notification"===e.type}));return e>=0?(this.subscriptions.splice(e,1),this.send("unsubscribeAddresses",{})):{subscribed:!1}},t.prototype.subscribeBlock=function(){var e=this,t=this.subscriptions.findIndex((function(e){return"block"===e.type}));t>=0&&this.subscriptions.splice(t,1);var r=this.messageID.toString();return this.subscriptions.push({id:r,type:"block",callback:function(t){e.emit("block",t)}}),this.send("subscribeNewBlock",{})},t.prototype.unsubscribeBlock=function(){var e=this.subscriptions.findIndex((function(e){return"block"===e.type}));return e>=0?(this.subscriptions.splice(e,1),this.send("unsubscribeNewBlock",{})):{subscribed:!1}},t.prototype.subscribeFiatRates=function(e){var t=this,r=this.subscriptions.findIndex((function(e){return"fiatRates"===e.type}));r>=0&&this.subscriptions.splice(r,1);var n=this.messageID.toString();return this.subscriptions.push({id:n,type:"fiatRates",callback:function(e){t.emit("fiatRates",e)}}),this.send("subscribeFiatRates",{currency:e})},t.prototype.unsubscribeFiatRates=function(){var e=this.subscriptions.findIndex((function(e){return"fiatRates"===e.type}));return e>=0?(this.subscriptions.splice(e,1),this.send("unsubscribeFiatRates",{})):{subscribed:!1}},t.prototype.dispose=function(){this.pingTimeout&&clearTimeout(this.pingTimeout),this.connectionTimeout&&clearTimeout(this.connectionTimeout);var e=this.ws;this.isConnected()&&this.disconnect(),e&&e.removeAllListeners(),this.removeAllListeners()},t}(a.EventEmitter);t.default=p},453:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.create=function(e){var t=function(){},r=function(){},n=new Promise((function(e,n){t=e,r=n}));return{id:e,resolve:t,reject:r,promise:n}}},454:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(r(7));t.transformServerInfo=function(e){return{name:e.name,shortcut:e.shortcut,testnet:e.testnet,version:e.version,decimals:e.decimals,blockHeight:e.bestHeight,blockHash:e.bestHash}},t.filterTargets=function(e,t){if("string"==typeof e&&(e=[e]),!(e&&Array.isArray(e)&&t&&Array.isArray(t)))return[];var r=e.map((function(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.address?e.address:null}));return t.filter((function(e){return!(!e||!Array.isArray(e.addresses))&&e.addresses.filter((function(e){return r.indexOf(e)>=0})).length>0}))},t.filterTokenTransfers=function(e,t){if("string"==typeof e&&(e=[e]),!(e&&Array.isArray(e)&&t&&Array.isArray(t)))return[];var r=e.map((function(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.address?e.address:null}));return t.filter((function(e){return!(!e||"object"!=typeof e)&&(e.from&&r.indexOf(e.from)>=0||e.to&&r.indexOf(e.to)>=0)})).map((function(e){var t=e.from&&r.indexOf(e.from)>=0,n=e.to&&r.indexOf(e.to)>=0,i="unknown";return t&&n?i="self":(t&&(i="sent"),n&&(i="recv")),{type:i,name:e.name,symbol:e.symbol,address:e.token,decimals:e.decimals||0,amount:e.value,from:e.from,to:e.to}}))};t.transformTransaction=function(e,r,n){var i,o,c=r?r.change.concat(r.used,r.unused):[e],u=Array.isArray(n.vin)?n.vin.length:0,a=Array.isArray(n.vout)?n.vout.length:0,f=t.filterTargets(c,n.vin),l=t.filterTargets(c,n.vout),d=r?t.filterTargets(r.change,n.vout):[],p=t.filterTokenTransfers(c,n.tokenTransfers),h=[],v=n.value;if(0===f.length&&0===l.length&&0===p.length)i="unknown";else if(u>0&&a>0&&f.length===u&&l.length===a)i="self",h=n.vout.filter((function(e){return d.indexOf(e)<0})),v=n.fees;else if(0===f.length&&(l.length>0||p.length>0))i="recv",v="0",l.length>0&&(h=l,v=l.reduce((function(e,t){return"string"!=typeof t.value?e:new s.default(e).plus(t.value).toString()}),v));else if(i="sent",0===p.length&&Array.isArray(n.vout)&&(h=n.vout.filter((function(e){return d.indexOf(e)<0}))),n.ethereumSpecific)v=p.length>0||0===n.ethereumSpecific.status?n.fees:n.value;else if(Array.isArray(n.vout)){var y=f.reduce((function(e,t){return"string"!=typeof t.value?e:new s.default(e).plus(t.value).toString()}),"0");v=l.reduce((function(e,t){return"string"!=typeof t.value?e:new s.default(e).minus(t.value).toString()}),y)}return Array.isArray(n.vin)&&n.vin.forEach((function(e){"number"==typeof e.sequence&&e.sequence<4294967294&&(o=!0)})),{type:i,txid:n.txid,blockTime:n.blockTime,blockHeight:n.blockHeight,blockHash:n.blockHash,amount:v,fee:n.fees,targets:h.filter((function(e){return"object"==typeof e})).map((function(e){return function(e,t){return{addresses:e.addresses,isAddress:e.isAddress,amount:e.value,coinbase:e.coinbase,isAccountTarget:!!t.includes(e)||void 0}}(e,l)})),tokens:p,rbf:o,ethereumSpecific:n.ethereumSpecific}},t.transformTokenInfo=function(e){if(e&&Array.isArray(e)){var t=e.reduce((function(e,t){return"ERC20"!==t.type?e:e.concat([{type:t.type,name:t.name,symbol:t.symbol,address:t.contract,balance:t.balance,decimals:t.decimals||0}])}),[]);return t.length>0?t:void 0}},t.transformAddresses=function(e){if(e&&Array.isArray(e)){var t=e.reduce((function(e,t){return"XPUBAddress"!==t.type?e:e.concat([{address:t.name,path:t.path,transfers:t.transfers,balance:t.balance,sent:t.totalSent,received:t.totalReceived}])}),[]);if(!(t.length<1)){var r=t.filter((function(e){return"1"===e.path.split("/")[4]})),n=t.filter((function(e){return r.indexOf(e)<0}));return{change:r,used:n.filter((function(e){return e.transfers>0})),unused:n.filter((function(e){return 0===e.transfers}))}}}},t.transformAccountInfo=function(e){var r;"number"==typeof e.page&&(r={index:e.page,size:e.itemsOnPage,total:e.totalPages});var i={};if("string"==typeof e.nonce&&(i.nonce=e.nonce),e.erc20Contract){var o=t.transformTokenInfo([n({type:"ERC20"},e.erc20Contract)]);if(o){var c=o[0];i.erc20Contract=c}}Object.keys(i).length<1&&(i=void 0);var u=e.address,a=t.transformAddresses(e.tokens),f=t.transformTokenInfo(e.tokens),l=0===e.txs&&0===e.unconfirmedTxs,d=new s.default(e.unconfirmedBalance),p=d.isNaN()||d.isZero()?e.balance:d.plus(e.balance).toString();return{descriptor:u,balance:e.balance,availableBalance:p,empty:l,tokens:f,addresses:a,history:{total:e.txs,tokens:"number"==typeof e.nonTokenTxs?e.txs-e.nonTokenTxs:void 0,unconfirmed:e.unconfirmedTxs,transactions:e.transactions?e.transactions.map((function(e){return t.transformTransaction(u,a,e)})):void 0},misc:i,page:r}},t.transformAccountUtxo=function(e){return e.map((function(e){return{txid:e.txid,vout:e.vout,amount:e.value,blockHeight:e.height,address:e.address,path:e.path,confirmations:e.confirmations,coinbase:e.coinbase}}))}},46:function(e,t,r){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=n(r(83));t.MESSAGES=i;var s=n(r(84));t.RESPONSES=s,t.NETWORKS={RIPPLE:"ripple",BLOCKBOOK:"blockbook"}},66:function(e,t,r){var n=r(67),i=r(39),s=(r(68),r(70),r(71)),o=r(72);var c=function(e){"use strict";s(r,e);var t;t=r;function r(t){var r;return r=e.call(this)||this,o(i(r),"ws",void 0),r.setMaxListeners(1/0),r.ws=new WebSocket(t),r.ws.onclose=function(){r.emit("close")},r.ws.onopen=function(){r.emit("open")},r.ws.onerror=function(e){r.emit("error",e)},r.ws.onmessage=function(e){r.emit("message",e.data)},r}var c=r.prototype;return c.close=function(){1===this.readyState&&this.ws.close()},c.send=function(e){this.ws.send(e)},n(r,[{key:"readyState",get:function(){return this.ws.readyState}}]),r}(r(17).EventEmitter);c.CONNECTING=0,c.OPEN=1,c.CLOSING=2,c.CLOSED=3,e.exports=c},67:function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},68:function(e,t,r){var n=r(69),i=r(39);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?i(e):t}},69:function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=r=function(e){return typeof e}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(t)}e.exports=r},7:function(e,t,r){var n;!function(i){"use strict";var s,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,c=Math.ceil,u=Math.floor,a="[BigNumber Error] ",f=a+"Number primitive has more than 15 significant digits: ",l=1e14,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e9;function h(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,s=e[0]+"";n<i;){for(r=14-(t=e[n++]+"").length;r--;t="0"+t);s+=t}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function y(e,t){var r,n,i=e.c,s=t.c,o=e.s,c=t.s,u=e.e,a=t.e;if(!o||!c)return null;if(r=i&&!i[0],n=s&&!s[0],r||n)return r?n?0:-c:o;if(o!=c)return o;if(r=o<0,n=u==a,!i||!s)return n?0:!i^r?1:-1;if(!n)return u>a^r?1:-1;for(c=(u=i.length)<(a=s.length)?u:a,o=0;o<c;o++)if(i[o]!=s[o])return i[o]>s[o]^r?1:-1;return u==a?0:u>a^r?1:-1}function b(e,t,r,n){if(e<t||e>r||e!==u(e))throw Error(a+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function g(e){var t=e.c.length-1;return h(e.e/14)==t&&e.c[t]%2!=0}function m(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(s=function e(t){var r,n,i,s,S,E,w,A,T,O=U.prototype={constructor:U,toString:null,valueOf:null},N=new U(1),k=20,C=4,R=-7,I=21,x=-1e7,P=1e7,L=!1,M=1,G=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz";function U(e,t){var r,s,c,a,l,d,p,h,v=this;if(!(v instanceof U))return new U(e,t);if(null==t){if(e&&!0===e._isBigNumber)return v.s=e.s,void(!e.c||e.e>P?v.c=v.e=null:e.e<x?v.c=[v.e=0]:(v.e=e.e,v.c=e.c.slice()));if((d="number"==typeof e)&&0*e==0){if(v.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,l=e;l>=10;l/=10,a++);return void(a>P?v.c=v.e=null:(v.e=a,v.c=[e]))}h=String(e)}else{if(!o.test(h=String(e)))return i(v,h,d);v.s=45==h.charCodeAt(0)?(h=h.slice(1),-1):1}(a=h.indexOf("."))>-1&&(h=h.replace(".","")),(l=h.search(/e/i))>0?(a<0&&(a=l),a+=+h.slice(l+1),h=h.substring(0,l)):a<0&&(a=h.length)}else{if(b(t,2,j.length,"Base"),10==t)return W(v=new U(e),k+v.e+1,C);if(h=String(e),d="number"==typeof e){if(0*e!=0)return i(v,h,d,t);if(v.s=1/e<0?(h=h.slice(1),-1):1,U.DEBUG&&h.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else v.s=45===h.charCodeAt(0)?(h=h.slice(1),-1):1;for(r=j.slice(0,t),a=l=0,p=h.length;l<p;l++)if(r.indexOf(s=h.charAt(l))<0){if("."==s){if(l>a){a=p;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,l=-1,a=0;continue}return i(v,String(e),d,t)}d=!1,(a=(h=n(h,t,10,v.s)).indexOf("."))>-1?h=h.replace(".",""):a=h.length}for(l=0;48===h.charCodeAt(l);l++);for(p=h.length;48===h.charCodeAt(--p););if(h=h.slice(l,++p)){if(p-=l,d&&U.DEBUG&&p>15&&(e>9007199254740991||e!==u(e)))throw Error(f+v.s*e);if((a=a-l-1)>P)v.c=v.e=null;else if(a<x)v.c=[v.e=0];else{if(v.e=a,v.c=[],l=(a+1)%14,a<0&&(l+=14),l<p){for(l&&v.c.push(+h.slice(0,l)),p-=14;l<p;)v.c.push(+h.slice(l,l+=14));l=14-(h=h.slice(l)).length}else l-=p;for(;l--;h+="0");v.c.push(+h)}}else v.c=[v.e=0]}function B(e,t,r,n){var i,s,o,c,u;if(null==r?r=C:b(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)u=v(e.c),u=1==n||2==n&&(o<=R||o>=I)?m(u,o):_(u,o,"0");else if(s=(e=W(new U(e),t,r)).e,c=(u=v(e.c)).length,1==n||2==n&&(t<=s||s<=R)){for(;c<t;u+="0",c++);u=m(u,s)}else if(t-=o,u=_(u,s,"0"),s+1>c){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=s-c)>0)for(s+1==c&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function H(e,t){for(var r,n=1,i=new U(e[0]);n<e.length;n++){if(!(r=new U(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function D(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+14*r-1)>P?e.c=e.e=null:r<x?e.c=[e.e=0]:(e.e=r,e.c=t),e}function W(e,t,r,n){var i,s,o,a,f,p,h,v=e.c,y=d;if(v){e:{for(i=1,a=v[0];a>=10;a/=10,i++);if((s=t-i)<0)s+=14,o=t,h=(f=v[p=0])/y[i-o-1]%10|0;else if((p=c((s+1)/14))>=v.length){if(!n)break e;for(;v.length<=p;v.push(0));f=h=0,i=1,o=(s%=14)-14+1}else{for(f=a=v[p],i=1;a>=10;a/=10,i++);h=(o=(s%=14)-14+i)<0?0:f/y[i-o-1]%10|0}if(n=n||t<0||null!=v[p+1]||(o<0?f:f%y[i-o-1]),n=r<4?(h||n)&&(0==r||r==(e.s<0?3:2)):h>5||5==h&&(4==r||n||6==r&&(s>0?o>0?f/y[i-o]:0:v[p-1])%10&1||r==(e.s<0?8:7)),t<1||!v[0])return v.length=0,n?(t-=e.e+1,v[0]=y[(14-t%14)%14],e.e=-t||0):v[0]=e.e=0,e;if(0==s?(v.length=p,a=1,p--):(v.length=p+1,a=y[14-s],v[p]=o>0?u(f/y[i-o]%y[o])*a:0),n)for(;;){if(0==p){for(s=1,o=v[0];o>=10;o/=10,s++);for(o=v[0]+=a,a=1;o>=10;o/=10,a++);s!=a&&(e.e++,v[0]==l&&(v[0]=1));break}if(v[p]+=a,v[p]!=l)break;v[p--]=0,a=1}for(s=v.length;0===v[--s];v.pop());}e.e>P?e.c=e.e=null:e.e<x&&(e.c=[e.e=0])}return e}function K(e){var t,r=e.e;return null===r?e.toString():(t=v(e.c),t=r<=R||r>=I?m(t,r):_(t,r,"0"),e.s<0?"-"+t:t)}return U.clone=e,U.ROUND_UP=0,U.ROUND_DOWN=1,U.ROUND_CEIL=2,U.ROUND_FLOOR=3,U.ROUND_HALF_UP=4,U.ROUND_HALF_DOWN=5,U.ROUND_HALF_EVEN=6,U.ROUND_HALF_CEIL=7,U.ROUND_HALF_FLOOR=8,U.EUCLID=9,U.config=U.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(a+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(b(r=e[t],0,p,t),k=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(b(r=e[t],0,8,t),C=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(b(r[0],-p,0,t),b(r[1],0,p,t),R=r[0],I=r[1]):(b(r,-p,p,t),R=-(I=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)b(r[0],-p,-1,t),b(r[1],1,p,t),x=r[0],P=r[1];else{if(b(r,-p,p,t),!r)throw Error(a+t+" cannot be zero: "+r);x=-(P=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(a+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!r,Error(a+"crypto unavailable");L=r}else L=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(b(r=e[t],0,9,t),M=r),e.hasOwnProperty(t="POW_PRECISION")&&(b(r=e[t],0,p,t),G=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(a+t+" not an object: "+r);F=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(a+t+" invalid: "+r);j=r}}return{DECIMAL_PLACES:k,ROUNDING_MODE:C,EXPONENTIAL_AT:[R,I],RANGE:[x,P],CRYPTO:L,MODULO_MODE:M,POW_PRECISION:G,FORMAT:F,ALPHABET:j}},U.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!U.DEBUG)return!0;var t,r,n=e.c,i=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===s||-1===s)&&i>=-p&&i<=p&&i===u(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%14)<1&&(t+=14),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=l||r!==u(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===s||1===s||-1===s))return!0;throw Error(a+"Invalid BigNumber: "+e)},U.maximum=U.max=function(){return H(arguments,O.lt)},U.minimum=U.min=function(){return H(arguments,O.gt)},U.random=(s=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,f=0,l=[],h=new U(N);if(null==e?e=k:b(e,0,p),i=c(e/14),L)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));f<i;)(o=131072*t[f]+(t[f+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(l.push(o%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw L=!1,Error(a+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f<i;)(o=281474976710656*(31&t[f])+1099511627776*t[f+1]+4294967296*t[f+2]+16777216*t[f+3]+(t[f+4]<<16)+(t[f+5]<<8)+t[f+6])>=9e15?crypto.randomBytes(7).copy(t,f):(l.push(o%1e14),f+=7);f=i/7}if(!L)for(;f<i;)(o=s())<9e15&&(l[f++]=o%1e14);for(e%=14,(i=l[--f])&&e&&(o=d[14-e],l[f]=u(i/o)*o);0===l[f];l.pop(),f--);if(f<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=14);for(f=1,o=l[0];o>=10;o/=10,f++);f<14&&(n-=14-f)}return h.e=n,h.c=l,h}),U.sum=function(){for(var e=1,t=arguments,r=new U(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){function e(e,t,r,n){for(var i,s,o=[0],c=0,u=e.length;c<u;){for(s=o.length;s--;o[s]*=t);for(o[0]+=n.indexOf(e.charAt(c++)),i=0;i<o.length;i++)o[i]>r-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(t,n,i,s,o){var c,u,a,f,l,d,p,h,y=t.indexOf("."),b=k,g=C;for(y>=0&&(f=G,G=0,t=t.replace(".",""),d=(h=new U(n)).pow(t.length-y),G=f,h.c=e(_(v(d.c),d.e,"0"),10,i,"0123456789"),h.e=h.c.length),a=f=(p=e(t,n,i,o?(c=j,"0123456789"):(c="0123456789",j))).length;0==p[--f];p.pop());if(!p[0])return c.charAt(0);if(y<0?--a:(d.c=p,d.e=a,d.s=s,p=(d=r(d,h,b,g,i)).c,l=d.r,a=d.e),y=p[u=a+b+1],f=i/2,l=l||u<0||null!=p[u+1],l=g<4?(null!=y||l)&&(0==g||g==(d.s<0?3:2)):y>f||y==f&&(4==g||l||6==g&&1&p[u-1]||g==(d.s<0?8:7)),u<1||!p[0])t=l?_(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(p.length=u,l)for(--i;++p[--u]>i;)p[u]=0,u||(++a,p=[1].concat(p));for(f=p.length;!p[--f];);for(y=0,t="";y<=f;t+=c.charAt(p[y++]));t=_(t,a,c.charAt(0))}return t}}(),r=function(){function e(e,t,r){var n,i,s,o,c=0,u=e.length,a=t%1e7,f=t/1e7|0;for(e=e.slice();u--;)c=((i=a*(s=e[u]%1e7)+(n=f*s+(o=e[u]/1e7|0)*a)%1e7*1e7+c)/r|0)+(n/1e7|0)+f*o,e[u]=i%r;return c&&(e=[c].concat(e)),e}function t(e,t,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(e[i]!=t[i]){s=e[i]>t[i]?1:-1;break}return s}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,s,o,c){var a,f,d,p,v,y,b,g,m,_,S,E,w,A,T,O,N,k=n.s==i.s?1:-1,C=n.c,R=i.c;if(!(C&&C[0]&&R&&R[0]))return new U(n.s&&i.s&&(C?!R||C[0]!=R[0]:R)?C&&0==C[0]||!R?0*k:k/0:NaN);for(m=(g=new U(k)).c=[],k=s+(f=n.e-i.e)+1,c||(c=l,f=h(n.e/14)-h(i.e/14),k=k/14|0),d=0;R[d]==(C[d]||0);d++);if(R[d]>(C[d]||0)&&f--,k<0)m.push(1),p=!0;else{for(A=C.length,O=R.length,d=0,k+=2,(v=u(c/(R[0]+1)))>1&&(R=e(R,v,c),C=e(C,v,c),O=R.length,A=C.length),w=O,S=(_=C.slice(0,O)).length;S<O;_[S++]=0);N=R.slice(),N=[0].concat(N),T=R[0],R[1]>=c/2&&T++;do{if(v=0,(a=t(R,_,O,S))<0){if(E=_[0],O!=S&&(E=E*c+(_[1]||0)),(v=u(E/T))>1)for(v>=c&&(v=c-1),b=(y=e(R,v,c)).length,S=_.length;1==t(y,_,b,S);)v--,r(y,O<b?N:R,b,c),b=y.length,a=1;else 0==v&&(a=v=1),b=(y=R.slice()).length;if(b<S&&(y=[0].concat(y)),r(_,y,S,c),S=_.length,-1==a)for(;t(R,_,O,S)<1;)v++,r(_,O<S?N:R,S,c),S=_.length}else 0===a&&(v++,_=[0]);m[d++]=v,_[0]?_[S++]=C[w]||0:(_=[C[w]],S=1)}while((w++<A||null!=_[0])&&k--);p=null!=_[0],m[0]||m.splice(0,1)}if(c==l){for(d=1,k=m[0];k>=10;k/=10,d++);W(g,s+(g.e=d+14*f-1)+1,o,p)}else g.e=f,g.r=+p;return g}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,w=/^\.([^.]+)$/,A=/^-?(Infinity|NaN)$/,T=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,s=r?t:t.replace(T,"");if(A.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(S,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,s=s.replace(E,"$1").replace(w,"0.$1")),t!=s))return new U(s,i);if(U.DEBUG)throw Error(a+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},O.absoluteValue=O.abs=function(){var e=new U(this);return e.s<0&&(e.s=1),e},O.comparedTo=function(e,t){return y(this,new U(e,t))},O.decimalPlaces=O.dp=function(e,t){var r,n,i,s=this;if(null!=e)return b(e,0,p),null==t?t=C:b(t,0,8),W(new U(s),e+s.e+1,t);if(!(r=s.c))return null;if(n=14*((i=r.length-1)-h(this.e/14)),i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},O.dividedBy=O.div=function(e,t){return r(this,new U(e,t),k,C)},O.dividedToIntegerBy=O.idiv=function(e,t){return r(this,new U(e,t),0,1)},O.exponentiatedBy=O.pow=function(e,t){var r,n,i,s,o,f,l,d,p=this;if((e=new U(e)).c&&!e.isInteger())throw Error(a+"Exponent not an integer: "+K(e));if(null!=t&&(t=new U(t)),o=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return d=new U(Math.pow(+K(p),o?2-g(e):+K(e))),t?d.mod(t):d;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new U(NaN);(n=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||o&&p.c[1]>=24e7:p.c[0]<8e13||o&&p.c[0]<=9999975e7)))return s=p.s<0&&g(e)?-0:0,p.e>-1&&(s=1/s),new U(f?1/s:s);G&&(s=c(G/14+2))}for(o?(r=new U(.5),f&&(e.s=1),l=g(e)):l=(i=Math.abs(+K(e)))%2,d=new U(N);;){if(l){if(!(d=d.times(p)).c)break;s?d.c.length>s&&(d.c.length=s):n&&(d=d.mod(t))}if(i){if(0===(i=u(i/2)))break;l=i%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)l=g(e);else{if(0===(i=+K(e)))break;l=i%2}p=p.times(p),s?p.c&&p.c.length>s&&(p.c.length=s):n&&(p=p.mod(t))}return n?d:(f&&(d=N.div(d)),t?d.mod(t):s?W(d,G,C,void 0):d)},O.integerValue=function(e){var t=new U(this);return null==e?e=C:b(e,0,8),W(t,t.e+1,e)},O.isEqualTo=O.eq=function(e,t){return 0===y(this,new U(e,t))},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(e,t){return y(this,new U(e,t))>0},O.isGreaterThanOrEqualTo=O.gte=function(e,t){return 1===(t=y(this,new U(e,t)))||0===t},O.isInteger=function(){return!!this.c&&h(this.e/14)>this.c.length-2},O.isLessThan=O.lt=function(e,t){return y(this,new U(e,t))<0},O.isLessThanOrEqualTo=O.lte=function(e,t){return-1===(t=y(this,new U(e,t)))||0===t},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&0==this.c[0]},O.minus=function(e,t){var r,n,i,s,o=this,c=o.s;if(t=(e=new U(e,t)).s,!c||!t)return new U(NaN);if(c!=t)return e.s=-t,o.plus(e);var u=o.e/14,a=e.e/14,f=o.c,d=e.c;if(!u||!a){if(!f||!d)return f?(e.s=-t,e):new U(d?o:NaN);if(!f[0]||!d[0])return d[0]?(e.s=-t,e):new U(f[0]?o:3==C?-0:0)}if(u=h(u),a=h(a),f=f.slice(),c=u-a){for((s=c<0)?(c=-c,i=f):(a=u,i=d),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(n=(s=(c=f.length)<(t=d.length))?c:t,c=t=0;t<n;t++)if(f[t]!=d[t]){s=f[t]<d[t];break}if(s&&(i=f,f=d,d=i,e.s=-e.s),(t=(n=d.length)-(r=f.length))>0)for(;t--;f[r++]=0);for(t=l-1;n>c;){if(f[--n]<d[n]){for(r=n;r&&!f[--r];f[r]=t);--f[r],f[n]+=l}f[n]-=d[n]}for(;0==f[0];f.splice(0,1),--a);return f[0]?D(e,f,a):(e.s=3==C?-1:1,e.c=[e.e=0],e)},O.modulo=O.mod=function(e,t){var n,i,s=this;return e=new U(e,t),!s.c||!e.s||e.c&&!e.c[0]?new U(NaN):!e.c||s.c&&!s.c[0]?new U(s):(9==M?(i=e.s,e.s=1,n=r(s,e,0,3),e.s=i,n.s*=i):n=r(s,e,0,M),(e=s.minus(n.times(e))).c[0]||1!=M||(e.s=s.s),e)},O.multipliedBy=O.times=function(e,t){var r,n,i,s,o,c,u,a,f,d,p,v,y,b,g=this,m=g.c,_=(e=new U(e,t)).c;if(!(m&&_&&m[0]&&_[0]))return!g.s||!e.s||m&&!m[0]&&!_||_&&!_[0]&&!m?e.c=e.e=e.s=null:(e.s*=g.s,m&&_?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=h(g.e/14)+h(e.e/14),e.s*=g.s,(u=m.length)<(d=_.length)&&(y=m,m=_,_=y,i=u,u=d,d=i),i=u+d,y=[];i--;y.push(0));for(b=l,1e7,i=d;--i>=0;){for(r=0,p=_[i]%1e7,v=_[i]/1e7|0,s=i+(o=u);s>i;)r=((a=p*(a=m[--o]%1e7)+(c=v*a+(f=m[o]/1e7|0)*p)%1e7*1e7+y[s]+r)/b|0)+(c/1e7|0)+v*f,y[s--]=a%b;y[s]=r}return r?++n:y.splice(0,1),D(e,y,n)},O.negated=function(){var e=new U(this);return e.s=-e.s||null,e},O.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new U(e,t)).s,!i||!t)return new U(NaN);if(i!=t)return e.s=-t,n.minus(e);var s=n.e/14,o=e.e/14,c=n.c,u=e.c;if(!s||!o){if(!c||!u)return new U(i/0);if(!c[0]||!u[0])return u[0]?e:new U(c[0]?n:0*i)}if(s=h(s),o=h(o),c=c.slice(),i=s-o){for(i>0?(o=s,r=u):(i=-i,r=c),r.reverse();i--;r.push(0));r.reverse()}for((i=c.length)-(t=u.length)<0&&(r=u,u=c,c=r,t=i),i=0;t;)i=(c[--t]=c[t]+u[t]+i)/l|0,c[t]=l===c[t]?0:c[t]%l;return i&&(c=[i].concat(c),++o),D(e,c,o)},O.precision=O.sd=function(e,t){var r,n,i,s=this;if(null!=e&&e!==!!e)return b(e,1,p),null==t?t=C:b(t,0,8),W(new U(s),e,t);if(!(r=s.c))return null;if(n=14*(i=r.length-1)+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&s.e+1>n&&(n=s.e+1),n},O.shiftedBy=function(e){return b(e,-9007199254740991,9007199254740991),this.times("1e"+e)},O.squareRoot=O.sqrt=function(){var e,t,n,i,s,o=this,c=o.c,u=o.s,a=o.e,f=k+4,l=new U("0.5");if(1!==u||!c||!c[0])return new U(!u||u<0&&(!c||c[0])?NaN:c?o:1/0);if(0==(u=Math.sqrt(+K(o)))||u==1/0?(((t=v(c)).length+a)%2==0&&(t+="0"),u=Math.sqrt(+t),a=h((a+1)/2)-(a<0||a%2),n=new U(t=u==1/0?"1e"+a:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+a)):n=new U(u+""),n.c[0])for((u=(a=n.e)+f)<3&&(u=0);;)if(s=n,n=l.times(s.plus(r(o,s,f,1))),v(s.c).slice(0,u)===(t=v(n.c)).slice(0,u)){if(n.e<a&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(W(n,n.e+k+2,1),e=!n.times(n).eq(o));break}if(!i&&(W(s,s.e+k+2,0),s.times(s).eq(o))){n=s;break}f+=4,u+=4,i=1}return W(n,n.e+k+1,C,e)},O.toExponential=function(e,t){return null!=e&&(b(e,0,p),e++),B(this,e,t,1)},O.toFixed=function(e,t){return null!=e&&(b(e,0,p),e=e+this.e+1),B(this,e,t)},O.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=F;else if("object"!=typeof r)throw Error(a+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var s,o=n.split("."),c=+r.groupSize,u=+r.secondaryGroupSize,f=r.groupSeparator||"",l=o[0],d=o[1],p=i.s<0,h=p?l.slice(1):l,v=h.length;if(u&&(s=c,c=u,u=s,v-=s),c>0&&v>0){for(s=v%c||c,l=h.substr(0,s);s<v;s+=c)l+=f+h.substr(s,c);u>0&&(l+=f+h.slice(s)),p&&(l="-"+l)}n=d?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):l}return(r.prefix||"")+n+(r.suffix||"")},O.toFraction=function(e){var t,n,i,s,o,c,u,f,l,p,h,y,b=this,g=b.c;if(null!=e&&(!(u=new U(e)).isInteger()&&(u.c||1!==u.s)||u.lt(N)))throw Error(a+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+K(u));if(!g)return new U(b);for(t=new U(N),l=n=new U(N),i=f=new U(N),y=v(g),o=t.e=y.length-b.e-1,t.c[0]=d[(c=o%14)<0?14+c:c],e=!e||u.comparedTo(t)>0?o>0?t:l:u,c=P,P=1/0,u=new U(y),f.c[0]=0;p=r(u,t,0,1),1!=(s=n.plus(p.times(i))).comparedTo(e);)n=i,i=s,l=f.plus(p.times(s=l)),f=s,t=u.minus(p.times(s=t)),u=s;return s=r(e.minus(n),i,0,1),f=f.plus(s.times(l)),n=n.plus(s.times(i)),f.s=l.s=b.s,h=r(l,i,o*=2,C).minus(b).abs().comparedTo(r(f,n,o,C).minus(b).abs())<1?[l,i]:[f,n],P=c,h},O.toNumber=function(){return+K(this)},O.toPrecision=function(e,t){return null!=e&&b(e,1,p),B(this,e,t,2)},O.toString=function(e){var t,r=this,i=r.s,s=r.e;return null===s?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=s<=R||s>=I?m(v(r.c),s):_(v(r.c),s,"0"):10===e?t=_(v((r=W(new U(r),k+s+1,C)).c),r.e,"0"):(b(e,2,j.length,"Base"),t=n(_(v(r.c),s,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},O.valueOf=O.toJSON=function(){return K(this)},O._isBigNumber=!0,null!=t&&U.set(t),U}()).default=s.BigNumber=s,void 0===(n=function(){return s}.call(t,r,t,e))||(e.exports=n)}()},70:function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},71:function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},72:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},83:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HANDSHAKE="m_handshake",t.INIT="m_init",t.CONNECT="m_connect",t.DISCONNECT="m_disconnect",t.GET_INFO="m_get_info",t.GET_CURRENT_FIAT_RATES="m_get_current_fiat_rates",t.GET_FIAT_RATES_FOR_TIMESTAMPS="m_get_fiat_rates_for_timestamps",t.GET_ACCOUNT_BALANCE_HISTORY="m_get_account_balance_history",t.GET_FIAT_RATES_TICKERS_LIST="m_get_fiat_rates_tickers_list",t.GET_BLOCK_HASH="m_get_block_hash",t.GET_ACCOUNT_INFO="m_get_account_info",t.GET_ACCOUNT_UTXO="m_get_account_utxo",t.GET_TRANSACTION="m_get_transaction",t.ESTIMATE_FEE="m_estimate_fee",t.SUBSCRIBE="m_subscribe",t.UNSUBSCRIBE="m_unsubscribe",t.PUSH_TRANSACTION="m_push_tx"},84:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERROR="r_error",t.CONNECT="r_connect",t.GET_INFO="r_info",t.GET_BLOCK_HASH="r_get_block_hash",t.GET_CURRENT_FIAT_RATES="r_get_current_fiat_rates",t.GET_FIAT_RATES_FOR_TIMESTAMPS="r_get_fiat_rates_for_timestamps",t.GET_FIAT_RATES_TICKERS_LIST="r_GET_FIAT_RATES_TICKERS_LIST",t.GET_ACCOUNT_INFO="r_account_info",t.GET_ACCOUNT_UTXO="r_get_account_utxo",t.GET_ACCOUNT_BALANCE_HISTORY="r_get_account_balance_history",t.GET_TRANSACTION="r_get_transaction",t.ESTIMATE_FEE="r_estimate_fee",t.SUBSCRIBE="r_subscribe",t.UNSUBSCRIBE="r_unsubscribe",t.PUSH_TRANSACTION="r_push_tx",t.CONNECTED="r_connected",t.DISCONNECTED="r_disconnected",t.NOTIFICATION="r_notification"},85:function(e,t,r){"use strict";var n=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var s=arguments[t],o=0,c=s.length;o<c;o++,i++)n[i]=s[o];return n};Object.defineProperty(t,"__esModule",{value:!0});var i=r(46),s=r(26),o=function(){function e(e){this.addresses=[],this.accounts=[],this.subscription={},this.settings={name:"unknown",worker:"unknown",server:[]},this.debugPrefix="[UnknownWorker]",this.post=function(){return console.warn("BlockchainLink:workers.common: postMessage method is not set")},void 0!==e&&(this.post=e)}return e.prototype.handshake=function(){this.post.call(null,{id:-1,type:i.MESSAGES.HANDSHAKE})},e.prototype.setSettings=function(e){this.settings=e,this.debugPrefix='[Worker "'+e.name+'"]:'},e.prototype.getSettings=function(){return this.settings},e.prototype.errorHandler=function(e){var t=e.id,r=e.error,n="blockchain_link/unknown",s=r.message;r.code&&(n=r.code),this.post.call(null,{id:t,type:i.RESPONSES.ERROR,payload:{code:n,message:s}})},e.prototype.response=function(e){this.post.call(null,this.removeEmpty(e))},e.prototype.validateAddresses=function(e){if(!Array.isArray(e))throw new s.CustomError("invalid_param","+addresses");var t=[];return e.filter((function(e){return"string"==typeof e&&(!(t.indexOf(e)>=0)&&(t.push(e),!0))}))},e.prototype.addAddresses=function(e){var t=this,r=this.validateAddresses(e).filter((function(e){return t.addresses.indexOf(e)<0}));return this.addresses=this.addresses.concat(r),r},e.prototype.getAddresses=function(){return this.addresses},e.prototype.removeAddresses=function(e){var t=this.validateAddresses(e);return this.addresses=this.addresses.filter((function(e){return t.indexOf(e)<0})),this.addresses},e.prototype.validateAccounts=function(e){if(!Array.isArray(e))throw new s.CustomError("invalid_param","+accounts");var t=[];return e.filter((function(e){return!(!e||"object"!=typeof e||"string"!=typeof e.descriptor)&&(!(t.indexOf(e.descriptor)>=0)&&(t.push(e.descriptor),!0))}))},e.prototype.getAccountAddresses=function(e){if(e.addresses){var t=e.addresses,r=t.change,n=t.used,i=t.unused;return r.concat(n,i).map((function(e){return e.address}))}return[e.descriptor]},e.prototype.addAccounts=function(e){var t=this,r=this.validateAccounts(e),n=this.accounts.filter((function(e){return!r.find((function(t){return t.descriptor===e.descriptor}))}));this.accounts=n.concat(r);var i=this.accounts.reduce((function(e,r){return e.concat(t.getAccountAddresses(r))}),[]);return this.addAddresses(i),r},e.prototype.getAccount=function(e){return this.accounts.find((function(t){if(t.descriptor===e)return!0;if(t.addresses){var r=t.addresses,n=r.change,i=r.used,s=r.unused;if(n.find((function(t){return t.address===e})))return!0;if(i.find((function(t){return t.address===e})))return!0;if(s.find((function(t){return t.address===e})))return!0}return!1}))},e.prototype.getAccounts=function(){return this.accounts},e.prototype.removeAccounts=function(e){var t=this,r=this.validateAccounts(e),n=this.accounts.filter((function(e){return r.find((function(t){return t.descriptor===e.descriptor}))})),i=n.reduce((function(e,r){return e.concat(t.getAccountAddresses(r))}),[]);return this.accounts=this.accounts.filter((function(e){return n.indexOf(e)<0})),this.removeAddresses(i),this.accounts},e.prototype.addSubscription=function(e){this.subscription[e]=!0},e.prototype.getSubscription=function(e){return this.subscription[e]},e.prototype.hasSubscriptions=function(){return Object.keys(this.subscription).length>0},e.prototype.removeSubscription=function(e){delete this.subscription[e]},e.prototype.clearSubscriptions=function(){var e=this;Object.keys(this.subscription).forEach((function(t){delete e.subscription[t]}))},e.prototype.shuffleEndpoints=function(e){for(var t,r=e.length-1;r>0;r--){var n=Math.floor(Math.random()*(r+1));t=[e[n],e[r]],e[r]=t[0],e[n]=t[1]}return e},e.prototype.removeEmpty=function(e){var t=this;return Object.keys(e).forEach((function(r){Array.isArray(e[r])&&e[r].map((function(e){return t.removeEmpty(e)})),e[r]&&"object"==typeof e[r]?t.removeEmpty(e[r]):void 0===e[r]&&delete e[r]})),e},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.settings&&this.settings.debug&&("warn"===e[0]||"error"===e[0]?console[e[0]].apply(console,n([this.debugPrefix],e.slice(1))):console.log.apply(console,n([this.debugPrefix],e)))},e}();t.default=o}});

@@ -0,1 +1,7 @@

# 1.0.12
#### changes
- Update dependencies
# 1.0.11

@@ -2,0 +8,0 @@

@@ -140,2 +140,3 @@ import { AccountBalanceHistoryParams, GetCurrentFiatRates, GetFiatRatesForTimestamps, GetFiatRatesTickersList, AccountInfoParams, EstimateFeeParams } from './messages';

sent: string;
sentToSelf?: string;
rates: FiatRates;

@@ -142,0 +143,0 @@ }

{
"name": "@trezor/blockchain-link",
"version": "1.0.11",
"version": "1.0.12",
"author": "Trezor <info@trezor.io>",

@@ -39,20 +39,20 @@ "homepage": "https://github.com/trezor/trezor-suite/packages/blockchain-link",

"devDependencies": {
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"@babel/register": "^7.10.1",
"@babel/runtime": "^7.10.2",
"babel-eslint": "^10.1.0",
"babel-jest": "^25.4.0",
"babel-jest": "^26.0.1",
"babel-loader": "^8.1.0",
"bignumber.js": "^9.0.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-loader": "^4.0.0",
"eslint-plugin-jest": "^23.8.2",
"html-webpack-plugin": "^4.2.0",
"ripple-lib": "1.6.5",
"eslint-loader": "^4.0.2",
"eslint-plugin-jest": "^23.13.2",
"html-webpack-plugin": "^4.3.0",
"ripple-lib": "1.7.1",
"tiny-worker": "^2.3.0",
"ts-loader": "^7.0.1",
"ts-loader": "^7.0.5",
"webpack": "^4.43.0",
"webpack-cli": "3.3.11",
"webpack-dev-server": "3.10.3",
"webpack-dev-server": "3.11.0",
"worker-loader": "^2.0.0",
"ws": "^7.2.3"
"ws": "^7.3.0"
},

@@ -59,0 +59,0 @@ "dependencies": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc