@burstjs/util
Advanced tools
Comparing version 0.6.0-beta.4 to 0.6.0-beta.5
@@ -6,2 +6,3 @@ # Change Log | ||
- `BurstValue.clone()` added | ||
- `BurstValue.fromPlanck()` accepts number now | ||
- Added hex <> base36 conversion | ||
@@ -8,0 +9,0 @@ |
@@ -1,2 +0,2 @@ | ||
var b$util=function(e){"use strict";function r(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function t(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}var i=Date.UTC(2014,7,11,2,0,0,0)/1e3,o=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],u=[1,2,4,8,16,5,10,20,13,26,17,7,14,28,29,31,27,19,3,6,12,24,21,15,30,25,23,11,22,9,18,1],a=[0,0,1,18,2,5,19,11,3,29,6,27,20,8,12,23,4,10,30,17,7,22,28,26,21,25,9,16,13,14,24,15],c=[3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11],l="23456789ABCDEFGHJKLMNPQRSTUVWXYZ".split(""),s=function(e,r){return 0===e||0===r?0:u[(a[e]+a[r])%31]},f=function(){function e(t){r(this,e),this._burstTimestamp=t}return n(e,[{key:"getBurstTimestamp",value:function(){return this._burstTimestamp}},{key:"setBurstTimestamp",value:function(e){this._burstTimestamp=e}},{key:"getEpoch",value:function(){return 1e3*(i+this._burstTimestamp)}},{key:"getDate",value:function(){return new Date(this.getEpoch())}},{key:"setDate",value:function(e){this._burstTimestamp=Math.round(e.getTime()/1e3)-i}},{key:"equals",value:function(e){return this._burstTimestamp===e._burstTimestamp}},{key:"before",value:function(e){return this._burstTimestamp<e._burstTimestamp}},{key:"after",value:function(e){return this._burstTimestamp>e._burstTimestamp}}],[{key:"fromBurstTimestamp",value:function(r){return new e(r)}},{key:"fromDate",value:function(r){var t=new e(0);return t.setDate(r),t}}]),e}(),h=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,g=Math.ceil,p=Math.floor,d="[BigNumber Error] ",v=d+"Number primitive has more than 15 significant digits: ",m=1e14,w=14,y=9007199254740991,b=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],A=1e7,S=1e9;function T(e){var r=0|e;return e>0||e===r?r:r-1}function E(e){for(var r,t,n=1,i=e.length,o=e[0]+"";n<i;){for(r=e[n++]+"",t=w-r.length;t--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function k(e,r){var t,n,i=e.c,o=r.c,u=e.s,a=r.s,c=e.e,l=r.e;if(!u||!a)return null;if(t=i&&!i[0],n=o&&!o[0],t||n)return t?n?0:-a:u;if(u!=a)return u;if(t=u<0,n=c==l,!i||!o)return n?0:!i^t?1:-1;if(!n)return c>l^t?1:-1;for(a=(c=i.length)<(l=o.length)?c:l,u=0;u<a;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return c==l?0:c>l^t?1:-1}function B(e,r,t,n){if(e<r||e>t||e!==p(e))throw Error(d+(n||"Argument")+("number"==typeof e?e<r||e>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function N(e){var r=e.c.length-1;return T(e.e/w)==r&&e.c[r]%2!=0}function x(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function O(e,r,t){var n,i;if(r<0){for(i=t+".";++r;i+=t);e=i+e}else if(++r>(n=e.length)){for(i=t,r-=n;--r;i+=t);e+=i}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}var _,C=function e(r){var t,n,i,o,u,a,c,l,s,f=G.prototype={constructor:G,toString:null,valueOf:null},_=new G(1),C=20,D=4,F=-7,U=21,P=-1e7,R=1e7,I=!1,L=1,M=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz";function G(e,r){var t,o,u,a,c,l,s,f,g=this;if(!(g instanceof G))return new G(e,r);if(null==r){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>R?g.c=g.e=null:e.e<P?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,c=e;c>=10;c/=10,a++);return void(a>R?g.c=g.e=null:(g.e=a,g.c=[e]))}f=String(e)}else{if(!h.test(f=String(e)))return i(g,f,l);g.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(a=f.indexOf("."))>-1&&(f=f.replace(".","")),(c=f.search(/e/i))>0?(a<0&&(a=c),a+=+f.slice(c+1),f=f.substring(0,c)):a<0&&(a=f.length)}else{if(B(r,2,j.length,"Base"),10==r)return $(g=new G(e),C+g.e+1,D);if(f=String(e),l="number"==typeof e){if(0*e!=0)return i(g,f,l,r);if(g.s=1/e<0?(f=f.slice(1),-1):1,G.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(v+e)}else g.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(t=j.slice(0,r),a=c=0,s=f.length;c<s;c++)if(t.indexOf(o=f.charAt(c))<0){if("."==o){if(c>a){a=s;continue}}else if(!u&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){u=!0,c=-1,a=0;continue}return i(g,String(e),l,r)}l=!1,(a=(f=n(f,r,10,g.s)).indexOf("."))>-1?f=f.replace(".",""):a=f.length}for(c=0;48===f.charCodeAt(c);c++);for(s=f.length;48===f.charCodeAt(--s););if(f=f.slice(c,++s)){if(s-=c,l&&G.DEBUG&&s>15&&(e>y||e!==p(e)))throw Error(v+g.s*e);if((a=a-c-1)>R)g.c=g.e=null;else if(a<P)g.c=[g.e=0];else{if(g.e=a,g.c=[],c=(a+1)%w,a<0&&(c+=w),c<s){for(c&&g.c.push(+f.slice(0,c)),s-=w;c<s;)g.c.push(+f.slice(c,c+=w));c=w-(f=f.slice(c)).length}else c-=s;for(;c--;f+="0");g.c.push(+f)}}else g.c=[g.e=0]}function q(e,r,t,n){var i,o,u,a,c;if(null==t?t=D:B(t,0,8),!e.c)return e.toString();if(i=e.c[0],u=e.e,null==r)c=E(e.c),c=1==n||2==n&&(u<=F||u>=U)?x(c,u):O(c,u,"0");else if(o=(e=$(new G(e),r,t)).e,a=(c=E(e.c)).length,1==n||2==n&&(r<=o||o<=F)){for(;a<r;c+="0",a++);c=x(c,o)}else if(r-=u,c=O(c,o,"0"),o+1>a){if(--r>0)for(c+=".";r--;c+="0");}else if((r+=o-a)>0)for(o+1==a&&(c+=".");r--;c+="0");return e.s<0&&i?"-"+c:c}function V(e,r){for(var t,n=1,i=new G(e[0]);n<e.length;n++){if(!(t=new G(e[n])).s){i=t;break}r.call(i,t)&&(i=t)}return i}function z(e,r,t){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,n++);return(t=n+t*w-1)>R?e.c=e.e=null:t<P?e.c=[e.e=0]:(e.e=t,e.c=r),e}function $(e,r,t,n){var i,o,u,a,c,l,s,f=e.c,h=b;if(f){e:{for(i=1,a=f[0];a>=10;a/=10,i++);if((o=r-i)<0)o+=w,u=r,s=(c=f[l=0])/h[i-u-1]%10|0;else if((l=g((o+1)/w))>=f.length){if(!n)break e;for(;f.length<=l;f.push(0));c=s=0,i=1,u=(o%=w)-w+1}else{for(c=a=f[l],i=1;a>=10;a/=10,i++);s=(u=(o%=w)-w+i)<0?0:c/h[i-u-1]%10|0}if(n=n||r<0||null!=f[l+1]||(u<0?c:c%h[i-u-1]),n=t<4?(s||n)&&(0==t||t==(e.s<0?3:2)):s>5||5==s&&(4==t||n||6==t&&(o>0?u>0?c/h[i-u]:0:f[l-1])%10&1||t==(e.s<0?8:7)),r<1||!f[0])return f.length=0,n?(r-=e.e+1,f[0]=h[(w-r%w)%w],e.e=-r||0):f[0]=e.e=0,e;if(0==o?(f.length=l,a=1,l--):(f.length=l+1,a=h[w-o],f[l]=u>0?p(c/h[i-u]%h[u])*a:0),n)for(;;){if(0==l){for(o=1,u=f[0];u>=10;u/=10,o++);for(u=f[0]+=a,a=1;u>=10;u/=10,a++);o!=a&&(e.e++,f[0]==m&&(f[0]=1));break}if(f[l]+=a,f[l]!=m)break;f[l--]=0,a=1}for(o=f.length;0===f[--o];f.pop());}e.e>R?e.c=e.e=null:e.e<P&&(e.c=[e.e=0])}return e}function Z(e){var r,t=e.e;return null===t?e.toString():(r=E(e.c),r=t<=F||t>=U?x(r,t):O(r,t,"0"),e.s<0?"-"+r:r)}return G.clone=e,G.ROUND_UP=0,G.ROUND_DOWN=1,G.ROUND_CEIL=2,G.ROUND_FLOOR=3,G.ROUND_HALF_UP=4,G.ROUND_HALF_DOWN=5,G.ROUND_HALF_EVEN=6,G.ROUND_HALF_CEIL=7,G.ROUND_HALF_FLOOR=8,G.EUCLID=9,G.config=G.set=function(e){var r,t;if(null!=e){if("object"!=typeof e)throw Error(d+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(B(t=e[r],0,S,r),C=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(B(t=e[r],0,8,r),D=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(B(t[0],-S,0,r),B(t[1],0,S,r),F=t[0],U=t[1]):(B(t,-S,S,r),F=-(U=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)B(t[0],-S,-1,r),B(t[1],1,S,r),P=t[0],R=t[1];else{if(B(t,-S,S,r),!t)throw Error(d+r+" cannot be zero: "+t);P=-(R=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(d+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw I=!t,Error(d+"crypto unavailable");I=t}else I=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(B(t=e[r],0,9,r),L=t),e.hasOwnProperty(r="POW_PRECISION")&&(B(t=e[r],0,S,r),M=t),e.hasOwnProperty(r="FORMAT")){if("object"!=typeof(t=e[r]))throw Error(d+r+" not an object: "+t);H=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.$|[+-.\s]|(.).*\1/.test(t))throw Error(d+r+" invalid: "+t);j=t}}return{DECIMAL_PLACES:C,ROUNDING_MODE:D,EXPONENTIAL_AT:[F,U],RANGE:[P,R],CRYPTO:I,MODULO_MODE:L,POW_PRECISION:M,FORMAT:H,ALPHABET:j}},G.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!G.DEBUG)return!0;var r,t,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-S&&i<=S&&i===p(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((r=(i+1)%w)<1&&(r+=w),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||t>=m||t!==p(t))break e;if(0!==t)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(d+"Invalid BigNumber: "+e)},G.maximum=G.max=function(){return V(arguments,f.lt)},G.minimum=G.min=function(){return V(arguments,f.gt)},G.random=(o=9007199254740992*Math.random()&2097151?function(){return p(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,n,i,u,a=0,c=[],l=new G(_);if(null==e?e=C:B(e,0,S),i=g(e/w),I)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));a<i;)(u=131072*r[a]+(r[a+1]>>>11))>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),r[a]=t[0],r[a+1]=t[1]):(c.push(u%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw I=!1,Error(d+"crypto unavailable");for(r=crypto.randomBytes(i*=7);a<i;)(u=281474976710656*(31&r[a])+1099511627776*r[a+1]+4294967296*r[a+2]+16777216*r[a+3]+(r[a+4]<<16)+(r[a+5]<<8)+r[a+6])>=9e15?crypto.randomBytes(7).copy(r,a):(c.push(u%1e14),a+=7);a=i/7}if(!I)for(;a<i;)(u=o())<9e15&&(c[a++]=u%1e14);for(i=c[--a],e%=w,i&&e&&(u=b[w-e],c[a]=p(i/u)*u);0===c[a];c.pop(),a--);if(a<0)c=[n=0];else{for(n=-1;0===c[0];c.splice(0,1),n-=w);for(a=1,u=c[0];u>=10;u/=10,a++);a<w&&(n-=w-a)}return l.e=n,l.c=c,l}),G.sum=function(){for(var e=1,r=arguments,t=new G(r[0]);e<r.length;)t=t.plus(r[e++]);return t},n=function(){function e(e,r,t,n){for(var i,o,u=[0],a=0,c=e.length;a<c;){for(o=u.length;o--;u[o]*=r);for(u[0]+=n.indexOf(e.charAt(a++)),i=0;i<u.length;i++)u[i]>t-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/t|0,u[i]%=t)}return u.reverse()}return function(r,n,i,o,u){var a,c,l,s,f,h,g,p,d=r.indexOf("."),v=C,m=D;for(d>=0&&(s=M,M=0,r=r.replace(".",""),h=(p=new G(n)).pow(r.length-d),M=s,p.c=e(O(E(h.c),h.e,"0"),10,i,"0123456789"),p.e=p.c.length),l=s=(g=e(r,n,i,u?(a=j,"0123456789"):(a="0123456789",j))).length;0==g[--s];g.pop());if(!g[0])return a.charAt(0);if(d<0?--l:(h.c=g,h.e=l,h.s=o,g=(h=t(h,p,v,m,i)).c,f=h.r,l=h.e),d=g[c=l+v+1],s=i/2,f=f||c<0||null!=g[c+1],f=m<4?(null!=d||f)&&(0==m||m==(h.s<0?3:2)):d>s||d==s&&(4==m||f||6==m&&1&g[c-1]||m==(h.s<0?8:7)),c<1||!g[0])r=f?O(a.charAt(1),-v,a.charAt(0)):a.charAt(0);else{if(g.length=c,f)for(--i;++g[--c]>i;)g[c]=0,c||(++l,g=[1].concat(g));for(s=g.length;!g[--s];);for(d=0,r="";d<=s;r+=a.charAt(g[d++]));r=O(r,l,a.charAt(0))}return r}}(),t=function(){function e(e,r,t){var n,i,o,u,a=0,c=e.length,l=r%A,s=r/A|0;for(e=e.slice();c--;)a=((i=l*(o=e[c]%A)+(n=s*o+(u=e[c]/A|0)*l)%A*A+a)/t|0)+(n/A|0)+s*u,e[c]=i%t;return a&&(e=[a].concat(e)),e}function r(e,r,t,n){var i,o;if(t!=n)o=t>n?1:-1;else for(i=o=0;i<t;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function t(e,r,t,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,u,a){var c,l,s,f,h,g,d,v,y,b,A,S,E,k,B,N,x,O=n.s==i.s?1:-1,_=n.c,C=i.c;if(!(_&&_[0]&&C&&C[0]))return new G(n.s&&i.s&&(_?!C||_[0]!=C[0]:C)?_&&0==_[0]||!C?0*O:O/0:NaN);for(y=(v=new G(O)).c=[],O=o+(l=n.e-i.e)+1,a||(a=m,l=T(n.e/w)-T(i.e/w),O=O/w|0),s=0;C[s]==(_[s]||0);s++);if(C[s]>(_[s]||0)&&l--,O<0)y.push(1),f=!0;else{for(k=_.length,N=C.length,s=0,O+=2,(h=p(a/(C[0]+1)))>1&&(C=e(C,h,a),_=e(_,h,a),N=C.length,k=_.length),E=N,A=(b=_.slice(0,N)).length;A<N;b[A++]=0);x=C.slice(),x=[0].concat(x),B=C[0],C[1]>=a/2&&B++;do{if(h=0,(c=r(C,b,N,A))<0){if(S=b[0],N!=A&&(S=S*a+(b[1]||0)),(h=p(S/B))>1)for(h>=a&&(h=a-1),d=(g=e(C,h,a)).length,A=b.length;1==r(g,b,d,A);)h--,t(g,N<d?x:C,d,a),d=g.length,c=1;else 0==h&&(c=h=1),d=(g=C.slice()).length;if(d<A&&(g=[0].concat(g)),t(b,g,A,a),A=b.length,-1==c)for(;r(C,b,N,A)<1;)h++,t(b,N<A?x:C,A,a),A=b.length}else 0===c&&(h++,b=[0]);y[s++]=h,b[0]?b[A++]=_[E]||0:(b=[_[E]],A=1)}while((E++<k||null!=b[0])&&O--);f=null!=b[0],y[0]||y.splice(0,1)}if(a==m){for(s=1,O=y[0];O>=10;O/=10,s++);$(v,o+(v.e=s+l*w-1)+1,u,f)}else v.e=l,v.r=+f;return v}}(),u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,a=/^([^.]+)\.$/,c=/^\.([^.]+)$/,l=/^-?(Infinity|NaN)$/,s=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,r,t,n){var i,o=t?r:r.replace(s,"");if(l.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!t&&(o=o.replace(u,function(e,r,t){return i="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=i?e:r}),n&&(i=n,o=o.replace(a,"$1").replace(c,"0.$1")),r!=o))return new G(o,i);if(G.DEBUG)throw Error(d+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new G(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,r){return k(this,new G(e,r))},f.decimalPlaces=f.dp=function(e,r){var t,n,i,o=this;if(null!=e)return B(e,0,S),null==r?r=D:B(r,0,8),$(new G(o),e+o.e+1,r);if(!(t=o.c))return null;if(n=((i=t.length-1)-T(this.e/w))*w,i=t[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},f.dividedBy=f.div=function(e,r){return t(this,new G(e,r),C,D)},f.dividedToIntegerBy=f.idiv=function(e,r){return t(this,new G(e,r),0,1)},f.exponentiatedBy=f.pow=function(e,r){var t,n,i,o,u,a,c,l,s=this;if((e=new G(e)).c&&!e.isInteger())throw Error(d+"Exponent not an integer: "+Z(e));if(null!=r&&(r=new G(r)),u=e.e>14,!s.c||!s.c[0]||1==s.c[0]&&!s.e&&1==s.c.length||!e.c||!e.c[0])return l=new G(Math.pow(+Z(s),u?2-N(e):+Z(e))),r?l.mod(r):l;if(a=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new G(NaN);(n=!a&&s.isInteger()&&r.isInteger())&&(s=s.mod(r))}else{if(e.e>9&&(s.e>0||s.e<-1||(0==s.e?s.c[0]>1||u&&s.c[1]>=24e7:s.c[0]<8e13||u&&s.c[0]<=9999975e7)))return o=s.s<0&&N(e)?-0:0,s.e>-1&&(o=1/o),new G(a?1/o:o);M&&(o=g(M/w+2))}for(u?(t=new G(.5),a&&(e.s=1),c=N(e)):c=(i=Math.abs(+Z(e)))%2,l=new G(_);;){if(c){if(!(l=l.times(s)).c)break;o?l.c.length>o&&(l.c.length=o):n&&(l=l.mod(r))}if(i){if(0===(i=p(i/2)))break;c=i%2}else if($(e=e.times(t),e.e+1,1),e.e>14)c=N(e);else{if(0==(i=+Z(e)))break;c=i%2}s=s.times(s),o?s.c&&s.c.length>o&&(s.c.length=o):n&&(s=s.mod(r))}return n?l:(a&&(l=_.div(l)),r?l.mod(r):o?$(l,M,D,void 0):l)},f.integerValue=function(e){var r=new G(this);return null==e?e=D:B(e,0,8),$(r,r.e+1,e)},f.isEqualTo=f.eq=function(e,r){return 0===k(this,new G(e,r))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,r){return k(this,new G(e,r))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,r){return 1===(r=k(this,new G(e,r)))||0===r},f.isInteger=function(){return!!this.c&&T(this.e/w)>this.c.length-2},f.isLessThan=f.lt=function(e,r){return k(this,new G(e,r))<0},f.isLessThanOrEqualTo=f.lte=function(e,r){return-1===(r=k(this,new G(e,r)))||0===r},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,r){var t,n,i,o,u=this,a=u.s;if(r=(e=new G(e,r)).s,!a||!r)return new G(NaN);if(a!=r)return e.s=-r,u.plus(e);var c=u.e/w,l=e.e/w,s=u.c,f=e.c;if(!c||!l){if(!s||!f)return s?(e.s=-r,e):new G(f?u:NaN);if(!s[0]||!f[0])return f[0]?(e.s=-r,e):new G(s[0]?u:3==D?-0:0)}if(c=T(c),l=T(l),s=s.slice(),a=c-l){for((o=a<0)?(a=-a,i=s):(l=c,i=f),i.reverse(),r=a;r--;i.push(0));i.reverse()}else for(n=(o=(a=s.length)<(r=f.length))?a:r,a=r=0;r<n;r++)if(s[r]!=f[r]){o=s[r]<f[r];break}if(o&&(i=s,s=f,f=i,e.s=-e.s),(r=(n=f.length)-(t=s.length))>0)for(;r--;s[t++]=0);for(r=m-1;n>a;){if(s[--n]<f[n]){for(t=n;t&&!s[--t];s[t]=r);--s[t],s[n]+=m}s[n]-=f[n]}for(;0==s[0];s.splice(0,1),--l);return s[0]?z(e,s,l):(e.s=3==D?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,r){var n,i,o=this;return e=new G(e,r),!o.c||!e.s||e.c&&!e.c[0]?new G(NaN):!e.c||o.c&&!o.c[0]?new G(o):(9==L?(i=e.s,e.s=1,n=t(o,e,0,3),e.s=i,n.s*=i):n=t(o,e,0,L),(e=o.minus(n.times(e))).c[0]||1!=L||(e.s=o.s),e)},f.multipliedBy=f.times=function(e,r){var t,n,i,o,u,a,c,l,s,f,h,g,p,d,v,y=this,b=y.c,S=(e=new G(e,r)).c;if(!(b&&S&&b[0]&&S[0]))return!y.s||!e.s||b&&!b[0]&&!S||S&&!S[0]&&!b?e.c=e.e=e.s=null:(e.s*=y.s,b&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=T(y.e/w)+T(e.e/w),e.s*=y.s,(c=b.length)<(f=S.length)&&(p=b,b=S,S=p,i=c,c=f,f=i),i=c+f,p=[];i--;p.push(0));for(d=m,v=A,i=f;--i>=0;){for(t=0,h=S[i]%v,g=S[i]/v|0,o=i+(u=c);o>i;)t=((l=h*(l=b[--u]%v)+(a=g*l+(s=b[u]/v|0)*h)%v*v+p[o]+t)/d|0)+(a/v|0)+g*s,p[o--]=l%d;p[o]=t}return t?++n:p.splice(0,1),z(e,p,n)},f.negated=function(){var e=new G(this);return e.s=-e.s||null,e},f.plus=function(e,r){var t,n=this,i=n.s;if(r=(e=new G(e,r)).s,!i||!r)return new G(NaN);if(i!=r)return e.s=-r,n.minus(e);var o=n.e/w,u=e.e/w,a=n.c,c=e.c;if(!o||!u){if(!a||!c)return new G(i/0);if(!a[0]||!c[0])return c[0]?e:new G(a[0]?n:0*i)}if(o=T(o),u=T(u),a=a.slice(),i=o-u){for(i>0?(u=o,t=c):(i=-i,t=a),t.reverse();i--;t.push(0));t.reverse()}for((i=a.length)-(r=c.length)<0&&(t=c,c=a,a=t,r=i),i=0;r;)i=(a[--r]=a[r]+c[r]+i)/m|0,a[r]=m===a[r]?0:a[r]%m;return i&&(a=[i].concat(a),++u),z(e,a,u)},f.precision=f.sd=function(e,r){var t,n,i,o=this;if(null!=e&&e!==!!e)return B(e,1,S),null==r?r=D:B(r,0,8),$(new G(o),e,r);if(!(t=o.c))return null;if(n=(i=t.length-1)*w+1,i=t[i]){for(;i%10==0;i/=10,n--);for(i=t[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},f.shiftedBy=function(e){return B(e,-y,y),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,r,n,i,o,u=this,a=u.c,c=u.s,l=u.e,s=C+4,f=new G("0.5");if(1!==c||!a||!a[0])return new G(!c||c<0&&(!a||a[0])?NaN:a?u:1/0);if(0==(c=Math.sqrt(+Z(u)))||c==1/0?(((r=E(a)).length+l)%2==0&&(r+="0"),c=Math.sqrt(+r),l=T((l+1)/2)-(l<0||l%2),n=new G(r=c==1/0?"1e"+l:(r=c.toExponential()).slice(0,r.indexOf("e")+1)+l)):n=new G(c+""),n.c[0])for((c=(l=n.e)+s)<3&&(c=0);;)if(o=n,n=f.times(o.plus(t(u,o,s,1))),E(o.c).slice(0,c)===(r=E(n.c)).slice(0,c)){if(n.e<l&&--c,"9999"!=(r=r.slice(c-3,c+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||($(n,n.e+C+2,1),e=!n.times(n).eq(u));break}if(!i&&($(o,o.e+C+2,0),o.times(o).eq(u))){n=o;break}s+=4,c+=4,i=1}return $(n,n.e+C+1,D,e)},f.toExponential=function(e,r){return null!=e&&(B(e,0,S),e++),q(this,e,r,1)},f.toFixed=function(e,r){return null!=e&&(B(e,0,S),e=e+this.e+1),q(this,e,r)},f.toFormat=function(e,r,t){var n,i=this;if(null==t)null!=e&&r&&"object"==typeof r?(t=r,r=null):e&&"object"==typeof e?(t=e,e=r=null):t=H;else if("object"!=typeof t)throw Error(d+"Argument not an object: "+t);if(n=i.toFixed(e,r),i.c){var o,u=n.split("."),a=+t.groupSize,c=+t.secondaryGroupSize,l=t.groupSeparator||"",s=u[0],f=u[1],h=i.s<0,g=h?s.slice(1):s,p=g.length;if(c&&(o=a,a=c,c=o,p-=o),a>0&&p>0){for(o=p%a||a,s=g.substr(0,o);o<p;o+=a)s+=l+g.substr(o,a);c>0&&(s+=l+g.slice(o)),h&&(s="-"+s)}n=f?s+(t.decimalSeparator||"")+((c=+t.fractionGroupSize)?f.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):f):s}return(t.prefix||"")+n+(t.suffix||"")},f.toFraction=function(e){var r,n,i,o,u,a,c,l,s,f,h,g,p=this,v=p.c;if(null!=e&&(!(c=new G(e)).isInteger()&&(c.c||1!==c.s)||c.lt(_)))throw Error(d+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Z(c));if(!v)return new G(p);for(r=new G(_),s=n=new G(_),i=l=new G(_),g=E(v),u=r.e=g.length-p.e-1,r.c[0]=b[(a=u%w)<0?w+a:a],e=!e||c.comparedTo(r)>0?u>0?r:s:c,a=R,R=1/0,c=new G(g),l.c[0]=0;f=t(c,r,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,s=l.plus(f.times(o=s)),l=o,r=c.minus(f.times(o=r)),c=o;return o=t(e.minus(n),i,0,1),l=l.plus(o.times(s)),n=n.plus(o.times(i)),l.s=s.s=p.s,h=t(s,i,u*=2,D).minus(p).abs().comparedTo(t(l,n,u,D).minus(p).abs())<1?[s,i]:[l,n],R=a,h},f.toNumber=function(){return+Z(this)},f.toPrecision=function(e,r){return null!=e&&B(e,1,S),q(this,e,r,2)},f.toString=function(e){var r,t=this,i=t.s,o=t.e;return null===o?i?(r="Infinity",i<0&&(r="-"+r)):r="NaN":(null==e?r=o<=F||o>=U?x(E(t.c),o):O(E(t.c),o,"0"):10===e?r=O(E((t=$(new G(t),C+o+1,D)).c),t.e,"0"):(B(e,2,j.length,"Base"),r=n(O(E(t.c),o,"0"),10,e,i,!0)),i<0&&t.c[0]&&(r="-"+r)),r},f.valueOf=f.toJSON=function(){return Z(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=r&&G.set(r),G}();function D(e){if(!e||!/^-?\d*(\.\d+)?$/.test(e))throw new Error("Invalid value: ".concat(e))}C.config({EXPONENTIAL_AT:[-9,20]}),(_=e.BurstValueFormat||(e.BurstValueFormat={}))[_.PLANCK=0]="PLANCK",_[_.BURST=1]="BURST";var F=function(){function t(e){r(this,t),D(e),this._planck=new C(e)}return n(t,[{key:"getRaw",value:function(){return this._planck}},{key:"getPlanck",value:function(){return this._planck.toString()}},{key:"setPlanck",value:function(e){D(e),this._planck=new C(e)}},{key:"getBurst",value:function(){return this._planck.dividedBy(1e8).toString()}},{key:"setBurst",value:function(e){D(e),this._planck=new C(e).multipliedBy(1e8)}},{key:"equals",value:function(e){return this._planck.eq(e._planck)}},{key:"lessOrEqual",value:function(e){return this._planck.lte(e._planck)}},{key:"less",value:function(e){return this._planck.lt(e._planck)}},{key:"greaterOrEqual",value:function(e){return this._planck.gte(e._planck)}},{key:"greater",value:function(e){return this._planck.gt(e._planck)}},{key:"add",value:function(e){return this._planck=this._planck.plus(e._planck),this}},{key:"subtract",value:function(e){return this._planck=this._planck.minus(e._planck),this}},{key:"multiply",value:function(e){return this._planck=this._planck.multipliedBy(e),this}},{key:"divide",value:function(e){if(0===e)throw new Error("Division by zero");return this._planck=this._planck.div(e),this}},{key:"toString",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.BurstValueFormat.BURST)===e.BurstValueFormat.BURST?"".concat("Ƀ"," ").concat(this.getBurst()):"".concat("ƀ"," ").concat(this._planck)}},{key:"clone",value:function(){return t.fromPlanck(this.getPlanck())}}],[{key:"Zero",value:function(){return new t("0")}},{key:"fromPlanck",value:function(e){return new t(e)}},{key:"fromBurst",value:function(e){var r=new t("0");return r.setBurst("number"==typeof e?e.toString(10):e),r}}]),t}(),U=function(e){0===e.indexOf("".concat("BURST","-"))&&(e=e.substr(6));for(var r=o.slice(),t=0,n=0;n<e.length;n++){var i=l.indexOf(e.charAt(n));if(!(i<=-1||i>l.length)){if(t>16)return!1;r[c[t]]=i,t++}}if(17!==t)return!1;for(var a=0,f=1;f<5;f++){for(var h=0,g=0;g<31;g++)if(!(g>12&&g<27)){var p=g;g>26&&(p-=14),h^=s(r[p],u[f*g%31])}a|=h}return 0===a};const P="function"==typeof atob,R="function"==typeof btoa,I="function"==typeof Buffer,L="function"==typeof TextDecoder?new TextDecoder:void 0,M="function"==typeof TextEncoder?new TextEncoder:void 0,H=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],j=(e=>{let r={};return H.forEach((e,t)=>r[e]=t),r})(),G=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,q=String.fromCharCode.bind(String),V="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,r=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(r)),z=e=>e.replace(/[+\/]/g,e=>"+"==e?"-":"_").replace(/=+$/m,""),$=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),Z=e=>{let r,t,n,i,o="";const u=e.length%3;for(let u=0;u<e.length;){if((t=e.charCodeAt(u++))>255||(n=e.charCodeAt(u++))>255||(i=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");o+=H[(r=t<<16|n<<8|i)>>18&63]+H[r>>12&63]+H[r>>6&63]+H[63&r]}return u?o.slice(0,u-3)+"===".substring(u):o},W=R?e=>btoa(e):I?e=>Buffer.from(e,"binary").toString("base64"):Z,Q=I?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let t=0,n=e.length;t<n;t+=4096)r.push(q.apply(null,e.subarray(t,t+4096)));return W(r.join(""))},X=e=>{if(e.length<2)return(r=e.charCodeAt(0))<128?e:r<2048?q(192|r>>>6)+q(128|63&r):q(224|r>>>12&15)+q(128|r>>>6&63)+q(128|63&r);var r=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return q(240|r>>>18&7)+q(128|r>>>12&63)+q(128|r>>>6&63)+q(128|63&r)},J=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,K=e=>e.replace(J,X),Y=I?e=>Buffer.from(e,"utf8").toString("base64"):M?e=>Q(M.encode(e)):e=>W(K(e)),ee=(e,r=!1)=>r?z(Y(e)):Y(e),re=e=>ee(e,!0),te=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,ne=e=>{switch(e.length){case 4:var r=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return q(55296+(r>>>10))+q(56320+(1023&r));case 3:return q((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return q((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},ie=e=>e.replace(te,ne),oe=e=>{if(e=e.replace(/\s+/g,""),!G.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let r,t,n,i="";for(let o=0;o<e.length;)r=j[e.charAt(o++)]<<18|j[e.charAt(o++)]<<12|(t=j[e.charAt(o++)])<<6|(n=j[e.charAt(o++)]),i+=64===t?q(r>>16&255):64===n?q(r>>16&255,r>>8&255):q(r>>16&255,r>>8&255,255&r);return i},ue=P?e=>atob($(e)):I?e=>Buffer.from(e,"base64").toString("binary"):oe,ae=I?e=>V(Buffer.from(e,"base64")):e=>V(ue(e),e=>e.charCodeAt(0)),ce=I?e=>Buffer.from(e,"base64").toString("utf8"):L?e=>L.decode(ae(e)):e=>ie(ue(e)),le=e=>$(e.replace(/[-_]/g,e=>"-"==e?"+":"/")),se=e=>ce(le(e)),fe=ee,he=re,ge=se;var pe=function(e){return 1e3*(i+e)},de=function(e){for(var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return r?t.join("").toUpperCase():t.join("")},ve=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(0===t)return"";var n=e;if(0!==r){var i=null===t?e.length-r:t;!function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t<0)throw new Error("Start index should not be negative");if(e.length<t+r)throw new Error("Need at least "+r+" bytes to convert to an integer")}(n,i,r),n=e.slice(r,r+i)}return decodeURIComponent(escape(String.fromCharCode.apply(null,Array.from(n))))};String.prototype.padStart||(String.prototype.padStart=function(e,r){return e>>=0,r=String(void 0!==r?r:" "),this.length>=e?String(this):((e-=this.length)>r.length&&(r+=r.repeat(e/r.length)),r.slice(0,e)+String(this))});var me,we=function(e){if(e.length%2)throw new Error("Invalid Hex String: ".concat(e));for(var r=new Uint8Array(e.length/2),t=0;t<e.length;t+=2){var n=parseInt(e.substr(t,2),16);if(Number.isNaN(n))throw new Error("Invalid Hex String: ".concat(e));r[t/2]=n}return r},ye=function(e){if(null==e||""===e)throw new Error("Invalid argument");return parseFloat(e)/1e8},be=function(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?he(e):fe(e)},Ae=function(e){for(var r=unescape(encodeURIComponent(e)),t=new Uint8Array(r.length),n=0;n<r.length;++n)t[n]=r.charCodeAt(n);return t},Se=function(e){return de(Ae(e))};(me=e.EncoderFormat||(e.EncoderFormat={}))[me.Text=0]="Text",me[me.Hexadecimal=1]="Hexadecimal",me[me.Base64=2]="Base64";var Te=/^burst.(.+):\/\/(v.+?)\??/i;return e.BurstPlanckSymbol="ƀ",e.BurstSymbol="Ƀ",e.BurstTime=f,e.BurstValue=F,e.FeeQuantPlanck=735e3,e.OneBurstPlanck=1e8,e.convertAddressToNumericId=function(e){if(null!=e&&0!==e.trim().length&&0===e.indexOf("".concat("BURST","-"))){e=e.substr(6);for(var r=o.slice(),t=0,n=0;n<e.length;n++){var i=l.indexOf(e.charAt(n));if(!(i<=-1||i>l.length)){if(t>16)return;r[c[t]]=i,t++}}if(U(e)){for(var u=13,a=[],s=0;s<u;s++)a[s]=r[u-s-1];var f,h="",g=0;do{f=0,g=0;for(var p=0;p<u;p++)(g=32*g+a[p])>=10?(a[f]=Math.floor(g/10),g%=10,f+=1):f>0&&(a[f]=0,f+=1);u=f,h+=g}while(u>0);return h.split("").reverse().join("")}}},e.convertBase36StringToHexString=function(e){return new C(e,36).toString(16)},e.convertBase64StringToString=function(e){return ge(e)},e.convertBurstTimeToDate=function(e){return new Date(pe(e))},e.convertBurstTimeToEpochTime=pe,e.convertByteArrayToHexString=de,e.convertByteArrayToString=ve,e.convertDateToBurstTime=function(e){return Math.round(e.getTime()/1e3)-i},e.convertDecStringToHexString=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t="string"==typeof e?new C(e):e;if(t.isNaN())throw new Error("Invalid decimal argument: [".concat(e,"] - Expected a valid decimal value"));if(r<0)throw new Error("Invalid padding argument: [".concat(r,"] - Expected a positive value"));var n=t.lt(0);n&&(t=function(e){for(var r=e.multipliedBy(-1).toString(2);r.length%8;)r="0"+r;var t="1"===r[0]&&-1!==r.slice(1).indexOf("1")?"11111111":"";return r=r.split("").map(function(e){return"0"===e?"1":"0"}).join(""),new C(t+r,2).plus(1)}(t));var i=t.toString(16),o=Math.ceil(i.length/r);return i.padStart(o*r,n?"f":"0")},e.convertHexEndianess=function(e){for(var r="",t=e,n=t.length-1;n>=0;n-=2)r+=t[n-1]+t[n];return r},e.convertHexStringToBase36String=function(e){return new C(e,16).toString(36)},e.convertHexStringToByteArray=we,e.convertHexStringToDecString=function(e){var r,t,n,i=[0];for(r=0;r<e.length;r+=1){for(n=parseInt(e.charAt(r),16),t=0;t<i.length;t+=1)i[t]=16*i[t]+n,n=i[t]/10|0,i[t]%=10;for(;n>0;)i.push(n%10),n=n/10|0}return i.reverse().join("")},e.convertHexStringToString=function(e){return ve(we(e))},e.convertNQTStringToNumber=ye,e.convertNumberToNQTString=function(e){if(null==e)throw new Error("Invalid argument");return parseFloat(e.toString()).toFixed(8).replace(".","")},e.convertNumericIdToAddress=function(e){if(null!=e&&0!==e.trim().length){for(var r=[],t=o.slice(),n=0,i=e.length,u=0;u<i;u++)r[u]=e.charCodeAt(u)-"0".charCodeAt(0);var a=0,f=0;do{a=0,f=0;for(var h=0;h<i;h++)(a=10*a+r[h])>=32?(r[f]=a>>5,a&=31,f++):f>0&&(r[f]=0,f++);i=f,t[n]=a,n++}while(i>0);for(var g=[0,0,0,0],p=12;p>=0;p--){var d=t[p]^g[3];g[3]=g[2]^s(30,d),g[2]=g[1]^s(6,d),g[1]=g[0]^s(9,d),g[0]=s(17,d)}t[13]=g[0],t[14]=g[1],t[15]=g[2],t[16]=g[3];for(var v="BURST-",m=0;m<17;m++)v+=l[t[c[m]]],3==(3&m)&&m<13&&(v+="-");return v}},e.convertStringToBase64String=be,e.convertStringToByteArray=Ae,e.convertStringToHexString=Se,e.createDeeplink=function(r){var t=r.encoderFormat,n=void 0===t?e.EncoderFormat.Base64:t,i=r.domain,o=r.action,u=r.payload,a="burst.".concat(i,"://v1");return o&&(a+="?action=".concat(o)),u&&(a+="&payload=".concat(function(r,t){var n=r;switch("string"!=typeof r&&(n=JSON.stringify(r)),t){case e.EncoderFormat.Hexadecimal:return Se(n);case e.EncoderFormat.Base64:return be(n);case e.EncoderFormat.Text:default:return n}}(u,n))),a},e.isBurstAddress=function(e){if(!new RegExp("".concat("BURST","-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{5}(-w+)?"),"i").test(e))return!1;var r=e.lastIndexOf("-"),t=e.substr(r+1);return e=t.length>5?e.substr(0,r):e,U(e)},e.isValid=U,e.parseDeeplink=function(e){var r=function(){throw new Error("Invalid deeplink: "+e)},t=function(e,t){return e.startsWith(t+"=")||r(),e.split("=")[1]},n=e.match(Te);n&&3===n.length||r();var i={domain:n[1],version:n[2],action:void 0,payload:void 0,decodedPayload:void 0};try{var o=e.indexOf("?");if(-1!==o){var u=e.substring(o+1).split("&");u.length>=1&&(u.length>2&&r(),i.action=t(u[0],"action"),2===u.length&&(i.payload=t(u[1],"payload")))}}catch(e){r()}return i},e.sumNQTStringToNumber=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.reduce(function(e,r){return e+ye(r)},0)},e}({}); | ||
var b$util=function(e){"use strict";function r(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function t(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}var i=Date.UTC(2014,7,11,2,0,0,0)/1e3,o=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],u=[1,2,4,8,16,5,10,20,13,26,17,7,14,28,29,31,27,19,3,6,12,24,21,15,30,25,23,11,22,9,18,1],a=[0,0,1,18,2,5,19,11,3,29,6,27,20,8,12,23,4,10,30,17,7,22,28,26,21,25,9,16,13,14,24,15],c=[3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11],l="23456789ABCDEFGHJKLMNPQRSTUVWXYZ".split(""),s=function(e,r){return 0===e||0===r?0:u[(a[e]+a[r])%31]},f=function(){function e(t){r(this,e),this._burstTimestamp=t}return n(e,[{key:"getBurstTimestamp",value:function(){return this._burstTimestamp}},{key:"setBurstTimestamp",value:function(e){this._burstTimestamp=e}},{key:"getEpoch",value:function(){return 1e3*(i+this._burstTimestamp)}},{key:"getDate",value:function(){return new Date(this.getEpoch())}},{key:"setDate",value:function(e){this._burstTimestamp=Math.round(e.getTime()/1e3)-i}},{key:"equals",value:function(e){return this._burstTimestamp===e._burstTimestamp}},{key:"before",value:function(e){return this._burstTimestamp<e._burstTimestamp}},{key:"after",value:function(e){return this._burstTimestamp>e._burstTimestamp}}],[{key:"fromBurstTimestamp",value:function(r){return new e(r)}},{key:"fromDate",value:function(r){var t=new e(0);return t.setDate(r),t}}]),e}(),h=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,g=Math.ceil,p=Math.floor,d="[BigNumber Error] ",v=d+"Number primitive has more than 15 significant digits: ",m=1e14,w=14,y=9007199254740991,b=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],A=1e7,S=1e9;function T(e){var r=0|e;return e>0||e===r?r:r-1}function E(e){for(var r,t,n=1,i=e.length,o=e[0]+"";n<i;){for(r=e[n++]+"",t=w-r.length;t--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function k(e,r){var t,n,i=e.c,o=r.c,u=e.s,a=r.s,c=e.e,l=r.e;if(!u||!a)return null;if(t=i&&!i[0],n=o&&!o[0],t||n)return t?n?0:-a:u;if(u!=a)return u;if(t=u<0,n=c==l,!i||!o)return n?0:!i^t?1:-1;if(!n)return c>l^t?1:-1;for(a=(c=i.length)<(l=o.length)?c:l,u=0;u<a;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return c==l?0:c>l^t?1:-1}function B(e,r,t,n){if(e<r||e>t||e!==p(e))throw Error(d+(n||"Argument")+("number"==typeof e?e<r||e>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function N(e){var r=e.c.length-1;return T(e.e/w)==r&&e.c[r]%2!=0}function x(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function O(e,r,t){var n,i;if(r<0){for(i=t+".";++r;i+=t);e=i+e}else if(++r>(n=e.length)){for(i=t,r-=n;--r;i+=t);e+=i}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}var _,C=function e(r){var t,n,i,o,u,a,c,l,s,f=G.prototype={constructor:G,toString:null,valueOf:null},_=new G(1),C=20,D=4,F=-7,U=21,R=-1e7,P=1e7,I=!1,L=1,M=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz";function G(e,r){var t,o,u,a,c,l,s,f,g=this;if(!(g instanceof G))return new G(e,r);if(null==r){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>P?g.c=g.e=null:e.e<R?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,c=e;c>=10;c/=10,a++);return void(a>P?g.c=g.e=null:(g.e=a,g.c=[e]))}f=String(e)}else{if(!h.test(f=String(e)))return i(g,f,l);g.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(a=f.indexOf("."))>-1&&(f=f.replace(".","")),(c=f.search(/e/i))>0?(a<0&&(a=c),a+=+f.slice(c+1),f=f.substring(0,c)):a<0&&(a=f.length)}else{if(B(r,2,j.length,"Base"),10==r)return $(g=new G(e),C+g.e+1,D);if(f=String(e),l="number"==typeof e){if(0*e!=0)return i(g,f,l,r);if(g.s=1/e<0?(f=f.slice(1),-1):1,G.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(v+e)}else g.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(t=j.slice(0,r),a=c=0,s=f.length;c<s;c++)if(t.indexOf(o=f.charAt(c))<0){if("."==o){if(c>a){a=s;continue}}else if(!u&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){u=!0,c=-1,a=0;continue}return i(g,String(e),l,r)}l=!1,(a=(f=n(f,r,10,g.s)).indexOf("."))>-1?f=f.replace(".",""):a=f.length}for(c=0;48===f.charCodeAt(c);c++);for(s=f.length;48===f.charCodeAt(--s););if(f=f.slice(c,++s)){if(s-=c,l&&G.DEBUG&&s>15&&(e>y||e!==p(e)))throw Error(v+g.s*e);if((a=a-c-1)>P)g.c=g.e=null;else if(a<R)g.c=[g.e=0];else{if(g.e=a,g.c=[],c=(a+1)%w,a<0&&(c+=w),c<s){for(c&&g.c.push(+f.slice(0,c)),s-=w;c<s;)g.c.push(+f.slice(c,c+=w));c=w-(f=f.slice(c)).length}else c-=s;for(;c--;f+="0");g.c.push(+f)}}else g.c=[g.e=0]}function q(e,r,t,n){var i,o,u,a,c;if(null==t?t=D:B(t,0,8),!e.c)return e.toString();if(i=e.c[0],u=e.e,null==r)c=E(e.c),c=1==n||2==n&&(u<=F||u>=U)?x(c,u):O(c,u,"0");else if(o=(e=$(new G(e),r,t)).e,a=(c=E(e.c)).length,1==n||2==n&&(r<=o||o<=F)){for(;a<r;c+="0",a++);c=x(c,o)}else if(r-=u,c=O(c,o,"0"),o+1>a){if(--r>0)for(c+=".";r--;c+="0");}else if((r+=o-a)>0)for(o+1==a&&(c+=".");r--;c+="0");return e.s<0&&i?"-"+c:c}function V(e,r){for(var t,n=1,i=new G(e[0]);n<e.length;n++){if(!(t=new G(e[n])).s){i=t;break}r.call(i,t)&&(i=t)}return i}function z(e,r,t){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,n++);return(t=n+t*w-1)>P?e.c=e.e=null:t<R?e.c=[e.e=0]:(e.e=t,e.c=r),e}function $(e,r,t,n){var i,o,u,a,c,l,s,f=e.c,h=b;if(f){e:{for(i=1,a=f[0];a>=10;a/=10,i++);if((o=r-i)<0)o+=w,u=r,s=(c=f[l=0])/h[i-u-1]%10|0;else if((l=g((o+1)/w))>=f.length){if(!n)break e;for(;f.length<=l;f.push(0));c=s=0,i=1,u=(o%=w)-w+1}else{for(c=a=f[l],i=1;a>=10;a/=10,i++);s=(u=(o%=w)-w+i)<0?0:c/h[i-u-1]%10|0}if(n=n||r<0||null!=f[l+1]||(u<0?c:c%h[i-u-1]),n=t<4?(s||n)&&(0==t||t==(e.s<0?3:2)):s>5||5==s&&(4==t||n||6==t&&(o>0?u>0?c/h[i-u]:0:f[l-1])%10&1||t==(e.s<0?8:7)),r<1||!f[0])return f.length=0,n?(r-=e.e+1,f[0]=h[(w-r%w)%w],e.e=-r||0):f[0]=e.e=0,e;if(0==o?(f.length=l,a=1,l--):(f.length=l+1,a=h[w-o],f[l]=u>0?p(c/h[i-u]%h[u])*a:0),n)for(;;){if(0==l){for(o=1,u=f[0];u>=10;u/=10,o++);for(u=f[0]+=a,a=1;u>=10;u/=10,a++);o!=a&&(e.e++,f[0]==m&&(f[0]=1));break}if(f[l]+=a,f[l]!=m)break;f[l--]=0,a=1}for(o=f.length;0===f[--o];f.pop());}e.e>P?e.c=e.e=null:e.e<R&&(e.c=[e.e=0])}return e}function Z(e){var r,t=e.e;return null===t?e.toString():(r=E(e.c),r=t<=F||t>=U?x(r,t):O(r,t,"0"),e.s<0?"-"+r:r)}return G.clone=e,G.ROUND_UP=0,G.ROUND_DOWN=1,G.ROUND_CEIL=2,G.ROUND_FLOOR=3,G.ROUND_HALF_UP=4,G.ROUND_HALF_DOWN=5,G.ROUND_HALF_EVEN=6,G.ROUND_HALF_CEIL=7,G.ROUND_HALF_FLOOR=8,G.EUCLID=9,G.config=G.set=function(e){var r,t;if(null!=e){if("object"!=typeof e)throw Error(d+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(B(t=e[r],0,S,r),C=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(B(t=e[r],0,8,r),D=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(B(t[0],-S,0,r),B(t[1],0,S,r),F=t[0],U=t[1]):(B(t,-S,S,r),F=-(U=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)B(t[0],-S,-1,r),B(t[1],1,S,r),R=t[0],P=t[1];else{if(B(t,-S,S,r),!t)throw Error(d+r+" cannot be zero: "+t);R=-(P=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(d+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw I=!t,Error(d+"crypto unavailable");I=t}else I=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(B(t=e[r],0,9,r),L=t),e.hasOwnProperty(r="POW_PRECISION")&&(B(t=e[r],0,S,r),M=t),e.hasOwnProperty(r="FORMAT")){if("object"!=typeof(t=e[r]))throw Error(d+r+" not an object: "+t);H=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.$|[+-.\s]|(.).*\1/.test(t))throw Error(d+r+" invalid: "+t);j=t}}return{DECIMAL_PLACES:C,ROUNDING_MODE:D,EXPONENTIAL_AT:[F,U],RANGE:[R,P],CRYPTO:I,MODULO_MODE:L,POW_PRECISION:M,FORMAT:H,ALPHABET:j}},G.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!G.DEBUG)return!0;var r,t,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-S&&i<=S&&i===p(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((r=(i+1)%w)<1&&(r+=w),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||t>=m||t!==p(t))break e;if(0!==t)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(d+"Invalid BigNumber: "+e)},G.maximum=G.max=function(){return V(arguments,f.lt)},G.minimum=G.min=function(){return V(arguments,f.gt)},G.random=(o=9007199254740992*Math.random()&2097151?function(){return p(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,n,i,u,a=0,c=[],l=new G(_);if(null==e?e=C:B(e,0,S),i=g(e/w),I)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));a<i;)(u=131072*r[a]+(r[a+1]>>>11))>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),r[a]=t[0],r[a+1]=t[1]):(c.push(u%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw I=!1,Error(d+"crypto unavailable");for(r=crypto.randomBytes(i*=7);a<i;)(u=281474976710656*(31&r[a])+1099511627776*r[a+1]+4294967296*r[a+2]+16777216*r[a+3]+(r[a+4]<<16)+(r[a+5]<<8)+r[a+6])>=9e15?crypto.randomBytes(7).copy(r,a):(c.push(u%1e14),a+=7);a=i/7}if(!I)for(;a<i;)(u=o())<9e15&&(c[a++]=u%1e14);for(i=c[--a],e%=w,i&&e&&(u=b[w-e],c[a]=p(i/u)*u);0===c[a];c.pop(),a--);if(a<0)c=[n=0];else{for(n=-1;0===c[0];c.splice(0,1),n-=w);for(a=1,u=c[0];u>=10;u/=10,a++);a<w&&(n-=w-a)}return l.e=n,l.c=c,l}),G.sum=function(){for(var e=1,r=arguments,t=new G(r[0]);e<r.length;)t=t.plus(r[e++]);return t},n=function(){function e(e,r,t,n){for(var i,o,u=[0],a=0,c=e.length;a<c;){for(o=u.length;o--;u[o]*=r);for(u[0]+=n.indexOf(e.charAt(a++)),i=0;i<u.length;i++)u[i]>t-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/t|0,u[i]%=t)}return u.reverse()}return function(r,n,i,o,u){var a,c,l,s,f,h,g,p,d=r.indexOf("."),v=C,m=D;for(d>=0&&(s=M,M=0,r=r.replace(".",""),h=(p=new G(n)).pow(r.length-d),M=s,p.c=e(O(E(h.c),h.e,"0"),10,i,"0123456789"),p.e=p.c.length),l=s=(g=e(r,n,i,u?(a=j,"0123456789"):(a="0123456789",j))).length;0==g[--s];g.pop());if(!g[0])return a.charAt(0);if(d<0?--l:(h.c=g,h.e=l,h.s=o,g=(h=t(h,p,v,m,i)).c,f=h.r,l=h.e),d=g[c=l+v+1],s=i/2,f=f||c<0||null!=g[c+1],f=m<4?(null!=d||f)&&(0==m||m==(h.s<0?3:2)):d>s||d==s&&(4==m||f||6==m&&1&g[c-1]||m==(h.s<0?8:7)),c<1||!g[0])r=f?O(a.charAt(1),-v,a.charAt(0)):a.charAt(0);else{if(g.length=c,f)for(--i;++g[--c]>i;)g[c]=0,c||(++l,g=[1].concat(g));for(s=g.length;!g[--s];);for(d=0,r="";d<=s;r+=a.charAt(g[d++]));r=O(r,l,a.charAt(0))}return r}}(),t=function(){function e(e,r,t){var n,i,o,u,a=0,c=e.length,l=r%A,s=r/A|0;for(e=e.slice();c--;)a=((i=l*(o=e[c]%A)+(n=s*o+(u=e[c]/A|0)*l)%A*A+a)/t|0)+(n/A|0)+s*u,e[c]=i%t;return a&&(e=[a].concat(e)),e}function r(e,r,t,n){var i,o;if(t!=n)o=t>n?1:-1;else for(i=o=0;i<t;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function t(e,r,t,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,u,a){var c,l,s,f,h,g,d,v,y,b,A,S,E,k,B,N,x,O=n.s==i.s?1:-1,_=n.c,C=i.c;if(!(_&&_[0]&&C&&C[0]))return new G(n.s&&i.s&&(_?!C||_[0]!=C[0]:C)?_&&0==_[0]||!C?0*O:O/0:NaN);for(y=(v=new G(O)).c=[],O=o+(l=n.e-i.e)+1,a||(a=m,l=T(n.e/w)-T(i.e/w),O=O/w|0),s=0;C[s]==(_[s]||0);s++);if(C[s]>(_[s]||0)&&l--,O<0)y.push(1),f=!0;else{for(k=_.length,N=C.length,s=0,O+=2,(h=p(a/(C[0]+1)))>1&&(C=e(C,h,a),_=e(_,h,a),N=C.length,k=_.length),E=N,A=(b=_.slice(0,N)).length;A<N;b[A++]=0);x=C.slice(),x=[0].concat(x),B=C[0],C[1]>=a/2&&B++;do{if(h=0,(c=r(C,b,N,A))<0){if(S=b[0],N!=A&&(S=S*a+(b[1]||0)),(h=p(S/B))>1)for(h>=a&&(h=a-1),d=(g=e(C,h,a)).length,A=b.length;1==r(g,b,d,A);)h--,t(g,N<d?x:C,d,a),d=g.length,c=1;else 0==h&&(c=h=1),d=(g=C.slice()).length;if(d<A&&(g=[0].concat(g)),t(b,g,A,a),A=b.length,-1==c)for(;r(C,b,N,A)<1;)h++,t(b,N<A?x:C,A,a),A=b.length}else 0===c&&(h++,b=[0]);y[s++]=h,b[0]?b[A++]=_[E]||0:(b=[_[E]],A=1)}while((E++<k||null!=b[0])&&O--);f=null!=b[0],y[0]||y.splice(0,1)}if(a==m){for(s=1,O=y[0];O>=10;O/=10,s++);$(v,o+(v.e=s+l*w-1)+1,u,f)}else v.e=l,v.r=+f;return v}}(),u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,a=/^([^.]+)\.$/,c=/^\.([^.]+)$/,l=/^-?(Infinity|NaN)$/,s=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,r,t,n){var i,o=t?r:r.replace(s,"");if(l.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!t&&(o=o.replace(u,function(e,r,t){return i="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=i?e:r}),n&&(i=n,o=o.replace(a,"$1").replace(c,"0.$1")),r!=o))return new G(o,i);if(G.DEBUG)throw Error(d+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new G(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,r){return k(this,new G(e,r))},f.decimalPlaces=f.dp=function(e,r){var t,n,i,o=this;if(null!=e)return B(e,0,S),null==r?r=D:B(r,0,8),$(new G(o),e+o.e+1,r);if(!(t=o.c))return null;if(n=((i=t.length-1)-T(this.e/w))*w,i=t[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},f.dividedBy=f.div=function(e,r){return t(this,new G(e,r),C,D)},f.dividedToIntegerBy=f.idiv=function(e,r){return t(this,new G(e,r),0,1)},f.exponentiatedBy=f.pow=function(e,r){var t,n,i,o,u,a,c,l,s=this;if((e=new G(e)).c&&!e.isInteger())throw Error(d+"Exponent not an integer: "+Z(e));if(null!=r&&(r=new G(r)),u=e.e>14,!s.c||!s.c[0]||1==s.c[0]&&!s.e&&1==s.c.length||!e.c||!e.c[0])return l=new G(Math.pow(+Z(s),u?2-N(e):+Z(e))),r?l.mod(r):l;if(a=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new G(NaN);(n=!a&&s.isInteger()&&r.isInteger())&&(s=s.mod(r))}else{if(e.e>9&&(s.e>0||s.e<-1||(0==s.e?s.c[0]>1||u&&s.c[1]>=24e7:s.c[0]<8e13||u&&s.c[0]<=9999975e7)))return o=s.s<0&&N(e)?-0:0,s.e>-1&&(o=1/o),new G(a?1/o:o);M&&(o=g(M/w+2))}for(u?(t=new G(.5),a&&(e.s=1),c=N(e)):c=(i=Math.abs(+Z(e)))%2,l=new G(_);;){if(c){if(!(l=l.times(s)).c)break;o?l.c.length>o&&(l.c.length=o):n&&(l=l.mod(r))}if(i){if(0===(i=p(i/2)))break;c=i%2}else if($(e=e.times(t),e.e+1,1),e.e>14)c=N(e);else{if(0==(i=+Z(e)))break;c=i%2}s=s.times(s),o?s.c&&s.c.length>o&&(s.c.length=o):n&&(s=s.mod(r))}return n?l:(a&&(l=_.div(l)),r?l.mod(r):o?$(l,M,D,void 0):l)},f.integerValue=function(e){var r=new G(this);return null==e?e=D:B(e,0,8),$(r,r.e+1,e)},f.isEqualTo=f.eq=function(e,r){return 0===k(this,new G(e,r))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,r){return k(this,new G(e,r))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,r){return 1===(r=k(this,new G(e,r)))||0===r},f.isInteger=function(){return!!this.c&&T(this.e/w)>this.c.length-2},f.isLessThan=f.lt=function(e,r){return k(this,new G(e,r))<0},f.isLessThanOrEqualTo=f.lte=function(e,r){return-1===(r=k(this,new G(e,r)))||0===r},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,r){var t,n,i,o,u=this,a=u.s;if(r=(e=new G(e,r)).s,!a||!r)return new G(NaN);if(a!=r)return e.s=-r,u.plus(e);var c=u.e/w,l=e.e/w,s=u.c,f=e.c;if(!c||!l){if(!s||!f)return s?(e.s=-r,e):new G(f?u:NaN);if(!s[0]||!f[0])return f[0]?(e.s=-r,e):new G(s[0]?u:3==D?-0:0)}if(c=T(c),l=T(l),s=s.slice(),a=c-l){for((o=a<0)?(a=-a,i=s):(l=c,i=f),i.reverse(),r=a;r--;i.push(0));i.reverse()}else for(n=(o=(a=s.length)<(r=f.length))?a:r,a=r=0;r<n;r++)if(s[r]!=f[r]){o=s[r]<f[r];break}if(o&&(i=s,s=f,f=i,e.s=-e.s),(r=(n=f.length)-(t=s.length))>0)for(;r--;s[t++]=0);for(r=m-1;n>a;){if(s[--n]<f[n]){for(t=n;t&&!s[--t];s[t]=r);--s[t],s[n]+=m}s[n]-=f[n]}for(;0==s[0];s.splice(0,1),--l);return s[0]?z(e,s,l):(e.s=3==D?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,r){var n,i,o=this;return e=new G(e,r),!o.c||!e.s||e.c&&!e.c[0]?new G(NaN):!e.c||o.c&&!o.c[0]?new G(o):(9==L?(i=e.s,e.s=1,n=t(o,e,0,3),e.s=i,n.s*=i):n=t(o,e,0,L),(e=o.minus(n.times(e))).c[0]||1!=L||(e.s=o.s),e)},f.multipliedBy=f.times=function(e,r){var t,n,i,o,u,a,c,l,s,f,h,g,p,d,v,y=this,b=y.c,S=(e=new G(e,r)).c;if(!(b&&S&&b[0]&&S[0]))return!y.s||!e.s||b&&!b[0]&&!S||S&&!S[0]&&!b?e.c=e.e=e.s=null:(e.s*=y.s,b&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=T(y.e/w)+T(e.e/w),e.s*=y.s,(c=b.length)<(f=S.length)&&(p=b,b=S,S=p,i=c,c=f,f=i),i=c+f,p=[];i--;p.push(0));for(d=m,v=A,i=f;--i>=0;){for(t=0,h=S[i]%v,g=S[i]/v|0,o=i+(u=c);o>i;)t=((l=h*(l=b[--u]%v)+(a=g*l+(s=b[u]/v|0)*h)%v*v+p[o]+t)/d|0)+(a/v|0)+g*s,p[o--]=l%d;p[o]=t}return t?++n:p.splice(0,1),z(e,p,n)},f.negated=function(){var e=new G(this);return e.s=-e.s||null,e},f.plus=function(e,r){var t,n=this,i=n.s;if(r=(e=new G(e,r)).s,!i||!r)return new G(NaN);if(i!=r)return e.s=-r,n.minus(e);var o=n.e/w,u=e.e/w,a=n.c,c=e.c;if(!o||!u){if(!a||!c)return new G(i/0);if(!a[0]||!c[0])return c[0]?e:new G(a[0]?n:0*i)}if(o=T(o),u=T(u),a=a.slice(),i=o-u){for(i>0?(u=o,t=c):(i=-i,t=a),t.reverse();i--;t.push(0));t.reverse()}for((i=a.length)-(r=c.length)<0&&(t=c,c=a,a=t,r=i),i=0;r;)i=(a[--r]=a[r]+c[r]+i)/m|0,a[r]=m===a[r]?0:a[r]%m;return i&&(a=[i].concat(a),++u),z(e,a,u)},f.precision=f.sd=function(e,r){var t,n,i,o=this;if(null!=e&&e!==!!e)return B(e,1,S),null==r?r=D:B(r,0,8),$(new G(o),e,r);if(!(t=o.c))return null;if(n=(i=t.length-1)*w+1,i=t[i]){for(;i%10==0;i/=10,n--);for(i=t[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},f.shiftedBy=function(e){return B(e,-y,y),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,r,n,i,o,u=this,a=u.c,c=u.s,l=u.e,s=C+4,f=new G("0.5");if(1!==c||!a||!a[0])return new G(!c||c<0&&(!a||a[0])?NaN:a?u:1/0);if(0==(c=Math.sqrt(+Z(u)))||c==1/0?(((r=E(a)).length+l)%2==0&&(r+="0"),c=Math.sqrt(+r),l=T((l+1)/2)-(l<0||l%2),n=new G(r=c==1/0?"1e"+l:(r=c.toExponential()).slice(0,r.indexOf("e")+1)+l)):n=new G(c+""),n.c[0])for((c=(l=n.e)+s)<3&&(c=0);;)if(o=n,n=f.times(o.plus(t(u,o,s,1))),E(o.c).slice(0,c)===(r=E(n.c)).slice(0,c)){if(n.e<l&&--c,"9999"!=(r=r.slice(c-3,c+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||($(n,n.e+C+2,1),e=!n.times(n).eq(u));break}if(!i&&($(o,o.e+C+2,0),o.times(o).eq(u))){n=o;break}s+=4,c+=4,i=1}return $(n,n.e+C+1,D,e)},f.toExponential=function(e,r){return null!=e&&(B(e,0,S),e++),q(this,e,r,1)},f.toFixed=function(e,r){return null!=e&&(B(e,0,S),e=e+this.e+1),q(this,e,r)},f.toFormat=function(e,r,t){var n,i=this;if(null==t)null!=e&&r&&"object"==typeof r?(t=r,r=null):e&&"object"==typeof e?(t=e,e=r=null):t=H;else if("object"!=typeof t)throw Error(d+"Argument not an object: "+t);if(n=i.toFixed(e,r),i.c){var o,u=n.split("."),a=+t.groupSize,c=+t.secondaryGroupSize,l=t.groupSeparator||"",s=u[0],f=u[1],h=i.s<0,g=h?s.slice(1):s,p=g.length;if(c&&(o=a,a=c,c=o,p-=o),a>0&&p>0){for(o=p%a||a,s=g.substr(0,o);o<p;o+=a)s+=l+g.substr(o,a);c>0&&(s+=l+g.slice(o)),h&&(s="-"+s)}n=f?s+(t.decimalSeparator||"")+((c=+t.fractionGroupSize)?f.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):f):s}return(t.prefix||"")+n+(t.suffix||"")},f.toFraction=function(e){var r,n,i,o,u,a,c,l,s,f,h,g,p=this,v=p.c;if(null!=e&&(!(c=new G(e)).isInteger()&&(c.c||1!==c.s)||c.lt(_)))throw Error(d+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Z(c));if(!v)return new G(p);for(r=new G(_),s=n=new G(_),i=l=new G(_),g=E(v),u=r.e=g.length-p.e-1,r.c[0]=b[(a=u%w)<0?w+a:a],e=!e||c.comparedTo(r)>0?u>0?r:s:c,a=P,P=1/0,c=new G(g),l.c[0]=0;f=t(c,r,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,s=l.plus(f.times(o=s)),l=o,r=c.minus(f.times(o=r)),c=o;return o=t(e.minus(n),i,0,1),l=l.plus(o.times(s)),n=n.plus(o.times(i)),l.s=s.s=p.s,h=t(s,i,u*=2,D).minus(p).abs().comparedTo(t(l,n,u,D).minus(p).abs())<1?[s,i]:[l,n],P=a,h},f.toNumber=function(){return+Z(this)},f.toPrecision=function(e,r){return null!=e&&B(e,1,S),q(this,e,r,2)},f.toString=function(e){var r,t=this,i=t.s,o=t.e;return null===o?i?(r="Infinity",i<0&&(r="-"+r)):r="NaN":(null==e?r=o<=F||o>=U?x(E(t.c),o):O(E(t.c),o,"0"):10===e?r=O(E((t=$(new G(t),C+o+1,D)).c),t.e,"0"):(B(e,2,j.length,"Base"),r=n(O(E(t.c),o,"0"),10,e,i,!0)),i<0&&t.c[0]&&(r="-"+r)),r},f.valueOf=f.toJSON=function(){return Z(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=r&&G.set(r),G}();function D(e){if(!e||!/^-?\d*(\.\d+)?$/.test(e))throw new Error("Invalid value: ".concat(e))}C.config({EXPONENTIAL_AT:[-9,20]}),(_=e.BurstValueFormat||(e.BurstValueFormat={}))[_.PLANCK=0]="PLANCK",_[_.BURST=1]="BURST";var F=function(){function t(e){r(this,t),"string"==typeof e&&D(e),this._planck=new C(e)}return n(t,[{key:"getRaw",value:function(){return this._planck}},{key:"getPlanck",value:function(){return this._planck.toString()}},{key:"setPlanck",value:function(e){D(e),this._planck=new C(e)}},{key:"getBurst",value:function(){return this._planck.dividedBy(1e8).toString()}},{key:"setBurst",value:function(e){D(e),this._planck=new C(e).multipliedBy(1e8)}},{key:"equals",value:function(e){return this._planck.eq(e._planck)}},{key:"lessOrEqual",value:function(e){return this._planck.lte(e._planck)}},{key:"less",value:function(e){return this._planck.lt(e._planck)}},{key:"greaterOrEqual",value:function(e){return this._planck.gte(e._planck)}},{key:"greater",value:function(e){return this._planck.gt(e._planck)}},{key:"add",value:function(e){return this._planck=this._planck.plus(e._planck),this}},{key:"subtract",value:function(e){return this._planck=this._planck.minus(e._planck),this}},{key:"multiply",value:function(e){return this._planck=this._planck.multipliedBy(e),this}},{key:"divide",value:function(e){if(0===e)throw new Error("Division by zero");return this._planck=this._planck.div(e),this}},{key:"toString",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.BurstValueFormat.BURST)===e.BurstValueFormat.BURST?"".concat("Ƀ"," ").concat(this.getBurst()):"".concat("ƀ"," ").concat(this._planck)}},{key:"clone",value:function(){return t.fromPlanck(this.getPlanck())}}],[{key:"Zero",value:function(){return new t("0")}},{key:"fromPlanck",value:function(e){return new t(e)}},{key:"fromBurst",value:function(e){var r=new t("0");return r.setBurst("number"==typeof e?e.toString(10):e),r}}]),t}(),U=function(e){0===e.indexOf("".concat("BURST","-"))&&(e=e.substr(6));for(var r=o.slice(),t=0,n=0;n<e.length;n++){var i=l.indexOf(e.charAt(n));if(!(i<=-1||i>l.length)){if(t>16)return!1;r[c[t]]=i,t++}}if(17!==t)return!1;for(var a=0,f=1;f<5;f++){for(var h=0,g=0;g<31;g++)if(!(g>12&&g<27)){var p=g;g>26&&(p-=14),h^=s(r[p],u[f*g%31])}a|=h}return 0===a};const R="function"==typeof atob,P="function"==typeof btoa,I="function"==typeof Buffer,L="function"==typeof TextDecoder?new TextDecoder:void 0,M="function"==typeof TextEncoder?new TextEncoder:void 0,H=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],j=(e=>{let r={};return H.forEach((e,t)=>r[e]=t),r})(),G=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,q=String.fromCharCode.bind(String),V="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,r=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(r)),z=e=>e.replace(/[+\/]/g,e=>"+"==e?"-":"_").replace(/=+$/m,""),$=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),Z=e=>{let r,t,n,i,o="";const u=e.length%3;for(let u=0;u<e.length;){if((t=e.charCodeAt(u++))>255||(n=e.charCodeAt(u++))>255||(i=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");o+=H[(r=t<<16|n<<8|i)>>18&63]+H[r>>12&63]+H[r>>6&63]+H[63&r]}return u?o.slice(0,u-3)+"===".substring(u):o},W=P?e=>btoa(e):I?e=>Buffer.from(e,"binary").toString("base64"):Z,Q=I?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let t=0,n=e.length;t<n;t+=4096)r.push(q.apply(null,e.subarray(t,t+4096)));return W(r.join(""))},X=e=>{if(e.length<2)return(r=e.charCodeAt(0))<128?e:r<2048?q(192|r>>>6)+q(128|63&r):q(224|r>>>12&15)+q(128|r>>>6&63)+q(128|63&r);var r=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return q(240|r>>>18&7)+q(128|r>>>12&63)+q(128|r>>>6&63)+q(128|63&r)},J=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,K=e=>e.replace(J,X),Y=I?e=>Buffer.from(e,"utf8").toString("base64"):M?e=>Q(M.encode(e)):e=>W(K(e)),ee=(e,r=!1)=>r?z(Y(e)):Y(e),re=e=>ee(e,!0),te=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,ne=e=>{switch(e.length){case 4:var r=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return q(55296+(r>>>10))+q(56320+(1023&r));case 3:return q((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return q((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},ie=e=>e.replace(te,ne),oe=e=>{if(e=e.replace(/\s+/g,""),!G.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let r,t,n,i="";for(let o=0;o<e.length;)r=j[e.charAt(o++)]<<18|j[e.charAt(o++)]<<12|(t=j[e.charAt(o++)])<<6|(n=j[e.charAt(o++)]),i+=64===t?q(r>>16&255):64===n?q(r>>16&255,r>>8&255):q(r>>16&255,r>>8&255,255&r);return i},ue=R?e=>atob($(e)):I?e=>Buffer.from(e,"base64").toString("binary"):oe,ae=I?e=>V(Buffer.from(e,"base64")):e=>V(ue(e),e=>e.charCodeAt(0)),ce=I?e=>Buffer.from(e,"base64").toString("utf8"):L?e=>L.decode(ae(e)):e=>ie(ue(e)),le=e=>$(e.replace(/[-_]/g,e=>"-"==e?"+":"/")),se=e=>ce(le(e)),fe=ee,he=re,ge=se;var pe=function(e){return 1e3*(i+e)},de=function(e){for(var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return r?t.join("").toUpperCase():t.join("")},ve=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(0===t)return"";var n=e;if(0!==r){var i=null===t?e.length-r:t;!function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t<0)throw new Error("Start index should not be negative");if(e.length<t+r)throw new Error("Need at least "+r+" bytes to convert to an integer")}(n,i,r),n=e.slice(r,r+i)}return decodeURIComponent(escape(String.fromCharCode.apply(null,Array.from(n))))};String.prototype.padStart||(String.prototype.padStart=function(e,r){return e>>=0,r=String(void 0!==r?r:" "),this.length>=e?String(this):((e-=this.length)>r.length&&(r+=r.repeat(e/r.length)),r.slice(0,e)+String(this))});var me,we=function(e){if(e.length%2)throw new Error("Invalid Hex String: ".concat(e));for(var r=new Uint8Array(e.length/2),t=0;t<e.length;t+=2){var n=parseInt(e.substr(t,2),16);if(Number.isNaN(n))throw new Error("Invalid Hex String: ".concat(e));r[t/2]=n}return r},ye=function(e){if(null==e||""===e)throw new Error("Invalid argument");return parseFloat(e)/1e8},be=function(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?he(e):fe(e)},Ae=function(e){for(var r=unescape(encodeURIComponent(e)),t=new Uint8Array(r.length),n=0;n<r.length;++n)t[n]=r.charCodeAt(n);return t},Se=function(e){return de(Ae(e))};(me=e.EncoderFormat||(e.EncoderFormat={}))[me.Text=0]="Text",me[me.Hexadecimal=1]="Hexadecimal",me[me.Base64=2]="Base64";var Te=/^burst.(.+):\/\/(v.+?)\??/i;return e.BurstPlanckSymbol="ƀ",e.BurstSymbol="Ƀ",e.BurstTime=f,e.BurstValue=F,e.FeeQuantPlanck=735e3,e.OneBurstPlanck=1e8,e.asyncRetry=function e(r){return t=this,n=void 0,o=function*(){var t=r.asyncFn,n=r.onFailureAsync,i=r.retryCount,o=void 0===i?1:i,u=r.maxRetrials,a=void 0===u?20:u;try{return yield t()}catch(r){if(o>a)throw r;if(!(yield n(r,o)))throw r;yield e({asyncFn:t,onFailureAsync:n,retryCount:o+1})}},new((i=void 0)||(i=Promise))(function(e,r){function u(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(r){r.done?e(r.value):new i(function(e){e(r.value)}).then(u,a)}c((o=o.apply(t,n||[])).next())});var t,n,i,o},e.convertAddressToNumericId=function(e){if(null!=e&&0!==e.trim().length&&0===e.indexOf("".concat("BURST","-"))){e=e.substr(6);for(var r=o.slice(),t=0,n=0;n<e.length;n++){var i=l.indexOf(e.charAt(n));if(!(i<=-1||i>l.length)){if(t>16)return;r[c[t]]=i,t++}}if(U(e)){for(var u=13,a=[],s=0;s<u;s++)a[s]=r[u-s-1];var f,h="",g=0;do{f=0,g=0;for(var p=0;p<u;p++)(g=32*g+a[p])>=10?(a[f]=Math.floor(g/10),g%=10,f+=1):f>0&&(a[f]=0,f+=1);u=f,h+=g}while(u>0);return h.split("").reverse().join("")}}},e.convertBase36StringToHexString=function(e){return new C(e,36).toString(16)},e.convertBase64StringToString=function(e){return ge(e)},e.convertBurstTimeToDate=function(e){return new Date(pe(e))},e.convertBurstTimeToEpochTime=pe,e.convertByteArrayToHexString=de,e.convertByteArrayToString=ve,e.convertDateToBurstTime=function(e){return Math.round(e.getTime()/1e3)-i},e.convertDecStringToHexString=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t="string"==typeof e?new C(e):e;if(t.isNaN())throw new Error("Invalid decimal argument: [".concat(e,"] - Expected a valid decimal value"));if(r<0)throw new Error("Invalid padding argument: [".concat(r,"] - Expected a positive value"));var n=t.lt(0);n&&(t=function(e){for(var r=e.multipliedBy(-1).toString(2);r.length%8;)r="0"+r;var t="1"===r[0]&&-1!==r.slice(1).indexOf("1")?"11111111":"";return r=r.split("").map(function(e){return"0"===e?"1":"0"}).join(""),new C(t+r,2).plus(1)}(t));var i=t.toString(16),o=Math.ceil(i.length/r);return i.padStart(o*r,n?"f":"0")},e.convertHexEndianess=function(e){for(var r="",t=e,n=t.length-1;n>=0;n-=2)r+=t[n-1]+t[n];return r},e.convertHexStringToBase36String=function(e){return new C(e,16).toString(36)},e.convertHexStringToByteArray=we,e.convertHexStringToDecString=function(e){var r,t,n,i=[0];for(r=0;r<e.length;r+=1){for(n=parseInt(e.charAt(r),16),t=0;t<i.length;t+=1)i[t]=16*i[t]+n,n=i[t]/10|0,i[t]%=10;for(;n>0;)i.push(n%10),n=n/10|0}return i.reverse().join("")},e.convertHexStringToString=function(e){return ve(we(e))},e.convertNQTStringToNumber=ye,e.convertNumberToNQTString=function(e){if(null==e)throw new Error("Invalid argument");return parseFloat(e.toString()).toFixed(8).replace(".","")},e.convertNumericIdToAddress=function(e){if(null!=e&&0!==e.trim().length){for(var r=[],t=o.slice(),n=0,i=e.length,u=0;u<i;u++)r[u]=e.charCodeAt(u)-"0".charCodeAt(0);var a=0,f=0;do{a=0,f=0;for(var h=0;h<i;h++)(a=10*a+r[h])>=32?(r[f]=a>>5,a&=31,f++):f>0&&(r[f]=0,f++);i=f,t[n]=a,n++}while(i>0);for(var g=[0,0,0,0],p=12;p>=0;p--){var d=t[p]^g[3];g[3]=g[2]^s(30,d),g[2]=g[1]^s(6,d),g[1]=g[0]^s(9,d),g[0]=s(17,d)}t[13]=g[0],t[14]=g[1],t[15]=g[2],t[16]=g[3];for(var v="BURST-",m=0;m<17;m++)v+=l[t[c[m]]],3==(3&m)&&m<13&&(v+="-");return v}},e.convertStringToBase64String=be,e.convertStringToByteArray=Ae,e.convertStringToHexString=Se,e.createDeeplink=function(r){var t=r.encoderFormat,n=void 0===t?e.EncoderFormat.Base64:t,i=r.domain,o=r.action,u=r.payload,a="burst.".concat(i,"://v1");return o&&(a+="?action=".concat(o)),u&&(a+="&payload=".concat(function(r,t){var n=r;switch("string"!=typeof r&&(n=JSON.stringify(r)),t){case e.EncoderFormat.Hexadecimal:return Se(n);case e.EncoderFormat.Base64:return be(n);case e.EncoderFormat.Text:default:return n}}(u,n))),a},e.isBurstAddress=function(e){if(!new RegExp("".concat("BURST","-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{5}(-w+)?"),"i").test(e))return!1;var r=e.lastIndexOf("-"),t=e.substr(r+1);return e=t.length>5?e.substr(0,r):e,U(e)},e.isValid=U,e.parseDeeplink=function(e){var r=function(){throw new Error("Invalid deeplink: "+e)},t=function(e,t){return e.startsWith(t+"=")||r(),e.split("=")[1]},n=e.match(Te);n&&3===n.length||r();var i={domain:n[1],version:n[2],action:void 0,payload:void 0,decodedPayload:void 0};try{var o=e.indexOf("?");if(-1!==o){var u=e.substring(o+1).split("&");u.length>=1&&(u.length>2&&r(),i.action=t(u[0],"action"),2===u.length&&(i.payload=t(u[1],"payload")))}}catch(e){r()}return i},e.sumNQTStringToNumber=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.reduce(function(e,r){return e+ye(r)},0)},e}({}); | ||
//# sourceMappingURL=burstjs.util.min.js.map |
@@ -10,3 +10,3 @@ import BigNumber from 'bignumber.js'; | ||
static Zero(): BurstValue; | ||
static fromPlanck(planck: string): BurstValue; | ||
static fromPlanck(planck: number | string): BurstValue; | ||
static fromBurst(burst: number | string): BurstValue; | ||
@@ -13,0 +13,0 @@ getRaw(): BigNumber; |
@@ -0,1 +1,2 @@ | ||
export * from './asyncRetry'; | ||
export * from './burstTime'; | ||
@@ -2,0 +3,0 @@ export * from './burstValue'; |
@@ -0,2 +1,3 @@ | ||
export * from './args/asyncRetryArgs'; | ||
export * from './args/createDeeplinkArgs'; | ||
export * from './DeeplinkParts'; |
@@ -10,3 +10,3 @@ import BigNumber from 'bignumber.js'; | ||
static Zero(): BurstValue; | ||
static fromPlanck(planck: string): BurstValue; | ||
static fromPlanck(planck: number | string): BurstValue; | ||
static fromBurst(burst: number | string): BurstValue; | ||
@@ -13,0 +13,0 @@ getRaw(): BigNumber; |
@@ -20,3 +20,5 @@ "use strict"; | ||
constructor(planck) { | ||
assureValidValue(planck); | ||
if (typeof planck === 'string') { | ||
assureValidValue(planck); | ||
} | ||
this._planck = new bignumber_js_1.default(planck); | ||
@@ -23,0 +25,0 @@ } |
@@ -0,1 +1,2 @@ | ||
export * from './asyncRetry'; | ||
export * from './burstTime'; | ||
@@ -2,0 +3,0 @@ export * from './burstValue'; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./asyncRetry")); | ||
__export(require("./burstTime")); | ||
@@ -8,0 +9,0 @@ __export(require("./burstValue")); |
@@ -0,2 +1,3 @@ | ||
export * from './args/asyncRetryArgs'; | ||
export * from './args/createDeeplinkArgs'; | ||
export * from './DeeplinkParts'; |
{ | ||
"name": "@burstjs/util", | ||
"version": "0.6.0-beta.4", | ||
"version": "0.6.0-beta.5", | ||
"description": "Useful utilities and tools for building Burstcoin applications", | ||
@@ -59,3 +59,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "b99e3b1355d6cfc9680d25cd666e203d131fc890", | ||
"gitHead": "3f8f40435d9c379feee73f457bb2953777614c7c", | ||
"dependencies": { | ||
@@ -62,0 +62,0 @@ "bignumber.js": "^9.0.0", |
@@ -16,2 +16,3 @@ import {BurstValue, BurstValueFormat} from '../burstValue'; | ||
it('Should create an instance correctly', () => { | ||
expect(BurstValue.fromPlanck(1).getBurst()).toEqual('0.00000001'); | ||
expect(BurstValue.fromPlanck('1').getBurst()).toEqual('0.00000001'); | ||
@@ -29,2 +30,3 @@ expect(BurstValue.fromPlanck('100').getBurst()).toEqual('0.000001'); | ||
expect(BurstValue.fromPlanck('0').getPlanck()).toEqual('0'); | ||
expect(BurstValue.fromPlanck(0).getPlanck()).toEqual('0'); | ||
expect(BurstValue.fromBurst('1').getPlanck()).toEqual('100000000'); | ||
@@ -31,0 +33,0 @@ }); |
@@ -38,4 +38,6 @@ /** | ||
private constructor(planck: string) { | ||
assureValidValue(planck); | ||
private constructor(planck: number | string) { | ||
if (typeof planck === 'string') { | ||
assureValidValue(planck); | ||
} | ||
this._planck = new BigNumber(planck); | ||
@@ -52,3 +54,3 @@ } | ||
*/ | ||
public static fromPlanck(planck: string): BurstValue { | ||
public static fromPlanck(planck: number | string): BurstValue { | ||
return new BurstValue(planck); | ||
@@ -55,0 +57,0 @@ } |
@@ -6,2 +6,3 @@ /** | ||
* */ | ||
export * from './asyncRetry'; | ||
export * from './burstTime'; | ||
@@ -8,0 +9,0 @@ export * from './burstValue'; |
/** @module util */ | ||
export * from './args/asyncRetryArgs'; | ||
export * from './args/createDeeplinkArgs'; | ||
export * from './DeeplinkParts'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
543863
204
6480