@burstjs/util
Advanced tools
Comparing version 0.5.0-beta.5 to 0.5.0-beta.6
@@ -1,2 +0,2 @@ | ||
var b$util=function(exports){"use strict";var GenesisBlockTime=Date.UTC(2014,7,11,2,0,0,0)/1e3,initialCodeword=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],gexp=[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],glog=[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],cwmap=[3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11],alphabet="23456789ABCDEFGHJKLMNPQRSTUVWXYZ".split(""),base32Length=13,gmult=function(e,r){if(0===e||0===r)return 0;var t=(glog[e]+glog[r])%31;return gexp[t]},isValid=function(e){0===e.indexOf("BURST-")&&(e=e.substr(6));for(var r=initialCodeword.slice(),t=0,n=0;n<e.length;n++){var o=alphabet.indexOf(e.charAt(n));if(!(o<=-1||o>alphabet.length)){if(t>16)return!1;r[cwmap[t]]=o,t++}}if(17!==t)return!1;for(var i=0,a=1;a<5;a++){for(var u=0,c=0;c<31;c++)if(!(c>12&&c<27)){var s=c;c>26&&(s-=14),u^=gmult(r[s],gexp[a*c%31])}i|=u}return 0===i},isBurstAddress=function(e){return/^BURST\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{5}/i.test(e)&&isValid(e)},convertAddressToNumericId=function(e){if(null!=e&&0!==e.trim().length&&0===e.indexOf("BURST-")){e=e.substr(6);for(var r=initialCodeword.slice(),t=0,n=0;n<e.length;n++){var o=alphabet.indexOf(e.charAt(n));if(!(o<=-1||o>alphabet.length)){if(t>16)return;r[cwmap[t]]=o,t++}}if(isValid(e)){for(var i=base32Length,a=[],u=0;u<i;u++)a[u]=r[i-u-1];var c,s="",l=0;do{c=0,l=0;for(var f=0;f<i;f++)(l=32*l+a[f])>=10?(a[c]=Math.floor(l/10),l%=10,c+=1):c>0&&(a[c]=0,c+=1);i=c,s+=l}while(i>0);return s.split("").reverse().join("")}}},convertBurstTimeToEpochTime=function(e){return 1e3*(GenesisBlockTime+e)},convertBurstTimeToDate=function(e){return new Date(convertBurstTimeToEpochTime(e))},convertByteArrayToHexString=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("")},convertByteArrayToString=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 o=null===t?e.length-r:t;checkBytesToIntInput(n,o,r),n=e.slice(r,r+o)}return decodeURIComponent(escape(String.fromCharCode.apply(null,Array.from(n))))};function checkBytesToIntInput(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");return t}var convertDateToBurstTime=function(e){return Math.round(e.getTime()/1e3)-GenesisBlockTime},convertHexEndianess=function(e){for(var r="",t=e,n=t.length-1;n>=0;n-=2)r+=t[n-1]+t[n];return r},convertHexStringToByteArray=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},convertHexStringToDecString=function(e){var r,t,n,o=[0];for(r=0;r<e.length;r+=1){for(n=parseInt(e.charAt(r),16),t=0;t<o.length;t+=1)o[t]=16*o[t]+n,n=o[t]/10|0,o[t]%=10;for(;n>0;)o.push(n%10),n=n/10|0}return o.reverse().join("")},convertHexStringToString=function(e){return convertByteArrayToString(convertHexStringToByteArray(e))},convertNQTStringToNumber=function(e){if(null==e||""===e)throw new Error("Invalid argument");return parseFloat(e)/1e8},convertNumberToNQTString=function(e){if(null==e)throw new Error("Invalid argument");return parseFloat(e.toString()).toFixed(8).replace(".","")},convertNumericIdToAddress=function(e){if(null!=e&&0!==e.trim().length){for(var r=[],t=initialCodeword.slice(),n=0,o=e.length,i=0;i<o;i++)r[i]=e.charCodeAt(i)-"0".charCodeAt(0);var a=0,u=0;do{a=0,u=0;for(var c=0;c<o;c++)(a=10*a+r[c])>=32?(r[u]=a>>5,a&=31,u++):u>0&&(r[u]=0,u++);o=u,t[n]=a,n++}while(o>0);for(var s=[0,0,0,0],l=base32Length-1;l>=0;l--){var f=t[l]^s[3];s[3]=s[2]^gmult(30,f),s[2]=s[1]^gmult(6,f),s[1]=s[0]^gmult(9,f),s[0]=gmult(17,f)}t[13]=s[0],t[14]=s[1],t[15]=s[2],t[16]=s[3];for(var h="BURST-",d=0;d<17;d++)h+=alphabet[t[cwmap[d]]],3==(3&d)&&d<13&&(h+="-");return h}},convertStringToByteArray=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},convertStringToHexString=function(e){return convertByteArrayToHexString(convertStringToByteArray(e))},EncoderFormat;EncoderFormat=exports.EncoderFormat||(exports.EncoderFormat={}),EncoderFormat[EncoderFormat.Text=0]="Text",EncoderFormat[EncoderFormat.Hexadecimal=1]="Hexadecimal",EncoderFormat[EncoderFormat.Base64=2]="Base64";var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,r){return e(r={exports:{}},r.exports),r.exports}var base64=createCommonjsModule(function(module,exports){var global,factory;global="undefined"!=typeof self?self:"undefined"!=typeof window?window:commonjsGlobal,factory=function(global){global=global||{};var _Base64=global.Base64,version="2.5.1",buffer;if(module.exports)try{buffer=eval("require('buffer').Buffer")}catch(e){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(e){for(var r={},t=0,n=e.length;t<n;t++)r[e.charAt(t)]=t;return r}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(e){if(e.length<2)return(r=e.charCodeAt(0))<128?e:r<2048?fromCharCode(192|r>>>6)+fromCharCode(128|63&r):fromCharCode(224|r>>>12&15)+fromCharCode(128|r>>>6&63)+fromCharCode(128|63&r);var r=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return fromCharCode(240|r>>>18&7)+fromCharCode(128|r>>>12&63)+fromCharCode(128|r>>>6&63)+fromCharCode(128|63&r)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(e){return e.replace(re_utob,cb_utob)},cb_encode=function(e){var r=[0,2,1][e.length%3],t=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[b64chars.charAt(t>>>18),b64chars.charAt(t>>>12&63),r>=2?"=":b64chars.charAt(t>>>6&63),r>=1?"=":b64chars.charAt(63&t)].join("")},btoa=global.btoa?function(e){return global.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e)).toString("base64")}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e)).toString("base64")}:function(e){return btoa(utob(e))},encode=function(e,r){return r?_encode(String(e)).replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,""):_encode(String(e))},encodeURI=function(e){return encode(e,!0)},re_btou=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),cb_btou=function(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 fromCharCode(55296+(r>>>10))+fromCharCode(56320+(1023&r));case 3:return fromCharCode((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return fromCharCode((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},btou=function(e){return e.replace(re_btou,cb_btou)},cb_decode=function(e){var r=e.length,t=r%4,n=(r>0?b64tab[e.charAt(0)]<<18:0)|(r>1?b64tab[e.charAt(1)]<<12:0)|(r>2?b64tab[e.charAt(2)]<<6:0)|(r>3?b64tab[e.charAt(3)]:0),o=[fromCharCode(n>>>16),fromCharCode(n>>>8&255),fromCharCode(255&n)];return o.length-=[0,0,2,1][t],o.join("")},_atob=global.atob?function(e){return global.atob(e)}:function(e){return e.replace(/\S{1,4}/g,cb_decode)},atob=function(e){return _atob(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e,"base64")).toString()}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e,"base64")).toString()}:function(e){return btou(_atob(e))},decode=function(e){return _decode(String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var e=global.Base64;return global.Base64=_Base64,e};if(global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,__buffer__:buffer},"function"==typeof Object.defineProperty){var noEnum=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)})),Object.defineProperty(String.prototype,"toBase64",noEnum(function(e){return encode(this,e)})),Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,!0)}))}}return global.Meteor&&(Base64=global.Base64),module.exports&&(module.exports.Base64=global.Base64),{Base64:global.Base64}},module.exports=factory(global)}),base64_1=base64.Base64,convertStringToBase64String=function(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?base64_1.encodeURI(e):base64_1.encode(e)};function encodePayload(e,r){var t=e;switch("string"!=typeof e&&(t=JSON.stringify(e)),r){case exports.EncoderFormat.Hexadecimal:return convertStringToHexString(t);case exports.EncoderFormat.Base64:return convertStringToBase64String(t);case exports.EncoderFormat.Text:default:return t}}var createDeeplink=function(e){var r=e.encoderFormat,t=void 0===r?exports.EncoderFormat.Base64:r,n=e.domain,o=e.action,i=e.payload,a="burst.".concat(n,"://v1");return o&&(a+="?action=".concat(o)),i&&(a+="&payload=".concat(encodePayload(i,t))),a},MandatoryPattern=/^burst.(.+):\/\/(v.+?)\??/i,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(MandatoryPattern);n&&3===n.length||r();var o={domain:n[1],version:n[2],action:void 0,payload:void 0,decodedPayload:void 0};try{var i=e.indexOf("?");if(-1!==i){var a=e.substring(i+1).split("&");a.length>=1&&(a.length>2&&r(),o.action=t(a[0],"action"),2===a.length&&(o.payload=t(a[1],"payload")))}}catch(e){r()}return o};function sumNQTStringToNumber(){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+convertNQTStringToNumber(r)},0)}var BurstSymbol="Ƀ",BurstPlanckSymbol="ƀ";function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(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 _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),e}var BurstTime=function(){function e(r){_classCallCheck(this,e),this._burstTimestamp=r}return _createClass(e,[{key:"getBurstTimestamp",value:function(){return this._burstTimestamp}},{key:"setBurstTimestamp",value:function(e){this._burstTimestamp=e}},{key:"getEpoch",value:function(){return 1e3*(GenesisBlockTime+this._burstTimestamp)}},{key:"getDate",value:function(){return new Date(this.getEpoch())}},{key:"setDate",value:function(e){this._burstTimestamp=Math.round(e.getTime()/1e3)-GenesisBlockTime}},{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}(),DP=20,RM=1,MAX_DP=1e6,MAX_POWER=1e6,NE=-7,PE=21,NAME="[big.js] ",INVALID=NAME+"Invalid ",INVALID_DP=INVALID+"decimal places",INVALID_RM=INVALID+"rounding mode",DIV_BY_ZERO=NAME+"Division by zero",P={},UNDEFINED=void 0,NUMERIC=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function _Big_(){function e(r){var t=this;if(!(t instanceof e))return r===UNDEFINED?_Big_():new e(r);r instanceof e?(t.s=r.s,t.e=r.e,t.c=r.c.slice()):parse(t,r),t.constructor=e}return e.prototype=P,e.DP=DP,e.RM=RM,e.NE=NE,e.PE=PE,e.version="5.2.2",e}function parse(e,r){var t,n,o;if(0===r&&1/r<0)r="-0";else if(!NUMERIC.test(r+=""))throw Error(INVALID+"number");for(e.s="-"==r.charAt(0)?(r=r.slice(1),-1):1,(t=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(t<0&&(t=n),t+=+r.slice(n+1),r=r.substring(0,n)):t<0&&(t=r.length),o=r.length,n=0;n<o&&"0"==r.charAt(n);)++n;if(n==o)e.c=[e.e=0];else{for(;o>0&&"0"==r.charAt(--o););for(e.e=t-n-1,e.c=[],t=0;n<=o;)e.c[t++]=+r.charAt(n++)}return e}function round(e,r,t,n){var o=e.c,i=e.e+r+1;if(i<o.length){if(1===t)n=o[i]>=5;else if(2===t)n=o[i]>5||5==o[i]&&(n||i<0||o[i+1]!==UNDEFINED||1&o[i-1]);else if(3===t)n=n||!!o[0];else if(n=!1,0!==t)throw Error(INVALID_RM);if(i<1)o.length=1,n?(e.e=-r,o[0]=1):o[0]=e.e=0;else{if(o.length=i--,n)for(;++o[i]>9;)o[i]=0,i--||(++e.e,o.unshift(1));for(i=o.length;!o[--i];)o.pop()}}else if(t<0||t>3||t!==~~t)throw Error(INVALID_RM);return e}function stringify(e,r,t,n){var o,i,a=e.constructor,u=!e.c[0];if(t!==UNDEFINED){if(t!==~~t||t<(3==r)||t>MAX_DP)throw Error(3==r?INVALID+"precision":INVALID_DP);for(t=n-(e=new a(e)).e,e.c.length>++n&&round(e,t,a.RM),2==r&&(n=e.e+t+1);e.c.length<n;)e.c.push(0)}if(o=e.e,t=(i=e.c.join("")).length,2!=r&&(1==r||3==r&&n<=o||o<=a.NE||o>=a.PE))i=i.charAt(0)+(t>1?"."+i.slice(1):"")+(o<0?"e":"e+")+o;else if(o<0){for(;++o;)i="0"+i;i="0."+i}else if(o>0)if(++o>t)for(o-=t;o--;)i+="0";else o<t&&(i=i.slice(0,o)+"."+i.slice(o));else t>1&&(i=i.charAt(0)+"."+i.slice(1));return e.s<0&&(!u||4==r)?"-"+i:i}P.abs=function(){var e=new this.constructor(this);return e.s=1,e},P.cmp=function(e){var r,t=this,n=t.c,o=(e=new t.constructor(e)).c,i=t.s,a=e.s,u=t.e,c=e.e;if(!n[0]||!o[0])return n[0]?i:o[0]?-a:0;if(i!=a)return i;if(r=i<0,u!=c)return u>c^r?1:-1;for(a=(u=n.length)<(c=o.length)?u:c,i=-1;++i<a;)if(n[i]!=o[i])return n[i]>o[i]^r?1:-1;return u==c?0:u>c^r?1:-1},P.div=function(e){var r=this,t=r.constructor,n=r.c,o=(e=new t(e)).c,i=r.s==e.s?1:-1,a=t.DP;if(a!==~~a||a<0||a>MAX_DP)throw Error(INVALID_DP);if(!o[0])throw Error(DIV_BY_ZERO);if(!n[0])return new t(0*i);var u,c,s,l,f,h=o.slice(),d=u=o.length,g=n.length,p=n.slice(0,u),m=p.length,v=e,b=v.c=[],y=0,T=a+(v.e=r.e-e.e)+1;for(v.s=i,i=T<0?0:T,h.unshift(0);m++<u;)p.push(0);do{for(s=0;s<10;s++){if(u!=(m=p.length))l=u>m?1:-1;else for(f=-1,l=0;++f<u;)if(o[f]!=p[f]){l=o[f]>p[f]?1:-1;break}if(!(l<0))break;for(c=m==u?o:h;m;){if(p[--m]<c[m]){for(f=m;f&&!p[--f];)p[f]=9;--p[f],p[m]+=10}p[m]-=c[m]}for(;!p[0];)p.shift()}b[y++]=l?s:++s,p[0]&&l?p[m]=n[d]||0:p=[n[d]]}while((d++<g||p[0]!==UNDEFINED)&&i--);return b[0]||1==y||(b.shift(),v.e--),y>T&&round(v,a,t.RM,p[0]!==UNDEFINED),v},P.eq=function(e){return!this.cmp(e)},P.gt=function(e){return this.cmp(e)>0},P.gte=function(e){return this.cmp(e)>-1},P.lt=function(e){return this.cmp(e)<0},P.lte=function(e){return this.cmp(e)<1},P.minus=P.sub=function(e){var r,t,n,o,i=this,a=i.constructor,u=i.s,c=(e=new a(e)).s;if(u!=c)return e.s=-c,i.plus(e);var s=i.c.slice(),l=i.e,f=e.c,h=e.e;if(!s[0]||!f[0])return f[0]?(e.s=-c,e):new a(s[0]?i:0);if(u=l-h){for((o=u<0)?(u=-u,n=s):(h=l,n=f),n.reverse(),c=u;c--;)n.push(0);n.reverse()}else for(t=((o=s.length<f.length)?s:f).length,u=c=0;c<t;c++)if(s[c]!=f[c]){o=s[c]<f[c];break}if(o&&(n=s,s=f,f=n,e.s=-e.s),(c=(t=f.length)-(r=s.length))>0)for(;c--;)s[r++]=0;for(c=r;t>u;){if(s[--t]<f[t]){for(r=t;r&&!s[--r];)s[r]=9;--s[r],s[t]+=10}s[t]-=f[t]}for(;0===s[--c];)s.pop();for(;0===s[0];)s.shift(),--h;return s[0]||(e.s=1,s=[h=0]),e.c=s,e.e=h,e},P.mod=function(e){var r,t=this,n=t.constructor,o=t.s,i=(e=new n(e)).s;if(!e.c[0])throw Error(DIV_BY_ZERO);return t.s=e.s=1,r=1==e.cmp(t),t.s=o,e.s=i,r?new n(t):(o=n.DP,i=n.RM,n.DP=n.RM=0,t=t.div(e),n.DP=o,n.RM=i,this.minus(t.times(e)))},P.plus=P.add=function(e){var r,t=this,n=t.constructor,o=t.s,i=(e=new n(e)).s;if(o!=i)return e.s=-i,t.minus(e);var a=t.e,u=t.c,c=e.e,s=e.c;if(!u[0]||!s[0])return s[0]?e:new n(u[0]?t:0*o);if(u=u.slice(),o=a-c){for(o>0?(c=a,r=s):(o=-o,r=u),r.reverse();o--;)r.push(0);r.reverse()}for(u.length-s.length<0&&(r=s,s=u,u=r),o=s.length,i=0;o;u[o]%=10)i=(u[--o]=u[o]+s[o]+i)/10|0;for(i&&(u.unshift(i),++c),o=u.length;0===u[--o];)u.pop();return e.c=u,e.e=c,e},P.pow=function(e){var r=this,t=new r.constructor(1),n=t,o=e<0;if(e!==~~e||e<-MAX_POWER||e>MAX_POWER)throw Error(INVALID+"exponent");for(o&&(e=-e);1&e&&(n=n.times(r)),e>>=1;)r=r.times(r);return o?t.div(n):n},P.round=function(e,r){var t=this.constructor;if(e===UNDEFINED)e=0;else if(e!==~~e||e<-MAX_DP||e>MAX_DP)throw Error(INVALID_DP);return round(new t(this),e,r===UNDEFINED?t.RM:r)},P.sqrt=function(){var e,r,t,n=this,o=n.constructor,i=n.s,a=n.e,u=new o(.5);if(!n.c[0])return new o(n);if(i<0)throw Error(NAME+"No square root");0===(i=Math.sqrt(n+""))||i===1/0?((r=n.c.join("")).length+a&1||(r+="0"),a=((a+1)/2|0)-(a<0||1&a),e=new o(((i=Math.sqrt(r))==1/0?"1e":(i=i.toExponential()).slice(0,i.indexOf("e")+1))+a)):e=new o(i),a=e.e+(o.DP+=4);do{t=e,e=u.times(t.plus(n.div(t)))}while(t.c.slice(0,a).join("")!==e.c.slice(0,a).join(""));return round(e,o.DP-=4,o.RM)},P.times=P.mul=function(e){var r,t=this,n=t.constructor,o=t.c,i=(e=new n(e)).c,a=o.length,u=i.length,c=t.e,s=e.e;if(e.s=t.s==e.s?1:-1,!o[0]||!i[0])return new n(0*e.s);for(e.e=c+s,a<u&&(r=o,o=i,i=r,s=a,a=u,u=s),r=new Array(s=a+u);s--;)r[s]=0;for(c=u;c--;){for(u=0,s=a+c;s>c;)u=r[s]+i[c]*o[s-c-1]+u,r[s--]=u%10,u=u/10|0;r[s]=(r[s]+u)%10}for(u?++e.e:r.shift(),c=r.length;!r[--c];)r.pop();return e.c=r,e},P.toExponential=function(e){return stringify(this,1,e,e)},P.toFixed=function(e){return stringify(this,2,e,this.e+e)},P.toPrecision=function(e){return stringify(this,3,e,e-1)},P.toString=function(){return stringify(this)},P.valueOf=P.toJSON=function(){return stringify(this,4)};var Big=_Big_(),BurstValueFormat;Big.NE=-9,BurstValueFormat=exports.BurstValueFormat||(exports.BurstValueFormat={}),BurstValueFormat[BurstValueFormat.PLANCK=0]="PLANCK",BurstValueFormat[BurstValueFormat.BURST=1]="BURST";var BurstValue=function(){function e(r){_classCallCheck(this,e),this._planck=Big(r)}return _createClass(e,[{key:"getRaw",value:function(){return Big(this._planck)}},{key:"getPlanck",value:function(){return this._planck.toString()}},{key:"setPlanck",value:function(e){this._planck=Big(e)}},{key:"getBurst",value:function(){return Big(this._planck).div(1e8).toString()}},{key:"setBurst",value:function(e){this._planck=Big(e).mul(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.mul(e),this}},{key:"divide",value:function(e){return this._planck=this._planck.div(e),this}},{key:"toString",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:exports.BurstValueFormat.BURST)===exports.BurstValueFormat.BURST?"".concat(BurstSymbol," ").concat(this.getBurst()):"".concat(BurstPlanckSymbol," ").concat(this._planck)}}],[{key:"fromPlanck",value:function(r){return new e(r)}},{key:"fromBurst",value:function(r){var t=new e("0");return t.setBurst("number"==typeof r?r.toString(10):r),t}}]),e}();return exports.BurstPlanckSymbol=BurstPlanckSymbol,exports.BurstSymbol=BurstSymbol,exports.BurstTime=BurstTime,exports.BurstValue=BurstValue,exports.convertAddressToNumericId=convertAddressToNumericId,exports.convertBurstTimeToDate=convertBurstTimeToDate,exports.convertBurstTimeToEpochTime=convertBurstTimeToEpochTime,exports.convertByteArrayToHexString=convertByteArrayToHexString,exports.convertByteArrayToString=convertByteArrayToString,exports.convertDateToBurstTime=convertDateToBurstTime,exports.convertHexEndianess=convertHexEndianess,exports.convertHexStringToByteArray=convertHexStringToByteArray,exports.convertHexStringToDecString=convertHexStringToDecString,exports.convertHexStringToString=convertHexStringToString,exports.convertNQTStringToNumber=convertNQTStringToNumber,exports.convertNumberToNQTString=convertNumberToNQTString,exports.convertNumericIdToAddress=convertNumericIdToAddress,exports.convertStringToByteArray=convertStringToByteArray,exports.convertStringToHexString=convertStringToHexString,exports.createDeeplink=createDeeplink,exports.isBurstAddress=isBurstAddress,exports.isValid=isValid,exports.parseDeeplink=parseDeeplink,exports.sumNQTStringToNumber=sumNQTStringToNumber,exports}({}); | ||
var b$util=function(exports){"use strict";var GenesisBlockTime=Date.UTC(2014,7,11,2,0,0,0)/1e3,initialCodeword=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],gexp=[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],glog=[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],cwmap=[3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11],alphabet="23456789ABCDEFGHJKLMNPQRSTUVWXYZ".split(""),base32Length=13,gmult=function(e,r){if(0===e||0===r)return 0;var t=(glog[e]+glog[r])%31;return gexp[t]},isValid=function(e){0===e.indexOf("BURST-")&&(e=e.substr(6));for(var r=initialCodeword.slice(),t=0,n=0;n<e.length;n++){var o=alphabet.indexOf(e.charAt(n));if(!(o<=-1||o>alphabet.length)){if(t>16)return!1;r[cwmap[t]]=o,t++}}if(17!==t)return!1;for(var i=0,a=1;a<5;a++){for(var u=0,c=0;c<31;c++)if(!(c>12&&c<27)){var s=c;c>26&&(s-=14),u^=gmult(r[s],gexp[a*c%31])}i|=u}return 0===i},isBurstAddress=function(e){return/^BURST\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{5}/i.test(e)&&isValid(e)},convertAddressToNumericId=function(e){if(null!=e&&0!==e.trim().length&&0===e.indexOf("BURST-")){e=e.substr(6);for(var r=initialCodeword.slice(),t=0,n=0;n<e.length;n++){var o=alphabet.indexOf(e.charAt(n));if(!(o<=-1||o>alphabet.length)){if(t>16)return;r[cwmap[t]]=o,t++}}if(isValid(e)){for(var i=base32Length,a=[],u=0;u<i;u++)a[u]=r[i-u-1];var c,s="",l=0;do{c=0,l=0;for(var f=0;f<i;f++)(l=32*l+a[f])>=10?(a[c]=Math.floor(l/10),l%=10,c+=1):c>0&&(a[c]=0,c+=1);i=c,s+=l}while(i>0);return s.split("").reverse().join("")}}},convertBurstTimeToEpochTime=function(e){return 1e3*(GenesisBlockTime+e)},convertBurstTimeToDate=function(e){return new Date(convertBurstTimeToEpochTime(e))},convertByteArrayToHexString=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("")},convertByteArrayToString=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 o=null===t?e.length-r:t;checkBytesToIntInput(n,o,r),n=e.slice(r,r+o)}return decodeURIComponent(escape(String.fromCharCode.apply(null,Array.from(n))))};function checkBytesToIntInput(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");return t}var convertDateToBurstTime=function(e){return Math.round(e.getTime()/1e3)-GenesisBlockTime},convertHexEndianess=function(e){for(var r="",t=e,n=t.length-1;n>=0;n-=2)r+=t[n-1]+t[n];return r},convertHexStringToByteArray=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},convertHexStringToDecString=function(e){var r,t,n,o=[0];for(r=0;r<e.length;r+=1){for(n=parseInt(e.charAt(r),16),t=0;t<o.length;t+=1)o[t]=16*o[t]+n,n=o[t]/10|0,o[t]%=10;for(;n>0;)o.push(n%10),n=n/10|0}return o.reverse().join("")},convertHexStringToString=function(e){return convertByteArrayToString(convertHexStringToByteArray(e))},convertNQTStringToNumber=function(e){if(null==e||""===e)throw new Error("Invalid argument");return parseFloat(e)/1e8},convertNumberToNQTString=function(e){if(null==e)throw new Error("Invalid argument");return parseFloat(e.toString()).toFixed(8).replace(".","")},convertNumericIdToAddress=function(e){if(null!=e&&0!==e.trim().length){for(var r=[],t=initialCodeword.slice(),n=0,o=e.length,i=0;i<o;i++)r[i]=e.charCodeAt(i)-"0".charCodeAt(0);var a=0,u=0;do{a=0,u=0;for(var c=0;c<o;c++)(a=10*a+r[c])>=32?(r[u]=a>>5,a&=31,u++):u>0&&(r[u]=0,u++);o=u,t[n]=a,n++}while(o>0);for(var s=[0,0,0,0],l=base32Length-1;l>=0;l--){var f=t[l]^s[3];s[3]=s[2]^gmult(30,f),s[2]=s[1]^gmult(6,f),s[1]=s[0]^gmult(9,f),s[0]=gmult(17,f)}t[13]=s[0],t[14]=s[1],t[15]=s[2],t[16]=s[3];for(var h="BURST-",g=0;g<17;g++)h+=alphabet[t[cwmap[g]]],3==(3&g)&&g<13&&(h+="-");return h}},convertStringToByteArray=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},convertStringToHexString=function(e){return convertByteArrayToHexString(convertStringToByteArray(e))},EncoderFormat;EncoderFormat=exports.EncoderFormat||(exports.EncoderFormat={}),EncoderFormat[EncoderFormat.Text=0]="Text",EncoderFormat[EncoderFormat.Hexadecimal=1]="Hexadecimal",EncoderFormat[EncoderFormat.Base64=2]="Base64";var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,r){return e(r={exports:{}},r.exports),r.exports}var base64=createCommonjsModule(function(module,exports){var global,factory;global="undefined"!=typeof self?self:"undefined"!=typeof window?window:commonjsGlobal,factory=function(global){global=global||{};var _Base64=global.Base64,version="2.5.1",buffer;if(module.exports)try{buffer=eval("require('buffer').Buffer")}catch(e){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(e){for(var r={},t=0,n=e.length;t<n;t++)r[e.charAt(t)]=t;return r}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(e){if(e.length<2)return(r=e.charCodeAt(0))<128?e:r<2048?fromCharCode(192|r>>>6)+fromCharCode(128|63&r):fromCharCode(224|r>>>12&15)+fromCharCode(128|r>>>6&63)+fromCharCode(128|63&r);var r=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return fromCharCode(240|r>>>18&7)+fromCharCode(128|r>>>12&63)+fromCharCode(128|r>>>6&63)+fromCharCode(128|63&r)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(e){return e.replace(re_utob,cb_utob)},cb_encode=function(e){var r=[0,2,1][e.length%3],t=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[b64chars.charAt(t>>>18),b64chars.charAt(t>>>12&63),r>=2?"=":b64chars.charAt(t>>>6&63),r>=1?"=":b64chars.charAt(63&t)].join("")},btoa=global.btoa?function(e){return global.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e)).toString("base64")}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e)).toString("base64")}:function(e){return btoa(utob(e))},encode=function(e,r){return r?_encode(String(e)).replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,""):_encode(String(e))},encodeURI=function(e){return encode(e,!0)},re_btou=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),cb_btou=function(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 fromCharCode(55296+(r>>>10))+fromCharCode(56320+(1023&r));case 3:return fromCharCode((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return fromCharCode((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},btou=function(e){return e.replace(re_btou,cb_btou)},cb_decode=function(e){var r=e.length,t=r%4,n=(r>0?b64tab[e.charAt(0)]<<18:0)|(r>1?b64tab[e.charAt(1)]<<12:0)|(r>2?b64tab[e.charAt(2)]<<6:0)|(r>3?b64tab[e.charAt(3)]:0),o=[fromCharCode(n>>>16),fromCharCode(n>>>8&255),fromCharCode(255&n)];return o.length-=[0,0,2,1][t],o.join("")},_atob=global.atob?function(e){return global.atob(e)}:function(e){return e.replace(/\S{1,4}/g,cb_decode)},atob=function(e){return _atob(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e,"base64")).toString()}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e,"base64")).toString()}:function(e){return btou(_atob(e))},decode=function(e){return _decode(String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var e=global.Base64;return global.Base64=_Base64,e};if(global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,__buffer__:buffer},"function"==typeof Object.defineProperty){var noEnum=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)})),Object.defineProperty(String.prototype,"toBase64",noEnum(function(e){return encode(this,e)})),Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,!0)}))}}return global.Meteor&&(Base64=global.Base64),module.exports&&(module.exports.Base64=global.Base64),{Base64:global.Base64}},module.exports=factory(global)}),base64_1=base64.Base64,convertStringToBase64String=function(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?base64_1.encodeURI(e):base64_1.encode(e)};function encodePayload(e,r){var t=e;switch("string"!=typeof e&&(t=JSON.stringify(e)),r){case exports.EncoderFormat.Hexadecimal:return convertStringToHexString(t);case exports.EncoderFormat.Base64:return convertStringToBase64String(t);case exports.EncoderFormat.Text:default:return t}}var createDeeplink=function(e){var r=e.encoderFormat,t=void 0===r?exports.EncoderFormat.Base64:r,n=e.domain,o=e.action,i=e.payload,a="burst.".concat(n,"://v1");return o&&(a+="?action=".concat(o)),i&&(a+="&payload=".concat(encodePayload(i,t))),a},MandatoryPattern=/^burst.(.+):\/\/(v.+?)\??/i,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(MandatoryPattern);n&&3===n.length||r();var o={domain:n[1],version:n[2],action:void 0,payload:void 0,decodedPayload:void 0};try{var i=e.indexOf("?");if(-1!==i){var a=e.substring(i+1).split("&");a.length>=1&&(a.length>2&&r(),o.action=t(a[0],"action"),2===a.length&&(o.payload=t(a[1],"payload")))}}catch(e){r()}return o};function sumNQTStringToNumber(){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+convertNQTStringToNumber(r)},0)}var BurstSymbol="Ƀ",BurstPlanckSymbol="ƀ",FeeQuantPlanck=735e3,OneBurstPlanck=1e8;function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(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 _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),e}var BurstTime=function(){function e(r){_classCallCheck(this,e),this._burstTimestamp=r}return _createClass(e,[{key:"getBurstTimestamp",value:function(){return this._burstTimestamp}},{key:"setBurstTimestamp",value:function(e){this._burstTimestamp=e}},{key:"getEpoch",value:function(){return 1e3*(GenesisBlockTime+this._burstTimestamp)}},{key:"getDate",value:function(){return new Date(this.getEpoch())}},{key:"setDate",value:function(e){this._burstTimestamp=Math.round(e.getTime()/1e3)-GenesisBlockTime}},{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}(),isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var r,t,n,o,i,a,u,c,s,l=y.prototype={constructor:y,toString:null,valueOf:null},f=new y(1),h=20,g=4,d=-7,p=21,m=-1e7,b=1e7,v=!1,S=1,A=0,B={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},E="0123456789abcdefghijklmnopqrstuvwxyz";function y(e,r){var o,i,a,u,c,s,l,f,d=this;if(!(d instanceof y))return new y(e,r);if(null==r){if(e&&!0===e._isBigNumber)return d.s=e.s,void(!e.c||e.e>b?d.c=d.e=null:e.e<m?d.c=[d.e=0]:(d.e=e.e,d.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(d.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,c=e;c>=10;c/=10,u++);return void(u>b?d.c=d.e=null:(d.e=u,d.c=[e]))}f=String(e)}else{if(!isNumeric.test(f=String(e)))return n(d,f,s);d.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(c=f.search(/e/i))>0?(u<0&&(u=c),u+=+f.slice(c+1),f=f.substring(0,c)):u<0&&(u=f.length)}else{if(intCheck(r,2,E.length,"Base"),10==r)return C(d=new y(e),h+d.e+1,g);if(f=String(e),s="number"==typeof e){if(0*e!=0)return n(d,f,s,r);if(d.s=1/e<0?(f=f.slice(1),-1):1,y.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+e)}else d.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(o=E.slice(0,r),u=c=0,l=f.length;c<l;c++)if(o.indexOf(i=f.charAt(c))<0){if("."==i){if(c>u){u=l;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,c=-1,u=0;continue}return n(d,String(e),s,r)}s=!1,(u=(f=t(f,r,10,d.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(c=0;48===f.charCodeAt(c);c++);for(l=f.length;48===f.charCodeAt(--l););if(f=f.slice(c,++l)){if(l-=c,s&&y.DEBUG&&l>15&&(e>MAX_SAFE_INTEGER||e!==mathfloor(e)))throw Error(tooManyDigits+d.s*e);if((u=u-c-1)>b)d.c=d.e=null;else if(u<m)d.c=[d.e=0];else{if(d.e=u,d.c=[],c=(u+1)%LOG_BASE,u<0&&(c+=LOG_BASE),c<l){for(c&&d.c.push(+f.slice(0,c)),l-=LOG_BASE;c<l;)d.c.push(+f.slice(c,c+=LOG_BASE));c=LOG_BASE-(f=f.slice(c)).length}else c-=l;for(;c--;f+="0");d.c.push(+f)}}else d.c=[d.e=0]}function T(e,r,t,n){var o,i,a,u,c;if(null==t?t=g:intCheck(t,0,8),!e.c)return e.toString();if(o=e.c[0],a=e.e,null==r)c=coeffToString(e.c),c=1==n||2==n&&(a<=d||a>=p)?toExponential(c,a):toFixedPoint(c,a,"0");else if(i=(e=C(new y(e),r,t)).e,u=(c=coeffToString(e.c)).length,1==n||2==n&&(r<=i||i<=d)){for(;u<r;c+="0",u++);c=toExponential(c,i)}else if(r-=a,c=toFixedPoint(c,i,"0"),i+1>u){if(--r>0)for(c+=".";r--;c+="0");}else if((r+=i-u)>0)for(i+1==u&&(c+=".");r--;c+="0");return e.s<0&&o?"-"+c:c}function _(e,r){for(var t,n=1,o=new y(e[0]);n<e.length;n++){if(!(t=new y(e[n])).s){o=t;break}r.call(o,t)&&(o=t)}return o}function w(e,r,t){for(var n=1,o=r.length;!r[--o];r.pop());for(o=r[0];o>=10;o/=10,n++);return(t=n+t*LOG_BASE-1)>b?e.c=e.e=null:t<m?e.c=[e.e=0]:(e.e=t,e.c=r),e}function C(e,r,t,n){var o,i,a,u,c,s,l,f=e.c,h=POWS_TEN;if(f){e:{for(o=1,u=f[0];u>=10;u/=10,o++);if((i=r-o)<0)i+=LOG_BASE,a=r,l=(c=f[s=0])/h[o-a-1]%10|0;else if((s=mathceil((i+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=s;f.push(0));c=l=0,o=1,a=(i%=LOG_BASE)-LOG_BASE+1}else{for(c=u=f[s],o=1;u>=10;u/=10,o++);l=(a=(i%=LOG_BASE)-LOG_BASE+o)<0?0:c/h[o-a-1]%10|0}if(n=n||r<0||null!=f[s+1]||(a<0?c:c%h[o-a-1]),n=t<4?(l||n)&&(0==t||t==(e.s<0?3:2)):l>5||5==l&&(4==t||n||6==t&&(i>0?a>0?c/h[o-a]:0:f[s-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[(LOG_BASE-r%LOG_BASE)%LOG_BASE],e.e=-r||0):f[0]=e.e=0,e;if(0==i?(f.length=s,u=1,s--):(f.length=s+1,u=h[LOG_BASE-i],f[s]=a>0?mathfloor(c/h[o-a]%h[a])*u:0),n)for(;;){if(0==s){for(i=1,a=f[0];a>=10;a/=10,i++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);i!=u&&(e.e++,f[0]==BASE&&(f[0]=1));break}if(f[s]+=u,f[s]!=BASE)break;f[s--]=0,u=1}for(i=f.length;0===f[--i];f.pop());}e.e>b?e.c=e.e=null:e.e<m&&(e.c=[e.e=0])}return e}function O(e){var r,t=e.e;return null===t?e.toString():(r=coeffToString(e.c),r=t<=d||t>=p?toExponential(r,t):toFixedPoint(r,t,"0"),e.s<0?"-"+r:r)}return y.clone=clone,y.ROUND_UP=0,y.ROUND_DOWN=1,y.ROUND_CEIL=2,y.ROUND_FLOOR=3,y.ROUND_HALF_UP=4,y.ROUND_HALF_DOWN=5,y.ROUND_HALF_EVEN=6,y.ROUND_HALF_CEIL=7,y.ROUND_HALF_FLOOR=8,y.EUCLID=9,y.config=y.set=function(e){var r,t;if(null!=e){if("object"!=typeof e)throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(intCheck(t=e[r],0,MAX,r),h=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(intCheck(t=e[r],0,8,r),g=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(intCheck(t[0],-MAX,0,r),intCheck(t[1],0,MAX,r),d=t[0],p=t[1]):(intCheck(t,-MAX,MAX,r),d=-(p=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)intCheck(t[0],-MAX,-1,r),intCheck(t[1],1,MAX,r),m=t[0],b=t[1];else{if(intCheck(t,-MAX,MAX,r),!t)throw Error(bignumberError+r+" cannot be zero: "+t);m=-(b=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(bignumberError+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw v=!t,Error(bignumberError+"crypto unavailable");v=t}else v=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(intCheck(t=e[r],0,9,r),S=t),e.hasOwnProperty(r="POW_PRECISION")&&(intCheck(t=e[r],0,MAX,r),A=t),e.hasOwnProperty(r="FORMAT")){if("object"!=typeof(t=e[r]))throw Error(bignumberError+r+" not an object: "+t);B=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.$|[+-.\s]|(.).*\1/.test(t))throw Error(bignumberError+r+" invalid: "+t);E=t}}return{DECIMAL_PLACES:h,ROUNDING_MODE:g,EXPONENTIAL_AT:[d,p],RANGE:[m,b],CRYPTO:v,MODULO_MODE:S,POW_PRECISION:A,FORMAT:B,ALPHABET:E}},y.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!y.DEBUG)return!0;var r,t,n=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===i||-1===i)&&o>=-MAX&&o<=MAX&&o===mathfloor(o)){if(0===n[0]){if(0===o&&1===n.length)return!0;break e}if((r=(o+1)%LOG_BASE)<1&&(r+=LOG_BASE),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||t>=BASE||t!==mathfloor(t))break e;if(0!==t)return!0}}}else if(null===n&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},y.maximum=y.max=function(){return _(arguments,l.lt)},y.minimum=y.min=function(){return _(arguments,l.gt)},y.random=(o=9007199254740992*Math.random()&2097151?function(){return mathfloor(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,n,i,a,u=0,c=[],s=new y(f);if(null==e?e=h:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),v)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(a=131072*r[u]+(r[u+1]>>>11))>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),r[u]=t[0],r[u+1]=t[1]):(c.push(a%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw v=!1,Error(bignumberError+"crypto unavailable");for(r=crypto.randomBytes(i*=7);u<i;)(a=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6])>=9e15?crypto.randomBytes(7).copy(r,u):(c.push(a%1e14),u+=7);u=i/7}if(!v)for(;u<i;)(a=o())<9e15&&(c[u++]=a%1e14);for(i=c[--u],e%=LOG_BASE,i&&e&&(a=POWS_TEN[LOG_BASE-e],c[u]=mathfloor(i/a)*a);0===c[u];c.pop(),u--);if(u<0)c=[n=0];else{for(n=-1;0===c[0];c.splice(0,1),n-=LOG_BASE);for(u=1,a=c[0];a>=10;a/=10,u++);u<LOG_BASE&&(n-=LOG_BASE-u)}return s.e=n,s.c=c,s}),y.sum=function(){for(var e=1,r=arguments,t=new y(r[0]);e<r.length;)t=t.plus(r[e++]);return t},t=function(){function e(e,r,t,n){for(var o,i,a=[0],u=0,c=e.length;u<c;){for(i=a.length;i--;a[i]*=r);for(a[0]+=n.indexOf(e.charAt(u++)),o=0;o<a.length;o++)a[o]>t-1&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/t|0,a[o]%=t)}return a.reverse()}return function(t,n,o,i,a){var u,c,s,l,f,d,p,m,b=t.indexOf("."),v=h,S=g;for(b>=0&&(l=A,A=0,t=t.replace(".",""),d=(m=new y(n)).pow(t.length-b),A=l,m.c=e(toFixedPoint(coeffToString(d.c),d.e,"0"),10,o,"0123456789"),m.e=m.c.length),s=l=(p=e(t,n,o,a?(u=E,"0123456789"):(u="0123456789",E))).length;0==p[--l];p.pop());if(!p[0])return u.charAt(0);if(b<0?--s:(d.c=p,d.e=s,d.s=i,p=(d=r(d,m,v,S,o)).c,f=d.r,s=d.e),b=p[c=s+v+1],l=o/2,f=f||c<0||null!=p[c+1],f=S<4?(null!=b||f)&&(0==S||S==(d.s<0?3:2)):b>l||b==l&&(4==S||f||6==S&&1&p[c-1]||S==(d.s<0?8:7)),c<1||!p[0])t=f?toFixedPoint(u.charAt(1),-v,u.charAt(0)):u.charAt(0);else{if(p.length=c,f)for(--o;++p[--c]>o;)p[c]=0,c||(++s,p=[1].concat(p));for(l=p.length;!p[--l];);for(b=0,t="";b<=l;t+=u.charAt(p[b++]));t=toFixedPoint(t,s,u.charAt(0))}return t}}(),r=function(){function e(e,r,t){var n,o,i,a,u=0,c=e.length,s=r%SQRT_BASE,l=r/SQRT_BASE|0;for(e=e.slice();c--;)u=((o=s*(i=e[c]%SQRT_BASE)+(n=l*i+(a=e[c]/SQRT_BASE|0)*s)%SQRT_BASE*SQRT_BASE+u)/t|0)+(n/SQRT_BASE|0)+l*a,e[c]=o%t;return u&&(e=[u].concat(e)),e}function r(e,r,t,n){var o,i;if(t!=n)i=t>n?1:-1;else for(o=i=0;o<t;o++)if(e[o]!=r[o]){i=e[o]>r[o]?1:-1;break}return i}function t(e,r,t,n){for(var o=0;t--;)e[t]-=o,o=e[t]<r[t]?1:0,e[t]=o*n+e[t]-r[t];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,o,i,a,u){var c,s,l,f,h,g,d,p,m,b,v,S,A,B,E,T,_,w=n.s==o.s?1:-1,O=n.c,x=o.c;if(!(O&&O[0]&&x&&x[0]))return new y(n.s&&o.s&&(O?!x||O[0]!=x[0]:x)?O&&0==O[0]||!x?0*w:w/0:NaN);for(m=(p=new y(w)).c=[],w=i+(s=n.e-o.e)+1,u||(u=BASE,s=bitFloor(n.e/LOG_BASE)-bitFloor(o.e/LOG_BASE),w=w/LOG_BASE|0),l=0;x[l]==(O[l]||0);l++);if(x[l]>(O[l]||0)&&s--,w<0)m.push(1),f=!0;else{for(B=O.length,T=x.length,l=0,w+=2,(h=mathfloor(u/(x[0]+1)))>1&&(x=e(x,h,u),O=e(O,h,u),T=x.length,B=O.length),A=T,v=(b=O.slice(0,T)).length;v<T;b[v++]=0);_=x.slice(),_=[0].concat(_),E=x[0],x[1]>=u/2&&E++;do{if(h=0,(c=r(x,b,T,v))<0){if(S=b[0],T!=v&&(S=S*u+(b[1]||0)),(h=mathfloor(S/E))>1)for(h>=u&&(h=u-1),d=(g=e(x,h,u)).length,v=b.length;1==r(g,b,d,v);)h--,t(g,T<d?_:x,d,u),d=g.length,c=1;else 0==h&&(c=h=1),d=(g=x.slice()).length;if(d<v&&(g=[0].concat(g)),t(b,g,v,u),v=b.length,-1==c)for(;r(x,b,T,v)<1;)h++,t(b,T<v?_:x,v,u),v=b.length}else 0===c&&(h++,b=[0]);m[l++]=h,b[0]?b[v++]=O[A]||0:(b=[O[A]],v=1)}while((A++<B||null!=b[0])&&w--);f=null!=b[0],m[0]||m.splice(0,1)}if(u==BASE){for(l=1,w=m[0];w>=10;w/=10,l++);C(p,i+(p.e=l+s*LOG_BASE-1)+1,a,f)}else p.e=s,p.r=+f;return p}}(),i=/^(-?)0([xbo])(?=\w[\w.]*$)/i,a=/^([^.]+)\.$/,u=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,s=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,r,t,n){var o,l=t?r:r.replace(s,"");if(c.test(l))e.s=isNaN(l)?null:l<0?-1:1;else{if(!t&&(l=l.replace(i,function(e,r,t){return o="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=o?e:r}),n&&(o=n,l=l.replace(a,"$1").replace(u,"0.$1")),r!=l))return new y(l,o);if(y.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},l.absoluteValue=l.abs=function(){var e=new y(this);return e.s<0&&(e.s=1),e},l.comparedTo=function(e,r){return compare(this,new y(e,r))},l.decimalPlaces=l.dp=function(e,r){var t,n,o,i=this;if(null!=e)return intCheck(e,0,MAX),null==r?r=g:intCheck(r,0,8),C(new y(i),e+i.e+1,r);if(!(t=i.c))return null;if(n=((o=t.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,o=t[o])for(;o%10==0;o/=10,n--);return n<0&&(n=0),n},l.dividedBy=l.div=function(e,t){return r(this,new y(e,t),h,g)},l.dividedToIntegerBy=l.idiv=function(e,t){return r(this,new y(e,t),0,1)},l.exponentiatedBy=l.pow=function(e,r){var t,n,o,i,a,u,c,s,l=this;if((e=new y(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+O(e));if(null!=r&&(r=new y(r)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return s=new y(Math.pow(+O(l),a?2-isOdd(e):+O(e))),r?s.mod(r):s;if(u=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new y(NaN);(n=!u&&l.isInteger()&&r.isInteger())&&(l=l.mod(r))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return i=l.s<0&&isOdd(e)?-0:0,l.e>-1&&(i=1/i),new y(u?1/i:i);A&&(i=mathceil(A/LOG_BASE+2))}for(a?(t=new y(.5),u&&(e.s=1),c=isOdd(e)):c=(o=Math.abs(+O(e)))%2,s=new y(f);;){if(c){if(!(s=s.times(l)).c)break;i?s.c.length>i&&(s.c.length=i):n&&(s=s.mod(r))}if(o){if(0===(o=mathfloor(o/2)))break;c=o%2}else if(C(e=e.times(t),e.e+1,1),e.e>14)c=isOdd(e);else{if(0===(o=+O(e)))break;c=o%2}l=l.times(l),i?l.c&&l.c.length>i&&(l.c.length=i):n&&(l=l.mod(r))}return n?s:(u&&(s=f.div(s)),r?s.mod(r):i?C(s,A,g,void 0):s)},l.integerValue=function(e){var r=new y(this);return null==e?e=g:intCheck(e,0,8),C(r,r.e+1,e)},l.isEqualTo=l.eq=function(e,r){return 0===compare(this,new y(e,r))},l.isFinite=function(){return!!this.c},l.isGreaterThan=l.gt=function(e,r){return compare(this,new y(e,r))>0},l.isGreaterThanOrEqualTo=l.gte=function(e,r){return 1===(r=compare(this,new y(e,r)))||0===r},l.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},l.isLessThan=l.lt=function(e,r){return compare(this,new y(e,r))<0},l.isLessThanOrEqualTo=l.lte=function(e,r){return-1===(r=compare(this,new y(e,r)))||0===r},l.isNaN=function(){return!this.s},l.isNegative=function(){return this.s<0},l.isPositive=function(){return this.s>0},l.isZero=function(){return!!this.c&&0==this.c[0]},l.minus=function(e,r){var t,n,o,i,a=this,u=a.s;if(r=(e=new y(e,r)).s,!u||!r)return new y(NaN);if(u!=r)return e.s=-r,a.plus(e);var c=a.e/LOG_BASE,s=e.e/LOG_BASE,l=a.c,f=e.c;if(!c||!s){if(!l||!f)return l?(e.s=-r,e):new y(f?a:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-r,e):new y(l[0]?a:3==g?-0:0)}if(c=bitFloor(c),s=bitFloor(s),l=l.slice(),u=c-s){for((i=u<0)?(u=-u,o=l):(s=c,o=f),o.reverse(),r=u;r--;o.push(0));o.reverse()}else for(n=(i=(u=l.length)<(r=f.length))?u:r,u=r=0;r<n;r++)if(l[r]!=f[r]){i=l[r]<f[r];break}if(i&&(o=l,l=f,f=o,e.s=-e.s),(r=(n=f.length)-(t=l.length))>0)for(;r--;l[t++]=0);for(r=BASE-1;n>u;){if(l[--n]<f[n]){for(t=n;t&&!l[--t];l[t]=r);--l[t],l[n]+=BASE}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--s);return l[0]?w(e,l,s):(e.s=3==g?-1:1,e.c=[e.e=0],e)},l.modulo=l.mod=function(e,t){var n,o,i=this;return e=new y(e,t),!i.c||!e.s||e.c&&!e.c[0]?new y(NaN):!e.c||i.c&&!i.c[0]?new y(i):(9==S?(o=e.s,e.s=1,n=r(i,e,0,3),e.s=o,n.s*=o):n=r(i,e,0,S),(e=i.minus(n.times(e))).c[0]||1!=S||(e.s=i.s),e)},l.multipliedBy=l.times=function(e,r){var t,n,o,i,a,u,c,s,l,f,h,g,d,p,m,b=this,v=b.c,S=(e=new y(e,r)).c;if(!(v&&S&&v[0]&&S[0]))return!b.s||!e.s||v&&!v[0]&&!S||S&&!S[0]&&!v?e.c=e.e=e.s=null:(e.s*=b.s,v&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=bitFloor(b.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=b.s,(c=v.length)<(f=S.length)&&(d=v,v=S,S=d,o=c,c=f,f=o),o=c+f,d=[];o--;d.push(0));for(p=BASE,m=SQRT_BASE,o=f;--o>=0;){for(t=0,h=S[o]%m,g=S[o]/m|0,i=o+(a=c);i>o;)t=((s=h*(s=v[--a]%m)+(u=g*s+(l=v[a]/m|0)*h)%m*m+d[i]+t)/p|0)+(u/m|0)+g*l,d[i--]=s%p;d[i]=t}return t?++n:d.splice(0,1),w(e,d,n)},l.negated=function(){var e=new y(this);return e.s=-e.s||null,e},l.plus=function(e,r){var t,n=this,o=n.s;if(r=(e=new y(e,r)).s,!o||!r)return new y(NaN);if(o!=r)return e.s=-r,n.minus(e);var i=n.e/LOG_BASE,a=e.e/LOG_BASE,u=n.c,c=e.c;if(!i||!a){if(!u||!c)return new y(o/0);if(!u[0]||!c[0])return c[0]?e:new y(u[0]?n:0*o)}if(i=bitFloor(i),a=bitFloor(a),u=u.slice(),o=i-a){for(o>0?(a=i,t=c):(o=-o,t=u),t.reverse();o--;t.push(0));t.reverse()}for((o=u.length)-(r=c.length)<0&&(t=c,c=u,u=t,r=o),o=0;r;)o=(u[--r]=u[r]+c[r]+o)/BASE|0,u[r]=BASE===u[r]?0:u[r]%BASE;return o&&(u=[o].concat(u),++a),w(e,u,a)},l.precision=l.sd=function(e,r){var t,n,o,i=this;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==r?r=g:intCheck(r,0,8),C(new y(i),e,r);if(!(t=i.c))return null;if(n=(o=t.length-1)*LOG_BASE+1,o=t[o]){for(;o%10==0;o/=10,n--);for(o=t[0];o>=10;o/=10,n++);}return e&&i.e+1>n&&(n=i.e+1),n},l.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},l.squareRoot=l.sqrt=function(){var e,t,n,o,i,a=this,u=a.c,c=a.s,s=a.e,l=h+4,f=new y("0.5");if(1!==c||!u||!u[0])return new y(!c||c<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(c=Math.sqrt(+O(a)))||c==1/0?(((t=coeffToString(u)).length+s)%2==0&&(t+="0"),c=Math.sqrt(+t),s=bitFloor((s+1)/2)-(s<0||s%2),n=new y(t=c==1/0?"1e"+s:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+s)):n=new y(c+""),n.c[0])for((c=(s=n.e)+l)<3&&(c=0);;)if(i=n,n=f.times(i.plus(r(a,i,l,1))),coeffToString(i.c).slice(0,c)===(t=coeffToString(n.c)).slice(0,c)){if(n.e<s&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(o||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(C(n,n.e+h+2,1),e=!n.times(n).eq(a));break}if(!o&&(C(i,i.e+h+2,0),i.times(i).eq(a))){n=i;break}l+=4,c+=4,o=1}return C(n,n.e+h+1,g,e)},l.toExponential=function(e,r){return null!=e&&(intCheck(e,0,MAX),e++),T(this,e,r,1)},l.toFixed=function(e,r){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),T(this,e,r)},l.toFormat=function(e,r,t){var n,o=this;if(null==t)null!=e&&r&&"object"==typeof r?(t=r,r=null):e&&"object"==typeof e?(t=e,e=r=null):t=B;else if("object"!=typeof t)throw Error(bignumberError+"Argument not an object: "+t);if(n=o.toFixed(e,r),o.c){var i,a=n.split("."),u=+t.groupSize,c=+t.secondaryGroupSize,s=t.groupSeparator||"",l=a[0],f=a[1],h=o.s<0,g=h?l.slice(1):l,d=g.length;if(c&&(i=u,u=c,c=i,d-=i),u>0&&d>0){for(i=d%u||u,l=g.substr(0,i);i<d;i+=u)l+=s+g.substr(i,u);c>0&&(l+=s+g.slice(i)),h&&(l="-"+l)}n=f?l+(t.decimalSeparator||"")+((c=+t.fractionGroupSize)?f.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):f):l}return(t.prefix||"")+n+(t.suffix||"")},l.toFraction=function(e){var t,n,o,i,a,u,c,s,l,h,d,p,m=this,v=m.c;if(null!=e&&(!(c=new y(e)).isInteger()&&(c.c||1!==c.s)||c.lt(f)))throw Error(bignumberError+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+O(c));if(!v)return new y(m);for(t=new y(f),l=n=new y(f),o=s=new y(f),p=coeffToString(v),a=t.e=p.length-m.e-1,t.c[0]=POWS_TEN[(u=a%LOG_BASE)<0?LOG_BASE+u:u],e=!e||c.comparedTo(t)>0?a>0?t:l:c,u=b,b=1/0,c=new y(p),s.c[0]=0;h=r(c,t,0,1),1!=(i=n.plus(h.times(o))).comparedTo(e);)n=o,o=i,l=s.plus(h.times(i=l)),s=i,t=c.minus(h.times(i=t)),c=i;return i=r(e.minus(n),o,0,1),s=s.plus(i.times(l)),n=n.plus(i.times(o)),s.s=l.s=m.s,d=r(l,o,a*=2,g).minus(m).abs().comparedTo(r(s,n,a,g).minus(m).abs())<1?[l,o]:[s,n],b=u,d},l.toNumber=function(){return+O(this)},l.toPrecision=function(e,r){return null!=e&&intCheck(e,1,MAX),T(this,e,r,2)},l.toString=function(e){var r,n=this,o=n.s,i=n.e;return null===i?o?(r="Infinity",o<0&&(r="-"+r)):r="NaN":(null==e?r=i<=d||i>=p?toExponential(coeffToString(n.c),i):toFixedPoint(coeffToString(n.c),i,"0"):10===e?r=toFixedPoint(coeffToString((n=C(new y(n),h+i+1,g)).c),n.e,"0"):(intCheck(e,2,E.length,"Base"),r=t(toFixedPoint(coeffToString(n.c),i,"0"),10,e,o,!0)),o<0&&n.c[0]&&(r="-"+r)),r},l.valueOf=l.toJSON=function(){return O(this)},l._isBigNumber=!0,l[Symbol.toStringTag]="BigNumber",l[Symbol.for("nodejs.util.inspect.custom")]=l.valueOf,null!=e&&y.set(e),y}function bitFloor(e){var r=0|e;return e>0||e===r?r:r-1}function coeffToString(e){for(var r,t,n=1,o=e.length,i=e[0]+"";n<o;){for(r=e[n++]+"",t=LOG_BASE-r.length;t--;r="0"+r);i+=r}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function compare(e,r){var t,n,o=e.c,i=r.c,a=e.s,u=r.s,c=e.e,s=r.e;if(!a||!u)return null;if(t=o&&!o[0],n=i&&!i[0],t||n)return t?n?0:-u:a;if(a!=u)return a;if(t=a<0,n=c==s,!o||!i)return n?0:!o^t?1:-1;if(!n)return c>s^t?1:-1;for(u=(c=o.length)<(s=i.length)?c:s,a=0;a<u;a++)if(o[a]!=i[a])return o[a]>i[a]^t?1:-1;return c==s?0:c>s^t?1:-1}function intCheck(e,r,t,n){if(e<r||e>t||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<r||e>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var r=e.c.length-1;return bitFloor(e.e/LOG_BASE)==r&&e.c[r]%2!=0}function toExponential(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function toFixedPoint(e,r,t){var n,o;if(r<0){for(o=t+".";++r;o+=t);e=o+e}else if(++r>(n=e.length)){for(o=t,r-=n;--r;o+=t);e+=o}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}var BigNumber=clone(),BurstValueFormat;function assureValidValue(e){if(!e||!/^-?\d*(\.\d+)?$/.test(e))throw new Error("Invalid value: ".concat(e))}BigNumber.config({EXPONENTIAL_AT:[-9,20]}),BurstValueFormat=exports.BurstValueFormat||(exports.BurstValueFormat={}),BurstValueFormat[BurstValueFormat.PLANCK=0]="PLANCK",BurstValueFormat[BurstValueFormat.BURST=1]="BURST";var BurstValue=function(){function e(r){_classCallCheck(this,e),assureValidValue(r),this._planck=new BigNumber(r)}return _createClass(e,[{key:"getRaw",value:function(){return this._planck}},{key:"getPlanck",value:function(){return this._planck.toString()}},{key:"setPlanck",value:function(e){assureValidValue(e),this._planck=new BigNumber(e)}},{key:"getBurst",value:function(){return this._planck.dividedBy(1e8).toString()}},{key:"setBurst",value:function(e){assureValidValue(e),this._planck=new BigNumber(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]:exports.BurstValueFormat.BURST)===exports.BurstValueFormat.BURST?"".concat(BurstSymbol," ").concat(this.getBurst()):"".concat(BurstPlanckSymbol," ").concat(this._planck)}}],[{key:"fromPlanck",value:function(r){return new e(r)}},{key:"fromBurst",value:function(r){var t=new e("0");return t.setBurst("number"==typeof r?r.toString(10):r),t}}]),e}();return exports.BurstPlanckSymbol=BurstPlanckSymbol,exports.BurstSymbol=BurstSymbol,exports.BurstTime=BurstTime,exports.BurstValue=BurstValue,exports.FeeQuantPlanck=FeeQuantPlanck,exports.OneBurstPlanck=OneBurstPlanck,exports.convertAddressToNumericId=convertAddressToNumericId,exports.convertBurstTimeToDate=convertBurstTimeToDate,exports.convertBurstTimeToEpochTime=convertBurstTimeToEpochTime,exports.convertByteArrayToHexString=convertByteArrayToHexString,exports.convertByteArrayToString=convertByteArrayToString,exports.convertDateToBurstTime=convertDateToBurstTime,exports.convertHexEndianess=convertHexEndianess,exports.convertHexStringToByteArray=convertHexStringToByteArray,exports.convertHexStringToDecString=convertHexStringToDecString,exports.convertHexStringToString=convertHexStringToString,exports.convertNQTStringToNumber=convertNQTStringToNumber,exports.convertNumberToNQTString=convertNumberToNQTString,exports.convertNumericIdToAddress=convertNumericIdToAddress,exports.convertStringToByteArray=convertStringToByteArray,exports.convertStringToHexString=convertStringToHexString,exports.createDeeplink=createDeeplink,exports.isBurstAddress=isBurstAddress,exports.isValid=isValid,exports.parseDeeplink=parseDeeplink,exports.sumNQTStringToNumber=sumNQTStringToNumber,exports}({}); | ||
//# sourceMappingURL=burstjs.util.min.js.map |
@@ -1,2 +0,2 @@ | ||
import Big from 'big.js'; | ||
import BigNumber from 'bignumber.js'; | ||
export declare enum BurstValueFormat { | ||
@@ -11,3 +11,3 @@ PLANCK = 0, | ||
static fromBurst(burst: number | string): BurstValue; | ||
getRaw(): Big; | ||
getRaw(): BigNumber; | ||
getPlanck(): string; | ||
@@ -14,0 +14,0 @@ setPlanck(p: string): void; |
export declare const BurstSymbol = "\u0243"; | ||
export declare const BurstPlanckSymbol = "\u0180"; | ||
export declare const FeeQuantPlanck = 735000; | ||
export declare const OneBurstPlanck = 100000000; |
@@ -1,2 +0,2 @@ | ||
import Big from 'big.js'; | ||
import BigNumber from 'bignumber.js'; | ||
export declare enum BurstValueFormat { | ||
@@ -11,3 +11,3 @@ PLANCK = 0, | ||
static fromBurst(burst: number | string): BurstValue; | ||
getRaw(): Big; | ||
getRaw(): BigNumber; | ||
getPlanck(): string; | ||
@@ -14,0 +14,0 @@ setPlanck(p: string): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const big_js_1 = require("big.js"); | ||
const bignumber_js_1 = require("bignumber.js"); | ||
const constants_1 = require("./constants"); | ||
big_js_1.default.NE = -9; | ||
bignumber_js_1.default.config({ | ||
EXPONENTIAL_AT: [-9, 20] | ||
}); | ||
var BurstValueFormat; | ||
@@ -11,5 +13,11 @@ (function (BurstValueFormat) { | ||
})(BurstValueFormat = exports.BurstValueFormat || (exports.BurstValueFormat = {})); | ||
function assureValidValue(b) { | ||
if (!(b && /^-?\d*(\.\d+)?$/.test(b))) { | ||
throw new Error(`Invalid value: ${b}`); | ||
} | ||
} | ||
class BurstValue { | ||
constructor(planck) { | ||
this._planck = big_js_1.default(planck); | ||
assureValidValue(planck); | ||
this._planck = new bignumber_js_1.default(planck); | ||
} | ||
@@ -25,3 +33,3 @@ static fromPlanck(planck) { | ||
getRaw() { | ||
return big_js_1.default(this._planck); | ||
return this._planck; | ||
} | ||
@@ -32,9 +40,11 @@ getPlanck() { | ||
setPlanck(p) { | ||
this._planck = big_js_1.default(p); | ||
assureValidValue(p); | ||
this._planck = new bignumber_js_1.default(p); | ||
} | ||
getBurst() { | ||
return big_js_1.default(this._planck).div(1E8).toString(); | ||
return this._planck.dividedBy(1E8).toString(); | ||
} | ||
setBurst(b) { | ||
this._planck = big_js_1.default(b).mul(1E8); | ||
assureValidValue(b); | ||
this._planck = new bignumber_js_1.default(b).multipliedBy(1E8); | ||
} | ||
@@ -65,6 +75,9 @@ equals(burstValue) { | ||
multiply(value) { | ||
this._planck = this._planck.mul(value); | ||
this._planck = this._planck.multipliedBy(value); | ||
return this; | ||
} | ||
divide(value) { | ||
if (value === 0) { | ||
throw new Error('Division by zero'); | ||
} | ||
this._planck = this._planck.div(value); | ||
@@ -71,0 +84,0 @@ return this; |
export declare const BurstSymbol = "\u0243"; | ||
export declare const BurstPlanckSymbol = "\u0180"; | ||
export declare const FeeQuantPlanck = 735000; | ||
export declare const OneBurstPlanck = 100000000; |
@@ -5,2 +5,4 @@ "use strict"; | ||
exports.BurstPlanckSymbol = 'ƀ'; | ||
exports.FeeQuantPlanck = 735000; | ||
exports.OneBurstPlanck = 100000000; | ||
//# sourceMappingURL=constants.js.map |
{ | ||
"name": "@burstjs/util", | ||
"version": "0.5.0-beta.5", | ||
"version": "0.5.0-beta.6", | ||
"description": "Useful utilities and tools for building Burstcoin applications", | ||
@@ -40,2 +40,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/bignumber.js": "^5.0.0", | ||
"@types/jest": "^24.0.23", | ||
@@ -59,8 +60,7 @@ "bili": "^4.8.1", | ||
}, | ||
"gitHead": "e3a4b63ad6dd058eead59517c464d60511f02c0a", | ||
"gitHead": "94e3134dab092607729232ca4afeda92c8b22a0e", | ||
"dependencies": { | ||
"@types/big.js": "^4.0.5", | ||
"big.js": "^5.2.2", | ||
"bignumber.js": "^9.0.0", | ||
"js-base64": "^2.5.1" | ||
} | ||
} |
@@ -73,3 +73,3 @@ import {BurstValue, BurstValueFormat} from '../burstValue'; | ||
const raw = burstValue.getRaw(); | ||
raw.add(1); | ||
raw.plus(1); | ||
expect(burstValue.getBurst()).toEqual('1'); | ||
@@ -220,3 +220,3 @@ }); | ||
expect(() => { | ||
burstValue1.divide(0).getBurst() | ||
burstValue1.divide(0).getBurst(); | ||
}).toThrow(); | ||
@@ -223,0 +223,0 @@ }); |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -12,2 +10,4 @@ * Original work Copyright (c) 2020 Burst Apps Team | ||
* A Value Object to facilitate Burst Timestamp conversions. | ||
* | ||
* @module util | ||
*/ | ||
@@ -14,0 +14,0 @@ export class BurstTime { |
@@ -1,11 +0,10 @@ | ||
/** @module util */ | ||
/** | ||
* Original work Copyright (c) 2020 Burst Apps Team | ||
*/ | ||
import Big from 'big.js'; | ||
import BigNumber from 'bignumber.js'; | ||
import {BurstPlanckSymbol, BurstSymbol} from './constants'; | ||
Big.NE = -9; | ||
BigNumber.config({ | ||
EXPONENTIAL_AT: [-9, 20] | ||
}); | ||
@@ -17,2 +16,8 @@ export enum BurstValueFormat { | ||
function assureValidValue(b: string) { | ||
if (!(b && /^-?\d*(\.\d+)?$/.test(b))) { | ||
throw new Error(`Invalid value: ${b}`); | ||
} | ||
} | ||
/** | ||
@@ -23,9 +28,12 @@ * A Value Object to facilitate BURST and Planck conversions/calculations. | ||
* number limits and numeric calculations are much more precise than JS number type | ||
* | ||
* @module util | ||
*/ | ||
export class BurstValue { | ||
private _planck: Big; | ||
private _planck: BigNumber; | ||
private constructor(planck: string) { | ||
this._planck = Big(planck); | ||
assureValidValue(planck); | ||
this._planck = new BigNumber(planck); | ||
} | ||
@@ -55,4 +63,4 @@ | ||
*/ | ||
getRaw(): Big { | ||
return Big(this._planck); | ||
getRaw(): BigNumber { | ||
return this._planck; | ||
} | ||
@@ -72,3 +80,4 @@ | ||
setPlanck(p: string): void { | ||
this._planck = Big(p); | ||
assureValidValue(p); | ||
this._planck = new BigNumber(p); | ||
} | ||
@@ -81,3 +90,3 @@ | ||
getBurst(): string { | ||
return Big(this._planck).div(1E8).toString(); | ||
return this._planck.dividedBy(1E8).toString(); | ||
} | ||
@@ -90,3 +99,4 @@ | ||
setBurst(b: string) { | ||
this._planck = Big(b).mul(1E8); | ||
assureValidValue(b); | ||
this._planck = new BigNumber(b).multipliedBy(1E8); | ||
} | ||
@@ -165,3 +175,3 @@ | ||
public multiply(value: number): BurstValue { | ||
this._planck = this._planck.mul(value); | ||
this._planck = this._planck.multipliedBy(value); | ||
return this; | ||
@@ -176,2 +186,3 @@ } | ||
public divide(value: number): BurstValue { | ||
if (value === 0) { throw new Error('Division by zero'); } | ||
this._planck = this._planck.div(value); | ||
@@ -178,0 +189,0 @@ return this; |
@@ -1,3 +0,23 @@ | ||
/** @module util */ | ||
/** | ||
* Symbol/Character for BURST unit | ||
* @module util | ||
* */ | ||
export const BurstSymbol = 'Ƀ'; | ||
/** | ||
* Symbol/Character for Planck (the smallest possible unit in Burstcoin) | ||
* @module util | ||
* */ | ||
export const BurstPlanckSymbol = 'ƀ'; | ||
/** | ||
* The smallest possible fee | ||
* @module util | ||
*/ | ||
export const FeeQuantPlanck = 735000; | ||
/** | ||
* One Burst expressed in Planck | ||
* @module util | ||
*/ | ||
export const OneBurstPlanck = 100000000; |
@@ -1,4 +0,1 @@ | ||
/** @module util */ | ||
// tslint:disable:no-bitwise | ||
/** | ||
@@ -16,2 +13,3 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
* @return The numeric id, or undefined if address is invalid | ||
* @module util | ||
*/ | ||
@@ -18,0 +16,0 @@ // @todo review, maybe better throwing exception |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -15,2 +13,3 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
* @return {string} The orginal string | ||
* @module util | ||
*/ | ||
@@ -17,0 +16,0 @@ export const convertBase64StringToString = (b64: string): string => { |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -12,2 +10,7 @@ * Original work Copyright (c) 2019 Burst Apps Team | ||
* @return Date | ||
* @deprecated | ||
* <div class="deprecated"> | ||
* Use [[BurstTime.getDate]] instead | ||
* </div> | ||
* @module util | ||
*/ | ||
@@ -14,0 +17,0 @@ export const convertBurstTimeToDate = (burstTimestamp: number): Date => { |
// tslint:disable:no-bitwise | ||
/** @module util */ | ||
@@ -11,6 +10,10 @@ import {GenesisBlockTime} from './internal'; | ||
/** | ||
* @deprecated use [[BurstTime.getEpoch()]] | ||
* Converts a Burst/Block Time (seconds since genesis block) into Unix Epoch Time (milliseconds since 01.01.1970) | ||
* @param burstTimestamp The numeric Id | ||
* @return Unix Epoch Time (milliseconds since 01.01.1970) | ||
* @deprecated | ||
* <div class="deprecated"> | ||
* Use [[BurstTime.getEpoch]] instead | ||
* </div> | ||
* @module util | ||
*/ | ||
@@ -17,0 +20,0 @@ export const convertBurstTimeToEpochTime = (burstTimestamp: number): number => { |
@@ -1,2 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -13,2 +12,3 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
* @return {string} A hex string representing the byte array input | ||
* @module util | ||
*/ | ||
@@ -15,0 +15,0 @@ export const convertByteArrayToHexString = (bytes: Uint8Array, uppercase = false): string => { |
@@ -1,2 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -14,2 +13,3 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
* @return {string} The converted string | ||
* @module util | ||
*/ | ||
@@ -16,0 +16,0 @@ export const convertByteArrayToString = (byteArray: Uint8Array, startIndex: number = 0, length: number = null): string => { |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -12,2 +10,7 @@ * Original work Copyright (c) 2019 Burst Apps Team | ||
* @return The Burst Timestamp | ||
* @deprecated | ||
* <div class="deprecated"> | ||
* Use [[BurstTime.fromDate]] instead | ||
* </div> | ||
* @module util | ||
*/ | ||
@@ -14,0 +17,0 @@ export const convertDateToBurstTime = (date: Date): number => { |
@@ -1,2 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -8,8 +7,13 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
/** | ||
* Converts the endianess of a hex string. | ||
* Toggles the endianess of a hex string. | ||
* `0xBEEF` > `0xEFBE` | ||
* If string is little Endianess it turns into Big Endianess, and vice versa | ||
* | ||
* > This method is mainly used for Smart Contract messaging and data inspection | ||
* | ||
* @param hexString The hex string to be converted | ||
* @return The converted string as hex string | ||
* @module util | ||
*/ | ||
export const convertHexEndianess = (hexString) : string => { | ||
export const convertHexEndianess = (hexString): string => { | ||
let result = ''; | ||
@@ -16,0 +20,0 @@ const rawData = hexString; |
@@ -1,2 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -11,2 +10,3 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
* @return {number[]} An byte array representing the hexadecimal input | ||
* @module util | ||
*/ | ||
@@ -13,0 +13,0 @@ export const convertHexStringToByteArray = (hex: string): Uint8Array => { |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -12,2 +10,3 @@ Original work Copyright (c) 2019 Burst Apps Team | ||
* @return A decimal string | ||
* @module util | ||
*/ | ||
@@ -14,0 +13,0 @@ export const convertHexStringToDecString = (hexStr: string): string => { |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -16,2 +14,3 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
* @return {string} The string represented by the Hex String | ||
* @module util | ||
*/ | ||
@@ -18,0 +17,0 @@ export const convertHexStringToString = (hex: string): string => { |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -9,7 +7,11 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
/** | ||
* @deprecated This method will be substituted in favor of [[BurstValue]] | ||
* Helper method to convert a Planck Value (BURST * 1E8) String to BURST number | ||
* Helper method to convert a Planck Value (BURST * 1E-8) String to BURST number | ||
* @param amount The amount in Planck (aka NQT) | ||
* @return A number expressed in Burst (not NQT) | ||
* @throws exception if argument is invalid | ||
* @deprecated | ||
* <div class="deprecated"> | ||
* Use [[BurstValue]] instead | ||
* </div> | ||
* @module util | ||
*/ | ||
@@ -16,0 +18,0 @@ export const convertNQTStringToNumber = (amount: string): number => { |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -9,6 +7,10 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
/** | ||
* @deprecated This method will be substituted in favor of [[BurstValue]] | ||
* Helper method to Number to String(8 decimals) representation | ||
* @param n the number | ||
* @return a NQT number string | ||
* @deprecated | ||
* <div class="deprecated"> | ||
* Use [[BurstValue]] instead | ||
* </div> | ||
* Helper method to Number to String(8 decimals) representation | ||
* @module util | ||
*/ | ||
@@ -15,0 +17,0 @@ export const convertNumberToNQTString = (n: number): string => { |
// tslint:disable:no-bitwise | ||
/** @module util */ | ||
@@ -11,3 +10,2 @@ /** | ||
/** | ||
@@ -17,2 +15,3 @@ * Encode a numeric id into BURST-XXXX-XXXX-XXXX-XXXXX | ||
* @return the BURST address in Reed-Solomon encoding, or undefined if passed null, undefined | ||
* @module util | ||
*/ | ||
@@ -19,0 +18,0 @@ export const convertNumericIdToAddress = (numericId: string): string => { |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -8,2 +6,3 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
// FIXME: This implementation has security warnings! | ||
import {Base64} from 'js-base64'; | ||
@@ -17,2 +16,3 @@ | ||
* @return {string} The Base64 String representing the input string. The string is already URI encoded, i.e. can be used directly in browsers | ||
* @module util | ||
*/ | ||
@@ -19,0 +19,0 @@ export const convertStringToBase64String = (str: string, isURICompatible = true): string => { |
@@ -1,2 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -12,2 +11,3 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
* @return {number[]} A byte array representing the string input | ||
* @module util | ||
*/ | ||
@@ -14,0 +14,0 @@ export const convertStringToByteArray = (str: string): Uint8Array => { |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -16,2 +14,3 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
* @return {string} The Hex String representing the input string | ||
* @module util | ||
*/ | ||
@@ -18,0 +17,0 @@ export const convertStringToHexString = (str: string): string => { |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -11,2 +9,5 @@ * Original work Copyright (c) 2019 Burst Apps Team | ||
/** | ||
* @internal | ||
*/ | ||
function encodePayload(payload: any, encoderFormat: EncoderFormat): string { | ||
@@ -34,3 +35,3 @@ | ||
* | ||
* burst.[domain]://v1?action=[action]&payload=[encodedData] | ||
* `burst.[domain]://v1?action=[action]&payload=[encodedData]` | ||
* | ||
@@ -40,4 +41,6 @@ * Deeplinks are a way to call/open applications and do certain actions within it, e.g. Phoenix wallet | ||
* | ||
* @see [[parseDeeplink]] as inverse function | ||
* @param {CreateDeeplinkArgs} args The arguments for the deeplink | ||
* @return The Deeplink | ||
* @module util | ||
*/ | ||
@@ -44,0 +47,0 @@ export const createDeeplink = (args: CreateDeeplinkArgs): string => { |
@@ -1,2 +0,6 @@ | ||
/** @module util */ | ||
/** | ||
* The utility package for BurstJS, with loads of convenience methods | ||
* | ||
* @moduledefinition util | ||
* */ | ||
export * from './convertAddressToNumericId'; | ||
@@ -3,0 +7,0 @@ export * from './convertBurstTimeToDate'; |
/** @ignore */ | ||
/** @internal */ | ||
/** @module util */ | ||
@@ -3,0 +4,0 @@ |
// tslint:disable:no-bitwise | ||
/** @module util */ | ||
/** | ||
@@ -11,6 +10,9 @@ * Original work Copyright (c) 2018 PoC-Consortium | ||
// TODO: should be split into separate file and get better naming | ||
/** | ||
* @internal | ||
* Check for valid Burst address (format: BURST-XXXX-XXXX-XXXX-XXXXX, XXXX-XXXX-XXXX-XXXXX) | ||
* @param {string} address The address | ||
* @return {boolean} true, if is a valid address, else false | ||
* @module util | ||
*/ | ||
@@ -72,5 +74,5 @@ export const isValid = (address: string): boolean => { | ||
* Check for valid Burst address (format: BURST-XXXX-XXXX-XXXX-XXXXX, XXXX-XXXX-XXXX-XXXXX) | ||
* @note This is with prior quick check | ||
* @param {string} address The address | ||
* @return {boolean} true, if is a valid address, else false | ||
* @module util | ||
*/ | ||
@@ -77,0 +79,0 @@ export const isBurstAddress = (address: string): boolean => { |
@@ -1,3 +0,1 @@ | ||
/** @module util */ | ||
/** | ||
@@ -13,6 +11,9 @@ * Original work Copyright (c) 2019 Burst Apps Team | ||
* | ||
* burst.[domain]://v1?action=[action]&payload=[encodedData] | ||
* `burst.[domain]://v1?action=[action]&payload=[encodedData]` | ||
* | ||
* @see [[createDeeplink]] as inverse function | ||
* @param {string} deeplink The deeplink to be parsed | ||
* @return The parsed deeplink parts. | ||
* @throws Error if parsing fails | ||
* @module util | ||
*/ | ||
@@ -19,0 +20,0 @@ export const parseDeeplink = (deeplink: string): DeeplinkParts => { |
@@ -9,6 +9,10 @@ /** @module util */ | ||
/** | ||
* @deprecated Use [[BurstValue.sum()]] instead | ||
* Sums various NQT values and returns in Burst | ||
* @param nqts Variable amount list with NQT string | ||
* @return The sum of all amounts in BURST | ||
* @deprecated | ||
* <div class='deprecated'> | ||
* Use [[BurstValue.add]] instead | ||
* </div> | ||
* @module util | ||
*/ | ||
@@ -15,0 +19,0 @@ export function sumNQTStringToNumber(...nqts: string[]): number { |
@@ -1,3 +0,6 @@ | ||
/** @module util */ | ||
/** | ||
* Encoder format constants | ||
* @see [[createDeeplink]] and [[CreateDeeplinkArgs]] | ||
* @module util | ||
*/ | ||
export enum EncoderFormat { | ||
@@ -16,2 +19,3 @@ Text, | ||
* @param {EncoderFormat?} encoderFormat The selected format for the payload encoding | ||
* @module util | ||
*/ | ||
@@ -18,0 +22,0 @@ export interface CreateDeeplinkArgs { |
@@ -1,3 +0,7 @@ | ||
/** @module util */ | ||
/** | ||
* | ||
* The resulting structure of [[parseDeeplink]] | ||
* | ||
* @module util | ||
*/ | ||
export interface DeeplinkParts { | ||
@@ -4,0 +8,0 @@ domain: string; |
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
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
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
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
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
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
656980
2
5839
4
+ Addedbignumber.js@^9.0.0
+ Addedbignumber.js@9.1.2(transitive)
- Removed@types/big.js@^4.0.5
- Removedbig.js@^5.2.2
- Removed@types/big.js@4.0.5(transitive)
- Removedbig.js@5.2.2(transitive)