@waves/balances
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -24,3 +24,5 @@ import { MyAsset, MyMoney, Poll } from './utils'; | ||
_assets: Assets; | ||
_updateBalancesMs: number; | ||
constructor(props: Props); | ||
changeUser(address: string): void; | ||
destroy(): void; | ||
@@ -27,0 +29,0 @@ getFeesByCoins(coins: MyMoney | BigNumber | number | string): Promise<Array<MyMoney>>; |
@@ -25,9 +25,26 @@ "use strict"; | ||
const { address, iconUrl = 'https://waves.exchange/static/icons/assets', dataServicesUrl = 'https://waves.exchange/api/v1', nodeUrl = 'https://nodes.waves.exchange', updateBalancesMs = null } = props; | ||
this._updateBalancesMs = updateBalancesMs; | ||
this._assets = new Assets_1.Assets(dataServicesUrl, iconUrl); | ||
this.address = address; | ||
this.dataServicesUrl = dataServicesUrl; | ||
this.nodeUrl = nodeUrl; | ||
if (updateBalancesMs) { | ||
this._updateBalances(updateBalancesMs); | ||
this.changeUser(address); | ||
} | ||
changeUser(address) { | ||
this.hasData = false; | ||
this.address = address; | ||
this.balances = Object.create(null); | ||
this.feeList = []; | ||
this._readyPromise = null; | ||
const emptyBalances = Object.entries(this.balances) | ||
.reduce((acc, [key, money]) => { | ||
acc[key] = money.cloneWithCoins(0); | ||
return acc; | ||
}, {}); | ||
this._onUpdate(Object.create(null)); | ||
if (!address) { | ||
return; | ||
} | ||
if (this._updateBalancesMs) { | ||
this._updateBalances(this._updateBalancesMs); | ||
} | ||
else { | ||
@@ -34,0 +51,0 @@ this._readyPromise = this._init(); |
@@ -1,1 +0,1 @@ | ||
(()=>{var e={689:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(905)),i=r(663),s=function(){function e(t){"object"==typeof t&&e.isBigNumber(t)?this.bn=t.bn.plus(0):this.bn=e.toBigNumberJs(t)}return e.prototype.clone=function(){return new e(this)},e.prototype.add=function(t){return new e(this.bn.plus(e.toBigNumberJs(t)))},e.prototype.sub=function(t){return new e(this.bn.minus(e.toBigNumberJs(t)))},e.prototype.mul=function(t){return new e(this.bn.times(e.toBigNumberJs(t)))},e.prototype.div=function(t){return new e(this.bn.div(e.toBigNumberJs(t)))},e.prototype.pow=function(t){return new e(this.bn.pow(e.toBigNumberJs(t)))},e.prototype.sqrt=function(){return new e(this.bn.sqrt())},e.prototype.abs=function(){return new e(this.bn.abs())},e.prototype.mod=function(t){return new e(this.bn.mod(e.toBigNumberJs(t)))},e.prototype.roundTo=function(t,r){return void 0===t&&(t=0),void 0===r&&(r=4),new e(this.bn.dp(t||0,r))},e.prototype.eq=function(t){return this.bn.eq(e.toBigNumberJs(t))},e.prototype.lt=function(t){return this.bn.lt(e.toBigNumberJs(t))},e.prototype.gt=function(t){return this.bn.gt(e.toBigNumberJs(t))},e.prototype.lte=function(t){return this.bn.lte(e.toBigNumberJs(t))},e.prototype.gte=function(t){return this.bn.gte(e.toBigNumberJs(t))},e.prototype.isNaN=function(){return this.bn.isNaN()},e.prototype.isFinite=function(){return this.bn.isFinite()},e.prototype.isZero=function(){return this.eq(0)},e.prototype.isPositive=function(){return this.gt(0)},e.prototype.isNegative=function(){return this.lt(0)},e.prototype.isInt=function(){return this.bn.isInteger()},e.prototype.getDecimalsCount=function(){return this.bn.dp()},e.prototype.isEven=function(){return this.mod(2).eq(0)},e.prototype.isOdd=function(){return!this.isEven()},e.prototype.isInSignedRange=function(){return this.gte(e.MIN_VALUE)&&this.lte(e.MAX_VALUE)},e.prototype.isInUnsignedRange=function(){return this.gte(e.MIN_UNSIGNED_VALUE)&&this.lte(e.MAX_UNSIGNED_VALUE)},e.prototype.toFormat=function(e,t,r){return this.bn.toFormat(e,t,r)},e.prototype.toFixed=function(e,t){return null==e?this.bn.toFixed():this.bn.toFixed(e,t)},e.prototype.toString=function(){return this.toFixed()},e.prototype.toNumber=function(){return this.bn.toNumber()},e.prototype.toJSON=function(){return this.bn.toFixed()},e.prototype.valueOf=function(){return this.bn.valueOf()},e.prototype.toBytes=function(t){var r=void 0===t?{}:t,n=r.isSigned,o=void 0===n||n,i=r.isLong,s=void 0===i||i;if(!this.isInt())throw new Error("Cant create bytes from number with decimals!");if(!o&&this.isNegative())throw new Error("Cant create bytes from negative number in signed mode!");if(s&&o&&!this.isInSignedRange())throw new Error("Number is not from signed numbers range");if(s&&!o&&!this.isInUnsignedRange())throw new Error("Number is not from unsigned numbers range");var u=o&&this.isNegative(),a=u?"1":"0",c=this.bn.plus(a).toString(2).replace("-",""),l=s?64:8*Math.ceil(c.length/8),f=e._toLength(l,c).split(""),h=[];do{h.push(parseInt(f.splice(0,8).join(""),2))}while(f.length);return u?Uint8Array.from(h.map((function(e){return 255-e}))):Uint8Array.from(h)},e.fromBytes=function(t,r){var n=void 0===r?{}:r,i=n.isSigned,s=void 0===i||i,u=n.isLong,a=void 0===u||u;if(a&&8!==t.length)throw new Error("Wrong bytes length! Minimal length is 8 byte!");t=!a&&t.length>0||a?t:[0];var c=!!s&&t[0]>127,l=Array.from(t).map((function(e){return c?255-e:e})).map((function(t){return e._toLength(8,t.toString(2))})).join(""),f=new e(new o.default(l,2));return c?f.mul(-1).sub(1):f},e.max=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.gte(t)?e:t}))},e.min=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.lte(t)?e:t}))},e.sum=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.add(t)}))},e.isBigNumber=function(t){return t&&"object"==typeof t&&(t instanceof e||Object.entries(e.prototype).filter((function(e){return"_"!==e[0].charAt(0)})).every((function(e){var r=e[0],n=e[1];return r in t&&typeof n==typeof t[r]})))},e.toBigNumber=function(t){return Array.isArray(t)?t.map((function(t){return new e(t)})):new e(t)},e.toBigNumberJs=function(t){return o.default.isBigNumber(t)?t:t instanceof e?t.bn:new o.default(t)},e._toLength=function(e,t){return new Array(e).fill("0",0,e).concat(t.split("")).slice(-e).join("")},e.MIN_VALUE=new e("-9223372036854775808"),e.MAX_VALUE=new e("9223372036854775807"),e.MIN_UNSIGNED_VALUE=new e("0"),e.MAX_UNSIGNED_VALUE=new e("18446744073709551615"),e.config=new i.Config,e}();t.BigNumber=s,function(e){var t;(t=e.ROUND_MODE||(e.ROUND_MODE={}))[t.ROUND_UP=0]="ROUND_UP",t[t.ROUND_DOWN=1]="ROUND_DOWN",t[t.ROUND_CEIL=2]="ROUND_CEIL",t[t.ROUND_FLOOR=3]="ROUND_FLOOR",t[t.ROUND_HALF_UP=4]="ROUND_HALF_UP",t[t.ROUND_HALF_DOWN=5]="ROUND_HALF_DOWN",t[t.ROUND_HALF_EVEN=6]="ROUND_HALF_EVEN",t[t.ROUND_HALF_CEIL=7]="ROUND_HALF_CEIL",t[t.ROUND_HALF_FLOOR=8]="ROUND_HALF_FLOOR"}(s=t.BigNumber||(t.BigNumber={})),t.BigNumber=s},663: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 o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=o(r(905)),s=function(){function e(){this.format=e.DEFAULT_FORMAT,i.default.config({FORMAT:this.format})}return e.prototype.set=function(e){"FORMAT"in e&&(this.format=n({},this.format,e.FORMAT),e.FORMAT=this.format),i.default.config(e)},e.DEFAULT_FORMAT={prefix:"",decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0,suffix:""},e}();t.Config=s},399:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(689);!function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(689)),t.default=n.BigNumber},466:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,n={remapAsset:function(e){return e},remapCandle:function(e){return e}};(r=t.config||(t.config={})).get=function(e){return n[e]},r.set=function e(t,r){"string"==typeof t?n[t]=r:Object.keys(t).forEach((function(r){return e(r,t[r])}))}},748:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(466),o=r(781),i=function(){function e(e){e=n.config.get("remapAsset")(e),this.quantity=o.toBigNumber(e.quantity),this.minSponsoredFee=o.toBigNumber(e.minSponsoredFee),this.ticker=e.ticker||null,this.id=e.id,this.name=e.name,this.precision=e.precision,this.description=e.description,this.height=e.height,this.timestamp=e.timestamp,this.sender=e.sender,this.reissuable=e.reissuable,this.hasScript=e.hasScript||!1,this.displayName=e.ticker||e.name}return e.prototype.toJSON=function(){return{ticker:this.ticker,id:this.id,name:this.name,precision:this.precision,description:this.description,height:this.height,timestamp:this.timestamp,sender:this.sender,quantity:this.quantity,reissuable:this.reissuable,hasScript:this.hasScript,minSponsoredFee:this.minSponsoredFee}},e.prototype.toString=function(){return this.id},e.isAsset=function(t){return t instanceof e},e}();t.Asset=i},55:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){this.amountAsset=e,this.priceAsset=t,this.precisionDifference=this.priceAsset.precision-this.amountAsset.precision}return e.prototype.toJSON=function(){return{amountAsset:this.amountAsset.id,priceAsset:this.priceAsset.id}},e.prototype.toString=function(){return this.amountAsset+"/"+this.priceAsset},e.isAssetPair=function(t){return t instanceof e},e}();t.AssetPair=r},318:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(466),o=r(781),i=function(){function e(e){var t=this;e=n.config.get("remapCandle")(e),["open","close","high","low","volume","quoteVolume","weightedAveragePrice"].forEach((function(r){return t[r]=o.toBigNumber(e[r])})),this.time=e.time,this.maxHeight=e.maxHeight,this.txsCount=e.txsCount}return e.prototype.toJSON=function(){return{time:this.time,open:this.open,close:this.close,high:this.high,low:this.low,volume:this.volume,quoteVolume:this.quoteVolume,weightedAveragePrice:this.weightedAveragePrice,maxHeight:this.maxHeight,txsCount:this.txsCount}},e.prototype.toString=function(){return"[object Candle]"},e.isCandle=function(t){return t instanceof e},e}();t.Candle=i},906:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(399),o=r(781),i=function(){function e(t,r){var n=e._getDivider(r.precision);this.asset=r,this._coins=o.toBigNumber(t).roundTo(0),this._tokens=this._coins.div(n)}return e.prototype.getCoins=function(){return this._coins.add(0)},e.prototype.getTokens=function(){return this._tokens.add(0)},e.prototype.toCoins=function(){return this._coins.toFixed(0)},e.prototype.toTokens=function(){return this._tokens.toFixed(this.asset.precision)},e.prototype.toFormat=function(e){return this._tokens.toFormat(e)},e.prototype.add=function(t){this._matchAssets(t);var r=t.getCoins();return new e(this._coins.add(r),this.asset)},e.prototype.plus=function(e){return this.add(e)},e.prototype.sub=function(t){this._matchAssets(t);var r=t.getCoins();return new e(this._coins.sub(r),this.asset)},e.prototype.minus=function(e){return this.sub(e)},e.prototype.times=function(t){return this._matchAssets(t),new e(this.getCoins().mul(t.getCoins()),this.asset)},e.prototype.div=function(t){return this._matchAssets(t),new e(this.getCoins().div(t.getCoins()),this.asset)},e.prototype.eq=function(e){return this._matchAssets(e),this._coins.eq(e.getCoins())},e.prototype.lt=function(e){return this._matchAssets(e),this._coins.lt(e.getCoins())},e.prototype.lte=function(e){return this._matchAssets(e),this._coins.lte(e.getCoins())},e.prototype.gt=function(e){return this._matchAssets(e),this._coins.gt(e.getCoins())},e.prototype.gte=function(e){return this._matchAssets(e),this._coins.gte(e.getCoins())},e.prototype.safeSub=function(e){return this.asset.id===e.asset.id?this.sub(e):this},e.prototype.toNonNegative=function(){return this.getTokens().lt(0)?this.cloneWithTokens(0):this},e.prototype.cloneWithCoins=function(t){return new e(new n.BigNumber(t),this.asset)},e.prototype.cloneWithTokens=function(t){var r=e._tokensToCoins(t,this.asset.precision);return new e(r,this.asset)},e.prototype.convertTo=function(t,r){return e.convert(this,t,o.toBigNumber(r))},e.prototype.toJSON=function(){return{assetId:this.asset.id,tokens:this.toTokens()}},e.prototype.toString=function(){return this.toTokens()+" "+this.asset.id},e.prototype._matchAssets=function(e){if(this.asset.id!==e.asset.id)throw new Error("You cannot apply arithmetic operations to Money created with different assets")},e.max=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return e.gte(t)?e:t}))},e.min=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return e.lte(t)?e:t}))},e.isMoney=function(t){return t instanceof e},e.convert=function(t,r,o){if(t.asset===r)return t;var i=t.asset.precision-r.precision,s=new n.BigNumber(10).pow(i),u=t.getCoins().mul(o).div(s).roundTo(0,1).toFixed();return new e(new n.BigNumber(u),r)},e.fromTokens=function(t,r){return new e(o.toBigNumber(t).mul(new n.BigNumber(10).pow(r.precision)),r)},e.fromCoins=function(t,r){return new e(t,r)},e._tokensToCoins=function(t,r){var o=e._getDivider(r);return t=new n.BigNumber(t).toFixed(r),new n.BigNumber(t).mul(o)},e._getDivider=function(e){return new n.BigNumber(10).pow(e)},e}();t.Money=i},454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(399),o=r(781),i=function(){function e(t,r){var n=e._getMatcherDivider(r.precisionDifference);this.pair=r,this._matcherCoins=t,this._tokens=this._matcherCoins.div(n)}return e.prototype.getMatcherCoins=function(){return this._matcherCoins.clone()},e.prototype.getTokens=function(){return this._tokens.clone()},e.prototype.toMatcherCoins=function(){return this._matcherCoins.toFixed(0)},e.prototype.toTokens=function(){return this._tokens.toFixed(this.pair.priceAsset.precision)},e.prototype.toFormat=function(){return this._tokens.toFormat(this.pair.priceAsset.precision)},e.prototype.toJSON=function(){return{amountAssetId:this.pair.amountAsset.id,priceAssetId:this.pair.priceAsset.id,priceTokens:this.toTokens()}},e.prototype.toString=function(){return this.toTokens()+" "+this.pair.amountAsset.id+"/"+this.pair.priceAsset.id},e.fromMatcherCoins=function(t,r){return e._checkAmount(t),new e(o.toBigNumber(t),r)},e.fromTokens=function(t,r){e._checkAmount(t),t=o.toBigNumber(t).toFixed(r.priceAsset.precision);var i=e._getMatcherDivider(r.precisionDifference);return new e(new n.BigNumber(t).mul(i),r)},e._getMatcherDivider=function(t){return new n.BigNumber(10).pow(t).mul(e._MATCHER_SCALE)},e.isOrderPrice=function(t){return t instanceof e},e._checkAmount=function(e){if(!(["string","number"].includes(typeof e)||e instanceof n.BigNumber))throw new Error("Please use strings to create instances of OrderPrice")},e._MATCHER_SCALE=new n.BigNumber(10).pow(8),e}();t.OrderPrice=i},739:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(748);t.Asset=n.Asset;var o=r(318);t.Candle=o.Candle;var i=r(906);t.Money=i.Money;var s=r(454);t.OrderPrice=s.OrderPrice;var u=r(55);t.AssetPair=u.AssetPair;var a=r(466);t.config=a.config},781:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(399);t.toBigNumber=function(e){return e instanceof n.BigNumber?e:new n.BigNumber(e)}},905:(e,t,r)=>{"use strict";r.r(t),r.d(t,{BigNumber:()=>_,default:()=>O});var n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,o=Math.ceil,i=Math.floor,s="[BigNumber Error] ",u=s+"Number primitive has more than 15 significant digits: ",a=1e14,c=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,p=1e9;function d(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,r,n=1,o=e.length,i=e[0]+"";n<o;){for(t=e[n++]+"",r=c-t.length;r--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function g(e,t){var r,n,o=e.c,i=t.c,s=e.s,u=t.s,a=e.e,c=t.e;if(!s||!u)return null;if(r=o&&!o[0],n=i&&!i[0],r||n)return r?n?0:-u:s;if(s!=u)return s;if(r=s<0,n=a==c,!o||!i)return n?0:!o^r?1:-1;if(!n)return a>c^r?1:-1;for(u=(a=o.length)<(c=i.length)?a:c,s=0;s<u;s++)if(o[s]!=i[s])return o[s]>i[s]^r?1:-1;return a==c?0:a>c^r?1:-1}function y(e,t,r,n){if(e<t||e>r||e!==i(e))throw Error(s+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function b(e){var t=e.c.length-1;return d(e.e/c)==t&&e.c[t]%2!=0}function v(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function w(e,t,r){var n,o;if(t<0){for(o=r+".";++t;o+=r);e=o+e}else if(++t>(n=e.length)){for(o=r,t-=n;--t;o+=r);e+=o}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var _=function e(t){var r,_,O,N,A,S,E,B,P,T,x=H.prototype={constructor:H,toString:null,valueOf:null},j=new H(1),C=20,U=4,M=-7,L=21,R=-1e7,F=1e7,k=!1,D=1,I=0,$={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz";function H(e,t){var r,o,s,a,f,h,p,d,m=this;if(!(m instanceof H))return new H(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>F?m.c=m.e=null:e.e<R?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,f=e;f>=10;f/=10,a++);return void(a>F?m.c=m.e=null:(m.e=a,m.c=[e]))}d=String(e)}else{if(!n.test(d=String(e)))return O(m,d,h);m.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(a=d.indexOf("."))>-1&&(d=d.replace(".","")),(f=d.search(/e/i))>0?(a<0&&(a=f),a+=+d.slice(f+1),d=d.substring(0,f)):a<0&&(a=d.length)}else{if(y(t,2,q.length,"Base"),10==t)return W(m=new H(e),C+m.e+1,U);if(d=String(e),h="number"==typeof e){if(0*e!=0)return O(m,d,h,t);if(m.s=1/e<0?(d=d.slice(1),-1):1,H.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(u+e)}else m.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(r=q.slice(0,t),a=f=0,p=d.length;f<p;f++)if(r.indexOf(o=d.charAt(f))<0){if("."==o){if(f>a){a=p;continue}}else if(!s&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){s=!0,f=-1,a=0;continue}return O(m,String(e),h,t)}h=!1,(a=(d=_(d,t,10,m.s)).indexOf("."))>-1?d=d.replace(".",""):a=d.length}for(f=0;48===d.charCodeAt(f);f++);for(p=d.length;48===d.charCodeAt(--p););if(d=d.slice(f,++p)){if(p-=f,h&&H.DEBUG&&p>15&&(e>l||e!==i(e)))throw Error(u+m.s*e);if((a=a-f-1)>F)m.c=m.e=null;else if(a<R)m.c=[m.e=0];else{if(m.e=a,m.c=[],f=(a+1)%c,a<0&&(f+=c),f<p){for(f&&m.c.push(+d.slice(0,f)),p-=c;f<p;)m.c.push(+d.slice(f,f+=c));f=c-(d=d.slice(f)).length}else f-=p;for(;f--;d+="0");m.c.push(+d)}}else m.c=[m.e=0]}function z(e,t,r,n){var o,i,s,u,a;if(null==r?r=U:y(r,0,8),!e.c)return e.toString();if(o=e.c[0],s=e.e,null==t)a=m(e.c),a=1==n||2==n&&(s<=M||s>=L)?v(a,s):w(a,s,"0");else if(i=(e=W(new H(e),t,r)).e,u=(a=m(e.c)).length,1==n||2==n&&(t<=i||i<=M)){for(;u<t;a+="0",u++);a=v(a,i)}else if(t-=s,a=w(a,i,"0"),i+1>u){if(--t>0)for(a+=".";t--;a+="0");}else if((t+=i-u)>0)for(i+1==u&&(a+=".");t--;a+="0");return e.s<0&&o?"-"+a:a}function J(e,t){for(var r,n=1,o=new H(e[0]);n<e.length;n++){if(!(r=new H(e[n])).s){o=r;break}t.call(o,r)&&(o=r)}return o}function V(e,t,r){for(var n=1,o=t.length;!t[--o];t.pop());for(o=t[0];o>=10;o/=10,n++);return(r=n+r*c-1)>F?e.c=e.e=null:r<R?e.c=[e.e=0]:(e.e=r,e.c=t),e}function W(e,t,r,n){var s,u,l,h,p,d,m,g=e.c,y=f;if(g){e:{for(s=1,h=g[0];h>=10;h/=10,s++);if((u=t-s)<0)u+=c,l=t,m=(p=g[d=0])/y[s-l-1]%10|0;else if((d=o((u+1)/c))>=g.length){if(!n)break e;for(;g.length<=d;g.push(0));p=m=0,s=1,l=(u%=c)-c+1}else{for(p=h=g[d],s=1;h>=10;h/=10,s++);m=(l=(u%=c)-c+s)<0?0:p/y[s-l-1]%10|0}if(n=n||t<0||null!=g[d+1]||(l<0?p:p%y[s-l-1]),n=r<4?(m||n)&&(0==r||r==(e.s<0?3:2)):m>5||5==m&&(4==r||n||6==r&&(u>0?l>0?p/y[s-l]:0:g[d-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=y[(c-t%c)%c],e.e=-t||0):g[0]=e.e=0,e;if(0==u?(g.length=d,h=1,d--):(g.length=d+1,h=y[c-u],g[d]=l>0?i(p/y[s-l]%y[l])*h:0),n)for(;;){if(0==d){for(u=1,l=g[0];l>=10;l/=10,u++);for(l=g[0]+=h,h=1;l>=10;l/=10,h++);u!=h&&(e.e++,g[0]==a&&(g[0]=1));break}if(g[d]+=h,g[d]!=a)break;g[d--]=0,h=1}for(u=g.length;0===g[--u];g.pop());}e.e>F?e.c=e.e=null:e.e<R&&(e.c=[e.e=0])}return e}function G(e){var t,r=e.e;return null===r?e.toString():(t=m(e.c),t=r<=M||r>=L?v(t,r):w(t,r,"0"),e.s<0?"-"+t:t)}return H.clone=e,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(r=e[t],0,p,t),C=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(r=e[t],0,8,t),U=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(y(r[0],-p,0,t),y(r[1],0,p,t),M=r[0],L=r[1]):(y(r,-p,p,t),M=-(L=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)y(r[0],-p,-1,t),y(r[1],1,p,t),R=r[0],F=r[1];else{if(y(r,-p,p,t),!r)throw Error(s+t+" cannot be zero: "+r);R=-(F=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(s+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw k=!r,Error(s+"crypto unavailable");k=r}else k=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(r=e[t],0,9,t),D=r),e.hasOwnProperty(t="POW_PRECISION")&&(y(r=e[t],0,p,t),I=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(s+t+" not an object: "+r);$=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(s+t+" invalid: "+r);q=r}}return{DECIMAL_PLACES:C,ROUNDING_MODE:U,EXPONENTIAL_AT:[M,L],RANGE:[R,F],CRYPTO:k,MODULO_MODE:D,POW_PRECISION:I,FORMAT:$,ALPHABET:q}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,r,n=e.c,o=e.e,u=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===u||-1===u)&&o>=-p&&o<=p&&o===i(o)){if(0===n[0]){if(0===o&&1===n.length)return!0;break e}if((t=(o+1)%c)<1&&(t+=c),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=a||r!==i(r))break e;if(0!==r)return!0}}}else if(null===n&&null===o&&(null===u||1===u||-1===u))return!0;throw Error(s+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return J(arguments,x.lt)},H.minimum=H.min=function(){return J(arguments,x.gt)},H.random=(N=9007199254740992,A=Math.random()*N&2097151?function(){return i(Math.random()*N)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,u,a,l=0,h=[],d=new H(j);if(null==e?e=C:y(e,0,p),u=o(e/c),k)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(u*=2));l<u;)(a=131072*t[l]+(t[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(h.push(a%1e14),l+=2);l=u/2}else{if(!crypto.randomBytes)throw k=!1,Error(s+"crypto unavailable");for(t=crypto.randomBytes(u*=7);l<u;)(a=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(h.push(a%1e14),l+=7);l=u/7}if(!k)for(;l<u;)(a=A())<9e15&&(h[l++]=a%1e14);for(u=h[--l],e%=c,u&&e&&(a=f[c-e],h[l]=i(u/a)*a);0===h[l];h.pop(),l--);if(l<0)h=[n=0];else{for(n=-1;0===h[0];h.splice(0,1),n-=c);for(l=1,a=h[0];a>=10;a/=10,l++);l<c&&(n-=c-l)}return d.e=n,d.c=h,d}),H.sum=function(){for(var e=1,t=arguments,r=new H(t[0]);e<t.length;)r=r.plus(t[e++]);return r},_=function(){var e="0123456789";function t(e,t,r,n){for(var o,i,s=[0],u=0,a=e.length;u<a;){for(i=s.length;i--;s[i]*=t);for(s[0]+=n.indexOf(e.charAt(u++)),o=0;o<s.length;o++)s[o]>r-1&&(null==s[o+1]&&(s[o+1]=0),s[o+1]+=s[o]/r|0,s[o]%=r)}return s.reverse()}return function(n,o,i,s,u){var a,c,l,f,h,p,d,g,y=n.indexOf("."),b=C,v=U;for(y>=0&&(f=I,I=0,n=n.replace(".",""),p=(g=new H(o)).pow(n.length-y),I=f,g.c=t(w(m(p.c),p.e,"0"),10,i,e),g.e=g.c.length),l=f=(d=t(n,o,i,u?(a=q,e):(a=e,q))).length;0==d[--f];d.pop());if(!d[0])return a.charAt(0);if(y<0?--l:(p.c=d,p.e=l,p.s=s,d=(p=r(p,g,b,v,i)).c,h=p.r,l=p.e),y=d[c=l+b+1],f=i/2,h=h||c<0||null!=d[c+1],h=v<4?(null!=y||h)&&(0==v||v==(p.s<0?3:2)):y>f||y==f&&(4==v||h||6==v&&1&d[c-1]||v==(p.s<0?8:7)),c<1||!d[0])n=h?w(a.charAt(1),-b,a.charAt(0)):a.charAt(0);else{if(d.length=c,h)for(--i;++d[--c]>i;)d[c]=0,c||(++l,d=[1].concat(d));for(f=d.length;!d[--f];);for(y=0,n="";y<=f;n+=a.charAt(d[y++]));n=w(n,l,a.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,o,i,s,u=0,a=e.length,c=t%h,l=t/h|0;for(e=e.slice();a--;)u=((o=c*(i=e[a]%h)+(n=l*i+(s=e[a]/h|0)*c)%h*h+u)/r|0)+(n/h|0)+l*s,e[a]=o%r;return u&&(e=[u].concat(e)),e}function t(e,t,r,n){var o,i;if(r!=n)i=r>n?1:-1;else for(o=i=0;o<r;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function r(e,t,r,n){for(var o=0;r--;)e[r]-=o,o=e[r]<t[r]?1:0,e[r]=o*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,o,s,u,l){var f,h,p,m,g,y,b,v,w,_,O,N,A,S,E,B,P,T=n.s==o.s?1:-1,x=n.c,j=o.c;if(!(x&&x[0]&&j&&j[0]))return new H(n.s&&o.s&&(x?!j||x[0]!=j[0]:j)?x&&0==x[0]||!j?0*T:T/0:NaN);for(w=(v=new H(T)).c=[],T=s+(h=n.e-o.e)+1,l||(l=a,h=d(n.e/c)-d(o.e/c),T=T/c|0),p=0;j[p]==(x[p]||0);p++);if(j[p]>(x[p]||0)&&h--,T<0)w.push(1),m=!0;else{for(S=x.length,B=j.length,p=0,T+=2,(g=i(l/(j[0]+1)))>1&&(j=e(j,g,l),x=e(x,g,l),B=j.length,S=x.length),A=B,O=(_=x.slice(0,B)).length;O<B;_[O++]=0);P=j.slice(),P=[0].concat(P),E=j[0],j[1]>=l/2&&E++;do{if(g=0,(f=t(j,_,B,O))<0){if(N=_[0],B!=O&&(N=N*l+(_[1]||0)),(g=i(N/E))>1)for(g>=l&&(g=l-1),b=(y=e(j,g,l)).length,O=_.length;1==t(y,_,b,O);)g--,r(y,B<b?P:j,b,l),b=y.length,f=1;else 0==g&&(f=g=1),b=(y=j.slice()).length;if(b<O&&(y=[0].concat(y)),r(_,y,O,l),O=_.length,-1==f)for(;t(j,_,B,O)<1;)g++,r(_,B<O?P:j,O,l),O=_.length}else 0===f&&(g++,_=[0]);w[p++]=g,_[0]?_[O++]=x[A]||0:(_=[x[A]],O=1)}while((A++<S||null!=_[0])&&T--);m=null!=_[0],w[0]||w.splice(0,1)}if(l==a){for(p=1,T=w[0];T>=10;T/=10,p++);W(v,s+(v.e=p+h*c-1)+1,u,m)}else v.e=h,v.r=+m;return v}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,B=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,T=/^\s*\+(?=[\w.])|^\s+|\s+$/g,O=function(e,t,r,n){var o,i=r?t:t.replace(T,"");if(P.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!r&&(i=i.replace(S,(function(e,t,r){return o="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=o?e:t})),n&&(o=n,i=i.replace(E,"$1").replace(B,"0.$1")),t!=i))return new H(i,o);if(H.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return g(this,new H(e,t))},x.decimalPlaces=x.dp=function(e,t){var r,n,o,i=this;if(null!=e)return y(e,0,p),null==t?t=U:y(t,0,8),W(new H(i),e+i.e+1,t);if(!(r=i.c))return null;if(n=((o=r.length-1)-d(this.e/c))*c,o=r[o])for(;o%10==0;o/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(e,t){return r(this,new H(e,t),C,U)},x.dividedToIntegerBy=x.idiv=function(e,t){return r(this,new H(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var r,n,u,a,l,f,h,p,d=this;if((e=new H(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+G(e));if(null!=t&&(t=new H(t)),l=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return p=new H(Math.pow(+G(d),l?2-b(e):+G(e))),t?p.mod(t):p;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);(n=!f&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||l&&d.c[1]>=24e7:d.c[0]<8e13||l&&d.c[0]<=9999975e7)))return a=d.s<0&&b(e)?-0:0,d.e>-1&&(a=1/a),new H(f?1/a:a);I&&(a=o(I/c+2))}for(l?(r=new H(.5),f&&(e.s=1),h=b(e)):h=(u=Math.abs(+G(e)))%2,p=new H(j);;){if(h){if(!(p=p.times(d)).c)break;a?p.c.length>a&&(p.c.length=a):n&&(p=p.mod(t))}if(u){if(0===(u=i(u/2)))break;h=u%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)h=b(e);else{if(0==(u=+G(e)))break;h=u%2}d=d.times(d),a?d.c&&d.c.length>a&&(d.c.length=a):n&&(d=d.mod(t))}return n?p:(f&&(p=j.div(p)),t?p.mod(t):a?W(p,I,U,void 0):p)},x.integerValue=function(e){var t=new H(this);return null==e?e=U:y(e,0,8),W(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===g(this,new H(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return g(this,new H(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=g(this,new H(e,t)))||0===t},x.isInteger=function(){return!!this.c&&d(this.e/c)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return g(this,new H(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=g(this,new H(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var r,n,o,i,s=this,u=s.s;if(t=(e=new H(e,t)).s,!u||!t)return new H(NaN);if(u!=t)return e.s=-t,s.plus(e);var l=s.e/c,f=e.e/c,h=s.c,p=e.c;if(!l||!f){if(!h||!p)return h?(e.s=-t,e):new H(p?s:NaN);if(!h[0]||!p[0])return p[0]?(e.s=-t,e):new H(h[0]?s:3==U?-0:0)}if(l=d(l),f=d(f),h=h.slice(),u=l-f){for((i=u<0)?(u=-u,o=h):(f=l,o=p),o.reverse(),t=u;t--;o.push(0));o.reverse()}else for(n=(i=(u=h.length)<(t=p.length))?u:t,u=t=0;t<n;t++)if(h[t]!=p[t]){i=h[t]<p[t];break}if(i&&(o=h,h=p,p=o,e.s=-e.s),(t=(n=p.length)-(r=h.length))>0)for(;t--;h[r++]=0);for(t=a-1;n>u;){if(h[--n]<p[n]){for(r=n;r&&!h[--r];h[r]=t);--h[r],h[n]+=a}h[n]-=p[n]}for(;0==h[0];h.splice(0,1),--f);return h[0]?V(e,h,f):(e.s=3==U?-1:1,e.c=[e.e=0],e)},x.modulo=x.mod=function(e,t){var n,o,i=this;return e=new H(e,t),!i.c||!e.s||e.c&&!e.c[0]?new H(NaN):!e.c||i.c&&!i.c[0]?new H(i):(9==D?(o=e.s,e.s=1,n=r(i,e,0,3),e.s=o,n.s*=o):n=r(i,e,0,D),(e=i.minus(n.times(e))).c[0]||1!=D||(e.s=i.s),e)},x.multipliedBy=x.times=function(e,t){var r,n,o,i,s,u,l,f,p,m,g,y,b,v,w,_=this,O=_.c,N=(e=new H(e,t)).c;if(!(O&&N&&O[0]&&N[0]))return!_.s||!e.s||O&&!O[0]&&!N||N&&!N[0]&&!O?e.c=e.e=e.s=null:(e.s*=_.s,O&&N?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=d(_.e/c)+d(e.e/c),e.s*=_.s,(l=O.length)<(m=N.length)&&(b=O,O=N,N=b,o=l,l=m,m=o),o=l+m,b=[];o--;b.push(0));for(v=a,w=h,o=m;--o>=0;){for(r=0,g=N[o]%w,y=N[o]/w|0,i=o+(s=l);i>o;)r=((f=g*(f=O[--s]%w)+(u=y*f+(p=O[s]/w|0)*g)%w*w+b[i]+r)/v|0)+(u/w|0)+y*p,b[i--]=f%v;b[i]=r}return r?++n:b.splice(0,1),V(e,b,n)},x.negated=function(){var e=new H(this);return e.s=-e.s||null,e},x.plus=function(e,t){var r,n=this,o=n.s;if(t=(e=new H(e,t)).s,!o||!t)return new H(NaN);if(o!=t)return e.s=-t,n.minus(e);var i=n.e/c,s=e.e/c,u=n.c,l=e.c;if(!i||!s){if(!u||!l)return new H(o/0);if(!u[0]||!l[0])return l[0]?e:new H(u[0]?n:0*o)}if(i=d(i),s=d(s),u=u.slice(),o=i-s){for(o>0?(s=i,r=l):(o=-o,r=u),r.reverse();o--;r.push(0));r.reverse()}for((o=u.length)-(t=l.length)<0&&(r=l,l=u,u=r,t=o),o=0;t;)o=(u[--t]=u[t]+l[t]+o)/a|0,u[t]=a===u[t]?0:u[t]%a;return o&&(u=[o].concat(u),++s),V(e,u,s)},x.precision=x.sd=function(e,t){var r,n,o,i=this;if(null!=e&&e!==!!e)return y(e,1,p),null==t?t=U:y(t,0,8),W(new H(i),e,t);if(!(r=i.c))return null;if(n=(o=r.length-1)*c+1,o=r[o]){for(;o%10==0;o/=10,n--);for(o=r[0];o>=10;o/=10,n++);}return e&&i.e+1>n&&(n=i.e+1),n},x.shiftedBy=function(e){return y(e,-9007199254740991,l),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,o,i,s=this,u=s.c,a=s.s,c=s.e,l=C+4,f=new H("0.5");if(1!==a||!u||!u[0])return new H(!a||a<0&&(!u||u[0])?NaN:u?s:1/0);if(0==(a=Math.sqrt(+G(s)))||a==1/0?(((t=m(u)).length+c)%2==0&&(t+="0"),a=Math.sqrt(+t),c=d((c+1)/2)-(c<0||c%2),n=new H(t=a==1/0?"5e"+c:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new H(a+""),n.c[0])for((a=(c=n.e)+l)<3&&(a=0);;)if(i=n,n=f.times(i.plus(r(s,i,l,1))),m(i.c).slice(0,a)===(t=m(n.c)).slice(0,a)){if(n.e<c&&--a,"9999"!=(t=t.slice(a-3,a+1))&&(o||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(W(n,n.e+C+2,1),e=!n.times(n).eq(s));break}if(!o&&(W(i,i.e+C+2,0),i.times(i).eq(s))){n=i;break}l+=4,a+=4,o=1}return W(n,n.e+C+1,U,e)},x.toExponential=function(e,t){return null!=e&&(y(e,0,p),e++),z(this,e,t,1)},x.toFixed=function(e,t){return null!=e&&(y(e,0,p),e=e+this.e+1),z(this,e,t)},x.toFormat=function(e,t,r){var n,o=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=$;else if("object"!=typeof r)throw Error(s+"Argument not an object: "+r);if(n=o.toFixed(e,t),o.c){var i,u=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",f=u[0],h=u[1],p=o.s<0,d=p?f.slice(1):f,m=d.length;if(c&&(i=a,a=c,c=i,m-=i),a>0&&m>0){for(i=m%a||a,f=d.substr(0,i);i<m;i+=a)f+=l+d.substr(i,a);c>0&&(f+=l+d.slice(i)),p&&(f="-"+f)}n=h?f+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):f}return(r.prefix||"")+n+(r.suffix||"")},x.toFraction=function(e){var t,n,o,i,u,a,l,h,p,d,g,y,b=this,v=b.c;if(null!=e&&(!(l=new H(e)).isInteger()&&(l.c||1!==l.s)||l.lt(j)))throw Error(s+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+G(l));if(!v)return new H(b);for(t=new H(j),p=n=new H(j),o=h=new H(j),y=m(v),u=t.e=y.length-b.e-1,t.c[0]=f[(a=u%c)<0?c+a:a],e=!e||l.comparedTo(t)>0?u>0?t:p:l,a=F,F=1/0,l=new H(y),h.c[0]=0;d=r(l,t,0,1),1!=(i=n.plus(d.times(o))).comparedTo(e);)n=o,o=i,p=h.plus(d.times(i=p)),h=i,t=l.minus(d.times(i=t)),l=i;return i=r(e.minus(n),o,0,1),h=h.plus(i.times(p)),n=n.plus(i.times(o)),h.s=p.s=b.s,g=r(p,o,u*=2,U).minus(b).abs().comparedTo(r(h,n,u,U).minus(b).abs())<1?[p,o]:[h,n],F=a,g},x.toNumber=function(){return+G(this)},x.toPrecision=function(e,t){return null!=e&&y(e,1,p),z(this,e,t,2)},x.toString=function(e){var t,r=this,n=r.s,o=r.e;return null===o?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=o<=M||o>=L?v(m(r.c),o):w(m(r.c),o,"0"):10===e?t=w(m((r=W(new H(r),C+o+1,U)).c),r.e,"0"):(y(e,2,q.length,"Base"),t=_(w(m(r.c),o,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return G(this)},x._isBigNumber=!0,x[Symbol.toStringTag]="BigNumber",x[Symbol.for("nodejs.util.inspect.custom")]=x.valueOf,null!=t&&H.set(t),H}();const O=_},165:(e,t,r)=>{const n=r(854),o=n.default||n,i=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),o.call(this,e,t)};i.ponyfill=!0,e.exports=t=i,t.fetch=i,t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response,t.default=i},854:(e,t,r)=>{"use strict";r.r(t),r.d(t,{FetchError:()=>h,Headers:()=>T,Request:()=>H,Response:()=>F,default:()=>G});const n=require("stream"),o=require("http"),i=require("url"),s=require("https"),u=require("zlib"),a=n.Readable,c=Symbol("buffer"),l=Symbol("type");class f{constructor(){this[l]="";const e=arguments[0],t=arguments[1],r=[];let n=0;if(e){const t=e,o=Number(t.length);for(let e=0;e<o;e++){const o=t[e];let i;i=o instanceof Buffer?o:ArrayBuffer.isView(o)?Buffer.from(o.buffer,o.byteOffset,o.byteLength):o instanceof ArrayBuffer?Buffer.from(o):o instanceof f?o[c]:Buffer.from("string"==typeof o?o:String(o)),n+=i.length,r.push(i)}}this[c]=Buffer.concat(r);let o=t&&void 0!==t.type&&String(t.type).toLowerCase();o&&!/[^\u0020-\u007E]/.test(o)&&(this[l]=o)}get size(){return this[c].length}get type(){return this[l]}text(){return Promise.resolve(this[c].toString())}arrayBuffer(){const e=this[c],t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(t)}stream(){const e=new a;return e._read=function(){},e.push(this[c]),e.push(null),e}toString(){return"[object Blob]"}slice(){const e=this.size,t=arguments[0],r=arguments[1];let n,o;n=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),o=void 0===r?e:r<0?Math.max(e+r,0):Math.min(r,e);const i=Math.max(o-n,0),s=this[c].slice(n,n+i),u=new f([],{type:arguments[2]});return u[c]=s,u}}function h(e,t,r){Error.call(this,e),this.message=e,this.type=t,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}let p;Object.defineProperties(f.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(f.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),h.prototype=Object.create(Error.prototype),h.prototype.constructor=h,h.prototype.name="FetchError";try{p=require("encoding").convert}catch(e){}const d=Symbol("Body internals"),m=n.PassThrough;function g(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.size;let i=void 0===o?0:o;var s=r.timeout;let u=void 0===s?0:s;null==e?e=null:b(e)?e=Buffer.from(e.toString()):v(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof n||(e=Buffer.from(String(e)))),this[d]={body:e,disturbed:!1,error:null},this.size=i,this.timeout=u,e instanceof n&&e.on("error",(function(e){const r="AbortError"===e.name?e:new h(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[d].error=r}))}function y(){var e=this;if(this[d].disturbed)return g.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[d].disturbed=!0,this[d].error)return g.Promise.reject(this[d].error);let t=this.body;if(null===t)return g.Promise.resolve(Buffer.alloc(0));if(v(t)&&(t=t.stream()),Buffer.isBuffer(t))return g.Promise.resolve(t);if(!(t instanceof n))return g.Promise.resolve(Buffer.alloc(0));let r=[],o=0,i=!1;return new g.Promise((function(n,s){let u;e.timeout&&(u=setTimeout((function(){i=!0,s(new h(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))}),e.timeout)),t.on("error",(function(t){"AbortError"===t.name?(i=!0,s(t)):s(new h(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))})),t.on("data",(function(t){if(!i&&null!==t){if(e.size&&o+t.length>e.size)return i=!0,void s(new h(`content size at ${e.url} over limit: ${e.size}`,"max-size"));o+=t.length,r.push(t)}})),t.on("end",(function(){if(!i){clearTimeout(u);try{n(Buffer.concat(r,o))}catch(t){s(new h(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}}))}))}function b(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function v(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function w(e){let t,r,o=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof n&&"function"!=typeof o.getBoundary&&(t=new m,r=new m,o.pipe(t),o.pipe(r),e[d].body=t,o=r),o}function _(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":b(e)?"application/x-www-form-urlencoded;charset=UTF-8":v(e)?e.type||null:Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?`multipart/form-data;boundary=${e.getBoundary()}`:e instanceof n?null:"text/plain;charset=UTF-8"}function O(e){const t=e.body;return null===t?0:v(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}g.prototype={get body(){return this[d].body},get bodyUsed(){return this[d].disturbed},arrayBuffer(){return y.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return y.call(this).then((function(t){return Object.assign(new f([],{type:e.toLowerCase()}),{[c]:t})}))},json(){var e=this;return y.call(this).then((function(t){try{return JSON.parse(t.toString())}catch(t){return g.Promise.reject(new h(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}}))},text(){return y.call(this).then((function(e){return e.toString()}))},buffer(){return y.call(this)},textConverted(){var e=this;return y.call(this).then((function(t){return function(e,t){if("function"!=typeof p)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=t.get("content-type");let n,o,i="utf-8";return r&&(n=/charset=([^;]*)/i.exec(r)),o=e.slice(0,1024).toString(),!n&&o&&(n=/<meta.+?charset=(['"])(.+?)\1/i.exec(o)),!n&&o&&(n=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(o),n||(n=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(o),n&&n.pop()),n&&(n=/charset=(.*)/i.exec(n.pop()))),!n&&o&&(n=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(o)),n&&(i=n.pop(),"gb2312"!==i&&"gbk"!==i||(i="gb18030")),p(e,"UTF-8",i).toString()}(t,e.headers)}))}},Object.defineProperties(g.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),g.mixIn=function(e){for(const t of Object.getOwnPropertyNames(g.prototype))if(!(t in e)){const r=Object.getOwnPropertyDescriptor(g.prototype,t);Object.defineProperty(e,t,r)}},g.Promise=global.Promise;const N=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,A=/[^\t\x20-\x7e\x80-\xff]/;function S(e){if(e=`${e}`,N.test(e)||""===e)throw new TypeError(`${e} is not a legal HTTP header name`)}function E(e){if(e=`${e}`,A.test(e))throw new TypeError(`${e} is not a legal HTTP header value`)}function B(e,t){t=t.toLowerCase();for(const r in e)if(r.toLowerCase()===t)return r}const P=Symbol("map");class T{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[P]=Object.create(null),e instanceof T){const t=e.raw(),r=Object.keys(t);for(const e of r)for(const r of t[e])this.append(e,r)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const r=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(t))}for(const e of r){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const r=e[t];this.append(t,r)}}}}get(e){S(e=`${e}`);const t=B(this[P],e);return void 0===t?null:this[P][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=x(this),n=0;for(;n<r.length;){var o=r[n];const i=o[0],s=o[1];e.call(t,s,i,this),r=x(this),n++}}set(e,t){t=`${t}`,S(e=`${e}`),E(t);const r=B(this[P],e);this[P][void 0!==r?r:e]=[t]}append(e,t){t=`${t}`,S(e=`${e}`),E(t);const r=B(this[P],e);void 0!==r?this[P][r].push(t):this[P][e]=[t]}has(e){return S(e=`${e}`),void 0!==B(this[P],e)}delete(e){S(e=`${e}`);const t=B(this[P],e);void 0!==t&&delete this[P][t]}raw(){return this[P]}keys(){return C(this,"key")}values(){return C(this,"value")}[Symbol.iterator](){return C(this,"key+value")}}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";const r=Object.keys(e[P]).sort();return r.map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[P][t].join(", ")}:function(t){return[t.toLowerCase(),e[P][t].join(", ")]})}T.prototype.entries=T.prototype[Symbol.iterator],Object.defineProperty(T.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(T.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const j=Symbol("internal");function C(e,t){const r=Object.create(U);return r[j]={target:e,kind:t,index:0},r}const U=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==U)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[j];const t=e.target,r=e.kind,n=e.index,o=x(t,r);return n>=o.length?{value:void 0,done:!0}:(this[j].index=n+1,{value:o[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function M(e){const t=Object.assign({__proto__:null},e[P]),r=B(e[P],"Host");return void 0!==r&&(t[r]=t[r][0]),t}Object.defineProperty(U,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const L=Symbol("Response internals"),R=o.STATUS_CODES;class F{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g.call(this,e,t);const r=t.status||200,n=new T(t.headers);if(null!=e&&!n.has("Content-Type")){const t=_(e);t&&n.append("Content-Type",t)}this[L]={url:t.url,status:r,statusText:t.statusText||R[r],headers:n,counter:t.counter}}get url(){return this[L].url||""}get status(){return this[L].status}get ok(){return this[L].status>=200&&this[L].status<300}get redirected(){return this[L].counter>0}get statusText(){return this[L].statusText}get headers(){return this[L].headers}clone(){return new F(w(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}g.mixIn(F.prototype),Object.defineProperties(F.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(F.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const k=Symbol("Request internals"),D=i.parse,I=i.format,$="destroy"in n.Readable.prototype;function q(e){return"object"==typeof e&&"object"==typeof e[k]}class H{constructor(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};q(e)?t=D(e.url):(t=e&&e.href?D(e.href):D(`${e}`),e={});let n=r.method||e.method||"GET";if(n=n.toUpperCase(),(null!=r.body||q(e)&&null!==e.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let o=null!=r.body?r.body:q(e)&&null!==e.body?w(e):null;g.call(this,o,{timeout:r.timeout||e.timeout||0,size:r.size||e.size||0});const i=new T(r.headers||e.headers||{});if(null!=o&&!i.has("Content-Type")){const e=_(o);e&&i.append("Content-Type",e)}let s=q(e)?e.signal:null;if("signal"in r&&(s=r.signal),null!=s&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[k]={method:n,redirect:r.redirect||e.redirect||"follow",headers:i,parsedURL:t,signal:s},this.follow=void 0!==r.follow?r.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===e.compress||e.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent}get method(){return this[k].method}get url(){return I(this[k].parsedURL)}get headers(){return this[k].headers}get redirect(){return this[k].redirect}get signal(){return this[k].signal}clone(){return new H(this)}}function z(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}g.mixIn(H.prototype),Object.defineProperty(H.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(H.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),z.prototype=Object.create(Error.prototype),z.prototype.constructor=z,z.prototype.name="AbortError";const J=n.PassThrough,V=i.resolve;function W(e,t){if(!W.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return g.Promise=W.Promise,new W.Promise((function(r,i){const a=new H(e,t),c=function(e){const t=e[k].parsedURL,r=new T(e[k].headers);if(r.has("Accept")||r.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof n.Readable&&!$)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let o=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(o="0"),null!=e.body){const t=O(e);"number"==typeof t&&(o=String(t))}o&&r.set("Content-Length",o),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=e.agent;return"function"==typeof i&&(i=i(t)),r.has("Connection")||i||r.set("Connection","close"),Object.assign({},t,{method:e.method,headers:M(r),agent:i})}(a),l=("https:"===c.protocol?s:o).request,f=a.signal;let p=null;const d=function(){let e=new z("The user aborted a request.");i(e),a.body&&a.body instanceof n.Readable&&a.body.destroy(e),p&&p.body&&p.body.emit("error",e)};if(f&&f.aborted)return void d();const m=function(){d(),b()},g=l(c);let y;function b(){g.abort(),f&&f.removeEventListener("abort",m),clearTimeout(y)}f&&f.addEventListener("abort",m),a.timeout&&g.once("socket",(function(e){y=setTimeout((function(){i(new h(`network timeout at: ${a.url}`,"request-timeout")),b()}),a.timeout)})),g.on("error",(function(e){i(new h(`request to ${a.url} failed, reason: ${e.message}`,"system",e)),b()})),g.on("response",(function(e){clearTimeout(y);const t=function(e){const t=new T;for(const r of Object.keys(e))if(!N.test(r))if(Array.isArray(e[r]))for(const n of e[r])A.test(n)||(void 0===t[P][r]?t[P][r]=[n]:t[P][r].push(n));else A.test(e[r])||(t[P][r]=[e[r]]);return t}(e.headers);if(W.isRedirect(e.statusCode)){const n=t.get("Location"),o=null===n?null:V(a.url,n);switch(a.redirect){case"error":return i(new h(`uri requested responds with a redirect, redirect mode is set to error: ${a.url}`,"no-redirect")),void b();case"manual":if(null!==o)try{t.set("Location",o)}catch(e){i(e)}break;case"follow":if(null===o)break;if(a.counter>=a.follow)return i(new h(`maximum redirect reached at: ${a.url}`,"max-redirect")),void b();const n={headers:new T(a.headers),follow:a.follow,counter:a.counter+1,agent:a.agent,compress:a.compress,method:a.method,body:a.body,signal:a.signal,timeout:a.timeout,size:a.size};return 303!==e.statusCode&&a.body&&null===O(a)?(i(new h("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void b()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==a.method)||(n.method="GET",n.body=void 0,n.headers.delete("content-length")),r(W(new H(o,n))),void b())}}e.once("end",(function(){f&&f.removeEventListener("abort",m)}));let n=e.pipe(new J);const o={url:a.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:a.size,timeout:a.timeout,counter:a.counter},s=t.get("Content-Encoding");if(!a.compress||"HEAD"===a.method||null===s||204===e.statusCode||304===e.statusCode)return p=new F(n,o),void r(p);const c={flush:u.Z_SYNC_FLUSH,finishFlush:u.Z_SYNC_FLUSH};if("gzip"==s||"x-gzip"==s)return n=n.pipe(u.createGunzip(c)),p=new F(n,o),void r(p);if("deflate"!=s&&"x-deflate"!=s){if("br"==s&&"function"==typeof u.createBrotliDecompress)return n=n.pipe(u.createBrotliDecompress()),p=new F(n,o),void r(p);p=new F(n,o),r(p)}else e.pipe(new J).once("data",(function(e){n=8==(15&e[0])?n.pipe(u.createInflate()):n.pipe(u.createInflateRaw()),p=new F(n,o),r(p)}))})),function(e,t){const r=t.body;null===r?e.end():v(r)?r.stream().pipe(e):Buffer.isBuffer(r)?(e.write(r),e.end()):r.pipe(e)}(g,a)}))}W.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},W.Promise=global.Promise;const G=W},382:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Assets=void 0;const o=r(593),i=r(165);t.Assets=class{constructor(e="https://waves.exchange/api/v1",t="https://waves.exchange/static/icons/assets"){this.assets=Object.create(null),this._assetsPromise=Object.create(null),this.iconUrl=t,this.dataServicesUrl=e}getAssets(e){return n(this,void 0,void 0,(function*(){const t=e.filter((e=>!this.assets[e]||!this._assetsPromise[e])),r=e.filter((e=>this._assetsPromise[e])).map((e=>this._assetsPromise[e].promise));for(;;)try{const e=this._fetchAssets(t).then((e=>(e.forEach((e=>{this.assets[e.id]=e})),e)));t.forEach(((t,r)=>{this._assetsPromise[t]={promise:e,index:r}})),yield Promise.all([e,...r]);break}catch(e){yield o.waitPromise(5e3)}return e.map((e=>this.assets[e]))}))}_fetchAssets(e){return i.default(`${this.dataServicesUrl}/assets`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e})}).then((e=>{if(e.status>=400)throw new Error("Bad response from server");return e.text()})).then(o.parseJSON).then((e=>e.data)).then((e=>e.map((e=>o.convertToExtendedAsset(e,this.iconUrl)))))}}},811:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Balance=void 0;const o=r(165),i=r(593),s=r(717),u=r(382);t.Balance=class{constructor(e){this.balances=Object.create(null),this.feeList=[],this.hasData=!1,this._onUpdateCbs=[],this._poll=null;const{address:t,iconUrl:r="https://waves.exchange/static/icons/assets",dataServicesUrl:n="https://waves.exchange/api/v1",nodeUrl:o="https://nodes.waves.exchange",updateBalancesMs:i=null}=e;this._assets=new u.Assets(n,r),this.address=t,this.dataServicesUrl=n,this.nodeUrl=o,i?this._updateBalances(i):this._readyPromise=this._init()}destroy(){this.offUpdate(),this._poll&&(this._poll.stop(),this._poll=null)}getFeesByCoins(e){return n(this,void 0,void 0,(function*(){yield this._readyPromise;const t=e instanceof i.MyMoney?e.getCoins():e;return s.getFeesByWavesMoney(this.feeList,new i.MyMoney(t,this._wavesAsset))}))}getFees(e){return n(this,void 0,void 0,(function*(){return yield this._readyPromise,s.getFeeByTx(this._wavesAsset,this.feeList,e,this.nodeUrl)}))}getBalances(){return n(this,void 0,void 0,(function*(){if(this._readyPromise)return this._readyPromise;this._readyPromise=this._init()}))}onUpdate(e){this._onUpdateCbs.push(e)}offUpdate(e){this._onUpdateCbs=e?this._onUpdateCbs.filter((t=>t!==e)):[]}_getBalances(){return n(this,void 0,void 0,(function*(){const e=yield this._fetchWavesBalances(),{balances:t}=yield this._fetchBalances(),r=(t||[]).map((e=>e.assetId)),n=yield this._assets.getAssets(["WAVES",...r]),o=i.toHash(n,"id");this._wavesAsset=o.WAVES;const s=new i.MyMoney(e.available,o.WAVES),u=t.reduce(((e,t)=>{const r=o[t.assetId];return e[t.assetId]=new i.MyMoney(t.balance,r),e}),Object.create(null)),a=Object.assign(Object.assign({},u),{WAVES:s}),c=this._getDiff(a);if(this.hasData=!0,!c)return null;this.balances=a,this.feeList=Object.values(this.balances).filter((e=>"WAVES"===e.asset.id||Number(e.asset.minSponsoredFee)>0)),this._onUpdate(c)}))}_fetchWavesBalances(){return n(this,void 0,void 0,(function*(){return yield o.default(`${this.nodeUrl}/addresses/balance/details/${this.address}`).then((e=>{if(e.status>=400)throw new Error("Bad response from server");return e.text()})).then(i.parseJSON)}))}_fetchBalances(){return n(this,void 0,void 0,(function*(){return yield o.default(`${this.nodeUrl}/assets/balance/${this.address}`).then((e=>{if(e.status>=400)throw new Error("Bad response from server");return e.text()})).then(i.parseJSON)}))}_getDiff(e){const t=Object.values(this.balances),r=Object.values(e),n=t.length>r.length,o=n?t:r,s=n?e:this.balances;return o.reduce(((e,t)=>{const r=t.asset.id,o=s[r];return o?(o.eq(t)||((e=e||Object.create(null))[r]=n?o:t),e):((e=e||Object.create(null))[r]=n?new i.MyMoney(0,t.asset):t,e)}),null)}_init(){return n(this,void 0,void 0,(function*(){for(;;)try{yield this._getBalances();break}catch(e){console.error("Retry Fetch Balances",e),yield i.waitPromise(5e3)}}))}_onUpdate(e){this._onUpdateCbs.forEach((t=>t(this.balances,e)))}_updateBalances(e){this._poll=new i.Poll(e,(()=>(this._readyPromise=null,this._readyPromise=this.getBalances(),this._readyPromise))),this._poll.start()}}},717:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getFeeByTx=t.getFeesByWavesMoney=void 0;const o=r(165),i=r(593);t.getFeesByWavesMoney=(e,t)=>{const r=t.getCoins().div(1e5).roundTo(0,0);return e.reduce(((e,n)=>{if("WAVES"===n.asset.id)e.push(t);else{const t=n.cloneWithTokens(n.getTokens().mul(r));t.lte(n)&&e.push(t)}return e}),[])},t.getFeeByTx=(e,r,s,u="https://nodes.waves.exchange")=>n(void 0,void 0,void 0,(function*(){const{feeAmount:n}=yield o.default(`${u}/transactions/calculateFee`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign(Object.assign({},s),{feeAssetId:null}))}).then((e=>{if(e.status>=400)throw new Error("Bad response from server");return e.text()})).then(i.parseJSON),a=new i.MyMoney(n,e);return t.getFeesByWavesMoney(r,a)}))},593:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Poll=t.waitPromise=t.convertToExtendedAsset=t.MyMoney=t.parseJSON=t.toHash=void 0;const o=r(739);t.toHash=(e,t)=>e.reduce(((e,r)=>(e[String(r[t])]=r,e)),Object.create(null));const i=new RegExp('((?!\\\\)"\\w+"):\\s*(-?[\\d|.]{14,}(e-?\\d+)?)',"g");t.parseJSON=function(e){return JSON.parse(e.replace(i,'$1:"$2"'))};class s extends o.Money{constructor(e,t){super(e,t)}}t.MyMoney=s,t.convertToExtendedAsset=(e,t)=>{const{data:r,metadata:n}=e,{has_script:i,description:s,min_sponsored_fee:u,height:a,id:c,name:l,precision:f,quantity:h,reissuable:p,sender:d,ticker:m,timestamp:g}=r,y=new o.Asset({id:c,height:a,name:l,precision:f,description:s,quantity:h,reissuable:p,sender:d,ticker:m,timestamp:new Date(g),hasScript:i,minSponsoredFee:u});return Object.assign(y,{hasImage:n.has_image,icon:n.has_image?`${t}/${y.id}.svg`:null,verifiedStatus:n.verified_status})},t.waitPromise=e=>new Promise((t=>setTimeout(t,e))),t.Poll=class{constructor(e,t,r){this.timeMs=e,this.isWorked=!1,this._cb=t,this._cbOut=r}start(){this.isWorked=!0,this._start()}stop(){this.isWorked=!1}_start(){return n(this,void 0,void 0,(function*(){for(;;){if(!this.isWorked)return;try{const e=yield this._cb();this._cbOut&&this._cbOut(e)}catch(e){}yield t.waitPromise(this.timeMs)}}))}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";r(811),r(382),r(593)})()})(); | ||
(()=>{var e={689:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(905)),i=r(663),s=function(){function e(t){"object"==typeof t&&e.isBigNumber(t)?this.bn=t.bn.plus(0):this.bn=e.toBigNumberJs(t)}return e.prototype.clone=function(){return new e(this)},e.prototype.add=function(t){return new e(this.bn.plus(e.toBigNumberJs(t)))},e.prototype.sub=function(t){return new e(this.bn.minus(e.toBigNumberJs(t)))},e.prototype.mul=function(t){return new e(this.bn.times(e.toBigNumberJs(t)))},e.prototype.div=function(t){return new e(this.bn.div(e.toBigNumberJs(t)))},e.prototype.pow=function(t){return new e(this.bn.pow(e.toBigNumberJs(t)))},e.prototype.sqrt=function(){return new e(this.bn.sqrt())},e.prototype.abs=function(){return new e(this.bn.abs())},e.prototype.mod=function(t){return new e(this.bn.mod(e.toBigNumberJs(t)))},e.prototype.roundTo=function(t,r){return void 0===t&&(t=0),void 0===r&&(r=4),new e(this.bn.dp(t||0,r))},e.prototype.eq=function(t){return this.bn.eq(e.toBigNumberJs(t))},e.prototype.lt=function(t){return this.bn.lt(e.toBigNumberJs(t))},e.prototype.gt=function(t){return this.bn.gt(e.toBigNumberJs(t))},e.prototype.lte=function(t){return this.bn.lte(e.toBigNumberJs(t))},e.prototype.gte=function(t){return this.bn.gte(e.toBigNumberJs(t))},e.prototype.isNaN=function(){return this.bn.isNaN()},e.prototype.isFinite=function(){return this.bn.isFinite()},e.prototype.isZero=function(){return this.eq(0)},e.prototype.isPositive=function(){return this.gt(0)},e.prototype.isNegative=function(){return this.lt(0)},e.prototype.isInt=function(){return this.bn.isInteger()},e.prototype.getDecimalsCount=function(){return this.bn.dp()},e.prototype.isEven=function(){return this.mod(2).eq(0)},e.prototype.isOdd=function(){return!this.isEven()},e.prototype.isInSignedRange=function(){return this.gte(e.MIN_VALUE)&&this.lte(e.MAX_VALUE)},e.prototype.isInUnsignedRange=function(){return this.gte(e.MIN_UNSIGNED_VALUE)&&this.lte(e.MAX_UNSIGNED_VALUE)},e.prototype.toFormat=function(e,t,r){return this.bn.toFormat(e,t,r)},e.prototype.toFixed=function(e,t){return null==e?this.bn.toFixed():this.bn.toFixed(e,t)},e.prototype.toString=function(){return this.toFixed()},e.prototype.toNumber=function(){return this.bn.toNumber()},e.prototype.toJSON=function(){return this.bn.toFixed()},e.prototype.valueOf=function(){return this.bn.valueOf()},e.prototype.toBytes=function(t){var r=void 0===t?{}:t,n=r.isSigned,o=void 0===n||n,i=r.isLong,s=void 0===i||i;if(!this.isInt())throw new Error("Cant create bytes from number with decimals!");if(!o&&this.isNegative())throw new Error("Cant create bytes from negative number in signed mode!");if(s&&o&&!this.isInSignedRange())throw new Error("Number is not from signed numbers range");if(s&&!o&&!this.isInUnsignedRange())throw new Error("Number is not from unsigned numbers range");var u=o&&this.isNegative(),a=u?"1":"0",c=this.bn.plus(a).toString(2).replace("-",""),l=s?64:8*Math.ceil(c.length/8),f=e._toLength(l,c).split(""),h=[];do{h.push(parseInt(f.splice(0,8).join(""),2))}while(f.length);return u?Uint8Array.from(h.map((function(e){return 255-e}))):Uint8Array.from(h)},e.fromBytes=function(t,r){var n=void 0===r?{}:r,i=n.isSigned,s=void 0===i||i,u=n.isLong,a=void 0===u||u;if(a&&8!==t.length)throw new Error("Wrong bytes length! Minimal length is 8 byte!");t=!a&&t.length>0||a?t:[0];var c=!!s&&t[0]>127,l=Array.from(t).map((function(e){return c?255-e:e})).map((function(t){return e._toLength(8,t.toString(2))})).join(""),f=new e(new o.default(l,2));return c?f.mul(-1).sub(1):f},e.max=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.gte(t)?e:t}))},e.min=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.lte(t)?e:t}))},e.sum=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.toBigNumber(t).reduce((function(e,t){return e.add(t)}))},e.isBigNumber=function(t){return t&&"object"==typeof t&&(t instanceof e||Object.entries(e.prototype).filter((function(e){return"_"!==e[0].charAt(0)})).every((function(e){var r=e[0],n=e[1];return r in t&&typeof n==typeof t[r]})))},e.toBigNumber=function(t){return Array.isArray(t)?t.map((function(t){return new e(t)})):new e(t)},e.toBigNumberJs=function(t){return o.default.isBigNumber(t)?t:t instanceof e?t.bn:new o.default(t)},e._toLength=function(e,t){return new Array(e).fill("0",0,e).concat(t.split("")).slice(-e).join("")},e.MIN_VALUE=new e("-9223372036854775808"),e.MAX_VALUE=new e("9223372036854775807"),e.MIN_UNSIGNED_VALUE=new e("0"),e.MAX_UNSIGNED_VALUE=new e("18446744073709551615"),e.config=new i.Config,e}();t.BigNumber=s,function(e){var t;(t=e.ROUND_MODE||(e.ROUND_MODE={}))[t.ROUND_UP=0]="ROUND_UP",t[t.ROUND_DOWN=1]="ROUND_DOWN",t[t.ROUND_CEIL=2]="ROUND_CEIL",t[t.ROUND_FLOOR=3]="ROUND_FLOOR",t[t.ROUND_HALF_UP=4]="ROUND_HALF_UP",t[t.ROUND_HALF_DOWN=5]="ROUND_HALF_DOWN",t[t.ROUND_HALF_EVEN=6]="ROUND_HALF_EVEN",t[t.ROUND_HALF_CEIL=7]="ROUND_HALF_CEIL",t[t.ROUND_HALF_FLOOR=8]="ROUND_HALF_FLOOR"}(s=t.BigNumber||(t.BigNumber={})),t.BigNumber=s},663: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 o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=o(r(905)),s=function(){function e(){this.format=e.DEFAULT_FORMAT,i.default.config({FORMAT:this.format})}return e.prototype.set=function(e){"FORMAT"in e&&(this.format=n({},this.format,e.FORMAT),e.FORMAT=this.format),i.default.config(e)},e.DEFAULT_FORMAT={prefix:"",decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0,suffix:""},e}();t.Config=s},399:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(689);!function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(689)),t.default=n.BigNumber},466:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,n={remapAsset:function(e){return e},remapCandle:function(e){return e}};(r=t.config||(t.config={})).get=function(e){return n[e]},r.set=function e(t,r){"string"==typeof t?n[t]=r:Object.keys(t).forEach((function(r){return e(r,t[r])}))}},748:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(466),o=r(781),i=function(){function e(e){e=n.config.get("remapAsset")(e),this.quantity=o.toBigNumber(e.quantity),this.minSponsoredFee=o.toBigNumber(e.minSponsoredFee),this.ticker=e.ticker||null,this.id=e.id,this.name=e.name,this.precision=e.precision,this.description=e.description,this.height=e.height,this.timestamp=e.timestamp,this.sender=e.sender,this.reissuable=e.reissuable,this.hasScript=e.hasScript||!1,this.displayName=e.ticker||e.name}return e.prototype.toJSON=function(){return{ticker:this.ticker,id:this.id,name:this.name,precision:this.precision,description:this.description,height:this.height,timestamp:this.timestamp,sender:this.sender,quantity:this.quantity,reissuable:this.reissuable,hasScript:this.hasScript,minSponsoredFee:this.minSponsoredFee}},e.prototype.toString=function(){return this.id},e.isAsset=function(t){return t instanceof e},e}();t.Asset=i},55:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){this.amountAsset=e,this.priceAsset=t,this.precisionDifference=this.priceAsset.precision-this.amountAsset.precision}return e.prototype.toJSON=function(){return{amountAsset:this.amountAsset.id,priceAsset:this.priceAsset.id}},e.prototype.toString=function(){return this.amountAsset+"/"+this.priceAsset},e.isAssetPair=function(t){return t instanceof e},e}();t.AssetPair=r},318:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(466),o=r(781),i=function(){function e(e){var t=this;e=n.config.get("remapCandle")(e),["open","close","high","low","volume","quoteVolume","weightedAveragePrice"].forEach((function(r){return t[r]=o.toBigNumber(e[r])})),this.time=e.time,this.maxHeight=e.maxHeight,this.txsCount=e.txsCount}return e.prototype.toJSON=function(){return{time:this.time,open:this.open,close:this.close,high:this.high,low:this.low,volume:this.volume,quoteVolume:this.quoteVolume,weightedAveragePrice:this.weightedAveragePrice,maxHeight:this.maxHeight,txsCount:this.txsCount}},e.prototype.toString=function(){return"[object Candle]"},e.isCandle=function(t){return t instanceof e},e}();t.Candle=i},906:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(399),o=r(781),i=function(){function e(t,r){var n=e._getDivider(r.precision);this.asset=r,this._coins=o.toBigNumber(t).roundTo(0),this._tokens=this._coins.div(n)}return e.prototype.getCoins=function(){return this._coins.add(0)},e.prototype.getTokens=function(){return this._tokens.add(0)},e.prototype.toCoins=function(){return this._coins.toFixed(0)},e.prototype.toTokens=function(){return this._tokens.toFixed(this.asset.precision)},e.prototype.toFormat=function(e){return this._tokens.toFormat(e)},e.prototype.add=function(t){this._matchAssets(t);var r=t.getCoins();return new e(this._coins.add(r),this.asset)},e.prototype.plus=function(e){return this.add(e)},e.prototype.sub=function(t){this._matchAssets(t);var r=t.getCoins();return new e(this._coins.sub(r),this.asset)},e.prototype.minus=function(e){return this.sub(e)},e.prototype.times=function(t){return this._matchAssets(t),new e(this.getCoins().mul(t.getCoins()),this.asset)},e.prototype.div=function(t){return this._matchAssets(t),new e(this.getCoins().div(t.getCoins()),this.asset)},e.prototype.eq=function(e){return this._matchAssets(e),this._coins.eq(e.getCoins())},e.prototype.lt=function(e){return this._matchAssets(e),this._coins.lt(e.getCoins())},e.prototype.lte=function(e){return this._matchAssets(e),this._coins.lte(e.getCoins())},e.prototype.gt=function(e){return this._matchAssets(e),this._coins.gt(e.getCoins())},e.prototype.gte=function(e){return this._matchAssets(e),this._coins.gte(e.getCoins())},e.prototype.safeSub=function(e){return this.asset.id===e.asset.id?this.sub(e):this},e.prototype.toNonNegative=function(){return this.getTokens().lt(0)?this.cloneWithTokens(0):this},e.prototype.cloneWithCoins=function(t){return new e(new n.BigNumber(t),this.asset)},e.prototype.cloneWithTokens=function(t){var r=e._tokensToCoins(t,this.asset.precision);return new e(r,this.asset)},e.prototype.convertTo=function(t,r){return e.convert(this,t,o.toBigNumber(r))},e.prototype.toJSON=function(){return{assetId:this.asset.id,tokens:this.toTokens()}},e.prototype.toString=function(){return this.toTokens()+" "+this.asset.id},e.prototype._matchAssets=function(e){if(this.asset.id!==e.asset.id)throw new Error("You cannot apply arithmetic operations to Money created with different assets")},e.max=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return e.gte(t)?e:t}))},e.min=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return e.lte(t)?e:t}))},e.isMoney=function(t){return t instanceof e},e.convert=function(t,r,o){if(t.asset===r)return t;var i=t.asset.precision-r.precision,s=new n.BigNumber(10).pow(i),u=t.getCoins().mul(o).div(s).roundTo(0,1).toFixed();return new e(new n.BigNumber(u),r)},e.fromTokens=function(t,r){return new e(o.toBigNumber(t).mul(new n.BigNumber(10).pow(r.precision)),r)},e.fromCoins=function(t,r){return new e(t,r)},e._tokensToCoins=function(t,r){var o=e._getDivider(r);return t=new n.BigNumber(t).toFixed(r),new n.BigNumber(t).mul(o)},e._getDivider=function(e){return new n.BigNumber(10).pow(e)},e}();t.Money=i},454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(399),o=r(781),i=function(){function e(t,r){var n=e._getMatcherDivider(r.precisionDifference);this.pair=r,this._matcherCoins=t,this._tokens=this._matcherCoins.div(n)}return e.prototype.getMatcherCoins=function(){return this._matcherCoins.clone()},e.prototype.getTokens=function(){return this._tokens.clone()},e.prototype.toMatcherCoins=function(){return this._matcherCoins.toFixed(0)},e.prototype.toTokens=function(){return this._tokens.toFixed(this.pair.priceAsset.precision)},e.prototype.toFormat=function(){return this._tokens.toFormat(this.pair.priceAsset.precision)},e.prototype.toJSON=function(){return{amountAssetId:this.pair.amountAsset.id,priceAssetId:this.pair.priceAsset.id,priceTokens:this.toTokens()}},e.prototype.toString=function(){return this.toTokens()+" "+this.pair.amountAsset.id+"/"+this.pair.priceAsset.id},e.fromMatcherCoins=function(t,r){return e._checkAmount(t),new e(o.toBigNumber(t),r)},e.fromTokens=function(t,r){e._checkAmount(t),t=o.toBigNumber(t).toFixed(r.priceAsset.precision);var i=e._getMatcherDivider(r.precisionDifference);return new e(new n.BigNumber(t).mul(i),r)},e._getMatcherDivider=function(t){return new n.BigNumber(10).pow(t).mul(e._MATCHER_SCALE)},e.isOrderPrice=function(t){return t instanceof e},e._checkAmount=function(e){if(!(["string","number"].includes(typeof e)||e instanceof n.BigNumber))throw new Error("Please use strings to create instances of OrderPrice")},e._MATCHER_SCALE=new n.BigNumber(10).pow(8),e}();t.OrderPrice=i},739:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(748);t.Asset=n.Asset;var o=r(318);t.Candle=o.Candle;var i=r(906);t.Money=i.Money;var s=r(454);t.OrderPrice=s.OrderPrice;var u=r(55);t.AssetPair=u.AssetPair;var a=r(466);t.config=a.config},781:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(399);t.toBigNumber=function(e){return e instanceof n.BigNumber?e:new n.BigNumber(e)}},905:(e,t,r)=>{"use strict";r.r(t),r.d(t,{BigNumber:()=>_,default:()=>O});var n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,o=Math.ceil,i=Math.floor,s="[BigNumber Error] ",u=s+"Number primitive has more than 15 significant digits: ",a=1e14,c=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,p=1e9;function d(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,r,n=1,o=e.length,i=e[0]+"";n<o;){for(t=e[n++]+"",r=c-t.length;r--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function g(e,t){var r,n,o=e.c,i=t.c,s=e.s,u=t.s,a=e.e,c=t.e;if(!s||!u)return null;if(r=o&&!o[0],n=i&&!i[0],r||n)return r?n?0:-u:s;if(s!=u)return s;if(r=s<0,n=a==c,!o||!i)return n?0:!o^r?1:-1;if(!n)return a>c^r?1:-1;for(u=(a=o.length)<(c=i.length)?a:c,s=0;s<u;s++)if(o[s]!=i[s])return o[s]>i[s]^r?1:-1;return a==c?0:a>c^r?1:-1}function y(e,t,r,n){if(e<t||e>r||e!==i(e))throw Error(s+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function b(e){var t=e.c.length-1;return d(e.e/c)==t&&e.c[t]%2!=0}function v(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function w(e,t,r){var n,o;if(t<0){for(o=r+".";++t;o+=r);e=o+e}else if(++t>(n=e.length)){for(o=r,t-=n;--t;o+=r);e+=o}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var _=function e(t){var r,_,O,N,A,S,E,B,P,T,x=H.prototype={constructor:H,toString:null,valueOf:null},C=new H(1),j=20,U=4,M=-7,L=21,R=-1e7,k=1e7,F=!1,D=1,I=0,$={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz";function H(e,t){var r,o,s,a,f,h,p,d,m=this;if(!(m instanceof H))return new H(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>k?m.c=m.e=null:e.e<R?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,f=e;f>=10;f/=10,a++);return void(a>k?m.c=m.e=null:(m.e=a,m.c=[e]))}d=String(e)}else{if(!n.test(d=String(e)))return O(m,d,h);m.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(a=d.indexOf("."))>-1&&(d=d.replace(".","")),(f=d.search(/e/i))>0?(a<0&&(a=f),a+=+d.slice(f+1),d=d.substring(0,f)):a<0&&(a=d.length)}else{if(y(t,2,q.length,"Base"),10==t)return V(m=new H(e),j+m.e+1,U);if(d=String(e),h="number"==typeof e){if(0*e!=0)return O(m,d,h,t);if(m.s=1/e<0?(d=d.slice(1),-1):1,H.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(u+e)}else m.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(r=q.slice(0,t),a=f=0,p=d.length;f<p;f++)if(r.indexOf(o=d.charAt(f))<0){if("."==o){if(f>a){a=p;continue}}else if(!s&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){s=!0,f=-1,a=0;continue}return O(m,String(e),h,t)}h=!1,(a=(d=_(d,t,10,m.s)).indexOf("."))>-1?d=d.replace(".",""):a=d.length}for(f=0;48===d.charCodeAt(f);f++);for(p=d.length;48===d.charCodeAt(--p););if(d=d.slice(f,++p)){if(p-=f,h&&H.DEBUG&&p>15&&(e>l||e!==i(e)))throw Error(u+m.s*e);if((a=a-f-1)>k)m.c=m.e=null;else if(a<R)m.c=[m.e=0];else{if(m.e=a,m.c=[],f=(a+1)%c,a<0&&(f+=c),f<p){for(f&&m.c.push(+d.slice(0,f)),p-=c;f<p;)m.c.push(+d.slice(f,f+=c));f=c-(d=d.slice(f)).length}else f-=p;for(;f--;d+="0");m.c.push(+d)}}else m.c=[m.e=0]}function z(e,t,r,n){var o,i,s,u,a;if(null==r?r=U:y(r,0,8),!e.c)return e.toString();if(o=e.c[0],s=e.e,null==t)a=m(e.c),a=1==n||2==n&&(s<=M||s>=L)?v(a,s):w(a,s,"0");else if(i=(e=V(new H(e),t,r)).e,u=(a=m(e.c)).length,1==n||2==n&&(t<=i||i<=M)){for(;u<t;a+="0",u++);a=v(a,i)}else if(t-=s,a=w(a,i,"0"),i+1>u){if(--t>0)for(a+=".";t--;a+="0");}else if((t+=i-u)>0)for(i+1==u&&(a+=".");t--;a+="0");return e.s<0&&o?"-"+a:a}function W(e,t){for(var r,n=1,o=new H(e[0]);n<e.length;n++){if(!(r=new H(e[n])).s){o=r;break}t.call(o,r)&&(o=r)}return o}function J(e,t,r){for(var n=1,o=t.length;!t[--o];t.pop());for(o=t[0];o>=10;o/=10,n++);return(r=n+r*c-1)>k?e.c=e.e=null:r<R?e.c=[e.e=0]:(e.e=r,e.c=t),e}function V(e,t,r,n){var s,u,l,h,p,d,m,g=e.c,y=f;if(g){e:{for(s=1,h=g[0];h>=10;h/=10,s++);if((u=t-s)<0)u+=c,l=t,m=(p=g[d=0])/y[s-l-1]%10|0;else if((d=o((u+1)/c))>=g.length){if(!n)break e;for(;g.length<=d;g.push(0));p=m=0,s=1,l=(u%=c)-c+1}else{for(p=h=g[d],s=1;h>=10;h/=10,s++);m=(l=(u%=c)-c+s)<0?0:p/y[s-l-1]%10|0}if(n=n||t<0||null!=g[d+1]||(l<0?p:p%y[s-l-1]),n=r<4?(m||n)&&(0==r||r==(e.s<0?3:2)):m>5||5==m&&(4==r||n||6==r&&(u>0?l>0?p/y[s-l]:0:g[d-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=y[(c-t%c)%c],e.e=-t||0):g[0]=e.e=0,e;if(0==u?(g.length=d,h=1,d--):(g.length=d+1,h=y[c-u],g[d]=l>0?i(p/y[s-l]%y[l])*h:0),n)for(;;){if(0==d){for(u=1,l=g[0];l>=10;l/=10,u++);for(l=g[0]+=h,h=1;l>=10;l/=10,h++);u!=h&&(e.e++,g[0]==a&&(g[0]=1));break}if(g[d]+=h,g[d]!=a)break;g[d--]=0,h=1}for(u=g.length;0===g[--u];g.pop());}e.e>k?e.c=e.e=null:e.e<R&&(e.c=[e.e=0])}return e}function G(e){var t,r=e.e;return null===r?e.toString():(t=m(e.c),t=r<=M||r>=L?v(t,r):w(t,r,"0"),e.s<0?"-"+t:t)}return H.clone=e,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(r=e[t],0,p,t),j=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(r=e[t],0,8,t),U=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(y(r[0],-p,0,t),y(r[1],0,p,t),M=r[0],L=r[1]):(y(r,-p,p,t),M=-(L=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)y(r[0],-p,-1,t),y(r[1],1,p,t),R=r[0],k=r[1];else{if(y(r,-p,p,t),!r)throw Error(s+t+" cannot be zero: "+r);R=-(k=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(s+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!r,Error(s+"crypto unavailable");F=r}else F=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(r=e[t],0,9,t),D=r),e.hasOwnProperty(t="POW_PRECISION")&&(y(r=e[t],0,p,t),I=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(s+t+" not an object: "+r);$=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(s+t+" invalid: "+r);q=r}}return{DECIMAL_PLACES:j,ROUNDING_MODE:U,EXPONENTIAL_AT:[M,L],RANGE:[R,k],CRYPTO:F,MODULO_MODE:D,POW_PRECISION:I,FORMAT:$,ALPHABET:q}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,r,n=e.c,o=e.e,u=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===u||-1===u)&&o>=-p&&o<=p&&o===i(o)){if(0===n[0]){if(0===o&&1===n.length)return!0;break e}if((t=(o+1)%c)<1&&(t+=c),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=a||r!==i(r))break e;if(0!==r)return!0}}}else if(null===n&&null===o&&(null===u||1===u||-1===u))return!0;throw Error(s+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return W(arguments,x.lt)},H.minimum=H.min=function(){return W(arguments,x.gt)},H.random=(N=9007199254740992,A=Math.random()*N&2097151?function(){return i(Math.random()*N)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,u,a,l=0,h=[],d=new H(C);if(null==e?e=j:y(e,0,p),u=o(e/c),F)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(u*=2));l<u;)(a=131072*t[l]+(t[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(h.push(a%1e14),l+=2);l=u/2}else{if(!crypto.randomBytes)throw F=!1,Error(s+"crypto unavailable");for(t=crypto.randomBytes(u*=7);l<u;)(a=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(h.push(a%1e14),l+=7);l=u/7}if(!F)for(;l<u;)(a=A())<9e15&&(h[l++]=a%1e14);for(u=h[--l],e%=c,u&&e&&(a=f[c-e],h[l]=i(u/a)*a);0===h[l];h.pop(),l--);if(l<0)h=[n=0];else{for(n=-1;0===h[0];h.splice(0,1),n-=c);for(l=1,a=h[0];a>=10;a/=10,l++);l<c&&(n-=c-l)}return d.e=n,d.c=h,d}),H.sum=function(){for(var e=1,t=arguments,r=new H(t[0]);e<t.length;)r=r.plus(t[e++]);return r},_=function(){var e="0123456789";function t(e,t,r,n){for(var o,i,s=[0],u=0,a=e.length;u<a;){for(i=s.length;i--;s[i]*=t);for(s[0]+=n.indexOf(e.charAt(u++)),o=0;o<s.length;o++)s[o]>r-1&&(null==s[o+1]&&(s[o+1]=0),s[o+1]+=s[o]/r|0,s[o]%=r)}return s.reverse()}return function(n,o,i,s,u){var a,c,l,f,h,p,d,g,y=n.indexOf("."),b=j,v=U;for(y>=0&&(f=I,I=0,n=n.replace(".",""),p=(g=new H(o)).pow(n.length-y),I=f,g.c=t(w(m(p.c),p.e,"0"),10,i,e),g.e=g.c.length),l=f=(d=t(n,o,i,u?(a=q,e):(a=e,q))).length;0==d[--f];d.pop());if(!d[0])return a.charAt(0);if(y<0?--l:(p.c=d,p.e=l,p.s=s,d=(p=r(p,g,b,v,i)).c,h=p.r,l=p.e),y=d[c=l+b+1],f=i/2,h=h||c<0||null!=d[c+1],h=v<4?(null!=y||h)&&(0==v||v==(p.s<0?3:2)):y>f||y==f&&(4==v||h||6==v&&1&d[c-1]||v==(p.s<0?8:7)),c<1||!d[0])n=h?w(a.charAt(1),-b,a.charAt(0)):a.charAt(0);else{if(d.length=c,h)for(--i;++d[--c]>i;)d[c]=0,c||(++l,d=[1].concat(d));for(f=d.length;!d[--f];);for(y=0,n="";y<=f;n+=a.charAt(d[y++]));n=w(n,l,a.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,o,i,s,u=0,a=e.length,c=t%h,l=t/h|0;for(e=e.slice();a--;)u=((o=c*(i=e[a]%h)+(n=l*i+(s=e[a]/h|0)*c)%h*h+u)/r|0)+(n/h|0)+l*s,e[a]=o%r;return u&&(e=[u].concat(e)),e}function t(e,t,r,n){var o,i;if(r!=n)i=r>n?1:-1;else for(o=i=0;o<r;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function r(e,t,r,n){for(var o=0;r--;)e[r]-=o,o=e[r]<t[r]?1:0,e[r]=o*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,o,s,u,l){var f,h,p,m,g,y,b,v,w,_,O,N,A,S,E,B,P,T=n.s==o.s?1:-1,x=n.c,C=o.c;if(!(x&&x[0]&&C&&C[0]))return new H(n.s&&o.s&&(x?!C||x[0]!=C[0]:C)?x&&0==x[0]||!C?0*T:T/0:NaN);for(w=(v=new H(T)).c=[],T=s+(h=n.e-o.e)+1,l||(l=a,h=d(n.e/c)-d(o.e/c),T=T/c|0),p=0;C[p]==(x[p]||0);p++);if(C[p]>(x[p]||0)&&h--,T<0)w.push(1),m=!0;else{for(S=x.length,B=C.length,p=0,T+=2,(g=i(l/(C[0]+1)))>1&&(C=e(C,g,l),x=e(x,g,l),B=C.length,S=x.length),A=B,O=(_=x.slice(0,B)).length;O<B;_[O++]=0);P=C.slice(),P=[0].concat(P),E=C[0],C[1]>=l/2&&E++;do{if(g=0,(f=t(C,_,B,O))<0){if(N=_[0],B!=O&&(N=N*l+(_[1]||0)),(g=i(N/E))>1)for(g>=l&&(g=l-1),b=(y=e(C,g,l)).length,O=_.length;1==t(y,_,b,O);)g--,r(y,B<b?P:C,b,l),b=y.length,f=1;else 0==g&&(f=g=1),b=(y=C.slice()).length;if(b<O&&(y=[0].concat(y)),r(_,y,O,l),O=_.length,-1==f)for(;t(C,_,B,O)<1;)g++,r(_,B<O?P:C,O,l),O=_.length}else 0===f&&(g++,_=[0]);w[p++]=g,_[0]?_[O++]=x[A]||0:(_=[x[A]],O=1)}while((A++<S||null!=_[0])&&T--);m=null!=_[0],w[0]||w.splice(0,1)}if(l==a){for(p=1,T=w[0];T>=10;T/=10,p++);V(v,s+(v.e=p+h*c-1)+1,u,m)}else v.e=h,v.r=+m;return v}}(),S=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,B=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,T=/^\s*\+(?=[\w.])|^\s+|\s+$/g,O=function(e,t,r,n){var o,i=r?t:t.replace(T,"");if(P.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!r&&(i=i.replace(S,(function(e,t,r){return o="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=o?e:t})),n&&(o=n,i=i.replace(E,"$1").replace(B,"0.$1")),t!=i))return new H(i,o);if(H.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return g(this,new H(e,t))},x.decimalPlaces=x.dp=function(e,t){var r,n,o,i=this;if(null!=e)return y(e,0,p),null==t?t=U:y(t,0,8),V(new H(i),e+i.e+1,t);if(!(r=i.c))return null;if(n=((o=r.length-1)-d(this.e/c))*c,o=r[o])for(;o%10==0;o/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(e,t){return r(this,new H(e,t),j,U)},x.dividedToIntegerBy=x.idiv=function(e,t){return r(this,new H(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var r,n,u,a,l,f,h,p,d=this;if((e=new H(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+G(e));if(null!=t&&(t=new H(t)),l=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return p=new H(Math.pow(+G(d),l?2-b(e):+G(e))),t?p.mod(t):p;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);(n=!f&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||l&&d.c[1]>=24e7:d.c[0]<8e13||l&&d.c[0]<=9999975e7)))return a=d.s<0&&b(e)?-0:0,d.e>-1&&(a=1/a),new H(f?1/a:a);I&&(a=o(I/c+2))}for(l?(r=new H(.5),f&&(e.s=1),h=b(e)):h=(u=Math.abs(+G(e)))%2,p=new H(C);;){if(h){if(!(p=p.times(d)).c)break;a?p.c.length>a&&(p.c.length=a):n&&(p=p.mod(t))}if(u){if(0===(u=i(u/2)))break;h=u%2}else if(V(e=e.times(r),e.e+1,1),e.e>14)h=b(e);else{if(0==(u=+G(e)))break;h=u%2}d=d.times(d),a?d.c&&d.c.length>a&&(d.c.length=a):n&&(d=d.mod(t))}return n?p:(f&&(p=C.div(p)),t?p.mod(t):a?V(p,I,U,void 0):p)},x.integerValue=function(e){var t=new H(this);return null==e?e=U:y(e,0,8),V(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===g(this,new H(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return g(this,new H(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=g(this,new H(e,t)))||0===t},x.isInteger=function(){return!!this.c&&d(this.e/c)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return g(this,new H(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=g(this,new H(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var r,n,o,i,s=this,u=s.s;if(t=(e=new H(e,t)).s,!u||!t)return new H(NaN);if(u!=t)return e.s=-t,s.plus(e);var l=s.e/c,f=e.e/c,h=s.c,p=e.c;if(!l||!f){if(!h||!p)return h?(e.s=-t,e):new H(p?s:NaN);if(!h[0]||!p[0])return p[0]?(e.s=-t,e):new H(h[0]?s:3==U?-0:0)}if(l=d(l),f=d(f),h=h.slice(),u=l-f){for((i=u<0)?(u=-u,o=h):(f=l,o=p),o.reverse(),t=u;t--;o.push(0));o.reverse()}else for(n=(i=(u=h.length)<(t=p.length))?u:t,u=t=0;t<n;t++)if(h[t]!=p[t]){i=h[t]<p[t];break}if(i&&(o=h,h=p,p=o,e.s=-e.s),(t=(n=p.length)-(r=h.length))>0)for(;t--;h[r++]=0);for(t=a-1;n>u;){if(h[--n]<p[n]){for(r=n;r&&!h[--r];h[r]=t);--h[r],h[n]+=a}h[n]-=p[n]}for(;0==h[0];h.splice(0,1),--f);return h[0]?J(e,h,f):(e.s=3==U?-1:1,e.c=[e.e=0],e)},x.modulo=x.mod=function(e,t){var n,o,i=this;return e=new H(e,t),!i.c||!e.s||e.c&&!e.c[0]?new H(NaN):!e.c||i.c&&!i.c[0]?new H(i):(9==D?(o=e.s,e.s=1,n=r(i,e,0,3),e.s=o,n.s*=o):n=r(i,e,0,D),(e=i.minus(n.times(e))).c[0]||1!=D||(e.s=i.s),e)},x.multipliedBy=x.times=function(e,t){var r,n,o,i,s,u,l,f,p,m,g,y,b,v,w,_=this,O=_.c,N=(e=new H(e,t)).c;if(!(O&&N&&O[0]&&N[0]))return!_.s||!e.s||O&&!O[0]&&!N||N&&!N[0]&&!O?e.c=e.e=e.s=null:(e.s*=_.s,O&&N?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=d(_.e/c)+d(e.e/c),e.s*=_.s,(l=O.length)<(m=N.length)&&(b=O,O=N,N=b,o=l,l=m,m=o),o=l+m,b=[];o--;b.push(0));for(v=a,w=h,o=m;--o>=0;){for(r=0,g=N[o]%w,y=N[o]/w|0,i=o+(s=l);i>o;)r=((f=g*(f=O[--s]%w)+(u=y*f+(p=O[s]/w|0)*g)%w*w+b[i]+r)/v|0)+(u/w|0)+y*p,b[i--]=f%v;b[i]=r}return r?++n:b.splice(0,1),J(e,b,n)},x.negated=function(){var e=new H(this);return e.s=-e.s||null,e},x.plus=function(e,t){var r,n=this,o=n.s;if(t=(e=new H(e,t)).s,!o||!t)return new H(NaN);if(o!=t)return e.s=-t,n.minus(e);var i=n.e/c,s=e.e/c,u=n.c,l=e.c;if(!i||!s){if(!u||!l)return new H(o/0);if(!u[0]||!l[0])return l[0]?e:new H(u[0]?n:0*o)}if(i=d(i),s=d(s),u=u.slice(),o=i-s){for(o>0?(s=i,r=l):(o=-o,r=u),r.reverse();o--;r.push(0));r.reverse()}for((o=u.length)-(t=l.length)<0&&(r=l,l=u,u=r,t=o),o=0;t;)o=(u[--t]=u[t]+l[t]+o)/a|0,u[t]=a===u[t]?0:u[t]%a;return o&&(u=[o].concat(u),++s),J(e,u,s)},x.precision=x.sd=function(e,t){var r,n,o,i=this;if(null!=e&&e!==!!e)return y(e,1,p),null==t?t=U:y(t,0,8),V(new H(i),e,t);if(!(r=i.c))return null;if(n=(o=r.length-1)*c+1,o=r[o]){for(;o%10==0;o/=10,n--);for(o=r[0];o>=10;o/=10,n++);}return e&&i.e+1>n&&(n=i.e+1),n},x.shiftedBy=function(e){return y(e,-9007199254740991,l),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,o,i,s=this,u=s.c,a=s.s,c=s.e,l=j+4,f=new H("0.5");if(1!==a||!u||!u[0])return new H(!a||a<0&&(!u||u[0])?NaN:u?s:1/0);if(0==(a=Math.sqrt(+G(s)))||a==1/0?(((t=m(u)).length+c)%2==0&&(t+="0"),a=Math.sqrt(+t),c=d((c+1)/2)-(c<0||c%2),n=new H(t=a==1/0?"5e"+c:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new H(a+""),n.c[0])for((a=(c=n.e)+l)<3&&(a=0);;)if(i=n,n=f.times(i.plus(r(s,i,l,1))),m(i.c).slice(0,a)===(t=m(n.c)).slice(0,a)){if(n.e<c&&--a,"9999"!=(t=t.slice(a-3,a+1))&&(o||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(V(n,n.e+j+2,1),e=!n.times(n).eq(s));break}if(!o&&(V(i,i.e+j+2,0),i.times(i).eq(s))){n=i;break}l+=4,a+=4,o=1}return V(n,n.e+j+1,U,e)},x.toExponential=function(e,t){return null!=e&&(y(e,0,p),e++),z(this,e,t,1)},x.toFixed=function(e,t){return null!=e&&(y(e,0,p),e=e+this.e+1),z(this,e,t)},x.toFormat=function(e,t,r){var n,o=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=$;else if("object"!=typeof r)throw Error(s+"Argument not an object: "+r);if(n=o.toFixed(e,t),o.c){var i,u=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",f=u[0],h=u[1],p=o.s<0,d=p?f.slice(1):f,m=d.length;if(c&&(i=a,a=c,c=i,m-=i),a>0&&m>0){for(i=m%a||a,f=d.substr(0,i);i<m;i+=a)f+=l+d.substr(i,a);c>0&&(f+=l+d.slice(i)),p&&(f="-"+f)}n=h?f+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):f}return(r.prefix||"")+n+(r.suffix||"")},x.toFraction=function(e){var t,n,o,i,u,a,l,h,p,d,g,y,b=this,v=b.c;if(null!=e&&(!(l=new H(e)).isInteger()&&(l.c||1!==l.s)||l.lt(C)))throw Error(s+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+G(l));if(!v)return new H(b);for(t=new H(C),p=n=new H(C),o=h=new H(C),y=m(v),u=t.e=y.length-b.e-1,t.c[0]=f[(a=u%c)<0?c+a:a],e=!e||l.comparedTo(t)>0?u>0?t:p:l,a=k,k=1/0,l=new H(y),h.c[0]=0;d=r(l,t,0,1),1!=(i=n.plus(d.times(o))).comparedTo(e);)n=o,o=i,p=h.plus(d.times(i=p)),h=i,t=l.minus(d.times(i=t)),l=i;return i=r(e.minus(n),o,0,1),h=h.plus(i.times(p)),n=n.plus(i.times(o)),h.s=p.s=b.s,g=r(p,o,u*=2,U).minus(b).abs().comparedTo(r(h,n,u,U).minus(b).abs())<1?[p,o]:[h,n],k=a,g},x.toNumber=function(){return+G(this)},x.toPrecision=function(e,t){return null!=e&&y(e,1,p),z(this,e,t,2)},x.toString=function(e){var t,r=this,n=r.s,o=r.e;return null===o?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=o<=M||o>=L?v(m(r.c),o):w(m(r.c),o,"0"):10===e?t=w(m((r=V(new H(r),j+o+1,U)).c),r.e,"0"):(y(e,2,q.length,"Base"),t=_(w(m(r.c),o,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return G(this)},x._isBigNumber=!0,x[Symbol.toStringTag]="BigNumber",x[Symbol.for("nodejs.util.inspect.custom")]=x.valueOf,null!=t&&H.set(t),H}();const O=_},165:(e,t,r)=>{const n=r(854),o=n.default||n,i=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),o.call(this,e,t)};i.ponyfill=!0,e.exports=t=i,t.fetch=i,t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response,t.default=i},854:(e,t,r)=>{"use strict";r.r(t),r.d(t,{FetchError:()=>h,Headers:()=>T,Request:()=>H,Response:()=>k,default:()=>G});const n=require("stream"),o=require("http"),i=require("url"),s=require("https"),u=require("zlib"),a=n.Readable,c=Symbol("buffer"),l=Symbol("type");class f{constructor(){this[l]="";const e=arguments[0],t=arguments[1],r=[];let n=0;if(e){const t=e,o=Number(t.length);for(let e=0;e<o;e++){const o=t[e];let i;i=o instanceof Buffer?o:ArrayBuffer.isView(o)?Buffer.from(o.buffer,o.byteOffset,o.byteLength):o instanceof ArrayBuffer?Buffer.from(o):o instanceof f?o[c]:Buffer.from("string"==typeof o?o:String(o)),n+=i.length,r.push(i)}}this[c]=Buffer.concat(r);let o=t&&void 0!==t.type&&String(t.type).toLowerCase();o&&!/[^\u0020-\u007E]/.test(o)&&(this[l]=o)}get size(){return this[c].length}get type(){return this[l]}text(){return Promise.resolve(this[c].toString())}arrayBuffer(){const e=this[c],t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(t)}stream(){const e=new a;return e._read=function(){},e.push(this[c]),e.push(null),e}toString(){return"[object Blob]"}slice(){const e=this.size,t=arguments[0],r=arguments[1];let n,o;n=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),o=void 0===r?e:r<0?Math.max(e+r,0):Math.min(r,e);const i=Math.max(o-n,0),s=this[c].slice(n,n+i),u=new f([],{type:arguments[2]});return u[c]=s,u}}function h(e,t,r){Error.call(this,e),this.message=e,this.type=t,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}let p;Object.defineProperties(f.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(f.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),h.prototype=Object.create(Error.prototype),h.prototype.constructor=h,h.prototype.name="FetchError";try{p=require("encoding").convert}catch(e){}const d=Symbol("Body internals"),m=n.PassThrough;function g(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.size;let i=void 0===o?0:o;var s=r.timeout;let u=void 0===s?0:s;null==e?e=null:b(e)?e=Buffer.from(e.toString()):v(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof n||(e=Buffer.from(String(e)))),this[d]={body:e,disturbed:!1,error:null},this.size=i,this.timeout=u,e instanceof n&&e.on("error",(function(e){const r="AbortError"===e.name?e:new h(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[d].error=r}))}function y(){var e=this;if(this[d].disturbed)return g.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[d].disturbed=!0,this[d].error)return g.Promise.reject(this[d].error);let t=this.body;if(null===t)return g.Promise.resolve(Buffer.alloc(0));if(v(t)&&(t=t.stream()),Buffer.isBuffer(t))return g.Promise.resolve(t);if(!(t instanceof n))return g.Promise.resolve(Buffer.alloc(0));let r=[],o=0,i=!1;return new g.Promise((function(n,s){let u;e.timeout&&(u=setTimeout((function(){i=!0,s(new h(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))}),e.timeout)),t.on("error",(function(t){"AbortError"===t.name?(i=!0,s(t)):s(new h(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))})),t.on("data",(function(t){if(!i&&null!==t){if(e.size&&o+t.length>e.size)return i=!0,void s(new h(`content size at ${e.url} over limit: ${e.size}`,"max-size"));o+=t.length,r.push(t)}})),t.on("end",(function(){if(!i){clearTimeout(u);try{n(Buffer.concat(r,o))}catch(t){s(new h(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}}))}))}function b(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function v(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function w(e){let t,r,o=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof n&&"function"!=typeof o.getBoundary&&(t=new m,r=new m,o.pipe(t),o.pipe(r),e[d].body=t,o=r),o}function _(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":b(e)?"application/x-www-form-urlencoded;charset=UTF-8":v(e)?e.type||null:Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?`multipart/form-data;boundary=${e.getBoundary()}`:e instanceof n?null:"text/plain;charset=UTF-8"}function O(e){const t=e.body;return null===t?0:v(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}g.prototype={get body(){return this[d].body},get bodyUsed(){return this[d].disturbed},arrayBuffer(){return y.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return y.call(this).then((function(t){return Object.assign(new f([],{type:e.toLowerCase()}),{[c]:t})}))},json(){var e=this;return y.call(this).then((function(t){try{return JSON.parse(t.toString())}catch(t){return g.Promise.reject(new h(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}}))},text(){return y.call(this).then((function(e){return e.toString()}))},buffer(){return y.call(this)},textConverted(){var e=this;return y.call(this).then((function(t){return function(e,t){if("function"!=typeof p)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=t.get("content-type");let n,o,i="utf-8";return r&&(n=/charset=([^;]*)/i.exec(r)),o=e.slice(0,1024).toString(),!n&&o&&(n=/<meta.+?charset=(['"])(.+?)\1/i.exec(o)),!n&&o&&(n=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(o),n||(n=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(o),n&&n.pop()),n&&(n=/charset=(.*)/i.exec(n.pop()))),!n&&o&&(n=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(o)),n&&(i=n.pop(),"gb2312"!==i&&"gbk"!==i||(i="gb18030")),p(e,"UTF-8",i).toString()}(t,e.headers)}))}},Object.defineProperties(g.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),g.mixIn=function(e){for(const t of Object.getOwnPropertyNames(g.prototype))if(!(t in e)){const r=Object.getOwnPropertyDescriptor(g.prototype,t);Object.defineProperty(e,t,r)}},g.Promise=global.Promise;const N=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,A=/[^\t\x20-\x7e\x80-\xff]/;function S(e){if(e=`${e}`,N.test(e)||""===e)throw new TypeError(`${e} is not a legal HTTP header name`)}function E(e){if(e=`${e}`,A.test(e))throw new TypeError(`${e} is not a legal HTTP header value`)}function B(e,t){t=t.toLowerCase();for(const r in e)if(r.toLowerCase()===t)return r}const P=Symbol("map");class T{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[P]=Object.create(null),e instanceof T){const t=e.raw(),r=Object.keys(t);for(const e of r)for(const r of t[e])this.append(e,r)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const r=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(t))}for(const e of r){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const r=e[t];this.append(t,r)}}}}get(e){S(e=`${e}`);const t=B(this[P],e);return void 0===t?null:this[P][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=x(this),n=0;for(;n<r.length;){var o=r[n];const i=o[0],s=o[1];e.call(t,s,i,this),r=x(this),n++}}set(e,t){t=`${t}`,S(e=`${e}`),E(t);const r=B(this[P],e);this[P][void 0!==r?r:e]=[t]}append(e,t){t=`${t}`,S(e=`${e}`),E(t);const r=B(this[P],e);void 0!==r?this[P][r].push(t):this[P][e]=[t]}has(e){return S(e=`${e}`),void 0!==B(this[P],e)}delete(e){S(e=`${e}`);const t=B(this[P],e);void 0!==t&&delete this[P][t]}raw(){return this[P]}keys(){return j(this,"key")}values(){return j(this,"value")}[Symbol.iterator](){return j(this,"key+value")}}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";const r=Object.keys(e[P]).sort();return r.map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[P][t].join(", ")}:function(t){return[t.toLowerCase(),e[P][t].join(", ")]})}T.prototype.entries=T.prototype[Symbol.iterator],Object.defineProperty(T.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(T.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const C=Symbol("internal");function j(e,t){const r=Object.create(U);return r[C]={target:e,kind:t,index:0},r}const U=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==U)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[C];const t=e.target,r=e.kind,n=e.index,o=x(t,r);return n>=o.length?{value:void 0,done:!0}:(this[C].index=n+1,{value:o[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function M(e){const t=Object.assign({__proto__:null},e[P]),r=B(e[P],"Host");return void 0!==r&&(t[r]=t[r][0]),t}Object.defineProperty(U,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const L=Symbol("Response internals"),R=o.STATUS_CODES;class k{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g.call(this,e,t);const r=t.status||200,n=new T(t.headers);if(null!=e&&!n.has("Content-Type")){const t=_(e);t&&n.append("Content-Type",t)}this[L]={url:t.url,status:r,statusText:t.statusText||R[r],headers:n,counter:t.counter}}get url(){return this[L].url||""}get status(){return this[L].status}get ok(){return this[L].status>=200&&this[L].status<300}get redirected(){return this[L].counter>0}get statusText(){return this[L].statusText}get headers(){return this[L].headers}clone(){return new k(w(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}g.mixIn(k.prototype),Object.defineProperties(k.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(k.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const F=Symbol("Request internals"),D=i.parse,I=i.format,$="destroy"in n.Readable.prototype;function q(e){return"object"==typeof e&&"object"==typeof e[F]}class H{constructor(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};q(e)?t=D(e.url):(t=e&&e.href?D(e.href):D(`${e}`),e={});let n=r.method||e.method||"GET";if(n=n.toUpperCase(),(null!=r.body||q(e)&&null!==e.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let o=null!=r.body?r.body:q(e)&&null!==e.body?w(e):null;g.call(this,o,{timeout:r.timeout||e.timeout||0,size:r.size||e.size||0});const i=new T(r.headers||e.headers||{});if(null!=o&&!i.has("Content-Type")){const e=_(o);e&&i.append("Content-Type",e)}let s=q(e)?e.signal:null;if("signal"in r&&(s=r.signal),null!=s&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[F]={method:n,redirect:r.redirect||e.redirect||"follow",headers:i,parsedURL:t,signal:s},this.follow=void 0!==r.follow?r.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===e.compress||e.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent}get method(){return this[F].method}get url(){return I(this[F].parsedURL)}get headers(){return this[F].headers}get redirect(){return this[F].redirect}get signal(){return this[F].signal}clone(){return new H(this)}}function z(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}g.mixIn(H.prototype),Object.defineProperty(H.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(H.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),z.prototype=Object.create(Error.prototype),z.prototype.constructor=z,z.prototype.name="AbortError";const W=n.PassThrough,J=i.resolve;function V(e,t){if(!V.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return g.Promise=V.Promise,new V.Promise((function(r,i){const a=new H(e,t),c=function(e){const t=e[F].parsedURL,r=new T(e[F].headers);if(r.has("Accept")||r.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof n.Readable&&!$)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let o=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(o="0"),null!=e.body){const t=O(e);"number"==typeof t&&(o=String(t))}o&&r.set("Content-Length",o),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=e.agent;return"function"==typeof i&&(i=i(t)),r.has("Connection")||i||r.set("Connection","close"),Object.assign({},t,{method:e.method,headers:M(r),agent:i})}(a),l=("https:"===c.protocol?s:o).request,f=a.signal;let p=null;const d=function(){let e=new z("The user aborted a request.");i(e),a.body&&a.body instanceof n.Readable&&a.body.destroy(e),p&&p.body&&p.body.emit("error",e)};if(f&&f.aborted)return void d();const m=function(){d(),b()},g=l(c);let y;function b(){g.abort(),f&&f.removeEventListener("abort",m),clearTimeout(y)}f&&f.addEventListener("abort",m),a.timeout&&g.once("socket",(function(e){y=setTimeout((function(){i(new h(`network timeout at: ${a.url}`,"request-timeout")),b()}),a.timeout)})),g.on("error",(function(e){i(new h(`request to ${a.url} failed, reason: ${e.message}`,"system",e)),b()})),g.on("response",(function(e){clearTimeout(y);const t=function(e){const t=new T;for(const r of Object.keys(e))if(!N.test(r))if(Array.isArray(e[r]))for(const n of e[r])A.test(n)||(void 0===t[P][r]?t[P][r]=[n]:t[P][r].push(n));else A.test(e[r])||(t[P][r]=[e[r]]);return t}(e.headers);if(V.isRedirect(e.statusCode)){const n=t.get("Location"),o=null===n?null:J(a.url,n);switch(a.redirect){case"error":return i(new h(`uri requested responds with a redirect, redirect mode is set to error: ${a.url}`,"no-redirect")),void b();case"manual":if(null!==o)try{t.set("Location",o)}catch(e){i(e)}break;case"follow":if(null===o)break;if(a.counter>=a.follow)return i(new h(`maximum redirect reached at: ${a.url}`,"max-redirect")),void b();const n={headers:new T(a.headers),follow:a.follow,counter:a.counter+1,agent:a.agent,compress:a.compress,method:a.method,body:a.body,signal:a.signal,timeout:a.timeout,size:a.size};return 303!==e.statusCode&&a.body&&null===O(a)?(i(new h("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void b()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==a.method)||(n.method="GET",n.body=void 0,n.headers.delete("content-length")),r(V(new H(o,n))),void b())}}e.once("end",(function(){f&&f.removeEventListener("abort",m)}));let n=e.pipe(new W);const o={url:a.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:a.size,timeout:a.timeout,counter:a.counter},s=t.get("Content-Encoding");if(!a.compress||"HEAD"===a.method||null===s||204===e.statusCode||304===e.statusCode)return p=new k(n,o),void r(p);const c={flush:u.Z_SYNC_FLUSH,finishFlush:u.Z_SYNC_FLUSH};if("gzip"==s||"x-gzip"==s)return n=n.pipe(u.createGunzip(c)),p=new k(n,o),void r(p);if("deflate"!=s&&"x-deflate"!=s){if("br"==s&&"function"==typeof u.createBrotliDecompress)return n=n.pipe(u.createBrotliDecompress()),p=new k(n,o),void r(p);p=new k(n,o),r(p)}else e.pipe(new W).once("data",(function(e){n=8==(15&e[0])?n.pipe(u.createInflate()):n.pipe(u.createInflateRaw()),p=new k(n,o),r(p)}))})),function(e,t){const r=t.body;null===r?e.end():v(r)?r.stream().pipe(e):Buffer.isBuffer(r)?(e.write(r),e.end()):r.pipe(e)}(g,a)}))}V.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},V.Promise=global.Promise;const G=V},382:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Assets=void 0;const o=r(593),i=r(165);t.Assets=class{constructor(e="https://waves.exchange/api/v1",t="https://waves.exchange/static/icons/assets"){this.assets=Object.create(null),this._assetsPromise=Object.create(null),this.iconUrl=t,this.dataServicesUrl=e}getAssets(e){return n(this,void 0,void 0,(function*(){const t=e.filter((e=>!this.assets[e]||!this._assetsPromise[e])),r=e.filter((e=>this._assetsPromise[e])).map((e=>this._assetsPromise[e].promise));for(;;)try{const e=this._fetchAssets(t).then((e=>(e.forEach((e=>{this.assets[e.id]=e})),e)));t.forEach(((t,r)=>{this._assetsPromise[t]={promise:e,index:r}})),yield Promise.all([e,...r]);break}catch(e){yield o.waitPromise(5e3)}return e.map((e=>this.assets[e]))}))}_fetchAssets(e){return i.default(`${this.dataServicesUrl}/assets`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e})}).then((e=>{if(e.status>=400)throw new Error("Bad response from server");return e.text()})).then(o.parseJSON).then((e=>e.data)).then((e=>e.map((e=>o.convertToExtendedAsset(e,this.iconUrl)))))}}},811:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Balance=void 0;const o=r(165),i=r(593),s=r(717),u=r(382);t.Balance=class{constructor(e){this.balances=Object.create(null),this.feeList=[],this.hasData=!1,this._onUpdateCbs=[],this._poll=null;const{address:t,iconUrl:r="https://waves.exchange/static/icons/assets",dataServicesUrl:n="https://waves.exchange/api/v1",nodeUrl:o="https://nodes.waves.exchange",updateBalancesMs:i=null}=e;this._updateBalancesMs=i,this._assets=new u.Assets(n,r),this.dataServicesUrl=n,this.nodeUrl=o,this.changeUser(t)}changeUser(e){this.hasData=!1,this.address=e,this.balances=Object.create(null),this.feeList=[],this._readyPromise=null,Object.entries(this.balances).reduce(((e,[t,r])=>(e[t]=r.cloneWithCoins(0),e)),{}),this._onUpdate(Object.create(null)),e&&(this._updateBalancesMs?this._updateBalances(this._updateBalancesMs):this._readyPromise=this._init())}destroy(){this.offUpdate(),this._poll&&(this._poll.stop(),this._poll=null)}getFeesByCoins(e){return n(this,void 0,void 0,(function*(){yield this._readyPromise;const t=e instanceof i.MyMoney?e.getCoins():e;return s.getFeesByWavesMoney(this.feeList,new i.MyMoney(t,this._wavesAsset))}))}getFees(e){return n(this,void 0,void 0,(function*(){return yield this._readyPromise,s.getFeeByTx(this._wavesAsset,this.feeList,e,this.nodeUrl)}))}getBalances(){return n(this,void 0,void 0,(function*(){if(this._readyPromise)return this._readyPromise;this._readyPromise=this._init()}))}onUpdate(e){this._onUpdateCbs.push(e)}offUpdate(e){this._onUpdateCbs=e?this._onUpdateCbs.filter((t=>t!==e)):[]}_getBalances(){return n(this,void 0,void 0,(function*(){const e=yield this._fetchWavesBalances(),{balances:t}=yield this._fetchBalances(),r=(t||[]).map((e=>e.assetId)),n=yield this._assets.getAssets(["WAVES",...r]),o=i.toHash(n,"id");this._wavesAsset=o.WAVES;const s=new i.MyMoney(e.available,o.WAVES),u=t.reduce(((e,t)=>{const r=o[t.assetId];return e[t.assetId]=new i.MyMoney(t.balance,r),e}),Object.create(null)),a=Object.assign(Object.assign({},u),{WAVES:s}),c=this._getDiff(a);if(this.hasData=!0,!c)return null;this.balances=a,this.feeList=Object.values(this.balances).filter((e=>"WAVES"===e.asset.id||Number(e.asset.minSponsoredFee)>0)),this._onUpdate(c)}))}_fetchWavesBalances(){return n(this,void 0,void 0,(function*(){return yield o.default(`${this.nodeUrl}/addresses/balance/details/${this.address}`).then((e=>{if(e.status>=400)throw new Error("Bad response from server");return e.text()})).then(i.parseJSON)}))}_fetchBalances(){return n(this,void 0,void 0,(function*(){return yield o.default(`${this.nodeUrl}/assets/balance/${this.address}`).then((e=>{if(e.status>=400)throw new Error("Bad response from server");return e.text()})).then(i.parseJSON)}))}_getDiff(e){const t=Object.values(this.balances),r=Object.values(e),n=t.length>r.length,o=n?t:r,s=n?e:this.balances;return o.reduce(((e,t)=>{const r=t.asset.id,o=s[r];return o?(o.eq(t)||((e=e||Object.create(null))[r]=n?o:t),e):((e=e||Object.create(null))[r]=n?new i.MyMoney(0,t.asset):t,e)}),null)}_init(){return n(this,void 0,void 0,(function*(){for(;;)try{yield this._getBalances();break}catch(e){console.error("Retry Fetch Balances",e),yield i.waitPromise(5e3)}}))}_onUpdate(e){this._onUpdateCbs.forEach((t=>t(this.balances,e)))}_updateBalances(e){this._poll=new i.Poll(e,(()=>(this._readyPromise=null,this._readyPromise=this.getBalances(),this._readyPromise))),this._poll.start()}}},717:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getFeeByTx=t.getFeesByWavesMoney=void 0;const o=r(165),i=r(593);t.getFeesByWavesMoney=(e,t)=>{const r=t.getCoins().div(1e5).roundTo(0,0);return e.reduce(((e,n)=>{if("WAVES"===n.asset.id)e.push(t);else{const t=n.cloneWithTokens(n.getTokens().mul(r));t.lte(n)&&e.push(t)}return e}),[])},t.getFeeByTx=(e,r,s,u="https://nodes.waves.exchange")=>n(void 0,void 0,void 0,(function*(){const{feeAmount:n}=yield o.default(`${u}/transactions/calculateFee`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign(Object.assign({},s),{feeAssetId:null}))}).then((e=>{if(e.status>=400)throw new Error("Bad response from server");return e.text()})).then(i.parseJSON),a=new i.MyMoney(n,e);return t.getFeesByWavesMoney(r,a)}))},593:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Poll=t.waitPromise=t.convertToExtendedAsset=t.MyMoney=t.parseJSON=t.toHash=void 0;const o=r(739);t.toHash=(e,t)=>e.reduce(((e,r)=>(e[String(r[t])]=r,e)),Object.create(null));const i=new RegExp('((?!\\\\)"\\w+"):\\s*(-?[\\d|.]{14,}(e-?\\d+)?)',"g");t.parseJSON=function(e){return JSON.parse(e.replace(i,'$1:"$2"'))};class s extends o.Money{constructor(e,t){super(e,t)}cloneWithCoins(e){const t=super.cloneWithCoins(e);return new s(t.getCoins(),this.asset)}cloneWithTokens(e){const t=super.cloneWithTokens(e);return new s(t.getCoins(),this.asset)}}t.MyMoney=s,t.convertToExtendedAsset=(e,t)=>{const{data:r,metadata:n}=e,{has_script:i,description:s,min_sponsored_fee:u,height:a,id:c,name:l,precision:f,quantity:h,reissuable:p,sender:d,ticker:m,timestamp:g}=r,y=new o.Asset({id:c,height:a,name:l,precision:f,description:s,quantity:h,reissuable:p,sender:d,ticker:m,timestamp:new Date(g),hasScript:i,minSponsoredFee:u});return Object.assign(y,{hasImage:n.has_image,icon:n.has_image?`${t}/${y.id}.svg`:null,verifiedStatus:n.verified_status})},t.waitPromise=e=>new Promise((t=>setTimeout(t,e))),t.Poll=class{constructor(e,t,r){this.timeMs=e,this.isWorked=!1,this._cb=t,this._cbOut=r}start(){this.isWorked=!0,this._start()}stop(){this.isWorked=!1}_start(){return n(this,void 0,void 0,(function*(){for(;;){if(!this.isWorked)return;try{const e=yield this._cb();this._cbOut&&this._cbOut(e)}catch(e){}yield t.waitPromise(this.timeMs)}}))}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";r(811),r(382),r(593)})()})(); |
@@ -1,1 +0,1 @@ | ||
(()=>{var t={368:function(t,e){!function(t){"use strict";var e=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,r=Math.floor,i="[BigNumber Error] ",o=i+"Number primitive has more than 15 significant digits: ",s=1e14,u=14,a=9007199254740991,c=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],f=1e7,h=1e9;function l(t){var e=0|t;return t>0||t===e?e:e-1}function p(t){for(var e,n,r=1,i=t.length,o=t[0]+"";r<i;){for(e=t[r++]+"",n=u-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function d(t,e){var n,r,i=t.c,o=e.c,s=t.s,u=e.s,a=t.e,c=e.e;if(!s||!u)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-u:s;if(s!=u)return s;if(n=s<0,r=a==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return a>c^n?1:-1;for(u=(a=i.length)<(c=o.length)?a:c,s=0;s<u;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return a==c?0:a>c^n?1:-1}function y(t,e,n,o){if(t<e||t>n||t!==r(t))throw Error(i+(o||"Argument")+("number"==typeof t?t<e||t>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function g(t){var e=t.c.length-1;return l(t.e/u)==e&&t.c[e]%2!=0}function m(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function b(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else e<r&&(t=t.slice(0,e)+"."+t.slice(e));return t}var v=function t(v){var w,_,O,A,N,E,B,x,S,P=H.prototype={constructor:H,toString:null,valueOf:null},U=new H(1),M=20,T=4,D=-7,R=21,F=-1e7,C=1e7,L=!1,j=1,I=0,k={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz";function H(t,n){var i,s,c,f,h,l,p,d,g=this;if(!(g instanceof H))return new H(t,n);if(null==n){if(t&&!0===t._isBigNumber)return g.s=t.s,void(!t.c||t.e>C?g.c=g.e=null:t.e<F?g.c=[g.e=0]:(g.e=t.e,g.c=t.c.slice()));if((l="number"==typeof t)&&0*t==0){if(g.s=1/t<0?(t=-t,-1):1,t===~~t){for(f=0,h=t;h>=10;h/=10,f++);return void(f>C?g.c=g.e=null:(g.e=f,g.c=[t]))}d=String(t)}else{if(!e.test(d=String(t)))return O(g,d,l);g.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(f=d.indexOf("."))>-1&&(d=d.replace(".","")),(h=d.search(/e/i))>0?(f<0&&(f=h),f+=+d.slice(h+1),d=d.substring(0,h)):f<0&&(f=d.length)}else{if(y(n,2,q.length,"Base"),10==n)return G(g=new H(t),M+g.e+1,T);if(d=String(t),l="number"==typeof t){if(0*t!=0)return O(g,d,l,n);if(g.s=1/t<0?(d=d.slice(1),-1):1,H.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(o+t)}else g.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(i=q.slice(0,n),f=h=0,p=d.length;h<p;h++)if(i.indexOf(s=d.charAt(h))<0){if("."==s){if(h>f){f=p;continue}}else if(!c&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){c=!0,h=-1,f=0;continue}return O(g,String(t),l,n)}l=!1,(f=(d=_(d,n,10,g.s)).indexOf("."))>-1?d=d.replace(".",""):f=d.length}for(h=0;48===d.charCodeAt(h);h++);for(p=d.length;48===d.charCodeAt(--p););if(d=d.slice(h,++p)){if(p-=h,l&&H.DEBUG&&p>15&&(t>a||t!==r(t)))throw Error(o+g.s*t);if((f=f-h-1)>C)g.c=g.e=null;else if(f<F)g.c=[g.e=0];else{if(g.e=f,g.c=[],h=(f+1)%u,f<0&&(h+=u),h<p){for(h&&g.c.push(+d.slice(0,h)),p-=u;h<p;)g.c.push(+d.slice(h,h+=u));h=u-(d=d.slice(h)).length}else h-=p;for(;h--;d+="0");g.c.push(+d)}}else g.c=[g.e=0]}function J(t,e,n,r){var i,o,s,u,a;if(null==n?n=T:y(n,0,8),!t.c)return t.toString();if(i=t.c[0],s=t.e,null==e)a=p(t.c),a=1==r||2==r&&(s<=D||s>=R)?m(a,s):b(a,s,"0");else if(o=(t=G(new H(t),e,n)).e,u=(a=p(t.c)).length,1==r||2==r&&(e<=o||o<=D)){for(;u<e;a+="0",u++);a=m(a,o)}else if(e-=s,a=b(a,o,"0"),o+1>u){if(--e>0)for(a+=".";e--;a+="0");}else if((e+=o-u)>0)for(o+1==u&&(a+=".");e--;a+="0");return t.s<0&&i?"-"+a:a}function W(t,e){for(var n,r=1,i=new H(t[0]);r<t.length;r++){if(!(n=new H(t[r])).s){i=n;break}e.call(i,n)&&(i=n)}return i}function V(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*u-1)>C?t.c=t.e=null:n<F?t.c=[t.e=0]:(t.e=n,t.c=e),t}function G(t,e,i,o){var a,f,h,l,p,d,y,g=t.c,m=c;if(g){t:{for(a=1,l=g[0];l>=10;l/=10,a++);if((f=e-a)<0)f+=u,h=e,y=(p=g[d=0])/m[a-h-1]%10|0;else if((d=n((f+1)/u))>=g.length){if(!o)break t;for(;g.length<=d;g.push(0));p=y=0,a=1,h=(f%=u)-u+1}else{for(p=l=g[d],a=1;l>=10;l/=10,a++);y=(h=(f%=u)-u+a)<0?0:p/m[a-h-1]%10|0}if(o=o||e<0||null!=g[d+1]||(h<0?p:p%m[a-h-1]),o=i<4?(y||o)&&(0==i||i==(t.s<0?3:2)):y>5||5==y&&(4==i||o||6==i&&(f>0?h>0?p/m[a-h]:0:g[d-1])%10&1||i==(t.s<0?8:7)),e<1||!g[0])return g.length=0,o?(e-=t.e+1,g[0]=m[(u-e%u)%u],t.e=-e||0):g[0]=t.e=0,t;if(0==f?(g.length=d,l=1,d--):(g.length=d+1,l=m[u-f],g[d]=h>0?r(p/m[a-h]%m[h])*l:0),o)for(;;){if(0==d){for(f=1,h=g[0];h>=10;h/=10,f++);for(h=g[0]+=l,l=1;h>=10;h/=10,l++);f!=l&&(t.e++,g[0]==s&&(g[0]=1));break}if(g[d]+=l,g[d]!=s)break;g[d--]=0,l=1}for(f=g.length;0===g[--f];g.pop());}t.e>C?t.c=t.e=null:t.e<F&&(t.c=[t.e=0])}return t}function $(t){var e,n=t.e;return null===n?t.toString():(e=p(t.c),e=n<=D||n>=R?m(e,n):b(e,n,"0"),t.s<0?"-"+e:e)}return H.clone=t,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(i+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(y(n=t[e],0,h,e),M=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(y(n=t[e],0,8,e),T=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(y(n[0],-h,0,e),y(n[1],0,h,e),D=n[0],R=n[1]):(y(n,-h,h,e),D=-(R=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)y(n[0],-h,-1,e),y(n[1],1,h,e),F=n[0],C=n[1];else{if(y(n,-h,h,e),!n)throw Error(i+e+" cannot be zero: "+n);F=-(C=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(i+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!n,Error(i+"crypto unavailable");L=n}else L=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(y(n=t[e],0,9,e),j=n),t.hasOwnProperty(e="POW_PRECISION")&&(y(n=t[e],0,h,e),I=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(i+e+" not an object: "+n);k=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(i+e+" invalid: "+n);q=n}}return{DECIMAL_PLACES:M,ROUNDING_MODE:T,EXPONENTIAL_AT:[D,R],RANGE:[F,C],CRYPTO:L,MODULO_MODE:j,POW_PRECISION:I,FORMAT:k,ALPHABET:q}},H.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!H.DEBUG)return!0;var e,n,o=t.c,a=t.e,c=t.s;t:if("[object Array]"=={}.toString.call(o)){if((1===c||-1===c)&&a>=-h&&a<=h&&a===r(a)){if(0===o[0]){if(0===a&&1===o.length)return!0;break t}if((e=(a+1)%u)<1&&(e+=u),String(o[0]).length==e){for(e=0;e<o.length;e++)if((n=o[e])<0||n>=s||n!==r(n))break t;if(0!==n)return!0}}}else if(null===o&&null===a&&(null===c||1===c||-1===c))return!0;throw Error(i+"Invalid BigNumber: "+t)},H.maximum=H.max=function(){return W(arguments,P.lt)},H.minimum=H.min=function(){return W(arguments,P.gt)},H.random=(A=9007199254740992*Math.random()&2097151?function(){return r(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,o,s,a,f,l=0,p=[],d=new H(U);if(null==t?t=M:y(t,0,h),a=n(t/u),L)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(a*=2));l<a;)(f=131072*e[l]+(e[l+1]>>>11))>=9e15?(o=crypto.getRandomValues(new Uint32Array(2)),e[l]=o[0],e[l+1]=o[1]):(p.push(f%1e14),l+=2);l=a/2}else{if(!crypto.randomBytes)throw L=!1,Error(i+"crypto unavailable");for(e=crypto.randomBytes(a*=7);l<a;)(f=281474976710656*(31&e[l])+1099511627776*e[l+1]+4294967296*e[l+2]+16777216*e[l+3]+(e[l+4]<<16)+(e[l+5]<<8)+e[l+6])>=9e15?crypto.randomBytes(7).copy(e,l):(p.push(f%1e14),l+=7);l=a/7}if(!L)for(;l<a;)(f=A())<9e15&&(p[l++]=f%1e14);for(a=p[--l],t%=u,a&&t&&(f=c[u-t],p[l]=r(a/f)*f);0===p[l];p.pop(),l--);if(l<0)p=[s=0];else{for(s=-1;0===p[0];p.splice(0,1),s-=u);for(l=1,f=p[0];f>=10;f/=10,l++);l<u&&(s-=u-l)}return d.e=s,d.c=p,d}),H.sum=function(){for(var t=1,e=arguments,n=new H(e[0]);t<e.length;)n=n.plus(e[t++]);return n},_=function(){function t(t,e,n,r){for(var i,o,s=[0],u=0,a=t.length;u<a;){for(o=s.length;o--;s[o]*=e);for(s[0]+=r.indexOf(t.charAt(u++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(e,n,r,i,o){var s,u,a,c,f,h,l,d,y=e.indexOf("."),g=M,m=T;for(y>=0&&(c=I,I=0,e=e.replace(".",""),h=(d=new H(n)).pow(e.length-y),I=c,d.c=t(b(p(h.c),h.e,"0"),10,r,"0123456789"),d.e=d.c.length),a=c=(l=t(e,n,r,o?(s=q,"0123456789"):(s="0123456789",q))).length;0==l[--c];l.pop());if(!l[0])return s.charAt(0);if(y<0?--a:(h.c=l,h.e=a,h.s=i,l=(h=w(h,d,g,m,r)).c,f=h.r,a=h.e),y=l[u=a+g+1],c=r/2,f=f||u<0||null!=l[u+1],f=m<4?(null!=y||f)&&(0==m||m==(h.s<0?3:2)):y>c||y==c&&(4==m||f||6==m&&1&l[u-1]||m==(h.s<0?8:7)),u<1||!l[0])e=f?b(s.charAt(1),-g,s.charAt(0)):s.charAt(0);else{if(l.length=u,f)for(--r;++l[--u]>r;)l[u]=0,u||(++a,l=[1].concat(l));for(c=l.length;!l[--c];);for(y=0,e="";y<=c;e+=s.charAt(l[y++]));e=b(e,a,s.charAt(0))}return e}}(),w=function(){function t(t,e,n){var r,i,o,s,u=0,a=t.length,c=e%f,h=e/f|0;for(t=t.slice();a--;)u=((i=c*(o=t[a]%f)+(r=h*o+(s=t[a]/f|0)*c)%f*f+u)/n|0)+(r/f|0)+h*s,t[a]=i%n;return u&&(t=[u].concat(t)),t}function e(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]<e[n]?1:0,t[n]=i*r+t[n]-e[n];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(i,o,a,c,f){var h,p,d,y,g,m,b,v,w,_,O,A,N,E,B,x,S,P=i.s==o.s?1:-1,U=i.c,M=o.c;if(!(U&&U[0]&&M&&M[0]))return new H(i.s&&o.s&&(U?!M||U[0]!=M[0]:M)?U&&0==U[0]||!M?0*P:P/0:NaN);for(w=(v=new H(P)).c=[],P=a+(p=i.e-o.e)+1,f||(f=s,p=l(i.e/u)-l(o.e/u),P=P/u|0),d=0;M[d]==(U[d]||0);d++);if(M[d]>(U[d]||0)&&p--,P<0)w.push(1),y=!0;else{for(E=U.length,x=M.length,d=0,P+=2,(g=r(f/(M[0]+1)))>1&&(M=t(M,g,f),U=t(U,g,f),x=M.length,E=U.length),N=x,O=(_=U.slice(0,x)).length;O<x;_[O++]=0);S=M.slice(),S=[0].concat(S),B=M[0],M[1]>=f/2&&B++;do{if(g=0,(h=e(M,_,x,O))<0){if(A=_[0],x!=O&&(A=A*f+(_[1]||0)),(g=r(A/B))>1)for(g>=f&&(g=f-1),b=(m=t(M,g,f)).length,O=_.length;1==e(m,_,b,O);)g--,n(m,x<b?S:M,b,f),b=m.length,h=1;else 0==g&&(h=g=1),b=(m=M.slice()).length;if(b<O&&(m=[0].concat(m)),n(_,m,O,f),O=_.length,-1==h)for(;e(M,_,x,O)<1;)g++,n(_,x<O?S:M,O,f),O=_.length}else 0===h&&(g++,_=[0]);w[d++]=g,_[0]?_[O++]=U[N]||0:(_=[U[N]],O=1)}while((N++<E||null!=_[0])&&P--);y=null!=_[0],w[0]||w.splice(0,1)}if(f==s){for(d=1,P=w[0];P>=10;P/=10,d++);G(v,a+(v.e=d+p*u-1)+1,c,y)}else v.e=p,v.r=+y;return v}}(),N=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,B=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,S=/^\s*\+(?=[\w.])|^\s+|\s+$/g,O=function(t,e,n,r){var o,s=n?e:e.replace(S,"");if(x.test(s))t.s=isNaN(s)?null:s<0?-1:1;else{if(!n&&(s=s.replace(N,(function(t,e,n){return o="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=o?t:e})),r&&(o=r,s=s.replace(E,"$1").replace(B,"0.$1")),e!=s))return new H(s,o);if(H.DEBUG)throw Error(i+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},P.absoluteValue=P.abs=function(){var t=new H(this);return t.s<0&&(t.s=1),t},P.comparedTo=function(t,e){return d(this,new H(t,e))},P.decimalPlaces=P.dp=function(t,e){var n,r,i,o=this;if(null!=t)return y(t,0,h),null==e?e=T:y(e,0,8),G(new H(o),t+o.e+1,e);if(!(n=o.c))return null;if(r=((i=n.length-1)-l(this.e/u))*u,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},P.dividedBy=P.div=function(t,e){return w(this,new H(t,e),M,T)},P.dividedToIntegerBy=P.idiv=function(t,e){return w(this,new H(t,e),0,1)},P.exponentiatedBy=P.pow=function(t,e){var o,s,a,c,f,h,l,p,d=this;if((t=new H(t)).c&&!t.isInteger())throw Error(i+"Exponent not an integer: "+$(t));if(null!=e&&(e=new H(e)),f=t.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!t.c||!t.c[0])return p=new H(Math.pow(+$(d),f?2-g(t):+$(t))),e?p.mod(e):p;if(h=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new H(NaN);(s=!h&&d.isInteger()&&e.isInteger())&&(d=d.mod(e))}else{if(t.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||f&&d.c[1]>=24e7:d.c[0]<8e13||f&&d.c[0]<=9999975e7)))return c=d.s<0&&g(t)?-0:0,d.e>-1&&(c=1/c),new H(h?1/c:c);I&&(c=n(I/u+2))}for(f?(o=new H(.5),h&&(t.s=1),l=g(t)):l=(a=Math.abs(+$(t)))%2,p=new H(U);;){if(l){if(!(p=p.times(d)).c)break;c?p.c.length>c&&(p.c.length=c):s&&(p=p.mod(e))}if(a){if(0===(a=r(a/2)))break;l=a%2}else if(G(t=t.times(o),t.e+1,1),t.e>14)l=g(t);else{if(0==(a=+$(t)))break;l=a%2}d=d.times(d),c?d.c&&d.c.length>c&&(d.c.length=c):s&&(d=d.mod(e))}return s?p:(h&&(p=U.div(p)),e?p.mod(e):c?G(p,I,T,void 0):p)},P.integerValue=function(t){var e=new H(this);return null==t?t=T:y(t,0,8),G(e,e.e+1,t)},P.isEqualTo=P.eq=function(t,e){return 0===d(this,new H(t,e))},P.isFinite=function(){return!!this.c},P.isGreaterThan=P.gt=function(t,e){return d(this,new H(t,e))>0},P.isGreaterThanOrEqualTo=P.gte=function(t,e){return 1===(e=d(this,new H(t,e)))||0===e},P.isInteger=function(){return!!this.c&&l(this.e/u)>this.c.length-2},P.isLessThan=P.lt=function(t,e){return d(this,new H(t,e))<0},P.isLessThanOrEqualTo=P.lte=function(t,e){return-1===(e=d(this,new H(t,e)))||0===e},P.isNaN=function(){return!this.s},P.isNegative=function(){return this.s<0},P.isPositive=function(){return this.s>0},P.isZero=function(){return!!this.c&&0==this.c[0]},P.minus=function(t,e){var n,r,i,o,a=this,c=a.s;if(e=(t=new H(t,e)).s,!c||!e)return new H(NaN);if(c!=e)return t.s=-e,a.plus(t);var f=a.e/u,h=t.e/u,p=a.c,d=t.c;if(!f||!h){if(!p||!d)return p?(t.s=-e,t):new H(d?a:NaN);if(!p[0]||!d[0])return d[0]?(t.s=-e,t):new H(p[0]?a:3==T?-0:0)}if(f=l(f),h=l(h),p=p.slice(),c=f-h){for((o=c<0)?(c=-c,i=p):(h=f,i=d),i.reverse(),e=c;e--;i.push(0));i.reverse()}else for(r=(o=(c=p.length)<(e=d.length))?c:e,c=e=0;e<r;e++)if(p[e]!=d[e]){o=p[e]<d[e];break}if(o&&(i=p,p=d,d=i,t.s=-t.s),(e=(r=d.length)-(n=p.length))>0)for(;e--;p[n++]=0);for(e=s-1;r>c;){if(p[--r]<d[r]){for(n=r;n&&!p[--n];p[n]=e);--p[n],p[r]+=s}p[r]-=d[r]}for(;0==p[0];p.splice(0,1),--h);return p[0]?V(t,p,h):(t.s=3==T?-1:1,t.c=[t.e=0],t)},P.modulo=P.mod=function(t,e){var n,r,i=this;return t=new H(t,e),!i.c||!t.s||t.c&&!t.c[0]?new H(NaN):!t.c||i.c&&!i.c[0]?new H(i):(9==j?(r=t.s,t.s=1,n=w(i,t,0,3),t.s=r,n.s*=r):n=w(i,t,0,j),(t=i.minus(n.times(t))).c[0]||1!=j||(t.s=i.s),t)},P.multipliedBy=P.times=function(t,e){var n,r,i,o,a,c,h,p,d,y,g,m,b,v,w,_=this,O=_.c,A=(t=new H(t,e)).c;if(!(O&&A&&O[0]&&A[0]))return!_.s||!t.s||O&&!O[0]&&!A||A&&!A[0]&&!O?t.c=t.e=t.s=null:(t.s*=_.s,O&&A?(t.c=[0],t.e=0):t.c=t.e=null),t;for(r=l(_.e/u)+l(t.e/u),t.s*=_.s,(h=O.length)<(y=A.length)&&(b=O,O=A,A=b,i=h,h=y,y=i),i=h+y,b=[];i--;b.push(0));for(v=s,w=f,i=y;--i>=0;){for(n=0,g=A[i]%w,m=A[i]/w|0,o=i+(a=h);o>i;)n=((p=g*(p=O[--a]%w)+(c=m*p+(d=O[a]/w|0)*g)%w*w+b[o]+n)/v|0)+(c/w|0)+m*d,b[o--]=p%v;b[o]=n}return n?++r:b.splice(0,1),V(t,b,r)},P.negated=function(){var t=new H(this);return t.s=-t.s||null,t},P.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new H(t,e)).s,!i||!e)return new H(NaN);if(i!=e)return t.s=-e,r.minus(t);var o=r.e/u,a=t.e/u,c=r.c,f=t.c;if(!o||!a){if(!c||!f)return new H(i/0);if(!c[0]||!f[0])return f[0]?t:new H(c[0]?r:0*i)}if(o=l(o),a=l(a),c=c.slice(),i=o-a){for(i>0?(a=o,n=f):(i=-i,n=c),n.reverse();i--;n.push(0));n.reverse()}for((i=c.length)-(e=f.length)<0&&(n=f,f=c,c=n,e=i),i=0;e;)i=(c[--e]=c[e]+f[e]+i)/s|0,c[e]=s===c[e]?0:c[e]%s;return i&&(c=[i].concat(c),++a),V(t,c,a)},P.precision=P.sd=function(t,e){var n,r,i,o=this;if(null!=t&&t!==!!t)return y(t,1,h),null==e?e=T:y(e,0,8),G(new H(o),t,e);if(!(n=o.c))return null;if(r=(i=n.length-1)*u+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&o.e+1>r&&(r=o.e+1),r},P.shiftedBy=function(t){return y(t,-a,a),this.times("1e"+t)},P.squareRoot=P.sqrt=function(){var t,e,n,r,i,o=this,s=o.c,u=o.s,a=o.e,c=M+4,f=new H("0.5");if(1!==u||!s||!s[0])return new H(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);if(0==(u=Math.sqrt(+$(o)))||u==1/0?(((e=p(s)).length+a)%2==0&&(e+="0"),u=Math.sqrt(+e),a=l((a+1)/2)-(a<0||a%2),n=new H(e=u==1/0?"5e"+a:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+a)):n=new H(u+""),n.c[0])for((u=(a=n.e)+c)<3&&(u=0);;)if(i=n,n=f.times(i.plus(w(o,i,c,1))),p(i.c).slice(0,u)===(e=p(n.c)).slice(0,u)){if(n.e<a&&--u,"9999"!=(e=e.slice(u-3,u+1))&&(r||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(G(n,n.e+M+2,1),t=!n.times(n).eq(o));break}if(!r&&(G(i,i.e+M+2,0),i.times(i).eq(o))){n=i;break}c+=4,u+=4,r=1}return G(n,n.e+M+1,T,t)},P.toExponential=function(t,e){return null!=t&&(y(t,0,h),t++),J(this,t,e,1)},P.toFixed=function(t,e){return null!=t&&(y(t,0,h),t=t+this.e+1),J(this,t,e)},P.toFormat=function(t,e,n){var r,o=this;if(null==n)null!=t&&e&&"object"==typeof e?(n=e,e=null):t&&"object"==typeof t?(n=t,t=e=null):n=k;else if("object"!=typeof n)throw Error(i+"Argument not an object: "+n);if(r=o.toFixed(t,e),o.c){var s,u=r.split("."),a=+n.groupSize,c=+n.secondaryGroupSize,f=n.groupSeparator||"",h=u[0],l=u[1],p=o.s<0,d=p?h.slice(1):h,y=d.length;if(c&&(s=a,a=c,c=s,y-=s),a>0&&y>0){for(s=y%a||a,h=d.substr(0,s);s<y;s+=a)h+=f+d.substr(s,a);c>0&&(h+=f+d.slice(s)),p&&(h="-"+h)}r=l?h+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?l.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):l):h}return(n.prefix||"")+r+(n.suffix||"")},P.toFraction=function(t){var e,n,r,o,s,a,f,h,l,d,y,g,m=this,b=m.c;if(null!=t&&(!(f=new H(t)).isInteger()&&(f.c||1!==f.s)||f.lt(U)))throw Error(i+"Argument "+(f.isInteger()?"out of range: ":"not an integer: ")+$(f));if(!b)return new H(m);for(e=new H(U),l=n=new H(U),r=h=new H(U),g=p(b),s=e.e=g.length-m.e-1,e.c[0]=c[(a=s%u)<0?u+a:a],t=!t||f.comparedTo(e)>0?s>0?e:l:f,a=C,C=1/0,f=new H(g),h.c[0]=0;d=w(f,e,0,1),1!=(o=n.plus(d.times(r))).comparedTo(t);)n=r,r=o,l=h.plus(d.times(o=l)),h=o,e=f.minus(d.times(o=e)),f=o;return o=w(t.minus(n),r,0,1),h=h.plus(o.times(l)),n=n.plus(o.times(r)),h.s=l.s=m.s,y=w(l,r,s*=2,T).minus(m).abs().comparedTo(w(h,n,s,T).minus(m).abs())<1?[l,r]:[h,n],C=a,y},P.toNumber=function(){return+$(this)},P.toPrecision=function(t,e){return null!=t&&y(t,1,h),J(this,t,e,2)},P.toString=function(t){var e,n=this,r=n.s,i=n.e;return null===i?r?(e="Infinity",r<0&&(e="-"+e)):e="NaN":(null==t?e=i<=D||i>=R?m(p(n.c),i):b(p(n.c),i,"0"):10===t?e=b(p((n=G(new H(n),M+i+1,T)).c),n.e,"0"):(y(t,2,q.length,"Base"),e=_(b(p(n.c),i,"0"),10,t,r,!0)),r<0&&n.c[0]&&(e="-"+e)),e},P.valueOf=P.toJSON=function(){return $(this)},P._isBigNumber=!0,P[Symbol.toStringTag]="BigNumber",P[Symbol.for("nodejs.util.inspect.custom")]=P.valueOf,null!=v&&H.set(v),H}(),w=function(){return(w=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},_=function(){function t(){this.format=t.DEFAULT_FORMAT,v.config({FORMAT:this.format})}return t.prototype.set=function(t){"FORMAT"in t&&(this.format=w({},this.format,t.FORMAT),t.FORMAT=this.format),v.config(t)},t.DEFAULT_FORMAT={prefix:"",decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0,suffix:""},t}();t.BigNumber=function(){function t(e){"object"==typeof e&&t.isBigNumber(e)?this.bn=e.bn.plus(0):this.bn=t.toBigNumberJs(e)}return t.prototype.clone=function(){return new t(this)},t.prototype.add=function(e){return new t(this.bn.plus(t.toBigNumberJs(e)))},t.prototype.sub=function(e){return new t(this.bn.minus(t.toBigNumberJs(e)))},t.prototype.mul=function(e){return new t(this.bn.times(t.toBigNumberJs(e)))},t.prototype.div=function(e){return new t(this.bn.div(t.toBigNumberJs(e)))},t.prototype.pow=function(e){return new t(this.bn.pow(t.toBigNumberJs(e)))},t.prototype.sqrt=function(){return new t(this.bn.sqrt())},t.prototype.abs=function(){return new t(this.bn.abs())},t.prototype.mod=function(e){return new t(this.bn.mod(t.toBigNumberJs(e)))},t.prototype.roundTo=function(e,n){return void 0===e&&(e=0),void 0===n&&(n=4),new t(this.bn.dp(e||0,n))},t.prototype.eq=function(e){return this.bn.eq(t.toBigNumberJs(e))},t.prototype.lt=function(e){return this.bn.lt(t.toBigNumberJs(e))},t.prototype.gt=function(e){return this.bn.gt(t.toBigNumberJs(e))},t.prototype.lte=function(e){return this.bn.lte(t.toBigNumberJs(e))},t.prototype.gte=function(e){return this.bn.gte(t.toBigNumberJs(e))},t.prototype.isNaN=function(){return this.bn.isNaN()},t.prototype.isFinite=function(){return this.bn.isFinite()},t.prototype.isZero=function(){return this.eq(0)},t.prototype.isPositive=function(){return this.gt(0)},t.prototype.isNegative=function(){return this.lt(0)},t.prototype.isInt=function(){return this.bn.isInteger()},t.prototype.getDecimalsCount=function(){return this.bn.dp()},t.prototype.isEven=function(){return this.mod(2).eq(0)},t.prototype.isOdd=function(){return!this.isEven()},t.prototype.isInSignedRange=function(){return this.gte(t.MIN_VALUE)&&this.lte(t.MAX_VALUE)},t.prototype.isInUnsignedRange=function(){return this.gte(t.MIN_UNSIGNED_VALUE)&&this.lte(t.MAX_UNSIGNED_VALUE)},t.prototype.toFormat=function(t,e,n){return this.bn.toFormat(t,e,n)},t.prototype.toFixed=function(t,e){return null==t?this.bn.toFixed():this.bn.toFixed(t,e)},t.prototype.toString=function(){return this.toFixed()},t.prototype.toNumber=function(){return this.bn.toNumber()},t.prototype.toJSON=function(){return this.bn.toFixed()},t.prototype.valueOf=function(){return this.bn.valueOf()},t.prototype.toBytes=function(e){var n=void 0===e?{}:e,r=n.isSigned,i=void 0===r||r,o=n.isLong,s=void 0===o||o;if(!this.isInt())throw new Error("Cant create bytes from number with decimals!");if(!i&&this.isNegative())throw new Error("Cant create bytes from negative number in signed mode!");if(s&&i&&!this.isInSignedRange())throw new Error("Number is not from signed numbers range");if(s&&!i&&!this.isInUnsignedRange())throw new Error("Number is not from unsigned numbers range");var u=i&&this.isNegative(),a=u?"1":"0",c=this.bn.plus(a).toString(2).replace("-",""),f=s?64:8*Math.ceil(c.length/8),h=t._toLength(f,c).split(""),l=[];do{l.push(parseInt(h.splice(0,8).join(""),2))}while(h.length);return u?Uint8Array.from(l.map((function(t){return 255-t}))):Uint8Array.from(l)},t.fromBytes=function(e,n){var r=void 0===n?{}:n,i=r.isSigned,o=void 0===i||i,s=r.isLong,u=void 0===s||s;if(u&&8!==e.length)throw new Error("Wrong bytes length! Minimal length is 8 byte!");e=!u&&e.length>0||u?e:[0];var a=!!o&&e[0]>127,c=Array.from(e).map((function(t){return a?255-t:t})).map((function(e){return t._toLength(8,e.toString(2))})).join(""),f=new t(new v(c,2));return a?f.mul(-1).sub(1):f},t.max=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.toBigNumber(e).reduce((function(t,e){return t.gte(e)?t:e}))},t.min=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.toBigNumber(e).reduce((function(t,e){return t.lte(e)?t:e}))},t.sum=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.toBigNumber(e).reduce((function(t,e){return t.add(e)}))},t.isBigNumber=function(e){return e&&"object"==typeof e&&(e instanceof t||Object.entries(t.prototype).filter((function(t){return"_"!==t[0].charAt(0)})).every((function(t){var n=t[0],r=t[1];return n in e&&typeof r==typeof e[n]})))},t.toBigNumber=function(e){return Array.isArray(e)?e.map((function(e){return new t(e)})):new t(e)},t.toBigNumberJs=function(e){return v.isBigNumber(e)?e:e instanceof t?e.bn:new v(e)},t._toLength=function(t,e){return new Array(t).fill("0",0,t).concat(e.split("")).slice(-t).join("")},t.MIN_VALUE=new t("-9223372036854775808"),t.MAX_VALUE=new t("9223372036854775807"),t.MIN_UNSIGNED_VALUE=new t("0"),t.MAX_UNSIGNED_VALUE=new t("18446744073709551615"),t.config=new _,t}(),function(t){!function(t){t[t.ROUND_UP=0]="ROUND_UP",t[t.ROUND_DOWN=1]="ROUND_DOWN",t[t.ROUND_CEIL=2]="ROUND_CEIL",t[t.ROUND_FLOOR=3]="ROUND_FLOOR",t[t.ROUND_HALF_UP=4]="ROUND_HALF_UP",t[t.ROUND_HALF_DOWN=5]="ROUND_HALF_DOWN",t[t.ROUND_HALF_EVEN=6]="ROUND_HALF_EVEN",t[t.ROUND_HALF_CEIL=7]="ROUND_HALF_CEIL",t[t.ROUND_HALF_FLOOR=8]="ROUND_HALF_FLOOR"}(t.ROUND_MODE||(t.ROUND_MODE={}))}(t.BigNumber||(t.BigNumber={}));var O=t.BigNumber;t.default=O,Object.defineProperty(t,"__esModule",{value:!0})}(e)},466:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,r={remapAsset:function(t){return t},remapCandle:function(t){return t}};(n=e.config||(e.config={})).get=function(t){return r[t]},n.set=function t(e,n){"string"==typeof e?r[e]=n:Object.keys(e).forEach((function(n){return t(n,e[n])}))}},748:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(466),i=n(781),o=function(){function t(t){t=r.config.get("remapAsset")(t),this.quantity=i.toBigNumber(t.quantity),this.minSponsoredFee=i.toBigNumber(t.minSponsoredFee),this.ticker=t.ticker||null,this.id=t.id,this.name=t.name,this.precision=t.precision,this.description=t.description,this.height=t.height,this.timestamp=t.timestamp,this.sender=t.sender,this.reissuable=t.reissuable,this.hasScript=t.hasScript||!1,this.displayName=t.ticker||t.name}return t.prototype.toJSON=function(){return{ticker:this.ticker,id:this.id,name:this.name,precision:this.precision,description:this.description,height:this.height,timestamp:this.timestamp,sender:this.sender,quantity:this.quantity,reissuable:this.reissuable,hasScript:this.hasScript,minSponsoredFee:this.minSponsoredFee}},t.prototype.toString=function(){return this.id},t.isAsset=function(e){return e instanceof t},t}();e.Asset=o},55:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this.amountAsset=t,this.priceAsset=e,this.precisionDifference=this.priceAsset.precision-this.amountAsset.precision}return t.prototype.toJSON=function(){return{amountAsset:this.amountAsset.id,priceAsset:this.priceAsset.id}},t.prototype.toString=function(){return this.amountAsset+"/"+this.priceAsset},t.isAssetPair=function(e){return e instanceof t},t}();e.AssetPair=n},318:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(466),i=n(781),o=function(){function t(t){var e=this;t=r.config.get("remapCandle")(t),["open","close","high","low","volume","quoteVolume","weightedAveragePrice"].forEach((function(n){return e[n]=i.toBigNumber(t[n])})),this.time=t.time,this.maxHeight=t.maxHeight,this.txsCount=t.txsCount}return t.prototype.toJSON=function(){return{time:this.time,open:this.open,close:this.close,high:this.high,low:this.low,volume:this.volume,quoteVolume:this.quoteVolume,weightedAveragePrice:this.weightedAveragePrice,maxHeight:this.maxHeight,txsCount:this.txsCount}},t.prototype.toString=function(){return"[object Candle]"},t.isCandle=function(e){return e instanceof t},t}();e.Candle=o},906:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(368),i=n(781),o=function(){function t(e,n){var r=t._getDivider(n.precision);this.asset=n,this._coins=i.toBigNumber(e).roundTo(0),this._tokens=this._coins.div(r)}return t.prototype.getCoins=function(){return this._coins.add(0)},t.prototype.getTokens=function(){return this._tokens.add(0)},t.prototype.toCoins=function(){return this._coins.toFixed(0)},t.prototype.toTokens=function(){return this._tokens.toFixed(this.asset.precision)},t.prototype.toFormat=function(t){return this._tokens.toFormat(t)},t.prototype.add=function(e){this._matchAssets(e);var n=e.getCoins();return new t(this._coins.add(n),this.asset)},t.prototype.plus=function(t){return this.add(t)},t.prototype.sub=function(e){this._matchAssets(e);var n=e.getCoins();return new t(this._coins.sub(n),this.asset)},t.prototype.minus=function(t){return this.sub(t)},t.prototype.times=function(e){return this._matchAssets(e),new t(this.getCoins().mul(e.getCoins()),this.asset)},t.prototype.div=function(e){return this._matchAssets(e),new t(this.getCoins().div(e.getCoins()),this.asset)},t.prototype.eq=function(t){return this._matchAssets(t),this._coins.eq(t.getCoins())},t.prototype.lt=function(t){return this._matchAssets(t),this._coins.lt(t.getCoins())},t.prototype.lte=function(t){return this._matchAssets(t),this._coins.lte(t.getCoins())},t.prototype.gt=function(t){return this._matchAssets(t),this._coins.gt(t.getCoins())},t.prototype.gte=function(t){return this._matchAssets(t),this._coins.gte(t.getCoins())},t.prototype.safeSub=function(t){return this.asset.id===t.asset.id?this.sub(t):this},t.prototype.toNonNegative=function(){return this.getTokens().lt(0)?this.cloneWithTokens(0):this},t.prototype.cloneWithCoins=function(e){return new t(new r.BigNumber(e),this.asset)},t.prototype.cloneWithTokens=function(e){var n=t._tokensToCoins(e,this.asset.precision);return new t(n,this.asset)},t.prototype.convertTo=function(e,n){return t.convert(this,e,i.toBigNumber(n))},t.prototype.toJSON=function(){return{assetId:this.asset.id,tokens:this.toTokens()}},t.prototype.toString=function(){return this.toTokens()+" "+this.asset.id},t.prototype._matchAssets=function(t){if(this.asset.id!==t.asset.id)throw new Error("You cannot apply arithmetic operations to Money created with different assets")},t.max=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return t.gte(e)?t:e}))},t.min=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return t.lte(e)?t:e}))},t.isMoney=function(e){return e instanceof t},t.convert=function(e,n,i){if(e.asset===n)return e;var o=e.asset.precision-n.precision,s=new r.BigNumber(10).pow(o),u=e.getCoins().mul(i).div(s).roundTo(0,1).toFixed();return new t(new r.BigNumber(u),n)},t.fromTokens=function(e,n){return new t(i.toBigNumber(e).mul(new r.BigNumber(10).pow(n.precision)),n)},t.fromCoins=function(e,n){return new t(e,n)},t._tokensToCoins=function(e,n){var i=t._getDivider(n);return e=new r.BigNumber(e).toFixed(n),new r.BigNumber(e).mul(i)},t._getDivider=function(t){return new r.BigNumber(10).pow(t)},t}();e.Money=o},454:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(368),i=n(781),o=function(){function t(e,n){var r=t._getMatcherDivider(n.precisionDifference);this.pair=n,this._matcherCoins=e,this._tokens=this._matcherCoins.div(r)}return t.prototype.getMatcherCoins=function(){return this._matcherCoins.clone()},t.prototype.getTokens=function(){return this._tokens.clone()},t.prototype.toMatcherCoins=function(){return this._matcherCoins.toFixed(0)},t.prototype.toTokens=function(){return this._tokens.toFixed(this.pair.priceAsset.precision)},t.prototype.toFormat=function(){return this._tokens.toFormat(this.pair.priceAsset.precision)},t.prototype.toJSON=function(){return{amountAssetId:this.pair.amountAsset.id,priceAssetId:this.pair.priceAsset.id,priceTokens:this.toTokens()}},t.prototype.toString=function(){return this.toTokens()+" "+this.pair.amountAsset.id+"/"+this.pair.priceAsset.id},t.fromMatcherCoins=function(e,n){return t._checkAmount(e),new t(i.toBigNumber(e),n)},t.fromTokens=function(e,n){t._checkAmount(e),e=i.toBigNumber(e).toFixed(n.priceAsset.precision);var o=t._getMatcherDivider(n.precisionDifference);return new t(new r.BigNumber(e).mul(o),n)},t._getMatcherDivider=function(e){return new r.BigNumber(10).pow(e).mul(t._MATCHER_SCALE)},t.isOrderPrice=function(e){return e instanceof t},t._checkAmount=function(t){if(!(["string","number"].includes(typeof t)||t instanceof r.BigNumber))throw new Error("Please use strings to create instances of OrderPrice")},t._MATCHER_SCALE=new r.BigNumber(10).pow(8),t}();e.OrderPrice=o},739:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(748);e.Asset=r.Asset;var i=n(318);e.Candle=i.Candle;var o=n(906);e.Money=o.Money;var s=n(454);e.OrderPrice=s.OrderPrice;var u=n(55);e.AssetPair=u.AssetPair;var a=n(466);e.config=a.config},781:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(368);e.toBigNumber=function(t){return t instanceof r.BigNumber?t:new r.BigNumber(t)}},98:function(t,e){var n="undefined"!=typeof self?self:this,r=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function y(t){var e=new FileReader,n=d(e);return e.readAsArrayBuffer(t),n}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,n,r=p(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,n=d(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=f(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=f(e)},l.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),h(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),h(t)},r&&(l.prototype[Symbol.iterator]=l.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var n,r,i=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(r=(n=e.method||this.method||"GET").toUpperCase(),b.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},m.call(v.prototype),m.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var O=[301,302,303,307,308];_.redirect=function(t,e){if(-1===O.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function A(t,n){return new Promise((function(r,o){var s=new v(t,n);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,n={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;r(new _(i,n))},u.onerror=function(){o(new TypeError("Network request failed"))},u.ontimeout=function(){o(new TypeError("Network request failed"))},u.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},u.open(s.method,s.url,!0),"include"===s.credentials?u.withCredentials=!0:"omit"===s.credentials&&(u.withCredentials=!1),"responseType"in u&&i&&(u.responseType="blob"),s.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&s.signal.removeEventListener("abort",a)}),u.send(void 0===s._bodyInit?null:s._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=l,t.Request=v,t.Response=_),e.Headers=l,e.Request=v,e.Response=_,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},382:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{a(r.next(t))}catch(t){o(t)}}function u(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Assets=void 0;const i=n(593),o=n(98);e.Assets=class{constructor(t="https://waves.exchange/api/v1",e="https://waves.exchange/static/icons/assets"){this.assets=Object.create(null),this._assetsPromise=Object.create(null),this.iconUrl=e,this.dataServicesUrl=t}getAssets(t){return r(this,void 0,void 0,(function*(){const e=t.filter((t=>!this.assets[t]||!this._assetsPromise[t])),n=t.filter((t=>this._assetsPromise[t])).map((t=>this._assetsPromise[t].promise));for(;;)try{const t=this._fetchAssets(e).then((t=>(t.forEach((t=>{this.assets[t.id]=t})),t)));e.forEach(((e,n)=>{this._assetsPromise[e]={promise:t,index:n}})),yield Promise.all([t,...n]);break}catch(t){yield i.waitPromise(5e3)}return t.map((t=>this.assets[t]))}))}_fetchAssets(t){return o.default(`${this.dataServicesUrl}/assets`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:t})}).then((t=>{if(t.status>=400)throw new Error("Bad response from server");return t.text()})).then(i.parseJSON).then((t=>t.data)).then((t=>t.map((t=>i.convertToExtendedAsset(t,this.iconUrl)))))}}},811:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{a(r.next(t))}catch(t){o(t)}}function u(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Balance=void 0;const i=n(98),o=n(593),s=n(717),u=n(382);e.Balance=class{constructor(t){this.balances=Object.create(null),this.feeList=[],this.hasData=!1,this._onUpdateCbs=[],this._poll=null;const{address:e,iconUrl:n="https://waves.exchange/static/icons/assets",dataServicesUrl:r="https://waves.exchange/api/v1",nodeUrl:i="https://nodes.waves.exchange",updateBalancesMs:o=null}=t;this._assets=new u.Assets(r,n),this.address=e,this.dataServicesUrl=r,this.nodeUrl=i,o?this._updateBalances(o):this._readyPromise=this._init()}destroy(){this.offUpdate(),this._poll&&(this._poll.stop(),this._poll=null)}getFeesByCoins(t){return r(this,void 0,void 0,(function*(){yield this._readyPromise;const e=t instanceof o.MyMoney?t.getCoins():t;return s.getFeesByWavesMoney(this.feeList,new o.MyMoney(e,this._wavesAsset))}))}getFees(t){return r(this,void 0,void 0,(function*(){return yield this._readyPromise,s.getFeeByTx(this._wavesAsset,this.feeList,t,this.nodeUrl)}))}getBalances(){return r(this,void 0,void 0,(function*(){if(this._readyPromise)return this._readyPromise;this._readyPromise=this._init()}))}onUpdate(t){this._onUpdateCbs.push(t)}offUpdate(t){this._onUpdateCbs=t?this._onUpdateCbs.filter((e=>e!==t)):[]}_getBalances(){return r(this,void 0,void 0,(function*(){const t=yield this._fetchWavesBalances(),{balances:e}=yield this._fetchBalances(),n=(e||[]).map((t=>t.assetId)),r=yield this._assets.getAssets(["WAVES",...n]),i=o.toHash(r,"id");this._wavesAsset=i.WAVES;const s=new o.MyMoney(t.available,i.WAVES),u=e.reduce(((t,e)=>{const n=i[e.assetId];return t[e.assetId]=new o.MyMoney(e.balance,n),t}),Object.create(null)),a=Object.assign(Object.assign({},u),{WAVES:s}),c=this._getDiff(a);if(this.hasData=!0,!c)return null;this.balances=a,this.feeList=Object.values(this.balances).filter((t=>"WAVES"===t.asset.id||Number(t.asset.minSponsoredFee)>0)),this._onUpdate(c)}))}_fetchWavesBalances(){return r(this,void 0,void 0,(function*(){return yield i.default(`${this.nodeUrl}/addresses/balance/details/${this.address}`).then((t=>{if(t.status>=400)throw new Error("Bad response from server");return t.text()})).then(o.parseJSON)}))}_fetchBalances(){return r(this,void 0,void 0,(function*(){return yield i.default(`${this.nodeUrl}/assets/balance/${this.address}`).then((t=>{if(t.status>=400)throw new Error("Bad response from server");return t.text()})).then(o.parseJSON)}))}_getDiff(t){const e=Object.values(this.balances),n=Object.values(t),r=e.length>n.length,i=r?e:n,s=r?t:this.balances;return i.reduce(((t,e)=>{const n=e.asset.id,i=s[n];return i?(i.eq(e)||((t=t||Object.create(null))[n]=r?i:e),t):((t=t||Object.create(null))[n]=r?new o.MyMoney(0,e.asset):e,t)}),null)}_init(){return r(this,void 0,void 0,(function*(){for(;;)try{yield this._getBalances();break}catch(t){console.error("Retry Fetch Balances",t),yield o.waitPromise(5e3)}}))}_onUpdate(t){this._onUpdateCbs.forEach((e=>e(this.balances,t)))}_updateBalances(t){this._poll=new o.Poll(t,(()=>(this._readyPromise=null,this._readyPromise=this.getBalances(),this._readyPromise))),this._poll.start()}}},717:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{a(r.next(t))}catch(t){o(t)}}function u(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getFeeByTx=e.getFeesByWavesMoney=void 0;const i=n(98),o=n(593);e.getFeesByWavesMoney=(t,e)=>{const n=e.getCoins().div(1e5).roundTo(0,0);return t.reduce(((t,r)=>{if("WAVES"===r.asset.id)t.push(e);else{const e=r.cloneWithTokens(r.getTokens().mul(n));e.lte(r)&&t.push(e)}return t}),[])},e.getFeeByTx=(t,n,s,u="https://nodes.waves.exchange")=>r(void 0,void 0,void 0,(function*(){const{feeAmount:r}=yield i.default(`${u}/transactions/calculateFee`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign(Object.assign({},s),{feeAssetId:null}))}).then((t=>{if(t.status>=400)throw new Error("Bad response from server");return t.text()})).then(o.parseJSON),a=new o.MyMoney(r,t);return e.getFeesByWavesMoney(n,a)}))},593:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{a(r.next(t))}catch(t){o(t)}}function u(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Poll=e.waitPromise=e.convertToExtendedAsset=e.MyMoney=e.parseJSON=e.toHash=void 0;const i=n(739);e.toHash=(t,e)=>t.reduce(((t,n)=>(t[String(n[e])]=n,t)),Object.create(null));const o=new RegExp('((?!\\\\)"\\w+"):\\s*(-?[\\d|.]{14,}(e-?\\d+)?)',"g");e.parseJSON=function(t){return JSON.parse(t.replace(o,'$1:"$2"'))};class s extends i.Money{constructor(t,e){super(t,e)}}e.MyMoney=s,e.convertToExtendedAsset=(t,e)=>{const{data:n,metadata:r}=t,{has_script:o,description:s,min_sponsored_fee:u,height:a,id:c,name:f,precision:h,quantity:l,reissuable:p,sender:d,ticker:y,timestamp:g}=n,m=new i.Asset({id:c,height:a,name:f,precision:h,description:s,quantity:l,reissuable:p,sender:d,ticker:y,timestamp:new Date(g),hasScript:o,minSponsoredFee:u});return Object.assign(m,{hasImage:r.has_image,icon:r.has_image?`${e}/${m.id}.svg`:null,verifiedStatus:r.verified_status})},e.waitPromise=t=>new Promise((e=>setTimeout(e,t))),e.Poll=class{constructor(t,e,n){this.timeMs=t,this.isWorked=!1,this._cb=e,this._cbOut=n}start(){this.isWorked=!0,this._start()}stop(){this.isWorked=!1}_start(){return r(this,void 0,void 0,(function*(){for(;;){if(!this.isWorked)return;try{const t=yield this._cb();this._cbOut&&this._cbOut(t)}catch(t){}yield e.waitPromise(this.timeMs)}}))}}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}(()=>{"use strict";n(811),n(382),n(593)})()})(); | ||
(()=>{var t={368:function(t,e){!function(t){"use strict";var e=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,r=Math.floor,i="[BigNumber Error] ",s=i+"Number primitive has more than 15 significant digits: ",o=1e14,u=14,a=9007199254740991,c=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,f=1e9;function l(t){var e=0|t;return t>0||t===e?e:e-1}function p(t){for(var e,n,r=1,i=t.length,s=t[0]+"";r<i;){for(e=t[r++]+"",n=u-e.length;n--;e="0"+e);s+=e}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function d(t,e){var n,r,i=t.c,s=e.c,o=t.s,u=e.s,a=t.e,c=e.e;if(!o||!u)return null;if(n=i&&!i[0],r=s&&!s[0],n||r)return n?r?0:-u:o;if(o!=u)return o;if(n=o<0,r=a==c,!i||!s)return r?0:!i^n?1:-1;if(!r)return a>c^n?1:-1;for(u=(a=i.length)<(c=s.length)?a:c,o=0;o<u;o++)if(i[o]!=s[o])return i[o]>s[o]^n?1:-1;return a==c?0:a>c^n?1:-1}function y(t,e,n,s){if(t<e||t>n||t!==r(t))throw Error(i+(s||"Argument")+("number"==typeof t?t<e||t>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function g(t){var e=t.c.length-1;return l(t.e/u)==e&&t.c[e]%2!=0}function m(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function b(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else e<r&&(t=t.slice(0,e)+"."+t.slice(e));return t}var v=function t(v){var w,_,O,A,N,E,B,x,U,P=H.prototype={constructor:H,toString:null,valueOf:null},S=new H(1),M=20,T=4,D=-7,C=21,R=-1e7,F=1e7,L=!1,j=1,I=0,k={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz";function H(t,n){var i,o,c,h,f,l,p,d,g=this;if(!(g instanceof H))return new H(t,n);if(null==n){if(t&&!0===t._isBigNumber)return g.s=t.s,void(!t.c||t.e>F?g.c=g.e=null:t.e<R?g.c=[g.e=0]:(g.e=t.e,g.c=t.c.slice()));if((l="number"==typeof t)&&0*t==0){if(g.s=1/t<0?(t=-t,-1):1,t===~~t){for(h=0,f=t;f>=10;f/=10,h++);return void(h>F?g.c=g.e=null:(g.e=h,g.c=[t]))}d=String(t)}else{if(!e.test(d=String(t)))return O(g,d,l);g.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(h=d.indexOf("."))>-1&&(d=d.replace(".","")),(f=d.search(/e/i))>0?(h<0&&(h=f),h+=+d.slice(f+1),d=d.substring(0,f)):h<0&&(h=d.length)}else{if(y(n,2,q.length,"Base"),10==n)return G(g=new H(t),M+g.e+1,T);if(d=String(t),l="number"==typeof t){if(0*t!=0)return O(g,d,l,n);if(g.s=1/t<0?(d=d.slice(1),-1):1,H.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(s+t)}else g.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(i=q.slice(0,n),h=f=0,p=d.length;f<p;f++)if(i.indexOf(o=d.charAt(f))<0){if("."==o){if(f>h){h=p;continue}}else if(!c&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){c=!0,f=-1,h=0;continue}return O(g,String(t),l,n)}l=!1,(h=(d=_(d,n,10,g.s)).indexOf("."))>-1?d=d.replace(".",""):h=d.length}for(f=0;48===d.charCodeAt(f);f++);for(p=d.length;48===d.charCodeAt(--p););if(d=d.slice(f,++p)){if(p-=f,l&&H.DEBUG&&p>15&&(t>a||t!==r(t)))throw Error(s+g.s*t);if((h=h-f-1)>F)g.c=g.e=null;else if(h<R)g.c=[g.e=0];else{if(g.e=h,g.c=[],f=(h+1)%u,h<0&&(f+=u),f<p){for(f&&g.c.push(+d.slice(0,f)),p-=u;f<p;)g.c.push(+d.slice(f,f+=u));f=u-(d=d.slice(f)).length}else f-=p;for(;f--;d+="0");g.c.push(+d)}}else g.c=[g.e=0]}function W(t,e,n,r){var i,s,o,u,a;if(null==n?n=T:y(n,0,8),!t.c)return t.toString();if(i=t.c[0],o=t.e,null==e)a=p(t.c),a=1==r||2==r&&(o<=D||o>=C)?m(a,o):b(a,o,"0");else if(s=(t=G(new H(t),e,n)).e,u=(a=p(t.c)).length,1==r||2==r&&(e<=s||s<=D)){for(;u<e;a+="0",u++);a=m(a,s)}else if(e-=o,a=b(a,s,"0"),s+1>u){if(--e>0)for(a+=".";e--;a+="0");}else if((e+=s-u)>0)for(s+1==u&&(a+=".");e--;a+="0");return t.s<0&&i?"-"+a:a}function J(t,e){for(var n,r=1,i=new H(t[0]);r<t.length;r++){if(!(n=new H(t[r])).s){i=n;break}e.call(i,n)&&(i=n)}return i}function V(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*u-1)>F?t.c=t.e=null:n<R?t.c=[t.e=0]:(t.e=n,t.c=e),t}function G(t,e,i,s){var a,h,f,l,p,d,y,g=t.c,m=c;if(g){t:{for(a=1,l=g[0];l>=10;l/=10,a++);if((h=e-a)<0)h+=u,f=e,y=(p=g[d=0])/m[a-f-1]%10|0;else if((d=n((h+1)/u))>=g.length){if(!s)break t;for(;g.length<=d;g.push(0));p=y=0,a=1,f=(h%=u)-u+1}else{for(p=l=g[d],a=1;l>=10;l/=10,a++);y=(f=(h%=u)-u+a)<0?0:p/m[a-f-1]%10|0}if(s=s||e<0||null!=g[d+1]||(f<0?p:p%m[a-f-1]),s=i<4?(y||s)&&(0==i||i==(t.s<0?3:2)):y>5||5==y&&(4==i||s||6==i&&(h>0?f>0?p/m[a-f]:0:g[d-1])%10&1||i==(t.s<0?8:7)),e<1||!g[0])return g.length=0,s?(e-=t.e+1,g[0]=m[(u-e%u)%u],t.e=-e||0):g[0]=t.e=0,t;if(0==h?(g.length=d,l=1,d--):(g.length=d+1,l=m[u-h],g[d]=f>0?r(p/m[a-f]%m[f])*l:0),s)for(;;){if(0==d){for(h=1,f=g[0];f>=10;f/=10,h++);for(f=g[0]+=l,l=1;f>=10;f/=10,l++);h!=l&&(t.e++,g[0]==o&&(g[0]=1));break}if(g[d]+=l,g[d]!=o)break;g[d--]=0,l=1}for(h=g.length;0===g[--h];g.pop());}t.e>F?t.c=t.e=null:t.e<R&&(t.c=[t.e=0])}return t}function $(t){var e,n=t.e;return null===n?t.toString():(e=p(t.c),e=n<=D||n>=C?m(e,n):b(e,n,"0"),t.s<0?"-"+e:e)}return H.clone=t,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(i+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(y(n=t[e],0,f,e),M=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(y(n=t[e],0,8,e),T=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(y(n[0],-f,0,e),y(n[1],0,f,e),D=n[0],C=n[1]):(y(n,-f,f,e),D=-(C=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)y(n[0],-f,-1,e),y(n[1],1,f,e),R=n[0],F=n[1];else{if(y(n,-f,f,e),!n)throw Error(i+e+" cannot be zero: "+n);R=-(F=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(i+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!n,Error(i+"crypto unavailable");L=n}else L=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(y(n=t[e],0,9,e),j=n),t.hasOwnProperty(e="POW_PRECISION")&&(y(n=t[e],0,f,e),I=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(i+e+" not an object: "+n);k=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(i+e+" invalid: "+n);q=n}}return{DECIMAL_PLACES:M,ROUNDING_MODE:T,EXPONENTIAL_AT:[D,C],RANGE:[R,F],CRYPTO:L,MODULO_MODE:j,POW_PRECISION:I,FORMAT:k,ALPHABET:q}},H.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!H.DEBUG)return!0;var e,n,s=t.c,a=t.e,c=t.s;t:if("[object Array]"=={}.toString.call(s)){if((1===c||-1===c)&&a>=-f&&a<=f&&a===r(a)){if(0===s[0]){if(0===a&&1===s.length)return!0;break t}if((e=(a+1)%u)<1&&(e+=u),String(s[0]).length==e){for(e=0;e<s.length;e++)if((n=s[e])<0||n>=o||n!==r(n))break t;if(0!==n)return!0}}}else if(null===s&&null===a&&(null===c||1===c||-1===c))return!0;throw Error(i+"Invalid BigNumber: "+t)},H.maximum=H.max=function(){return J(arguments,P.lt)},H.minimum=H.min=function(){return J(arguments,P.gt)},H.random=(A=9007199254740992*Math.random()&2097151?function(){return r(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,s,o,a,h,l=0,p=[],d=new H(S);if(null==t?t=M:y(t,0,f),a=n(t/u),L)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(a*=2));l<a;)(h=131072*e[l]+(e[l+1]>>>11))>=9e15?(s=crypto.getRandomValues(new Uint32Array(2)),e[l]=s[0],e[l+1]=s[1]):(p.push(h%1e14),l+=2);l=a/2}else{if(!crypto.randomBytes)throw L=!1,Error(i+"crypto unavailable");for(e=crypto.randomBytes(a*=7);l<a;)(h=281474976710656*(31&e[l])+1099511627776*e[l+1]+4294967296*e[l+2]+16777216*e[l+3]+(e[l+4]<<16)+(e[l+5]<<8)+e[l+6])>=9e15?crypto.randomBytes(7).copy(e,l):(p.push(h%1e14),l+=7);l=a/7}if(!L)for(;l<a;)(h=A())<9e15&&(p[l++]=h%1e14);for(a=p[--l],t%=u,a&&t&&(h=c[u-t],p[l]=r(a/h)*h);0===p[l];p.pop(),l--);if(l<0)p=[o=0];else{for(o=-1;0===p[0];p.splice(0,1),o-=u);for(l=1,h=p[0];h>=10;h/=10,l++);l<u&&(o-=u-l)}return d.e=o,d.c=p,d}),H.sum=function(){for(var t=1,e=arguments,n=new H(e[0]);t<e.length;)n=n.plus(e[t++]);return n},_=function(){function t(t,e,n,r){for(var i,s,o=[0],u=0,a=t.length;u<a;){for(s=o.length;s--;o[s]*=e);for(o[0]+=r.indexOf(t.charAt(u++)),i=0;i<o.length;i++)o[i]>n-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/n|0,o[i]%=n)}return o.reverse()}return function(e,n,r,i,s){var o,u,a,c,h,f,l,d,y=e.indexOf("."),g=M,m=T;for(y>=0&&(c=I,I=0,e=e.replace(".",""),f=(d=new H(n)).pow(e.length-y),I=c,d.c=t(b(p(f.c),f.e,"0"),10,r,"0123456789"),d.e=d.c.length),a=c=(l=t(e,n,r,s?(o=q,"0123456789"):(o="0123456789",q))).length;0==l[--c];l.pop());if(!l[0])return o.charAt(0);if(y<0?--a:(f.c=l,f.e=a,f.s=i,l=(f=w(f,d,g,m,r)).c,h=f.r,a=f.e),y=l[u=a+g+1],c=r/2,h=h||u<0||null!=l[u+1],h=m<4?(null!=y||h)&&(0==m||m==(f.s<0?3:2)):y>c||y==c&&(4==m||h||6==m&&1&l[u-1]||m==(f.s<0?8:7)),u<1||!l[0])e=h?b(o.charAt(1),-g,o.charAt(0)):o.charAt(0);else{if(l.length=u,h)for(--r;++l[--u]>r;)l[u]=0,u||(++a,l=[1].concat(l));for(c=l.length;!l[--c];);for(y=0,e="";y<=c;e+=o.charAt(l[y++]));e=b(e,a,o.charAt(0))}return e}}(),w=function(){function t(t,e,n){var r,i,s,o,u=0,a=t.length,c=e%h,f=e/h|0;for(t=t.slice();a--;)u=((i=c*(s=t[a]%h)+(r=f*s+(o=t[a]/h|0)*c)%h*h+u)/n|0)+(r/h|0)+f*o,t[a]=i%n;return u&&(t=[u].concat(t)),t}function e(t,e,n,r){var i,s;if(n!=r)s=n>r?1:-1;else for(i=s=0;i<n;i++)if(t[i]!=e[i]){s=t[i]>e[i]?1:-1;break}return s}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]<e[n]?1:0,t[n]=i*r+t[n]-e[n];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(i,s,a,c,h){var f,p,d,y,g,m,b,v,w,_,O,A,N,E,B,x,U,P=i.s==s.s?1:-1,S=i.c,M=s.c;if(!(S&&S[0]&&M&&M[0]))return new H(i.s&&s.s&&(S?!M||S[0]!=M[0]:M)?S&&0==S[0]||!M?0*P:P/0:NaN);for(w=(v=new H(P)).c=[],P=a+(p=i.e-s.e)+1,h||(h=o,p=l(i.e/u)-l(s.e/u),P=P/u|0),d=0;M[d]==(S[d]||0);d++);if(M[d]>(S[d]||0)&&p--,P<0)w.push(1),y=!0;else{for(E=S.length,x=M.length,d=0,P+=2,(g=r(h/(M[0]+1)))>1&&(M=t(M,g,h),S=t(S,g,h),x=M.length,E=S.length),N=x,O=(_=S.slice(0,x)).length;O<x;_[O++]=0);U=M.slice(),U=[0].concat(U),B=M[0],M[1]>=h/2&&B++;do{if(g=0,(f=e(M,_,x,O))<0){if(A=_[0],x!=O&&(A=A*h+(_[1]||0)),(g=r(A/B))>1)for(g>=h&&(g=h-1),b=(m=t(M,g,h)).length,O=_.length;1==e(m,_,b,O);)g--,n(m,x<b?U:M,b,h),b=m.length,f=1;else 0==g&&(f=g=1),b=(m=M.slice()).length;if(b<O&&(m=[0].concat(m)),n(_,m,O,h),O=_.length,-1==f)for(;e(M,_,x,O)<1;)g++,n(_,x<O?U:M,O,h),O=_.length}else 0===f&&(g++,_=[0]);w[d++]=g,_[0]?_[O++]=S[N]||0:(_=[S[N]],O=1)}while((N++<E||null!=_[0])&&P--);y=null!=_[0],w[0]||w.splice(0,1)}if(h==o){for(d=1,P=w[0];P>=10;P/=10,d++);G(v,a+(v.e=d+p*u-1)+1,c,y)}else v.e=p,v.r=+y;return v}}(),N=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,B=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,U=/^\s*\+(?=[\w.])|^\s+|\s+$/g,O=function(t,e,n,r){var s,o=n?e:e.replace(U,"");if(x.test(o))t.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(N,(function(t,e,n){return s="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=s?t:e})),r&&(s=r,o=o.replace(E,"$1").replace(B,"0.$1")),e!=o))return new H(o,s);if(H.DEBUG)throw Error(i+"Not a"+(r?" base "+r:"")+" number: "+e);t.s=null}t.c=t.e=null},P.absoluteValue=P.abs=function(){var t=new H(this);return t.s<0&&(t.s=1),t},P.comparedTo=function(t,e){return d(this,new H(t,e))},P.decimalPlaces=P.dp=function(t,e){var n,r,i,s=this;if(null!=t)return y(t,0,f),null==e?e=T:y(e,0,8),G(new H(s),t+s.e+1,e);if(!(n=s.c))return null;if(r=((i=n.length-1)-l(this.e/u))*u,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},P.dividedBy=P.div=function(t,e){return w(this,new H(t,e),M,T)},P.dividedToIntegerBy=P.idiv=function(t,e){return w(this,new H(t,e),0,1)},P.exponentiatedBy=P.pow=function(t,e){var s,o,a,c,h,f,l,p,d=this;if((t=new H(t)).c&&!t.isInteger())throw Error(i+"Exponent not an integer: "+$(t));if(null!=e&&(e=new H(e)),h=t.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!t.c||!t.c[0])return p=new H(Math.pow(+$(d),h?2-g(t):+$(t))),e?p.mod(e):p;if(f=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new H(NaN);(o=!f&&d.isInteger()&&e.isInteger())&&(d=d.mod(e))}else{if(t.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||h&&d.c[1]>=24e7:d.c[0]<8e13||h&&d.c[0]<=9999975e7)))return c=d.s<0&&g(t)?-0:0,d.e>-1&&(c=1/c),new H(f?1/c:c);I&&(c=n(I/u+2))}for(h?(s=new H(.5),f&&(t.s=1),l=g(t)):l=(a=Math.abs(+$(t)))%2,p=new H(S);;){if(l){if(!(p=p.times(d)).c)break;c?p.c.length>c&&(p.c.length=c):o&&(p=p.mod(e))}if(a){if(0===(a=r(a/2)))break;l=a%2}else if(G(t=t.times(s),t.e+1,1),t.e>14)l=g(t);else{if(0==(a=+$(t)))break;l=a%2}d=d.times(d),c?d.c&&d.c.length>c&&(d.c.length=c):o&&(d=d.mod(e))}return o?p:(f&&(p=S.div(p)),e?p.mod(e):c?G(p,I,T,void 0):p)},P.integerValue=function(t){var e=new H(this);return null==t?t=T:y(t,0,8),G(e,e.e+1,t)},P.isEqualTo=P.eq=function(t,e){return 0===d(this,new H(t,e))},P.isFinite=function(){return!!this.c},P.isGreaterThan=P.gt=function(t,e){return d(this,new H(t,e))>0},P.isGreaterThanOrEqualTo=P.gte=function(t,e){return 1===(e=d(this,new H(t,e)))||0===e},P.isInteger=function(){return!!this.c&&l(this.e/u)>this.c.length-2},P.isLessThan=P.lt=function(t,e){return d(this,new H(t,e))<0},P.isLessThanOrEqualTo=P.lte=function(t,e){return-1===(e=d(this,new H(t,e)))||0===e},P.isNaN=function(){return!this.s},P.isNegative=function(){return this.s<0},P.isPositive=function(){return this.s>0},P.isZero=function(){return!!this.c&&0==this.c[0]},P.minus=function(t,e){var n,r,i,s,a=this,c=a.s;if(e=(t=new H(t,e)).s,!c||!e)return new H(NaN);if(c!=e)return t.s=-e,a.plus(t);var h=a.e/u,f=t.e/u,p=a.c,d=t.c;if(!h||!f){if(!p||!d)return p?(t.s=-e,t):new H(d?a:NaN);if(!p[0]||!d[0])return d[0]?(t.s=-e,t):new H(p[0]?a:3==T?-0:0)}if(h=l(h),f=l(f),p=p.slice(),c=h-f){for((s=c<0)?(c=-c,i=p):(f=h,i=d),i.reverse(),e=c;e--;i.push(0));i.reverse()}else for(r=(s=(c=p.length)<(e=d.length))?c:e,c=e=0;e<r;e++)if(p[e]!=d[e]){s=p[e]<d[e];break}if(s&&(i=p,p=d,d=i,t.s=-t.s),(e=(r=d.length)-(n=p.length))>0)for(;e--;p[n++]=0);for(e=o-1;r>c;){if(p[--r]<d[r]){for(n=r;n&&!p[--n];p[n]=e);--p[n],p[r]+=o}p[r]-=d[r]}for(;0==p[0];p.splice(0,1),--f);return p[0]?V(t,p,f):(t.s=3==T?-1:1,t.c=[t.e=0],t)},P.modulo=P.mod=function(t,e){var n,r,i=this;return t=new H(t,e),!i.c||!t.s||t.c&&!t.c[0]?new H(NaN):!t.c||i.c&&!i.c[0]?new H(i):(9==j?(r=t.s,t.s=1,n=w(i,t,0,3),t.s=r,n.s*=r):n=w(i,t,0,j),(t=i.minus(n.times(t))).c[0]||1!=j||(t.s=i.s),t)},P.multipliedBy=P.times=function(t,e){var n,r,i,s,a,c,f,p,d,y,g,m,b,v,w,_=this,O=_.c,A=(t=new H(t,e)).c;if(!(O&&A&&O[0]&&A[0]))return!_.s||!t.s||O&&!O[0]&&!A||A&&!A[0]&&!O?t.c=t.e=t.s=null:(t.s*=_.s,O&&A?(t.c=[0],t.e=0):t.c=t.e=null),t;for(r=l(_.e/u)+l(t.e/u),t.s*=_.s,(f=O.length)<(y=A.length)&&(b=O,O=A,A=b,i=f,f=y,y=i),i=f+y,b=[];i--;b.push(0));for(v=o,w=h,i=y;--i>=0;){for(n=0,g=A[i]%w,m=A[i]/w|0,s=i+(a=f);s>i;)n=((p=g*(p=O[--a]%w)+(c=m*p+(d=O[a]/w|0)*g)%w*w+b[s]+n)/v|0)+(c/w|0)+m*d,b[s--]=p%v;b[s]=n}return n?++r:b.splice(0,1),V(t,b,r)},P.negated=function(){var t=new H(this);return t.s=-t.s||null,t},P.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new H(t,e)).s,!i||!e)return new H(NaN);if(i!=e)return t.s=-e,r.minus(t);var s=r.e/u,a=t.e/u,c=r.c,h=t.c;if(!s||!a){if(!c||!h)return new H(i/0);if(!c[0]||!h[0])return h[0]?t:new H(c[0]?r:0*i)}if(s=l(s),a=l(a),c=c.slice(),i=s-a){for(i>0?(a=s,n=h):(i=-i,n=c),n.reverse();i--;n.push(0));n.reverse()}for((i=c.length)-(e=h.length)<0&&(n=h,h=c,c=n,e=i),i=0;e;)i=(c[--e]=c[e]+h[e]+i)/o|0,c[e]=o===c[e]?0:c[e]%o;return i&&(c=[i].concat(c),++a),V(t,c,a)},P.precision=P.sd=function(t,e){var n,r,i,s=this;if(null!=t&&t!==!!t)return y(t,1,f),null==e?e=T:y(e,0,8),G(new H(s),t,e);if(!(n=s.c))return null;if(r=(i=n.length-1)*u+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&s.e+1>r&&(r=s.e+1),r},P.shiftedBy=function(t){return y(t,-a,a),this.times("1e"+t)},P.squareRoot=P.sqrt=function(){var t,e,n,r,i,s=this,o=s.c,u=s.s,a=s.e,c=M+4,h=new H("0.5");if(1!==u||!o||!o[0])return new H(!u||u<0&&(!o||o[0])?NaN:o?s:1/0);if(0==(u=Math.sqrt(+$(s)))||u==1/0?(((e=p(o)).length+a)%2==0&&(e+="0"),u=Math.sqrt(+e),a=l((a+1)/2)-(a<0||a%2),n=new H(e=u==1/0?"5e"+a:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+a)):n=new H(u+""),n.c[0])for((u=(a=n.e)+c)<3&&(u=0);;)if(i=n,n=h.times(i.plus(w(s,i,c,1))),p(i.c).slice(0,u)===(e=p(n.c)).slice(0,u)){if(n.e<a&&--u,"9999"!=(e=e.slice(u-3,u+1))&&(r||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(G(n,n.e+M+2,1),t=!n.times(n).eq(s));break}if(!r&&(G(i,i.e+M+2,0),i.times(i).eq(s))){n=i;break}c+=4,u+=4,r=1}return G(n,n.e+M+1,T,t)},P.toExponential=function(t,e){return null!=t&&(y(t,0,f),t++),W(this,t,e,1)},P.toFixed=function(t,e){return null!=t&&(y(t,0,f),t=t+this.e+1),W(this,t,e)},P.toFormat=function(t,e,n){var r,s=this;if(null==n)null!=t&&e&&"object"==typeof e?(n=e,e=null):t&&"object"==typeof t?(n=t,t=e=null):n=k;else if("object"!=typeof n)throw Error(i+"Argument not an object: "+n);if(r=s.toFixed(t,e),s.c){var o,u=r.split("."),a=+n.groupSize,c=+n.secondaryGroupSize,h=n.groupSeparator||"",f=u[0],l=u[1],p=s.s<0,d=p?f.slice(1):f,y=d.length;if(c&&(o=a,a=c,c=o,y-=o),a>0&&y>0){for(o=y%a||a,f=d.substr(0,o);o<y;o+=a)f+=h+d.substr(o,a);c>0&&(f+=h+d.slice(o)),p&&(f="-"+f)}r=l?f+(n.decimalSeparator||"")+((c=+n.fractionGroupSize)?l.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):l):f}return(n.prefix||"")+r+(n.suffix||"")},P.toFraction=function(t){var e,n,r,s,o,a,h,f,l,d,y,g,m=this,b=m.c;if(null!=t&&(!(h=new H(t)).isInteger()&&(h.c||1!==h.s)||h.lt(S)))throw Error(i+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+$(h));if(!b)return new H(m);for(e=new H(S),l=n=new H(S),r=f=new H(S),g=p(b),o=e.e=g.length-m.e-1,e.c[0]=c[(a=o%u)<0?u+a:a],t=!t||h.comparedTo(e)>0?o>0?e:l:h,a=F,F=1/0,h=new H(g),f.c[0]=0;d=w(h,e,0,1),1!=(s=n.plus(d.times(r))).comparedTo(t);)n=r,r=s,l=f.plus(d.times(s=l)),f=s,e=h.minus(d.times(s=e)),h=s;return s=w(t.minus(n),r,0,1),f=f.plus(s.times(l)),n=n.plus(s.times(r)),f.s=l.s=m.s,y=w(l,r,o*=2,T).minus(m).abs().comparedTo(w(f,n,o,T).minus(m).abs())<1?[l,r]:[f,n],F=a,y},P.toNumber=function(){return+$(this)},P.toPrecision=function(t,e){return null!=t&&y(t,1,f),W(this,t,e,2)},P.toString=function(t){var e,n=this,r=n.s,i=n.e;return null===i?r?(e="Infinity",r<0&&(e="-"+e)):e="NaN":(null==t?e=i<=D||i>=C?m(p(n.c),i):b(p(n.c),i,"0"):10===t?e=b(p((n=G(new H(n),M+i+1,T)).c),n.e,"0"):(y(t,2,q.length,"Base"),e=_(b(p(n.c),i,"0"),10,t,r,!0)),r<0&&n.c[0]&&(e="-"+e)),e},P.valueOf=P.toJSON=function(){return $(this)},P._isBigNumber=!0,P[Symbol.toStringTag]="BigNumber",P[Symbol.for("nodejs.util.inspect.custom")]=P.valueOf,null!=v&&H.set(v),H}(),w=function(){return(w=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},_=function(){function t(){this.format=t.DEFAULT_FORMAT,v.config({FORMAT:this.format})}return t.prototype.set=function(t){"FORMAT"in t&&(this.format=w({},this.format,t.FORMAT),t.FORMAT=this.format),v.config(t)},t.DEFAULT_FORMAT={prefix:"",decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0,suffix:""},t}();t.BigNumber=function(){function t(e){"object"==typeof e&&t.isBigNumber(e)?this.bn=e.bn.plus(0):this.bn=t.toBigNumberJs(e)}return t.prototype.clone=function(){return new t(this)},t.prototype.add=function(e){return new t(this.bn.plus(t.toBigNumberJs(e)))},t.prototype.sub=function(e){return new t(this.bn.minus(t.toBigNumberJs(e)))},t.prototype.mul=function(e){return new t(this.bn.times(t.toBigNumberJs(e)))},t.prototype.div=function(e){return new t(this.bn.div(t.toBigNumberJs(e)))},t.prototype.pow=function(e){return new t(this.bn.pow(t.toBigNumberJs(e)))},t.prototype.sqrt=function(){return new t(this.bn.sqrt())},t.prototype.abs=function(){return new t(this.bn.abs())},t.prototype.mod=function(e){return new t(this.bn.mod(t.toBigNumberJs(e)))},t.prototype.roundTo=function(e,n){return void 0===e&&(e=0),void 0===n&&(n=4),new t(this.bn.dp(e||0,n))},t.prototype.eq=function(e){return this.bn.eq(t.toBigNumberJs(e))},t.prototype.lt=function(e){return this.bn.lt(t.toBigNumberJs(e))},t.prototype.gt=function(e){return this.bn.gt(t.toBigNumberJs(e))},t.prototype.lte=function(e){return this.bn.lte(t.toBigNumberJs(e))},t.prototype.gte=function(e){return this.bn.gte(t.toBigNumberJs(e))},t.prototype.isNaN=function(){return this.bn.isNaN()},t.prototype.isFinite=function(){return this.bn.isFinite()},t.prototype.isZero=function(){return this.eq(0)},t.prototype.isPositive=function(){return this.gt(0)},t.prototype.isNegative=function(){return this.lt(0)},t.prototype.isInt=function(){return this.bn.isInteger()},t.prototype.getDecimalsCount=function(){return this.bn.dp()},t.prototype.isEven=function(){return this.mod(2).eq(0)},t.prototype.isOdd=function(){return!this.isEven()},t.prototype.isInSignedRange=function(){return this.gte(t.MIN_VALUE)&&this.lte(t.MAX_VALUE)},t.prototype.isInUnsignedRange=function(){return this.gte(t.MIN_UNSIGNED_VALUE)&&this.lte(t.MAX_UNSIGNED_VALUE)},t.prototype.toFormat=function(t,e,n){return this.bn.toFormat(t,e,n)},t.prototype.toFixed=function(t,e){return null==t?this.bn.toFixed():this.bn.toFixed(t,e)},t.prototype.toString=function(){return this.toFixed()},t.prototype.toNumber=function(){return this.bn.toNumber()},t.prototype.toJSON=function(){return this.bn.toFixed()},t.prototype.valueOf=function(){return this.bn.valueOf()},t.prototype.toBytes=function(e){var n=void 0===e?{}:e,r=n.isSigned,i=void 0===r||r,s=n.isLong,o=void 0===s||s;if(!this.isInt())throw new Error("Cant create bytes from number with decimals!");if(!i&&this.isNegative())throw new Error("Cant create bytes from negative number in signed mode!");if(o&&i&&!this.isInSignedRange())throw new Error("Number is not from signed numbers range");if(o&&!i&&!this.isInUnsignedRange())throw new Error("Number is not from unsigned numbers range");var u=i&&this.isNegative(),a=u?"1":"0",c=this.bn.plus(a).toString(2).replace("-",""),h=o?64:8*Math.ceil(c.length/8),f=t._toLength(h,c).split(""),l=[];do{l.push(parseInt(f.splice(0,8).join(""),2))}while(f.length);return u?Uint8Array.from(l.map((function(t){return 255-t}))):Uint8Array.from(l)},t.fromBytes=function(e,n){var r=void 0===n?{}:n,i=r.isSigned,s=void 0===i||i,o=r.isLong,u=void 0===o||o;if(u&&8!==e.length)throw new Error("Wrong bytes length! Minimal length is 8 byte!");e=!u&&e.length>0||u?e:[0];var a=!!s&&e[0]>127,c=Array.from(e).map((function(t){return a?255-t:t})).map((function(e){return t._toLength(8,e.toString(2))})).join(""),h=new t(new v(c,2));return a?h.mul(-1).sub(1):h},t.max=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.toBigNumber(e).reduce((function(t,e){return t.gte(e)?t:e}))},t.min=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.toBigNumber(e).reduce((function(t,e){return t.lte(e)?t:e}))},t.sum=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.toBigNumber(e).reduce((function(t,e){return t.add(e)}))},t.isBigNumber=function(e){return e&&"object"==typeof e&&(e instanceof t||Object.entries(t.prototype).filter((function(t){return"_"!==t[0].charAt(0)})).every((function(t){var n=t[0],r=t[1];return n in e&&typeof r==typeof e[n]})))},t.toBigNumber=function(e){return Array.isArray(e)?e.map((function(e){return new t(e)})):new t(e)},t.toBigNumberJs=function(e){return v.isBigNumber(e)?e:e instanceof t?e.bn:new v(e)},t._toLength=function(t,e){return new Array(t).fill("0",0,t).concat(e.split("")).slice(-t).join("")},t.MIN_VALUE=new t("-9223372036854775808"),t.MAX_VALUE=new t("9223372036854775807"),t.MIN_UNSIGNED_VALUE=new t("0"),t.MAX_UNSIGNED_VALUE=new t("18446744073709551615"),t.config=new _,t}(),function(t){!function(t){t[t.ROUND_UP=0]="ROUND_UP",t[t.ROUND_DOWN=1]="ROUND_DOWN",t[t.ROUND_CEIL=2]="ROUND_CEIL",t[t.ROUND_FLOOR=3]="ROUND_FLOOR",t[t.ROUND_HALF_UP=4]="ROUND_HALF_UP",t[t.ROUND_HALF_DOWN=5]="ROUND_HALF_DOWN",t[t.ROUND_HALF_EVEN=6]="ROUND_HALF_EVEN",t[t.ROUND_HALF_CEIL=7]="ROUND_HALF_CEIL",t[t.ROUND_HALF_FLOOR=8]="ROUND_HALF_FLOOR"}(t.ROUND_MODE||(t.ROUND_MODE={}))}(t.BigNumber||(t.BigNumber={}));var O=t.BigNumber;t.default=O,Object.defineProperty(t,"__esModule",{value:!0})}(e)},466:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,r={remapAsset:function(t){return t},remapCandle:function(t){return t}};(n=e.config||(e.config={})).get=function(t){return r[t]},n.set=function t(e,n){"string"==typeof e?r[e]=n:Object.keys(e).forEach((function(n){return t(n,e[n])}))}},748:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(466),i=n(781),s=function(){function t(t){t=r.config.get("remapAsset")(t),this.quantity=i.toBigNumber(t.quantity),this.minSponsoredFee=i.toBigNumber(t.minSponsoredFee),this.ticker=t.ticker||null,this.id=t.id,this.name=t.name,this.precision=t.precision,this.description=t.description,this.height=t.height,this.timestamp=t.timestamp,this.sender=t.sender,this.reissuable=t.reissuable,this.hasScript=t.hasScript||!1,this.displayName=t.ticker||t.name}return t.prototype.toJSON=function(){return{ticker:this.ticker,id:this.id,name:this.name,precision:this.precision,description:this.description,height:this.height,timestamp:this.timestamp,sender:this.sender,quantity:this.quantity,reissuable:this.reissuable,hasScript:this.hasScript,minSponsoredFee:this.minSponsoredFee}},t.prototype.toString=function(){return this.id},t.isAsset=function(e){return e instanceof t},t}();e.Asset=s},55:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this.amountAsset=t,this.priceAsset=e,this.precisionDifference=this.priceAsset.precision-this.amountAsset.precision}return t.prototype.toJSON=function(){return{amountAsset:this.amountAsset.id,priceAsset:this.priceAsset.id}},t.prototype.toString=function(){return this.amountAsset+"/"+this.priceAsset},t.isAssetPair=function(e){return e instanceof t},t}();e.AssetPair=n},318:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(466),i=n(781),s=function(){function t(t){var e=this;t=r.config.get("remapCandle")(t),["open","close","high","low","volume","quoteVolume","weightedAveragePrice"].forEach((function(n){return e[n]=i.toBigNumber(t[n])})),this.time=t.time,this.maxHeight=t.maxHeight,this.txsCount=t.txsCount}return t.prototype.toJSON=function(){return{time:this.time,open:this.open,close:this.close,high:this.high,low:this.low,volume:this.volume,quoteVolume:this.quoteVolume,weightedAveragePrice:this.weightedAveragePrice,maxHeight:this.maxHeight,txsCount:this.txsCount}},t.prototype.toString=function(){return"[object Candle]"},t.isCandle=function(e){return e instanceof t},t}();e.Candle=s},906:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(368),i=n(781),s=function(){function t(e,n){var r=t._getDivider(n.precision);this.asset=n,this._coins=i.toBigNumber(e).roundTo(0),this._tokens=this._coins.div(r)}return t.prototype.getCoins=function(){return this._coins.add(0)},t.prototype.getTokens=function(){return this._tokens.add(0)},t.prototype.toCoins=function(){return this._coins.toFixed(0)},t.prototype.toTokens=function(){return this._tokens.toFixed(this.asset.precision)},t.prototype.toFormat=function(t){return this._tokens.toFormat(t)},t.prototype.add=function(e){this._matchAssets(e);var n=e.getCoins();return new t(this._coins.add(n),this.asset)},t.prototype.plus=function(t){return this.add(t)},t.prototype.sub=function(e){this._matchAssets(e);var n=e.getCoins();return new t(this._coins.sub(n),this.asset)},t.prototype.minus=function(t){return this.sub(t)},t.prototype.times=function(e){return this._matchAssets(e),new t(this.getCoins().mul(e.getCoins()),this.asset)},t.prototype.div=function(e){return this._matchAssets(e),new t(this.getCoins().div(e.getCoins()),this.asset)},t.prototype.eq=function(t){return this._matchAssets(t),this._coins.eq(t.getCoins())},t.prototype.lt=function(t){return this._matchAssets(t),this._coins.lt(t.getCoins())},t.prototype.lte=function(t){return this._matchAssets(t),this._coins.lte(t.getCoins())},t.prototype.gt=function(t){return this._matchAssets(t),this._coins.gt(t.getCoins())},t.prototype.gte=function(t){return this._matchAssets(t),this._coins.gte(t.getCoins())},t.prototype.safeSub=function(t){return this.asset.id===t.asset.id?this.sub(t):this},t.prototype.toNonNegative=function(){return this.getTokens().lt(0)?this.cloneWithTokens(0):this},t.prototype.cloneWithCoins=function(e){return new t(new r.BigNumber(e),this.asset)},t.prototype.cloneWithTokens=function(e){var n=t._tokensToCoins(e,this.asset.precision);return new t(n,this.asset)},t.prototype.convertTo=function(e,n){return t.convert(this,e,i.toBigNumber(n))},t.prototype.toJSON=function(){return{assetId:this.asset.id,tokens:this.toTokens()}},t.prototype.toString=function(){return this.toTokens()+" "+this.asset.id},t.prototype._matchAssets=function(t){if(this.asset.id!==t.asset.id)throw new Error("You cannot apply arithmetic operations to Money created with different assets")},t.max=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return t.gte(e)?t:e}))},t.min=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return t.lte(e)?t:e}))},t.isMoney=function(e){return e instanceof t},t.convert=function(e,n,i){if(e.asset===n)return e;var s=e.asset.precision-n.precision,o=new r.BigNumber(10).pow(s),u=e.getCoins().mul(i).div(o).roundTo(0,1).toFixed();return new t(new r.BigNumber(u),n)},t.fromTokens=function(e,n){return new t(i.toBigNumber(e).mul(new r.BigNumber(10).pow(n.precision)),n)},t.fromCoins=function(e,n){return new t(e,n)},t._tokensToCoins=function(e,n){var i=t._getDivider(n);return e=new r.BigNumber(e).toFixed(n),new r.BigNumber(e).mul(i)},t._getDivider=function(t){return new r.BigNumber(10).pow(t)},t}();e.Money=s},454:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(368),i=n(781),s=function(){function t(e,n){var r=t._getMatcherDivider(n.precisionDifference);this.pair=n,this._matcherCoins=e,this._tokens=this._matcherCoins.div(r)}return t.prototype.getMatcherCoins=function(){return this._matcherCoins.clone()},t.prototype.getTokens=function(){return this._tokens.clone()},t.prototype.toMatcherCoins=function(){return this._matcherCoins.toFixed(0)},t.prototype.toTokens=function(){return this._tokens.toFixed(this.pair.priceAsset.precision)},t.prototype.toFormat=function(){return this._tokens.toFormat(this.pair.priceAsset.precision)},t.prototype.toJSON=function(){return{amountAssetId:this.pair.amountAsset.id,priceAssetId:this.pair.priceAsset.id,priceTokens:this.toTokens()}},t.prototype.toString=function(){return this.toTokens()+" "+this.pair.amountAsset.id+"/"+this.pair.priceAsset.id},t.fromMatcherCoins=function(e,n){return t._checkAmount(e),new t(i.toBigNumber(e),n)},t.fromTokens=function(e,n){t._checkAmount(e),e=i.toBigNumber(e).toFixed(n.priceAsset.precision);var s=t._getMatcherDivider(n.precisionDifference);return new t(new r.BigNumber(e).mul(s),n)},t._getMatcherDivider=function(e){return new r.BigNumber(10).pow(e).mul(t._MATCHER_SCALE)},t.isOrderPrice=function(e){return e instanceof t},t._checkAmount=function(t){if(!(["string","number"].includes(typeof t)||t instanceof r.BigNumber))throw new Error("Please use strings to create instances of OrderPrice")},t._MATCHER_SCALE=new r.BigNumber(10).pow(8),t}();e.OrderPrice=s},739:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(748);e.Asset=r.Asset;var i=n(318);e.Candle=i.Candle;var s=n(906);e.Money=s.Money;var o=n(454);e.OrderPrice=o.OrderPrice;var u=n(55);e.AssetPair=u.AssetPair;var a=n(466);e.config=a.config},781:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(368);e.toBigNumber=function(t){return t instanceof r.BigNumber?t:new r.BigNumber(t)}},98:function(t,e){var n="undefined"!=typeof self?self:this,r=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in t,o="ArrayBuffer"in t;if(o)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function y(t){var e=new FileReader,n=d(e);return e.readAsArrayBuffer(t),n}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&i&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,n,r=p(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,n=d(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=h(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=h(e)},l.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),f(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),f(t)},r&&(l.prototype[Symbol.iterator]=l.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var n,r,i=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(r=(n=e.method||this.method||"GET").toUpperCase(),b.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function _(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},m.call(v.prototype),m.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var O=[301,302,303,307,308];_.redirect=function(t,e){if(-1===O.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function A(t,n){return new Promise((function(r,s){var o=new v(t,n);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,n={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;r(new _(i,n))},u.onerror=function(){s(new TypeError("Network request failed"))},u.ontimeout=function(){s(new TypeError("Network request failed"))},u.onabort=function(){s(new e.DOMException("Aborted","AbortError"))},u.open(o.method,o.url,!0),"include"===o.credentials?u.withCredentials=!0:"omit"===o.credentials&&(u.withCredentials=!1),"responseType"in u&&i&&(u.responseType="blob"),o.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&o.signal.removeEventListener("abort",a)}),u.send(void 0===o._bodyInit?null:o._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=l,t.Request=v,t.Response=_),e.Headers=l,e.Request=v,e.Response=_,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},382:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{a(r.next(t))}catch(t){s(t)}}function u(t){try{a(r.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Assets=void 0;const i=n(593),s=n(98);e.Assets=class{constructor(t="https://waves.exchange/api/v1",e="https://waves.exchange/static/icons/assets"){this.assets=Object.create(null),this._assetsPromise=Object.create(null),this.iconUrl=e,this.dataServicesUrl=t}getAssets(t){return r(this,void 0,void 0,(function*(){const e=t.filter((t=>!this.assets[t]||!this._assetsPromise[t])),n=t.filter((t=>this._assetsPromise[t])).map((t=>this._assetsPromise[t].promise));for(;;)try{const t=this._fetchAssets(e).then((t=>(t.forEach((t=>{this.assets[t.id]=t})),t)));e.forEach(((e,n)=>{this._assetsPromise[e]={promise:t,index:n}})),yield Promise.all([t,...n]);break}catch(t){yield i.waitPromise(5e3)}return t.map((t=>this.assets[t]))}))}_fetchAssets(t){return s.default(`${this.dataServicesUrl}/assets`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:t})}).then((t=>{if(t.status>=400)throw new Error("Bad response from server");return t.text()})).then(i.parseJSON).then((t=>t.data)).then((t=>t.map((t=>i.convertToExtendedAsset(t,this.iconUrl)))))}}},811:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{a(r.next(t))}catch(t){s(t)}}function u(t){try{a(r.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Balance=void 0;const i=n(98),s=n(593),o=n(717),u=n(382);e.Balance=class{constructor(t){this.balances=Object.create(null),this.feeList=[],this.hasData=!1,this._onUpdateCbs=[],this._poll=null;const{address:e,iconUrl:n="https://waves.exchange/static/icons/assets",dataServicesUrl:r="https://waves.exchange/api/v1",nodeUrl:i="https://nodes.waves.exchange",updateBalancesMs:s=null}=t;this._updateBalancesMs=s,this._assets=new u.Assets(r,n),this.dataServicesUrl=r,this.nodeUrl=i,this.changeUser(e)}changeUser(t){this.hasData=!1,this.address=t,this.balances=Object.create(null),this.feeList=[],this._readyPromise=null,Object.entries(this.balances).reduce(((t,[e,n])=>(t[e]=n.cloneWithCoins(0),t)),{}),this._onUpdate(Object.create(null)),t&&(this._updateBalancesMs?this._updateBalances(this._updateBalancesMs):this._readyPromise=this._init())}destroy(){this.offUpdate(),this._poll&&(this._poll.stop(),this._poll=null)}getFeesByCoins(t){return r(this,void 0,void 0,(function*(){yield this._readyPromise;const e=t instanceof s.MyMoney?t.getCoins():t;return o.getFeesByWavesMoney(this.feeList,new s.MyMoney(e,this._wavesAsset))}))}getFees(t){return r(this,void 0,void 0,(function*(){return yield this._readyPromise,o.getFeeByTx(this._wavesAsset,this.feeList,t,this.nodeUrl)}))}getBalances(){return r(this,void 0,void 0,(function*(){if(this._readyPromise)return this._readyPromise;this._readyPromise=this._init()}))}onUpdate(t){this._onUpdateCbs.push(t)}offUpdate(t){this._onUpdateCbs=t?this._onUpdateCbs.filter((e=>e!==t)):[]}_getBalances(){return r(this,void 0,void 0,(function*(){const t=yield this._fetchWavesBalances(),{balances:e}=yield this._fetchBalances(),n=(e||[]).map((t=>t.assetId)),r=yield this._assets.getAssets(["WAVES",...n]),i=s.toHash(r,"id");this._wavesAsset=i.WAVES;const o=new s.MyMoney(t.available,i.WAVES),u=e.reduce(((t,e)=>{const n=i[e.assetId];return t[e.assetId]=new s.MyMoney(e.balance,n),t}),Object.create(null)),a=Object.assign(Object.assign({},u),{WAVES:o}),c=this._getDiff(a);if(this.hasData=!0,!c)return null;this.balances=a,this.feeList=Object.values(this.balances).filter((t=>"WAVES"===t.asset.id||Number(t.asset.minSponsoredFee)>0)),this._onUpdate(c)}))}_fetchWavesBalances(){return r(this,void 0,void 0,(function*(){return yield i.default(`${this.nodeUrl}/addresses/balance/details/${this.address}`).then((t=>{if(t.status>=400)throw new Error("Bad response from server");return t.text()})).then(s.parseJSON)}))}_fetchBalances(){return r(this,void 0,void 0,(function*(){return yield i.default(`${this.nodeUrl}/assets/balance/${this.address}`).then((t=>{if(t.status>=400)throw new Error("Bad response from server");return t.text()})).then(s.parseJSON)}))}_getDiff(t){const e=Object.values(this.balances),n=Object.values(t),r=e.length>n.length,i=r?e:n,o=r?t:this.balances;return i.reduce(((t,e)=>{const n=e.asset.id,i=o[n];return i?(i.eq(e)||((t=t||Object.create(null))[n]=r?i:e),t):((t=t||Object.create(null))[n]=r?new s.MyMoney(0,e.asset):e,t)}),null)}_init(){return r(this,void 0,void 0,(function*(){for(;;)try{yield this._getBalances();break}catch(t){console.error("Retry Fetch Balances",t),yield s.waitPromise(5e3)}}))}_onUpdate(t){this._onUpdateCbs.forEach((e=>e(this.balances,t)))}_updateBalances(t){this._poll=new s.Poll(t,(()=>(this._readyPromise=null,this._readyPromise=this.getBalances(),this._readyPromise))),this._poll.start()}}},717:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{a(r.next(t))}catch(t){s(t)}}function u(t){try{a(r.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.getFeeByTx=e.getFeesByWavesMoney=void 0;const i=n(98),s=n(593);e.getFeesByWavesMoney=(t,e)=>{const n=e.getCoins().div(1e5).roundTo(0,0);return t.reduce(((t,r)=>{if("WAVES"===r.asset.id)t.push(e);else{const e=r.cloneWithTokens(r.getTokens().mul(n));e.lte(r)&&t.push(e)}return t}),[])},e.getFeeByTx=(t,n,o,u="https://nodes.waves.exchange")=>r(void 0,void 0,void 0,(function*(){const{feeAmount:r}=yield i.default(`${u}/transactions/calculateFee`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign(Object.assign({},o),{feeAssetId:null}))}).then((t=>{if(t.status>=400)throw new Error("Bad response from server");return t.text()})).then(s.parseJSON),a=new s.MyMoney(r,t);return e.getFeesByWavesMoney(n,a)}))},593:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{a(r.next(t))}catch(t){s(t)}}function u(t){try{a(r.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Poll=e.waitPromise=e.convertToExtendedAsset=e.MyMoney=e.parseJSON=e.toHash=void 0;const i=n(739);e.toHash=(t,e)=>t.reduce(((t,n)=>(t[String(n[e])]=n,t)),Object.create(null));const s=new RegExp('((?!\\\\)"\\w+"):\\s*(-?[\\d|.]{14,}(e-?\\d+)?)',"g");e.parseJSON=function(t){return JSON.parse(t.replace(s,'$1:"$2"'))};class o extends i.Money{constructor(t,e){super(t,e)}cloneWithCoins(t){const e=super.cloneWithCoins(t);return new o(e.getCoins(),this.asset)}cloneWithTokens(t){const e=super.cloneWithTokens(t);return new o(e.getCoins(),this.asset)}}e.MyMoney=o,e.convertToExtendedAsset=(t,e)=>{const{data:n,metadata:r}=t,{has_script:s,description:o,min_sponsored_fee:u,height:a,id:c,name:h,precision:f,quantity:l,reissuable:p,sender:d,ticker:y,timestamp:g}=n,m=new i.Asset({id:c,height:a,name:h,precision:f,description:o,quantity:l,reissuable:p,sender:d,ticker:y,timestamp:new Date(g),hasScript:s,minSponsoredFee:u});return Object.assign(m,{hasImage:r.has_image,icon:r.has_image?`${e}/${m.id}.svg`:null,verifiedStatus:r.verified_status})},e.waitPromise=t=>new Promise((e=>setTimeout(e,t))),e.Poll=class{constructor(t,e,n){this.timeMs=t,this.isWorked=!1,this._cb=e,this._cbOut=n}start(){this.isWorked=!0,this._start()}stop(){this.isWorked=!1}_start(){return r(this,void 0,void 0,(function*(){for(;;){if(!this.isWorked)return;try{const t=yield this._cb();this._cbOut&&this._cbOut(t)}catch(t){}yield e.waitPromise(this.timeMs)}}))}}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var s=e[r]={exports:{}};return t[r].call(s.exports,s,s.exports,n),s.exports}(()=>{"use strict";n(811),n(382),n(593)})()})(); |
@@ -45,2 +45,4 @@ import { Money, Asset } from '@waves/data-entities'; | ||
constructor(coins: TMoneyInput, asset: MyAsset); | ||
cloneWithCoins(coins: TMoneyInput): MyMoney; | ||
cloneWithTokens(tokens: TMoneyInput): MyMoney; | ||
} | ||
@@ -47,0 +49,0 @@ export declare const convertToExtendedAsset: (asset: ServiceAsset, iconApiUrl: string) => MyAsset; |
@@ -31,2 +31,10 @@ "use strict"; | ||
} | ||
cloneWithCoins(coins) { | ||
const money = super.cloneWithCoins(coins); | ||
return new MyMoney(money.getCoins(), this.asset); | ||
} | ||
cloneWithTokens(tokens) { | ||
const money = super.cloneWithTokens(tokens); | ||
return new MyMoney(money.getCoins(), this.asset); | ||
} | ||
} | ||
@@ -33,0 +41,0 @@ exports.MyMoney = MyMoney; |
{ | ||
"name": "@waves/balances", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Get Waves Assets and Balances", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
178486
926