numbro
Version:
Format and manipulate numbers.
195 lines (194 loc) • 49.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).numbro=t()}(this,(function(){"use strict";var e,t,r,n,i,a,o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}
/*!
* Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/function s(){return t?e:(t=1,e={languageTag:"en-US",delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},spaceSeparated:!1,ordinal:function(e){let t=e%10;return 1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"},bytes:{binarySuffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],decimalSuffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},currency:{symbol:"$",position:"prefix",code:"USD"},currencyFormat:{thousandSeparated:!0,totalLength:4,spaceSeparated:!0,spaceSeparatedCurrency:!0},formats:{fourDigits:{totalLength:4,spaceSeparated:!0},fullWithTwoDecimals:{output:"currency",thousandSeparated:!0,mantissa:2},fullWithTwoDecimalsNoCurrency:{thousandSeparated:!0,mantissa:2},fullWithNoDecimals:{output:"currency",thousandSeparated:!0,mantissa:0}}})}
/*!
* Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/function l(){if(n)return r;n=1;const e=[{key:"ZiB",factor:Math.pow(1024,7)},{key:"ZB",factor:Math.pow(1e3,7)},{key:"YiB",factor:Math.pow(1024,8)},{key:"YB",factor:Math.pow(1e3,8)},{key:"TiB",factor:Math.pow(1024,4)},{key:"TB",factor:Math.pow(1e3,4)},{key:"PiB",factor:Math.pow(1024,5)},{key:"PB",factor:Math.pow(1e3,5)},{key:"MiB",factor:Math.pow(1024,2)},{key:"MB",factor:Math.pow(1e3,2)},{key:"KiB",factor:Math.pow(1024,1)},{key:"KB",factor:Math.pow(1e3,1)},{key:"GiB",factor:Math.pow(1024,3)},{key:"GB",factor:Math.pow(1e3,3)},{key:"EiB",factor:Math.pow(1024,6)},{key:"EB",factor:Math.pow(1e3,6)},{key:"B",factor:1}];function t(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function i(r,n,a,o,u,s,l){if(!isNaN(+r))return+r;let c="",f=r.replace(/(^[^(]*)\((.*)\)([^)]*$)/,"$1$2$3");if(f!==r)return-1*i(f,n,a,o,u,s);for(let t=0;t<e.length;t++){let l=e[t];if(c=r.replace(RegExp(`([0-9 ])(${l.key})$`),"$1"),c!==r)return i(c,n,a,o,u,s)*l.factor}if(c=r.replace("%",""),c!==r)return i(c,n,a,o,u,s)/100;let p=parseFloat(r);if(isNaN(p))return;let g=o(p);if(g&&"."!==g&&(c=r.replace(new RegExp(`${t(g)}$`),""),c!==r))return i(c,n,a,o,u,s);let h={};Object.keys(s).forEach((e=>{h[s[e]]=e}));let d=Object.keys(h).sort().reverse(),m=d.length;for(let e=0;e<m;e++){let t=d[e],l=h[t];if(c=r.replace(t,""),c!==r){let e;switch(l){case"thousand":e=Math.pow(10,3);break;case"million":e=Math.pow(10,6);break;case"billion":e=Math.pow(10,9);break;case"trillion":e=Math.pow(10,12)}return i(c,n,a,o,u,s)*e}}}function a(e,r,n="",a,o,u,s){if(""===e)return;if(e===o)return 0;let l=function(e,r,n){let i=e.replace(n,"");return i=i.replace(new RegExp(`([0-9])${t(r.thousands)}([0-9])`,"g"),"$1$2"),i=i.replace(r.decimal,"."),i}(e,r,n);return i(l,r,n,a,o,u)}return r={unformat:function(e,t){const r=h();let n,i=r.currentDelimiters(),o=r.currentCurrency().symbol,u=r.currentOrdinal(),s=r.getZeroFormat(),l=r.currentAbbreviations();if("string"==typeof e)n=function(e,t){if(!e.indexOf(":")||":"===t.thousands)return!1;let r=e.split(":");if(3!==r.length)return!1;let n=+r[0],i=+r[1],a=+r[2];return!isNaN(n)&&!isNaN(i)&&!isNaN(a)}(e,i)?function(e){let t=e.split(":"),r=+t[0],n=+t[1];return+t[2]+60*n+3600*r}(e):a(e,i,o,u,s,l);else{if("number"!=typeof e)return;n=e}if(void 0!==n)return n}},r}
/*!
* Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/function c(){if(a)return i;a=1;let e=l();const t=/^[a-z]{2,3}(-[a-zA-Z]{4})?(-([A-Z]{2}|[0-9]{3}))?$/,r={output:{type:"string",validValues:["currency","percent","byte","time","ordinal","number"]},base:{type:"string",validValues:["decimal","binary","general"],restriction:(e,t)=>"byte"===t.output,message:"`base` must be provided only when the output is `byte`",mandatory:e=>"byte"===e.output},characteristic:{type:"number",restriction:e=>e>=0,message:"value must be positive"},prefix:"string",postfix:"string",forceAverage:{type:"string",validValues:["trillion","billion","million","thousand"]},average:"boolean",lowPrecision:{type:"boolean",restriction:(e,t)=>!0===t.average,message:"`lowPrecision` must be provided only when the option `average` is set"},currencyPosition:{type:"string",validValues:["prefix","infix","postfix"]},currencySymbol:"string",totalLength:{type:"number",restrictions:[{restriction:e=>e>=0,message:"value must be positive"},{restriction:(e,t)=>!t.exponential,message:"`totalLength` is incompatible with `exponential`"}]},mantissa:{type:"number",restriction:e=>e>=0,message:"value must be positive"},optionalMantissa:"boolean",trimMantissa:"boolean",roundingFunction:"function",optionalCharacteristic:"boolean",thousandSeparated:"boolean",spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",spaceSeparatedAbbreviation:"boolean",abbreviations:{type:"object",children:{thousand:"string",million:"string",billion:"string",trillion:"string"}},negative:{type:"string",validValues:["sign","parenthesis"]},forceSign:"boolean",exponential:{type:"boolean"},prefixSymbol:{type:"boolean",restriction:(e,t)=>"percent"===t.output,message:"`prefixSymbol` can be provided only when the output is `percent`"}},n={languageTag:{type:"string",mandatory:!0,restriction:e=>e.match(t),message:"the language tag must follow the BCP 47 specification (see https://tools.ieft.org/html/bcp47)"},delimiters:{type:"object",children:{thousands:"string",decimal:"string",thousandsSize:"number"},mandatory:!0},abbreviations:{type:"object",children:{thousand:{type:"string",mandatory:!0},million:{type:"string",mandatory:!0},billion:{type:"string",mandatory:!0},trillion:{type:"string",mandatory:!0}},mandatory:!0},spaceSeparated:"boolean",spaceSeparatedCurrency:"boolean",ordinal:{type:"function",mandatory:!0},bytes:{type:"object",children:{binarySuffixes:"object",decimalSuffixes:"object"}},currency:{type:"object",children:{symbol:"string",position:"string",code:"string"},mandatory:!0},defaults:"format",ordinalFormat:"format",byteFormat:"format",percentageFormat:"format",currencyFormat:"format",timeDefaults:"format",formats:{type:"object",children:{fourDigits:{type:"format",mandatory:!0},fullWithTwoDecimals:{type:"format",mandatory:!0},fullWithTwoDecimalsNoCurrency:{type:"format",mandatory:!0},fullWithNoDecimals:{type:"format",mandatory:!0}}}};function o(t){return void 0!==e.unformat(t)}function u(e,t,n,i=!1){let a=Object.keys(e).map((i=>{if(!t[i])return console.error(`${n} Invalid key: ${i}`),!1;let a=e[i],o=t[i];if("string"==typeof o&&(o={type:o}),"format"===o.type){if(!u(a,r,`[Validate ${i}]`,!0))return!1}else if(typeof a!==o.type)return console.error(`${n} ${i} type mismatched: "${o.type}" expected, "${typeof a}" provided`),!1;if(o.restrictions&&o.restrictions.length){let t=o.restrictions.length;for(let r=0;r<t;r++){let{restriction:t,message:u}=o.restrictions[r];if(!t(a,e))return console.error(`${n} ${i} invalid value: ${u}`),!1}}if(o.restriction&&!o.restriction(a,e))return console.error(`${n} ${i} invalid value: ${o.message}`),!1;if(o.validValues&&-1===o.validValues.indexOf(a))return console.error(`${n} ${i} invalid value: must be among ${JSON.stringify(o.validValues)}, "${a}" provided`),!1;if(o.children){if(!u(a,o.children,`[Validate ${i}]`))return!1}return!0}));return i||a.push(...Object.keys(t).map((r=>{let i=t[r];if("string"==typeof i&&(i={type:i}),i.mandatory){let t=i.mandatory;if("function"==typeof t&&(t=t(e)),t&&void 0===e[r])return console.error(`${n} Missing mandatory key "${r}"`),!1}return!0}))),a.reduce(((e,t)=>e&&t),!0)}function s(e){return u(e,r,"[Validate format]")}return i={validate:function(e,t){let r=o(e),n=s(t);return r&&n},validateFormat:s,validateInput:o,validateLanguage:function(e){return u(e,n,"[Validate language]")}},i}
/*!
* Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/var f,p,g={parseFormat:function(e,t={}){return"string"!=typeof e?e:(function(e,t){if(-1===e.indexOf("$")){if(-1===e.indexOf("%"))return-1!==e.indexOf("bd")?(t.output="byte",void(t.base="general")):-1!==e.indexOf("b")?(t.output="byte",void(t.base="binary")):-1!==e.indexOf("d")?(t.output="byte",void(t.base="decimal")):void(-1===e.indexOf(":")?-1!==e.indexOf("o")&&(t.output="ordinal"):t.output="time");t.output="percent"}else t.output="currency"}(e=function(e,t){let r=e.match(/{([^}]*)}$/);return r?(t.postfix=r[1],e.slice(0,-r[0].length)):e}(e=function(e,t){let r=e.match(/^{([^}]*)}/);return r?(t.prefix=r[1],e.slice(r[0].length)):e}(e,t),t),t),function(e,t){let r=e.match(/[1-9]+[0-9]*/);r&&(t.totalLength=+r[0])}(e,t),function(e,t){let r=e.split(".")[0].match(/0+/);r&&(t.characteristic=r[0].length)}(e,t),function(e,t){if(-1!==e.indexOf(".")){let r=e.split(".")[0];t.optionalCharacteristic=-1===r.indexOf("0")}}(e,t),function(e,t){-1!==e.indexOf("a")&&(t.average=!0)}(e,t),function(e,t){-1!==e.indexOf("K")?t.forceAverage="thousand":-1!==e.indexOf("M")?t.forceAverage="million":-1!==e.indexOf("B")?t.forceAverage="billion":-1!==e.indexOf("T")&&(t.forceAverage="trillion")}(e,t),function(e,t){let r=e.split(".")[1];if(r){let e=r.match(/0+/);e&&(t.mantissa=e[0].length)}}(e,t),function(e,t){e.match(/\[\.]/)?t.optionalMantissa=!0:e.match(/\./)&&(t.optionalMantissa=!1)}(e,t),function(e,t){const r=e.split(".")[1];r&&(t.trimMantissa=-1!==r.indexOf("["))}(e,t),function(e,t){-1!==e.indexOf(",")&&(t.thousandSeparated=!0)}(e,t),function(e,t){-1!==e.indexOf(" ")&&(t.spaceSeparated=!0,t.spaceSeparatedCurrency=!0,(t.average||t.forceAverage)&&(t.spaceSeparatedAbbreviation=!0))}(e,t),function(e,t){e.match(/^\+?\([^)]*\)$/)&&(t.negative="parenthesis"),e.match(/^\+?-/)&&(t.negative="sign")}(e,t),function(e,t){e.match(/^\+/)&&(t.forceSign=!0)}(e,t),t)}};
/*!
* Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/function h(){if(p)return f;p=1;const e=s(),t=c(),r=g;let n,i={},a={},o=null,u={};function l(e){n=e}function h(){return a[n]}return i.languages=()=>Object.assign({},a),i.currentLanguage=()=>n,i.currentBytes=()=>h().bytes||{},i.currentCurrency=()=>h().currency,i.currentAbbreviations=()=>h().abbreviations,i.currentDelimiters=()=>h().delimiters,i.currentOrdinal=()=>h().ordinal,i.currentDefaults=()=>Object.assign({},h().defaults,u),i.currentOrdinalDefaultFormat=()=>Object.assign({},i.currentDefaults(),h().ordinalFormat),i.currentByteDefaultFormat=()=>Object.assign({},i.currentDefaults(),h().byteFormat),i.currentPercentageDefaultFormat=()=>Object.assign({},i.currentDefaults(),h().percentageFormat),i.currentCurrencyDefaultFormat=()=>Object.assign({},i.currentDefaults(),h().currencyFormat),i.currentTimeDefaultFormat=()=>Object.assign({},i.currentDefaults(),h().timeFormat),i.setDefaults=e=>{e=r.parseFormat(e),t.validateFormat(e)&&(u=e)},i.getZeroFormat=()=>o,i.setZeroFormat=e=>o="string"==typeof e?e:null,i.hasZeroFormat=()=>null!==o,i.languageData=e=>{if(e){if(a[e])return a[e];throw new Error(`Unknown tag "${e}"`)}return h()},i.registerLanguage=(e,r=!1)=>{if(!t.validateLanguage(e))throw new Error("Invalid language data");a[e.languageTag]=e,r&&l(e.languageTag)},i.setLanguage=(t,r=e.languageTag)=>{if(!a[t]){let e=t.split("-")[0],n=Object.keys(a).find((t=>t.split("-")[0]===e));return a[n]?void l(n):void l(r)}l(t)},i.registerLanguage(e),n=e.languageTag,f=i}
/*!
* Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
function d(e,t){e.forEach((e=>{let r;try{r=function(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(`../languages/${e}`)}catch(t){console.error(`Unable to load "${e}". No matching language file found.`)}r&&t.registerLanguage(r)}))}var m={exports:{}};!function(e){!function(t){var r,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,a=Math.floor,o="[BigNumber Error] ",u=o+"Number primitive has more than 15 significant digits: ",s=1e14,l=14,c=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e7,g=1e9;function h(e){var t=0|e;return e>0||e===t?t:t-1}function d(e){for(var t,r,n=1,i=e.length,a=e[0]+"";n<i;){for(t=e[n++]+"",r=l-t.length;r--;t="0"+t);a+=t}for(i=a.length;48===a.charCodeAt(--i););return a.slice(0,i+1||1)}function m(e,t){var r,n,i=e.c,a=t.c,o=e.s,u=t.s,s=e.e,l=t.e;if(!o||!u)return null;if(r=i&&!i[0],n=a&&!a[0],r||n)return r?n?0:-u:o;if(o!=u)return o;if(r=o<0,n=s==l,!i||!a)return n?0:!i^r?1:-1;if(!n)return s>l^r?1:-1;for(u=(s=i.length)<(l=a.length)?s:l,o=0;o<u;o++)if(i[o]!=a[o])return i[o]>a[o]^r?1:-1;return s==l?0:s>l^r?1:-1}function y(e,t,r,n){if(e<t||e>r||e!==a(e))throw Error(o+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function b(e){var t=e.c.length-1;return h(e.e/l)==t&&e.c[t]%2!=0}function v(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function w(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}r=function e(t){var r,O,x,S,N,$,B,M,D,F,E=q.prototype={constructor:q,toString:null,valueOf:null},A=new q(1),_=20,k=4,L=-7,P=21,T=-1e7,C=1e7,j=!1,U=1,R=0,I={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},G="0123456789abcdefghijklmnopqrstuvwxyz",V=!0;function q(e,t){var r,i,o,s,f,p,g,h,d=this;if(!(d instanceof q))return new q(e,t);if(null==t){if(e&&!0===e._isBigNumber)return d.s=e.s,void(!e.c||e.e>C?d.c=d.e=null:e.e<T?d.c=[d.e=0]:(d.e=e.e,d.c=e.c.slice()));if((p="number"==typeof e)&&0*e==0){if(d.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,f=e;f>=10;f/=10,s++);return void(s>C?d.c=d.e=null:(d.e=s,d.c=[e]))}h=String(e)}else{if(!n.test(h=String(e)))return x(d,h,p);d.s=45==h.charCodeAt(0)?(h=h.slice(1),-1):1}(s=h.indexOf("."))>-1&&(h=h.replace(".","")),(f=h.search(/e/i))>0?(s<0&&(s=f),s+=+h.slice(f+1),h=h.substring(0,f)):s<0&&(s=h.length)}else{if(y(t,2,G.length,"Base"),10==t&&V)return H(d=new q(e),_+d.e+1,k);if(h=String(e),p="number"==typeof e){if(0*e!=0)return x(d,h,p,t);if(d.s=1/e<0?(h=h.slice(1),-1):1,q.DEBUG&&h.replace(/^0\.0*|\./,"").length>15)throw Error(u+e)}else d.s=45===h.charCodeAt(0)?(h=h.slice(1),-1):1;for(r=G.slice(0,t),s=f=0,g=h.length;f<g;f++)if(r.indexOf(i=h.charAt(f))<0){if("."==i){if(f>s){s=g;continue}}else if(!o&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){o=!0,f=-1,s=0;continue}return x(d,String(e),p,t)}p=!1,(s=(h=O(h,t,10,d.s)).indexOf("."))>-1?h=h.replace(".",""):s=h.length}for(f=0;48===h.charCodeAt(f);f++);for(g=h.length;48===h.charCodeAt(--g););if(h=h.slice(f,++g)){if(g-=f,p&&q.DEBUG&&g>15&&(e>c||e!==a(e)))throw Error(u+d.s*e);if((s=s-f-1)>C)d.c=d.e=null;else if(s<T)d.c=[d.e=0];else{if(d.e=s,d.c=[],f=(s+1)%l,s<0&&(f+=l),f<g){for(f&&d.c.push(+h.slice(0,f)),g-=l;f<g;)d.c.push(+h.slice(f,f+=l));f=l-(h=h.slice(f)).length}else f-=g;for(;f--;h+="0");d.c.push(+h)}}else d.c=[d.e=0]}function Z(e,t,r,n){var i,a,o,u,s;if(null==r?r=k:y(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)s=d(e.c),s=1==n||2==n&&(o<=L||o>=P)?v(s,o):w(s,o,"0");else if(a=(e=H(new q(e),t,r)).e,u=(s=d(e.c)).length,1==n||2==n&&(t<=a||a<=L)){for(;u<t;s+="0",u++);s=v(s,a)}else if(t-=o,s=w(s,a,"0"),a+1>u){if(--t>0)for(s+=".";t--;s+="0");}else if((t+=a-u)>0)for(a+1==u&&(s+=".");t--;s+="0");return e.s<0&&i?"-"+s:s}function z(e,t){for(var r,n,i=1,a=new q(e[0]);i<e.length;i++)(!(n=new q(e[i])).s||(r=m(a,n))===t||0===r&&a.s===t)&&(a=n);return a}function W(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*l-1)>C?e.c=e.e=null:r<T?e.c=[e.e=0]:(e.e=r,e.c=t),e}function H(e,t,r,n){var o,u,c,p,g,h,d,m=e.c,y=f;if(m){e:{for(o=1,p=m[0];p>=10;p/=10,o++);if((u=t-o)<0)u+=l,c=t,g=m[h=0],d=a(g/y[o-c-1]%10);else if((h=i((u+1)/l))>=m.length){if(!n)break e;for(;m.length<=h;m.push(0));g=d=0,o=1,c=(u%=l)-l+1}else{for(g=p=m[h],o=1;p>=10;p/=10,o++);d=(c=(u%=l)-l+o)<0?0:a(g/y[o-c-1]%10)}if(n=n||t<0||null!=m[h+1]||(c<0?g:g%y[o-c-1]),n=r<4?(d||n)&&(0==r||r==(e.s<0?3:2)):d>5||5==d&&(4==r||n||6==r&&(u>0?c>0?g/y[o-c]:0:m[h-1])%10&1||r==(e.s<0?8:7)),t<1||!m[0])return m.length=0,n?(t-=e.e+1,m[0]=y[(l-t%l)%l],e.e=-t||0):m[0]=e.e=0,e;if(0==u?(m.length=h,p=1,h--):(m.length=h+1,p=y[l-u],m[h]=c>0?a(g/y[o-c]%y[c])*p:0),n)for(;;){if(0==h){for(u=1,c=m[0];c>=10;c/=10,u++);for(c=m[0]+=p,p=1;c>=10;c/=10,p++);u!=p&&(e.e++,m[0]==s&&(m[0]=1));break}if(m[h]+=p,m[h]!=s)break;m[h--]=0,p=1}for(u=m.length;0===m[--u];m.pop());}e.e>C?e.c=e.e=null:e.e<T&&(e.c=[e.e=0])}return e}function Y(e){var t,r=e.e;return null===r?e.toString():(t=d(e.c),t=r<=L||r>=P?v(t,r):w(t,r,"0"),e.s<0?"-"+t:t)}return q.clone=e,q.ROUND_UP=0,q.ROUND_DOWN=1,q.ROUND_CEIL=2,q.ROUND_FLOOR=3,q.ROUND_HALF_UP=4,q.ROUND_HALF_DOWN=5,q.ROUND_HALF_EVEN=6,q.ROUND_HALF_CEIL=7,q.ROUND_HALF_FLOOR=8,q.EUCLID=9,q.config=q.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(o+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(r=e[t],0,g,t),_=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(r=e[t],0,8,t),k=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(y(r[0],-g,0,t),y(r[1],0,g,t),L=r[0],P=r[1]):(y(r,-g,g,t),L=-(P=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)y(r[0],-g,-1,t),y(r[1],1,g,t),T=r[0],C=r[1];else{if(y(r,-g,g,t),!r)throw Error(o+t+" cannot be zero: "+r);T=-(C=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(o+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw j=!r,Error(o+"crypto unavailable");j=r}else j=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(r=e[t],0,9,t),U=r),e.hasOwnProperty(t="POW_PRECISION")&&(y(r=e[t],0,g,t),R=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(o+t+" not an object: "+r);I=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(o+t+" invalid: "+r);V="0123456789"==r.slice(0,10),G=r}}return{DECIMAL_PLACES:_,ROUNDING_MODE:k,EXPONENTIAL_AT:[L,P],RANGE:[T,C],CRYPTO:j,MODULO_MODE:U,POW_PRECISION:R,FORMAT:I,ALPHABET:G}},q.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!q.DEBUG)return!0;var t,r,n=e.c,i=e.e,u=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===u||-1===u)&&i>=-g&&i<=g&&i===a(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%l)<1&&(t+=l),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=s||r!==a(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===u||1===u||-1===u))return!0;throw Error(o+"Invalid BigNumber: "+e)},q.maximum=q.max=function(){return z(arguments,-1)},q.minimum=q.min=function(){return z(arguments,1)},q.random=(S=9007199254740992,N=Math.random()*S&2097151?function(){return a(Math.random()*S)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,u,s,c=0,p=[],h=new q(A);if(null==e?e=_:y(e,0,g),u=i(e/l),j)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(u*=2));c<u;)(s=131072*t[c]+(t[c+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[c]=r[0],t[c+1]=r[1]):(p.push(s%1e14),c+=2);c=u/2}else{if(!crypto.randomBytes)throw j=!1,Error(o+"crypto unavailable");for(t=crypto.randomBytes(u*=7);c<u;)(s=281474976710656*(31&t[c])+1099511627776*t[c+1]+4294967296*t[c+2]+16777216*t[c+3]+(t[c+4]<<16)+(t[c+5]<<8)+t[c+6])>=9e15?crypto.randomBytes(7).copy(t,c):(p.push(s%1e14),c+=7);c=u/7}if(!j)for(;c<u;)(s=N())<9e15&&(p[c++]=s%1e14);for(u=p[--c],e%=l,u&&e&&(s=f[l-e],p[c]=a(u/s)*s);0===p[c];p.pop(),c--);if(c<0)p=[n=0];else{for(n=-1;0===p[0];p.splice(0,1),n-=l);for(c=1,s=p[0];s>=10;s/=10,c++);c<l&&(n-=l-c)}return h.e=n,h.c=p,h}),q.sum=function(){for(var e=1,t=arguments,r=new q(t[0]);e<t.length;)r=r.plus(t[e++]);return r},O=function(){var e="0123456789";function t(e,t,r,n){for(var i,a,o=[0],u=0,s=e.length;u<s;){for(a=o.length;a--;o[a]*=t);for(o[0]+=n.indexOf(e.charAt(u++)),i=0;i<o.length;i++)o[i]>r-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(n,i,a,o,u){var s,l,c,f,p,g,h,m,y=n.indexOf("."),b=_,v=k;for(y>=0&&(f=R,R=0,n=n.replace(".",""),g=(m=new q(i)).pow(n.length-y),R=f,m.c=t(w(d(g.c),g.e,"0"),10,a,e),m.e=m.c.length),c=f=(h=t(n,i,a,u?(s=G,e):(s=e,G))).length;0==h[--f];h.pop());if(!h[0])return s.charAt(0);if(y<0?--c:(g.c=h,g.e=c,g.s=o,h=(g=r(g,m,b,v,a)).c,p=g.r,c=g.e),y=h[l=c+b+1],f=a/2,p=p||l<0||null!=h[l+1],p=v<4?(null!=y||p)&&(0==v||v==(g.s<0?3:2)):y>f||y==f&&(4==v||p||6==v&&1&h[l-1]||v==(g.s<0?8:7)),l<1||!h[0])n=p?w(s.charAt(1),-b,s.charAt(0)):s.charAt(0);else{if(h.length=l,p)for(--a;++h[--l]>a;)h[l]=0,l||(++c,h=[1].concat(h));for(f=h.length;!h[--f];);for(y=0,n="";y<=f;n+=s.charAt(h[y++]));n=w(n,c,s.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,a,o,u=0,s=e.length,l=t%p,c=t/p|0;for(e=e.slice();s--;)u=((i=l*(a=e[s]%p)+(n=c*a+(o=e[s]/p|0)*l)%p*p+u)/r|0)+(n/p|0)+c*o,e[s]=i%r;return u&&(e=[u].concat(e)),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,u,c){var f,p,g,d,m,y,b,v,w,O,x,S,N,$,B,M,D,F=n.s==i.s?1:-1,E=n.c,A=i.c;if(!(E&&E[0]&&A&&A[0]))return new q(n.s&&i.s&&(E?!A||E[0]!=A[0]:A)?E&&0==E[0]||!A?0*F:F/0:NaN);for(w=(v=new q(F)).c=[],F=o+(p=n.e-i.e)+1,c||(c=s,p=h(n.e/l)-h(i.e/l),F=F/l|0),g=0;A[g]==(E[g]||0);g++);if(A[g]>(E[g]||0)&&p--,F<0)w.push(1),d=!0;else{for($=E.length,M=A.length,g=0,F+=2,(m=a(c/(A[0]+1)))>1&&(A=e(A,m,c),E=e(E,m,c),M=A.length,$=E.length),N=M,x=(O=E.slice(0,M)).length;x<M;O[x++]=0);D=A.slice(),D=[0].concat(D),B=A[0],A[1]>=c/2&&B++;do{if(m=0,(f=t(A,O,M,x))<0){if(S=O[0],M!=x&&(S=S*c+(O[1]||0)),(m=a(S/B))>1)for(m>=c&&(m=c-1),b=(y=e(A,m,c)).length,x=O.length;1==t(y,O,b,x);)m--,r(y,M<b?D:A,b,c),b=y.length,f=1;else 0==m&&(f=m=1),b=(y=A.slice()).length;if(b<x&&(y=[0].concat(y)),r(O,y,x,c),x=O.length,-1==f)for(;t(A,O,M,x)<1;)m++,r(O,M<x?D:A,x,c),x=O.length}else 0===f&&(m++,O=[0]);w[g++]=m,O[0]?O[x++]=E[N]||0:(O=[E[N]],x=1)}while((N++<$||null!=O[0])&&F--);d=null!=O[0],w[0]||w.splice(0,1)}if(c==s){for(g=1,F=w[0];F>=10;F/=10,g++);H(v,o+(v.e=g+p*l-1)+1,u,d)}else v.e=p,v.r=+d;return v}}(),$=/^(-?)0([xbo])(?=\w[\w.]*$)/i,B=/^([^.]+)\.$/,M=/^\.([^.]+)$/,D=/^-?(Infinity|NaN)$/,F=/^\s*\+(?=[\w.])|^\s+|\s+$/g,x=function(e,t,r,n){var i,a=r?t:t.replace(F,"");if(D.test(a))e.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace($,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,a=a.replace(B,"$1").replace(M,"0.$1")),t!=a))return new q(a,i);if(q.DEBUG)throw Error(o+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},E.absoluteValue=E.abs=function(){var e=new q(this);return e.s<0&&(e.s=1),e},E.comparedTo=function(e,t){return m(this,new q(e,t))},E.decimalPlaces=E.dp=function(e,t){var r,n,i,a=this;if(null!=e)return y(e,0,g),null==t?t=k:y(t,0,8),H(new q(a),e+a.e+1,t);if(!(r=a.c))return null;if(n=((i=r.length-1)-h(this.e/l))*l,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},E.dividedBy=E.div=function(e,t){return r(this,new q(e,t),_,k)},E.dividedToIntegerBy=E.idiv=function(e,t){return r(this,new q(e,t),0,1)},E.exponentiatedBy=E.pow=function(e,t){var r,n,u,s,c,f,p,g,h=this;if((e=new q(e)).c&&!e.isInteger())throw Error(o+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new q(t)),c=e.e>14,!h.c||!h.c[0]||1==h.c[0]&&!h.e&&1==h.c.length||!e.c||!e.c[0])return g=new q(Math.pow(+Y(h),c?e.s*(2-b(e)):+Y(e))),t?g.mod(t):g;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new q(NaN);(n=!f&&h.isInteger()&&t.isInteger())&&(h=h.mod(t))}else{if(e.e>9&&(h.e>0||h.e<-1||(0==h.e?h.c[0]>1||c&&h.c[1]>=24e7:h.c[0]<8e13||c&&h.c[0]<=9999975e7)))return s=h.s<0&&b(e)?-0:0,h.e>-1&&(s=1/s),new q(f?1/s:s);R&&(s=i(R/l+2))}for(c?(r=new q(.5),f&&(e.s=1),p=b(e)):p=(u=Math.abs(+Y(e)))%2,g=new q(A);;){if(p){if(!(g=g.times(h)).c)break;s?g.c.length>s&&(g.c.length=s):n&&(g=g.mod(t))}if(u){if(0===(u=a(u/2)))break;p=u%2}else if(H(e=e.times(r),e.e+1,1),e.e>14)p=b(e);else{if(0===(u=+Y(e)))break;p=u%2}h=h.times(h),s?h.c&&h.c.length>s&&(h.c.length=s):n&&(h=h.mod(t))}return n?g:(f&&(g=A.div(g)),t?g.mod(t):s?H(g,R,k,undefined):g)},E.integerValue=function(e){var t=new q(this);return null==e?e=k:y(e,0,8),H(t,t.e+1,e)},E.isEqualTo=E.eq=function(e,t){return 0===m(this,new q(e,t))},E.isFinite=function(){return!!this.c},E.isGreaterThan=E.gt=function(e,t){return m(this,new q(e,t))>0},E.isGreaterThanOrEqualTo=E.gte=function(e,t){return 1===(t=m(this,new q(e,t)))||0===t},E.isInteger=function(){return!!this.c&&h(this.e/l)>this.c.length-2},E.isLessThan=E.lt=function(e,t){return m(this,new q(e,t))<0},E.isLessThanOrEqualTo=E.lte=function(e,t){return-1===(t=m(this,new q(e,t)))||0===t},E.isNaN=function(){return!this.s},E.isNegative=function(){return this.s<0},E.isPositive=function(){return this.s>0},E.isZero=function(){return!!this.c&&0==this.c[0]},E.minus=function(e,t){var r,n,i,a,o=this,u=o.s;if(t=(e=new q(e,t)).s,!u||!t)return new q(NaN);if(u!=t)return e.s=-t,o.plus(e);var c=o.e/l,f=e.e/l,p=o.c,g=e.c;if(!c||!f){if(!p||!g)return p?(e.s=-t,e):new q(g?o:NaN);if(!p[0]||!g[0])return g[0]?(e.s=-t,e):new q(p[0]?o:3==k?-0:0)}if(c=h(c),f=h(f),p=p.slice(),u=c-f){for((a=u<0)?(u=-u,i=p):(f=c,i=g),i.reverse(),t=u;t--;i.push(0));i.reverse()}else for(n=(a=(u=p.length)<(t=g.length))?u:t,u=t=0;t<n;t++)if(p[t]!=g[t]){a=p[t]<g[t];break}if(a&&(i=p,p=g,g=i,e.s=-e.s),(t=(n=g.length)-(r=p.length))>0)for(;t--;p[r++]=0);for(t=s-1;n>u;){if(p[--n]<g[n]){for(r=n;r&&!p[--r];p[r]=t);--p[r],p[n]+=s}p[n]-=g[n]}for(;0==p[0];p.splice(0,1),--f);return p[0]?W(e,p,f):(e.s=3==k?-1:1,e.c=[e.e=0],e)},E.modulo=E.mod=function(e,t){var n,i,a=this;return e=new q(e,t),!a.c||!e.s||e.c&&!e.c[0]?new q(NaN):!e.c||a.c&&!a.c[0]?new q(a):(9==U?(i=e.s,e.s=1,n=r(a,e,0,3),e.s=i,n.s*=i):n=r(a,e,0,U),(e=a.minus(n.times(e))).c[0]||1!=U||(e.s=a.s),e)},E.multipliedBy=E.times=function(e,t){var r,n,i,a,o,u,c,f,g,d,m,y,b,v,w,O=this,x=O.c,S=(e=new q(e,t)).c;if(!(x&&S&&x[0]&&S[0]))return!O.s||!e.s||x&&!x[0]&&!S||S&&!S[0]&&!x?e.c=e.e=e.s=null:(e.s*=O.s,x&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=h(O.e/l)+h(e.e/l),e.s*=O.s,(c=x.length)<(d=S.length)&&(b=x,x=S,S=b,i=c,c=d,d=i),i=c+d,b=[];i--;b.push(0));for(v=s,w=p,i=d;--i>=0;){for(r=0,m=S[i]%w,y=S[i]/w|0,a=i+(o=c);a>i;)r=((f=m*(f=x[--o]%w)+(u=y*f+(g=x[o]/w|0)*m)%w*w+b[a]+r)/v|0)+(u/w|0)+y*g,b[a--]=f%v;b[a]=r}return r?++n:b.splice(0,1),W(e,b,n)},E.negated=function(){var e=new q(this);return e.s=-e.s||null,e},E.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new q(e,t)).s,!i||!t)return new q(NaN);if(i!=t)return e.s=-t,n.minus(e);var a=n.e/l,o=e.e/l,u=n.c,c=e.c;if(!a||!o){if(!u||!c)return new q(i/0);if(!u[0]||!c[0])return c[0]?e:new q(u[0]?n:0*i)}if(a=h(a),o=h(o),u=u.slice(),i=a-o){for(i>0?(o=a,r=c):(i=-i,r=u),r.reverse();i--;r.push(0));r.reverse()}for((i=u.length)-(t=c.length)<0&&(r=c,c=u,u=r,t=i),i=0;t;)i=(u[--t]=u[t]+c[t]+i)/s|0,u[t]=s===u[t]?0:u[t]%s;return i&&(u=[i].concat(u),++o),W(e,u,o)},E.precision=E.sd=function(e,t){var r,n,i,a=this;if(null!=e&&e!==!!e)return y(e,1,g),null==t?t=k:y(t,0,8),H(new q(a),e,t);if(!(r=a.c))return null;if(n=(i=r.length-1)*l+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&a.e+1>n&&(n=a.e+1),n},E.shiftedBy=function(e){return y(e,-9007199254740991,c),this.times("1e"+e)},E.squareRoot=E.sqrt=function(){var e,t,n,i,a,o=this,u=o.c,s=o.s,l=o.e,c=_+4,f=new q("0.5");if(1!==s||!u||!u[0])return new q(!s||s<0&&(!u||u[0])?NaN:u?o:1/0);if(0==(s=Math.sqrt(+Y(o)))||s==1/0?(((t=d(u)).length+l)%2==0&&(t+="0"),s=Math.sqrt(+t),l=h((l+1)/2)-(l<0||l%2),n=new q(t=s==1/0?"5e"+l:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+l)):n=new q(s+""),n.c[0])for((s=(l=n.e)+c)<3&&(s=0);;)if(a=n,n=f.times(a.plus(r(o,a,c,1))),d(a.c).slice(0,s)===(t=d(n.c)).slice(0,s)){if(n.e<l&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(H(n,n.e+_+2,1),e=!n.times(n).eq(o));break}if(!i&&(H(a,a.e+_+2,0),a.times(a).eq(o))){n=a;break}c+=4,s+=4,i=1}return H(n,n.e+_+1,k,e)},E.toExponential=function(e,t){return null!=e&&(y(e,0,g),e++),Z(this,e,t,1)},E.toFixed=function(e,t){return null!=e&&(y(e,0,g),e=e+this.e+1),Z(this,e,t)},E.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=I;else if("object"!=typeof r)throw Error(o+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var a,u=n.split("."),s=+r.groupSize,l=+r.secondaryGroupSize,c=r.groupSeparator||"",f=u[0],p=u[1],g=i.s<0,h=g?f.slice(1):f,d=h.length;if(l&&(a=s,s=l,l=a,d-=a),s>0&&d>0){for(a=d%s||s,f=h.substr(0,a);a<d;a+=s)f+=c+h.substr(a,s);l>0&&(f+=c+h.slice(a)),g&&(f="-"+f)}n=p?f+(r.decimalSeparator||"")+((l=+r.fractionGroupSize)?p.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):p):f}return(r.prefix||"")+n+(r.suffix||"")},E.toFraction=function(e){var t,n,i,a,u,s,c,p,g,h,m,y,b=this,v=b.c;if(null!=e&&(!(c=new q(e)).isInteger()&&(c.c||1!==c.s)||c.lt(A)))throw Error(o+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!v)return new q(b);for(t=new q(A),g=n=new q(A),i=p=new q(A),y=d(v),u=t.e=y.length-b.e-1,t.c[0]=f[(s=u%l)<0?l+s:s],e=!e||c.comparedTo(t)>0?u>0?t:g:c,s=C,C=1/0,c=new q(y),p.c[0]=0;h=r(c,t,0,1),1!=(a=n.plus(h.times(i))).comparedTo(e);)n=i,i=a,g=p.plus(h.times(a=g)),p=a,t=c.minus(h.times(a=t)),c=a;return a=r(e.minus(n),i,0,1),p=p.plus(a.times(g)),n=n.plus(a.times(i)),p.s=g.s=b.s,m=r(g,i,u*=2,k).minus(b).abs().comparedTo(r(p,n,u,k).minus(b).abs())<1?[g,i]:[p,n],C=s,m},E.toNumber=function(){return+Y(this)},E.toPrecision=function(e,t){return null!=e&&y(e,1,g),Z(this,e,t,2)},E.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=L||i>=P?v(d(r.c),i):w(d(r.c),i,"0"):10===e&&V?t=w(d((r=H(new q(r),_+i+1,k)).c),r.e,"0"):(y(e,2,G.length,"Base"),t=O(w(d(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},E.valueOf=E.toJSON=function(){return Y(this)},E._isBigNumber=!0,null!=t&&q.set(t),q}(),r.default=r.BigNumber=r,e.exports?e.exports=r:(t||(t="undefined"!=typeof self&&self?self:window),t.BigNumber=r)}(o)}(m);var y=m.exports;
/*!
* Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/const b=h(),v=c(),w=g,O=y,x={trillion:Math.pow(10,12),billion:Math.pow(10,9),million:Math.pow(10,6),thousand:Math.pow(10,3)},S={totalLength:0,characteristic:0,forceAverage:!1,average:!1,mantissa:-1,optionalMantissa:!0,thousandSeparated:!1,spaceSeparated:!1,negative:"sign",forceSign:!1,roundingFunction:Math.round,spaceSeparatedAbbreviation:!1},{binarySuffixes:N,decimalSuffixes:$}=b.currentBytes(),B={general:{scale:1024,suffixes:$,marker:"bd"},binary:{scale:1024,suffixes:N,marker:"b"},decimal:{scale:1e3,suffixes:$,marker:"d"}};function M(e,t={},r){if("string"==typeof t&&(t=w.parseFormat(t)),!v.validateFormat(t))return"ERROR: invalid format";let n=t.prefix||"",i=t.postfix||"",a=function(e,t,r){switch(t.output){case"currency":return function(e,t,r){const n=r.currentCurrency();let i,a=Object.assign({},t),o=Object.assign({},S,a),u="",s=!!o.totalLength||!!o.forceAverage||o.average,l=a.currencyPosition||n.position,c=a.currencySymbol||n.symbol;const f=void 0!==o.spaceSeparatedCurrency?o.spaceSeparatedCurrency:o.spaceSeparated;void 0===a.lowPrecision&&(a.lowPrecision=!1);f&&(u=" ");"infix"===l&&(i=u+c+u);let p=A({instance:e,providedFormat:a,state:r,decimalSeparator:i});"prefix"===l&&(p=e._value<0&&"sign"===o.negative?`-${u}${c}${p.slice(1)}`:e._value>0&&o.forceSign?`+${u}${c}${p.slice(1)}`:c+u+p);l&&"postfix"!==l||(u=!o.spaceSeparatedAbbreviation&&s?"":u,p=p+u+c);return p}(e,t=_(t,b.currentCurrencyDefaultFormat()),b);case"percent":return function(e,t,r,n){let i=t.prefixSymbol,a=A({instance:n(100*e._value),providedFormat:t,state:r}),o=Object.assign({},S,t);if(i)return`%${o.spaceSeparated?" ":""}${a}`;return`${a}${o.spaceSeparated?" ":""}%`}(e,t=_(t,b.currentPercentageDefaultFormat()),b,r);case"byte":return function(e,t,r,n){let i=t.base||"binary",a=Object.assign({},S,t);const{binarySuffixes:o,decimalSuffixes:u}=r.currentBytes();let s={general:{scale:1024,suffixes:u||$,marker:"bd"},binary:{scale:1024,suffixes:o||N,marker:"b"},decimal:{scale:1e3,suffixes:u||$,marker:"d"}}[i],{value:l,suffix:c}=D(e._value,s.suffixes,s.scale),f=A({instance:n(l),providedFormat:t,state:r,defaults:r.currentByteDefaultFormat()});return`${f}${a.spaceSeparated?" ":""}${c}`}(e,t=_(t,b.currentByteDefaultFormat()),b,r);case"time":return t=_(t,b.currentTimeDefaultFormat()),function(e){let t=Math.floor(e._value/60/60),r=Math.floor((e._value-60*t*60)/60),n=Math.round(e._value-60*t*60-60*r);return`${t}:${r<10?"0":""}${r}:${n<10?"0":""}${n}`}(e);case"ordinal":return function(e,t,r){let n=r.currentOrdinal(),i=Object.assign({},S,t),a=A({instance:e,providedFormat:t,state:r}),o=n(e._value);return`${a}${i.spaceSeparated?" ":""}${o}`}(e,t=_(t,b.currentOrdinalDefaultFormat()),b);default:return A({instance:e,providedFormat:t,numbro:r})}}(e,t,r);return a=function(e,t){return t+e}(a,n),a=function(e,t){return e+t}(a,i),a}function D(e,t,r){let n=t[0],i=Math.abs(e);if(i>=r){for(let a=1;a<t.length;++a){let o=Math.pow(r,a),u=Math.pow(r,a+1);if(i>=o&&i<u){n=t[a],e/=o;break}}n===t[0]&&(e/=Math.pow(r,t.length-1),n=t[t.length-1])}return{value:e,suffix:n}}function F(e){let t="";for(let r=0;r<e;r++)t+="0";return t}function E(e,t,r=Math.round){if(-1!==e.toString().indexOf("e"))return function(e,t){let r=e.toString(),[n,i]=r.split("e"),[a,o=""]=n.split(".");if(+i>0)r=a+o+F(i-o.length);else{let e=".";e=+a<0?`-0${e}`:`0${e}`;let n=(F(-i-1)+Math.abs(a)+o).substr(0,t);n.length<t&&(n+=F(t-n.length)),r=e+n}return+i>0&&t>0&&(r+=`.${F(t)}`),r}(e,t);return new O(r(+`${e}e+${t}`)/Math.pow(10,t)).toFixed(t)}function A({instance:e,providedFormat:t,state:r=b,decimalSeparator:n,defaults:i=r.currentDefaults()}){let a=e._value;if(0===a&&r.hasZeroFormat())return r.getZeroFormat();if(!isFinite(a))return a.toString();let o=Object.assign({},S,i,t),u=o.totalLength,s=u?0:o.characteristic,l=o.optionalCharacteristic,c=o.forceAverage,f=o.lowPrecision,p=!!u||!!c||o.average,g=u?-1:p&&void 0===t.mantissa?0:o.mantissa,h=!u&&(void 0===t.optionalMantissa?-1===g:o.optionalMantissa),d=o.trimMantissa,m=o.thousandSeparated,y=o.spaceSeparated,v=o.negative,w=o.forceSign,O=o.exponential,N=o.roundingFunction,$="";if(p){let e=function({value:e,forceAverage:t,lowPrecision:r=!0,abbreviations:n,spaceSeparated:i=!1,totalLength:a=0,roundingFunction:o=Math.round}){let u="",s=Math.abs(e),l=-1;if(t&&n[t]&&x[t]?(u=n[t],e/=x[t]):s>=x.trillion||r&&1===o(s/x.trillion)?(u=n.trillion,e/=x.trillion):s<x.trillion&&s>=x.billion||r&&1===o(s/x.billion)?(u=n.billion,e/=x.billion):s<x.billion&&s>=x.million||r&&1===o(s/x.million)?(u=n.million,e/=x.million):(s<x.million&&s>=x.thousand||r&&1===o(s/x.thousand))&&(u=n.thousand,e/=x.thousand),u&&(u=(i?" ":"")+u),a){let t=e<0,r=e.toString().split(".")[0],n=t?r.length-1:r.length;l=Math.max(a-n,0)}return{value:e,abbreviation:u,mantissaPrecision:l}}({value:a,forceAverage:c,lowPrecision:f,abbreviations:r.currentAbbreviations(),spaceSeparated:y,roundingFunction:N,totalLength:u});a=e.value,$+=e.abbreviation,u&&(g=e.mantissaPrecision)}if(O){let e=function({value:e,characteristicPrecision:t}){let[r,n]=e.toExponential().split("e"),i=+r;return t?(1<t&&(i*=Math.pow(10,t-1),n=+n-(t-1),n=n>=0?`+${n}`:n),{value:i,abbreviation:`e${n}`}):{value:i,abbreviation:`e${n}`}}({value:a,characteristicPrecision:s});a=e.value,$=e.abbreviation+$}let B=function(e,t,r,n,i,a){if(-1===n)return e;let o=E(t,n,a),[u,s=""]=o.toString().split(".");if(s.match(/^0+$/)&&(r||i))return u;let l=s.match(/0+$/);return i&&l?`${u}.${s.toString().slice(0,l.index)}`:o.toString()}(a.toString(),a,h,g,d,N);return B=function(e,t,r,n){let i=e,[a,o]=i.toString().split(".");if(a.match(/^-?0$/)&&r)return o?`${a.replace("0","")}.${o}`:a.replace("0","");const u=t<0&&0===a.indexOf("-");if(u&&(a=a.slice(1),i=i.slice(1)),a.length<n){let e=n-a.length;for(let t=0;t<e;t++)i=`0${i}`}return u&&(i=`-${i}`),i.toString()}(B,a,l,s),B=function(e,t,r,n,i){let a=n.currentDelimiters(),o=a.thousands;i=i||a.decimal;let u=a.thousandsSize||3,s=e.toString(),l=s.split(".")[0],c=s.split(".")[1];const f=t<0&&0===l.indexOf("-");if(r){f&&(l=l.slice(1));let e=function(e,t){let r=[],n=0;for(let i=e;i>0;i--)n===t&&(r.unshift(i),n=0),n++;return r}(l.length,u);e.forEach(((e,t)=>{l=l.slice(0,e+t)+o+l.slice(e+t)})),f&&(l=`-${l}`)}return s=c?l+i+c:l,s}(B,a,m,r,n),(p||O)&&(B=function(e,t){return e+t}(B,$)),(w||a<0)&&(B=function(e,t,r){return 0===t?e:0==+e?e.replace("-",""):t>0?`+${e}`:"sign"===r?e:`(${e.replace("-","")})`}(B,a,v)),B}function _(e,t){if(!e)return t;let r=Object.keys(e);return 1===r.length&&"output"===r[0]?t:e}
/*!
* Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
const k=y;function L(e,t,r){let n=new k(e._value),i=t;return r.isNumbro(t)&&(i=t._value),i=new k(i),e._value=n.minus(i).toNumber(),e}
/*!
* Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
const P=h(),T=c(),C=(e=>({loadLanguagesInNode:t=>d(t,e)}))(q),j=l();let U=(e=>({format:(...t)=>M(...t,e),getByteUnit:(...t)=>function(e){let t=B.general;return D(e._value,t.suffixes,t.scale).suffix}(...t,e),getBinaryByteUnit:(...t)=>function(e){let t=B.binary;return D(e._value,t.suffixes,t.scale).suffix}(...t,e),getDecimalByteUnit:(...t)=>function(e){let t=B.decimal;return D(e._value,t.suffixes,t.scale).suffix}(...t,e),formatOrDefault:_}))(q),R=(e=>({add:(t,r)=>function(e,t,r){let n=new k(e._value),i=t;return r.isNumbro(t)&&(i=t._value),i=new k(i),e._value=n.plus(i).toNumber(),e}(t,r,e),subtract:(t,r)=>L(t,r,e),multiply:(t,r)=>function(e,t,r){let n=new k(e._value),i=t;return r.isNumbro(t)&&(i=t._value),i=new k(i),e._value=n.times(i).toNumber(),e}(t,r,e),divide:(t,r)=>function(e,t,r){let n=new k(e._value),i=t;return r.isNumbro(t)&&(i=t._value),i=new k(i),e._value=n.dividedBy(i).toNumber(),e}(t,r,e),set:(t,r)=>function(e,t,r){let n=t;return r.isNumbro(t)&&(n=t._value),e._value=n,e}(t,r,e),difference:(t,r)=>function(e,t,r){let n=r(e._value);return L(n,t,r),Math.abs(n._value)}(t,r,e),BigNumber:k}))(q);const I=g;class G{constructor(e){this._value=e}clone(){return q(this._value)}format(e={}){return U.format(this,e)}formatCurrency(e){return"string"==typeof e&&(e=I.parseFormat(e)),(e=U.formatOrDefault(e,P.currentCurrencyDefaultFormat())).output="currency",U.format(this,e)}formatTime(e={}){return e.output="time",U.format(this,e)}binaryByteUnits(){return U.getBinaryByteUnit(this)}decimalByteUnits(){return U.getDecimalByteUnit(this)}byteUnits(){return U.getByteUnit(this)}difference(e){return R.difference(this,e)}add(e){return R.add(this,e)}subtract(e){return R.subtract(this,e)}multiply(e){return R.multiply(this,e)}divide(e){return R.divide(this,e)}set(e){return R.set(this,V(e))}value(){return this._value}valueOf(){return this._value}}function V(e){let t=e;return q.isNumbro(e)?t=e._value:"string"==typeof e?t=q.unformat(e):isNaN(e)&&(t=NaN),t}function q(e){return new G(V(e))}return q.version="2.5.0",q.isNumbro=function(e){return e instanceof G},q.language=P.currentLanguage,q.registerLanguage=P.registerLanguage,q.setLanguage=P.setLanguage,q.languages=P.languages,q.languageData=P.languageData,q.zeroFormat=P.setZeroFormat,q.defaultFormat=P.currentDefaults,q.setDefaults=P.setDefaults,q.defaultCurrencyFormat=P.currentCurrencyDefaultFormat,q.validate=T.validate,q.loadLanguagesInNode=C.loadLanguagesInNode,q.unformat=j.unformat,q.BigNumber=R.BigNumber,u(q)}));
//# sourceMappingURL=numbro.min.js.map