{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","node_modules/bignumber.js/bignumber.js","src/en-US.js","src/formatting.js","src/globalState.js","src/loading.js","src/manipulating.js","src/numbro.js","src/parsing.js","src/unformatting.js","src/validating.js"],"names":["f","exports","module","define","amd","window","global","self","this","numbro","e","t","n","r","s","o","u","a","require","i","Error","code","l","call","length","1","globalObj","constructorFactory","config","BigNumber","b","c","num","len","str","x","ERRORS","raise","isValidInt","id","round","DECIMAL_PLACES","ROUNDING_MODE","RegExp","ALPHABET","slice","test","parseNumeric","replace","tooManyDigits","charCodeAt","convertBase","isNumeric","indexOf","search","substring","MAX_SAFE_INTEGER","mathfloor","MAX_EXP","MIN_EXP","LOG_BASE","push","baseOut","baseIn","sign","d","k","xc","y","dp","rm","toLowerCase","POW_PRECISION","pow","toBaseOut","toFixedPoint","coeffToString","pop","div","concat","charAt","format","caller","c0","ne","roundingMode","toString","TO_EXP_NEG","toExponential","maxOrMin","args","method","m","isArray","intValidatorWithErrors","min","max","name","truncate","normalise","j","msg","val","error","sd","ni","rd","pows10","POWS_TEN","out","mathceil","BASE","P","prototype","ONE","TO_EXP_POS","CRYPTO","MODULO_MODE","FORMAT","decimalSeparator","groupSeparator","groupSize","secondaryGroupSize","fractionGroupSeparator","fractionGroupSize","another","ROUND_UP","ROUND_DOWN","ROUND_CEIL","ROUND_FLOOR","ROUND_HALF_UP","ROUND_HALF_DOWN","ROUND_HALF_EVEN","ROUND_HALF_CEIL","ROUND_HALF_FLOOR","EUCLID","set","v","p","arguments","has","hasOwnProperty","MAX","intValidatorNoErrors","notBool","crypto","getRandomValues","randomBytes","lt","gt","random","random53bitInt","Math","rand","Uint32Array","copy","splice","multiply","base","temp","xlo","xhi","carry","klo","SQRT_BASE","khi","compare","aL","bL","cmp","subtract","more","prod","prodL","q","qc","rem","remL","rem0","xi","xL","yc0","yL","yz","yc","NaN","bitFloor","basePrefix","dotAfter","dotBefore","isInfinityOrNaN","whitespaceOrPlus","isNaN","p1","p2","absoluteValue","abs","ceil","comparedTo","decimalPlaces","dividedBy","dividedToIntegerBy","divToInt","equals","eq","floor","greaterThan","greaterThanOrEqualTo","gte","isFinite","isInteger","isInt","isNegative","isNeg","isZero","lessThan","lessThanOrEqualTo","lte","minus","sub","xLTy","plus","xe","ye","reverse","modulo","mod","times","negated","neg","add","precision","z","shift","squareRoot","sqrt","rep","half","mul","xcL","ycL","ylo","yhi","zc","sqrtBase","toDigits","toFixed","toFormat","arr","split","g1","g2","intPart","fractionPart","intDigits","substr","toFraction","md","d0","d2","exp","n0","n1","d1","toNumber","toPower","parseFloat","toPrecision","truncated","trunc","valueOf","toJSON","isBigNumber","obj","Object","arrL","Function","languageTag","delimiters","thousands","decimal","abbreviations","thousand","million","billion","trillion","spaceSeparated","ordinal","number","currency","symbol","position","currencyFormat","thousandSeparated","totalLength","formats","fourDigits","fullWithTwoDecimals","output","mantissa","fullWithTwoDecimalsNoCurrency","fullWithNoDecimals","_format","instance","providedFormat","undefined","parsing","parseFormat","validating","validateFormat","prefix","postfix","formatNumbro","insertPrefix","insertPostfix","formatOrDefault","globalState","currentCurrencyDefaultFormat","formatCurrency","currentPercentageDefaultFormat","formatPercentage","currentByteDefaultFormat","formatByte","currentTimeDefaultFormat","formatTime","currentOrdinalDefaultFormat","formatOrdinal","formatNumber","_getDecimalByteUnit","data","bytes","getFormatByteUnits","_value","suffixes","scale","suffix","_getBinaryByteUnit","binary","_getByteUnit","general","value","power","state","baseInfo","_getFormatByteUnits","defaults","currentAbbreviations","spaced","ordinalFn","currentOrdinal","options","assign","defaultOptions","hours","minutes","seconds","prefixSymbol","currentCurrency","space","average","forceAverage","negative","computeAverage","_ref","_ref$spaceSeparated","_ref$totalLength","abbreviation","mantissaPrecision","optionalSpace","characteristic","computeExponential","_ref2","_ref2$characteristicP","characteristicPrecision","_value$toExponential$","_value$toExponential$2","_slicedToArray","numberString","exponential","zeroes","result","toFixedLarge","_result$split","_result$split2","_base$split","_base$split2","_base$split2$","setMantissaPrecision","optionalMantissa","_result$toString$spli","_result$toString$spli2","currentCharacteristic","_result$toString$spli3","match","setCharacteristicPrecision","optionalCharacteristic","_result$toString$spli4","_result$toString$spli5","currentMantissa","missingZeros","indexesOfGroupSpaces","counter","unshift","replaceDelimiters","currentDelimiters","thousandSeparator","thousandsSize","forEach","index","insertAbbreviation","insertSign","_ref3","_ref3$state","_ref3$defaults","currentDefaults","hasZeroFormat","getZeroFormat","forceSign","_data","defaultFormat","keys","decimalSuffixes","marker","_len","Array","_key","apply","getByteUnit","_len2","_key2","getBinaryByteUnit","_len3","_key3","getDecimalByteUnit","_len4","_key4","chooseLanguage","tag","currentLanguageTag","currentLanguageData","languages","enUS","zeroFormat","globalDefaults","currentLanguage","ordinalFormat","byteFormat","percentageFormat","timeFormat","setDefaults","setZeroFormat","string","languageData","registerLanguage","useLanguage","validateLanguage","setLanguage","fallbackTag","matchingLanguageTag","find","each","_loadLanguagesInNode","tags","console","loadLanguagesInNode","_add","other","otherValue","isNumbro","_subtract","_multiply","_divide","_set","_difference","clone","divide","difference","normalizeInput","input","unformat","Numbro","validator","loader","unformatter","formatter","manipulate","_classCallCheck","version","object","language","defaultCurrencyFormat","validate","parsePrefix","parsePostfix","parseOutput","parseThousandSeparated","parseSpaceSeparated","parseTotalLength","parseCharacteristic","parseMantissa","parseAverage","parseForceAverage","parseOptionalMantissa","parseOptionalCharacteristic","parseNegative","parseForceSign","escapeRegExp","computeUnformattedValue","inputString","currencySymbol","stripped","newInput","allSuffixes","key","factor","possibleOrdinalValue","ordinalString","inversedAbbreviations","abbreviationValues","sort","numberOfAbbreviations","_i","removeFormattingSymbols","unformatValue","matchesTime","segments","unformatTime","validateInput","validateSpec","toValidate","spec","skipMandatoryCheck","results","map","type","validFormat","_typeof","restrictions","_data$restrictions$i","restriction","message","validValues","JSON","stringify","children","_toConsumableArray","mandatory","reduce","acc","current","bcp47RegExp","validLanguage","timeDefaults","validInput","isFormatValid"],"mappings":"CAAA,SAAAA,GAAA,GAA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D","file":"numbro.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o\r\n MIT Expat Licence\r\n */\r\n\r\n\r\n var BigNumber,\r\n isNumeric = /^-?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i,\r\n mathceil = Math.ceil,\r\n mathfloor = Math.floor,\r\n notBool = ' not a boolean or binary digit',\r\n roundingMode = 'rounding mode',\r\n tooManyDigits = 'number type has more than 15 significant digits',\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_',\r\n BASE = 1e14,\r\n LOG_BASE = 14,\r\n MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1\r\n // MAX_INT32 = 0x7fffffff, // 2^31 - 1\r\n POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],\r\n SQRT_BASE = 1e7,\r\n\r\n /*\r\n * The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and\r\n * the arguments to toExponential, toFixed, toFormat, and toPrecision, beyond which an\r\n * exception is thrown (if ERRORS is true).\r\n */\r\n MAX = 1E9; // 0 to MAX_INT32\r\n\r\n\r\n /*\r\n * Create and return a BigNumber constructor.\r\n */\r\n function constructorFactory(config) {\r\n var div, parseNumeric,\r\n\r\n // id tracks the caller function, so its name can be included in error messages.\r\n id = 0,\r\n P = BigNumber.prototype,\r\n ONE = new BigNumber(1),\r\n\r\n\r\n /********************************* EDITABLE DEFAULTS **********************************/\r\n\r\n\r\n /*\r\n * The default values below must be integers within the inclusive ranges stated.\r\n * The values can also be changed at run-time using BigNumber.config.\r\n */\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n /*\r\n * The rounding mode used when rounding to the above decimal places, and when using\r\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n * UP 0 Away from zero.\r\n * DOWN 1 Towards zero.\r\n * CEIL 2 Towards +Infinity.\r\n * FLOOR 3 Towards -Infinity.\r\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n */\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether BigNumber Errors are ever thrown.\r\n ERRORS = true, // true or false\r\n\r\n // Change to intValidatorNoErrors if ERRORS is false.\r\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n /*\r\n * The modulo mode used when calculating the modulus: a mod n.\r\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n * The remainder (r) is calculated as: r = a - n * q.\r\n *\r\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n * DOWN 1 The remainder has the same sign as the dividend.\r\n * This modulo mode is commonly known as 'truncated division' and is\r\n * equivalent to (a % n) in JavaScript.\r\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n * The remainder is always positive.\r\n *\r\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n * modes are commonly used for the modulus operation.\r\n * Although the other rounding modes can also be used, they may not give useful results.\r\n */\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the toPower operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n decimalSeparator: '.',\r\n groupSeparator: ',',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n fractionGroupSize: 0\r\n };\r\n\r\n\r\n /******************************************************************************************/\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * n {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\r\n */\r\n function BigNumber( n, b ) {\r\n var c, e, i, num, len, str,\r\n x = this;\r\n\r\n // Enable constructor usage without new.\r\n if ( !( x instanceof BigNumber ) ) {\r\n\r\n // 'BigNumber() constructor call without new: {n}'\r\n if (ERRORS) raise( 26, 'constructor call without new', n );\r\n return new BigNumber( n, b );\r\n }\r\n\r\n // 'new BigNumber() base not an integer: {b}'\r\n // 'new BigNumber() base out of range: {b}'\r\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\r\n\r\n // Duplicate.\r\n if ( n instanceof BigNumber ) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = ( n = n.c ) ? n.slice() : n;\r\n id = 0;\r\n return;\r\n }\r\n\r\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\r\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\r\n\r\n // Fast path for integers.\r\n if ( n === ~~n ) {\r\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\r\n x.e = e;\r\n x.c = [n];\r\n id = 0;\r\n return;\r\n }\r\n\r\n str = n + '';\r\n } else {\r\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n } else {\r\n b = b | 0;\r\n str = n + '';\r\n\r\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\r\n // Allow exponential notation to be used with base 10 argument.\r\n if ( b == 10 ) {\r\n x = new BigNumber( n instanceof BigNumber ? n : str );\r\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\r\n }\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n // Any number in exponential form will fail due to the [Ee][+-].\r\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\r\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\r\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\r\n return parseNumeric( x, str, num, b );\r\n }\r\n\r\n if (num) {\r\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\r\n\r\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\r\n\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n raise( id, tooManyDigits, n );\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n num = false;\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\r\n }\r\n\r\n str = convertBase( str, 10, b, x.s );\r\n }\r\n\r\n // Decimal point?\r\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\r\n\r\n // Exponential form?\r\n if ( ( i = str.search( /e/i ) ) > 0 ) {\r\n\r\n // Determine exponent.\r\n if ( e < 0 ) e = i;\r\n e += +str.slice( i + 1 );\r\n str = str.substring( 0, i );\r\n } else if ( e < 0 ) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\r\n\r\n // Determine trailing zeros.\r\n for ( len = str.length; str.charCodeAt(--len) === 48; );\r\n str = str.slice( i, len + 1 );\r\n\r\n if (str) {\r\n len = str.length;\r\n\r\n // Disallow numbers with over 15 significant digits if number type.\r\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\r\n if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {\r\n raise( id, tooManyDigits, x.s * n );\r\n }\r\n\r\n e = e - i - 1;\r\n\r\n // Overflow?\r\n if ( e > MAX_EXP ) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = ( e + 1 ) % LOG_BASE;\r\n if ( e < 0 ) i += LOG_BASE;\r\n\r\n if ( i < len ) {\r\n if (i) x.c.push( +str.slice( 0, i ) );\r\n\r\n for ( len -= LOG_BASE; i < len; ) {\r\n x.c.push( +str.slice( i, i += LOG_BASE ) );\r\n }\r\n\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for ( ; i--; str += '0' );\r\n x.c.push( +str );\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [ x.e = 0 ];\r\n }\r\n\r\n id = 0;\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.another = constructorFactory;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object or an argument list, with one or many of the following properties or\r\n * parameters respectively:\r\n *\r\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\r\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\r\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\r\n * [integer -MAX to 0 incl., 0 to MAX incl.]\r\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\r\n * ERRORS {boolean|number} true, false, 1 or 0\r\n * CRYPTO {boolean|number} true, false, 1 or 0\r\n * MODULO_MODE {number} 0 to 9 inclusive\r\n * POW_PRECISION {number} 0 to MAX inclusive\r\n * FORMAT {object} See BigNumber.prototype.toFormat\r\n * decimalSeparator {string}\r\n * groupSeparator {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * fractionGroupSize {number}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config(20, 4) is equivalent to\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined.\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function () {\r\n var v, p,\r\n i = 0,\r\n r = {},\r\n a = arguments,\r\n o = a[0],\r\n has = o && typeof o == 'object'\r\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\r\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // 'config() DECIMAL_PLACES not an integer: {v}'\r\n // 'config() DECIMAL_PLACES out of range: {v}'\r\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n DECIMAL_PLACES = v | 0;\r\n }\r\n r[p] = DECIMAL_PLACES;\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // 'config() ROUNDING_MODE not an integer: {v}'\r\n // 'config() ROUNDING_MODE out of range: {v}'\r\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\r\n ROUNDING_MODE = v | 0;\r\n }\r\n r[p] = ROUNDING_MODE;\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // 'config() EXPONENTIAL_AT not an integer: {v}'\r\n // 'config() EXPONENTIAL_AT out of range: {v}'\r\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\r\n TO_EXP_NEG = v[0] | 0;\r\n TO_EXP_POS = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\r\n }\r\n }\r\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // 'config() RANGE not an integer: {v}'\r\n // 'config() RANGE cannot be zero: {v}'\r\n // 'config() RANGE out of range: {v}'\r\n if ( has( p = 'RANGE' ) ) {\r\n\r\n if ( isArray(v) ) {\r\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\r\n MIN_EXP = v[0] | 0;\r\n MAX_EXP = v[1] | 0;\r\n }\r\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\r\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\r\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\r\n }\r\n }\r\n r[p] = [ MIN_EXP, MAX_EXP ];\r\n\r\n // ERRORS {boolean|number} true, false, 1 or 0.\r\n // 'config() ERRORS not a boolean or binary digit: {v}'\r\n if ( has( p = 'ERRORS' ) ) {\r\n\r\n if ( v === !!v || v === 1 || v === 0 ) {\r\n id = 0;\r\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = ERRORS;\r\n\r\n // CRYPTO {boolean|number} true, false, 1 or 0.\r\n // 'config() CRYPTO not a boolean or binary digit: {v}'\r\n // 'config() crypto unavailable: {crypto}'\r\n if ( has( p = 'CRYPTO' ) ) {\r\n\r\n if ( v === true || v === false || v === 1 || v === 0 ) {\r\n if (v) {\r\n v = typeof crypto == 'undefined';\r\n if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = true;\r\n } else if (ERRORS) {\r\n raise( 2, 'crypto unavailable', v ? void 0 : crypto );\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else {\r\n CRYPTO = false;\r\n }\r\n } else if (ERRORS) {\r\n raise( 2, p + notBool, v );\r\n }\r\n }\r\n r[p] = CRYPTO;\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // 'config() MODULO_MODE not an integer: {v}'\r\n // 'config() MODULO_MODE out of range: {v}'\r\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\r\n MODULO_MODE = v | 0;\r\n }\r\n r[p] = MODULO_MODE;\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // 'config() POW_PRECISION not an integer: {v}'\r\n // 'config() POW_PRECISION out of range: {v}'\r\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\r\n POW_PRECISION = v | 0;\r\n }\r\n r[p] = POW_PRECISION;\r\n\r\n // FORMAT {object}\r\n // 'config() FORMAT not an object: {v}'\r\n if ( has( p = 'FORMAT' ) ) {\r\n\r\n if ( typeof v == 'object' ) {\r\n FORMAT = v;\r\n } else if (ERRORS) {\r\n raise( 2, p + ' not an object', v );\r\n }\r\n }\r\n r[p] = FORMAT;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * 'random() decimal places not an integer: {dp}'\r\n * 'random() decimal places out of range: {dp}'\r\n * 'random() crypto unavailable: {crypto}'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\r\n k = mathceil( dp / LOG_BASE );\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if ( v >= 9e15 ) {\r\n b = crypto.getRandomValues( new Uint32Array(2) );\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes( k *= 7 );\r\n\r\n for ( ; i < k; ) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\r\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\r\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\r\n\r\n if ( v >= 9e15 ) {\r\n crypto.randomBytes(7).copy( a, i );\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push( v % 1e14 );\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n if (ERRORS) raise( 14, 'crypto unavailable', crypto );\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for ( ; i < k; ) {\r\n v = random53bitInt();\r\n if ( v < 9e15 ) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if ( k && dp ) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor( k / v ) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for ( ; c[i] === 0; c.pop(), i-- );\r\n\r\n // Zero?\r\n if ( i < 0 ) {\r\n c = [ e = 0 ];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply( x, k, base ) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for ( x = x.slice(); i--; ) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\r\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare( a, b, aL, bL ) {\r\n var i, cmp;\r\n\r\n if ( aL != bL ) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for ( i = cmp = 0; i < aL; i++ ) {\r\n\r\n if ( a[i] != b[i] ) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n return cmp;\r\n }\r\n\r\n function subtract( a, b, aL, base ) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for ( ; aL--; ) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for ( ; !a[0] && a.length > 1; a.splice(0, 1) );\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function ( x, y, dp, rm, base ) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if ( !base ) {\r\n base = BASE;\r\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\r\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\r\n\r\n if ( s < 0 ) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor( base / ( yc[0] + 1 ) );\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\r\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\r\n if ( n > 1 ) {\r\n yc = multiply( yc, n, base );\r\n xc = multiply( xc, n, base );\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice( 0, yL );\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for ( ; remL < yL; rem[remL++] = 0 );\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if ( yc[1] >= base / 2 ) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare( yc, rem, yL, remL );\r\n\r\n // If divisor < remainder.\r\n if ( cmp < 0 ) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor( rem0 / yc0 );\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (n)\r\n // 2. if product > remainder: product -= divisor, n--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, n++\r\n\r\n if ( n > 1 ) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply( yc, n, base );\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder.\r\n // Trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if ( n == 0 ) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if ( prodL < remL ) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract( rem, prod, remL, base );\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if ( cmp == -1 ) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while ( compare( yc, rem, yL, remL ) < 1 ) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract( rem, yL < remL ? yz : yc, remL, base );\r\n remL = rem.length;\r\n }\r\n }\r\n } else if ( cmp === 0 ) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if ( rem[0] ) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [ xc[xi] ];\r\n remL = 1;\r\n }\r\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if ( !qc[0] ) qc.splice(0, 1);\r\n }\r\n\r\n if ( base == BASE ) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\r\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n is a BigNumber.\r\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm is the rounding mode.\r\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\r\n */\r\n function format( n, i, rm, caller ) {\r\n var c0, e, ne, len, str;\r\n\r\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\r\n ? rm | 0 : ROUNDING_MODE;\r\n\r\n if ( !n.c ) return n.toString();\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if ( i == null ) {\r\n str = coeffToString( n.c );\r\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\r\n ? toExponential( str, ne )\r\n : toFixedPoint( str, ne );\r\n } else {\r\n n = round( new BigNumber(n), i, rm );\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString( n.c );\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\r\n\r\n // Append zeros?\r\n for ( ; len < i; str += '0', len++ );\r\n str = toExponential( str, e );\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint( str, e );\r\n\r\n // Append zeros?\r\n if ( e + 1 > len ) {\r\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\r\n } else {\r\n i += e - len;\r\n if ( i > 0 ) {\r\n if ( e + 1 == len ) str += '.';\r\n for ( ; i--; str += '0' );\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n function maxOrMin( args, method ) {\r\n var m, n,\r\n i = 0;\r\n\r\n if ( isArray( args[0] ) ) args = args[0];\r\n m = new BigNumber( args[0] );\r\n\r\n for ( ; ++i < args.length; ) {\r\n n = new BigNumber( args[i] );\r\n\r\n // If any number is NaN, return NaN.\r\n if ( !n.s ) {\r\n m = n;\r\n break;\r\n } else if ( method.call( m, n ) ) {\r\n m = n;\r\n }\r\n }\r\n\r\n return m;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is an integer in range, otherwise throw.\r\n * Use for argument validation when ERRORS is true.\r\n */\r\n function intValidatorWithErrors( n, min, max, caller, name ) {\r\n if ( n < min || n > max || n != truncate(n) ) {\r\n raise( caller, ( name || 'decimal places' ) +\r\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\r\n }\r\n\r\n return true;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise( n, c, e ) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; !c[--j]; c.pop() );\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for ( j = c[0]; j >= 10; j /= 10, i++ );\r\n\r\n // Overflow?\r\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if ( e < MIN_EXP ) {\r\n\r\n // Zero.\r\n n.c = [ n.e = 0 ];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function ( x, str, num, b ) {\r\n var base,\r\n s = num ? str : str.replace( whitespaceOrPlus, '' );\r\n\r\n // No exception on ±Infinity or NaN.\r\n if ( isInfinityOrNaN.test(s) ) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if ( !num ) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\r\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\r\n }\r\n\r\n if ( str != s ) return new BigNumber( s, base );\r\n }\r\n\r\n // 'new BigNumber() not a number: {n}'\r\n // 'new BigNumber() not a base {b} number: {n}'\r\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n id = 0;\r\n }\r\n })();\r\n\r\n\r\n // Throw a BigNumber Error.\r\n function raise( caller, msg, val ) {\r\n var error = new Error( [\r\n 'new BigNumber', // 0\r\n 'cmp', // 1\r\n 'config', // 2\r\n 'div', // 3\r\n 'divToInt', // 4\r\n 'eq', // 5\r\n 'gt', // 6\r\n 'gte', // 7\r\n 'lt', // 8\r\n 'lte', // 9\r\n 'minus', // 10\r\n 'mod', // 11\r\n 'plus', // 12\r\n 'precision', // 13\r\n 'random', // 14\r\n 'round', // 15\r\n 'shift', // 16\r\n 'times', // 17\r\n 'toDigits', // 18\r\n 'toExponential', // 19\r\n 'toFixed', // 20\r\n 'toFormat', // 21\r\n 'toFraction', // 22\r\n 'pow', // 23\r\n 'toPrecision', // 24\r\n 'toString', // 25\r\n 'BigNumber' // 26\r\n ][caller] + '() ' + msg + ': ' + val );\r\n\r\n error.name = 'BigNumber Error';\r\n id = 0;\r\n throw error;\r\n }\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round( x, sd, rm, r ) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if ( i < 0 ) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ ni = 0 ];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\r\n } else {\r\n ni = mathceil( ( i + 1 ) / LOG_BASE );\r\n\r\n if ( ni >= xc.length ) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for ( ; xc.length <= ni; xc.push(0) );\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for ( d = 1; k >= 10; k /= 10, d++ );\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\r\n\r\n r = rm < 4\r\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( sd < 1 || !xc[0] ) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if ( i == 0 ) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[ LOG_BASE - i ];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for ( ; ; ) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if ( ni == 0 ) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\r\n j = xc[0] += k;\r\n for ( k = 1; j >= 10; j /= 10, k++ );\r\n\r\n // if i != k the length has increased.\r\n if ( i != k ) {\r\n x.e++;\r\n if ( xc[0] == BASE ) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if ( xc[ni] != BASE ) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\r\n }\r\n\r\n // Overflow? Infinity.\r\n if ( x.e > MAX_EXP ) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if ( x.e < MIN_EXP ) {\r\n x.c = [ x.e = 0 ];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if ( x.s < 0 ) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of Infinity.\r\n */\r\n P.ceil = function () {\r\n return round( new BigNumber(this), this.e + 1, 2 );\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = P.cmp = function ( y, b ) {\r\n id = 1;\r\n return compare( this, new BigNumber( y, b ) );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of decimal places of the value of this BigNumber, or null if the value\r\n * of this BigNumber is ±Infinity or NaN.\r\n */\r\n P.decimalPlaces = P.dp = function () {\r\n var n, v,\r\n c = this.c;\r\n\r\n if ( !c ) return null;\r\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\r\n if ( n < 0 ) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function ( y, b ) {\r\n id = 3;\r\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\r\n id = 4;\r\n return div( this, new BigNumber( y, b ), 0, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.equals = P.eq = function ( y, b ) {\r\n id = 5;\r\n return compare( this, new BigNumber( y, b ) ) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\r\n * number in the direction of -Infinity.\r\n */\r\n P.floor = function () {\r\n return round( new BigNumber(this), this.e + 1, 3 );\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.greaterThan = P.gt = function ( y, b ) {\r\n id = 6;\r\n return compare( this, new BigNumber( y, b ) ) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\r\n id = 7;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = P.isInt = function () {\r\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise returns false.\r\n */\r\n P.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise returns false.\r\n */\r\n P.lessThan = P.lt = function ( y, b ) {\r\n id = 8;\r\n return compare( this, new BigNumber( y, b ) ) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise returns false.\r\n */\r\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\r\n id = 9;\r\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = P.sub = function ( y, b ) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 10;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\r\n\r\n // Either zero?\r\n if ( !xc[0] || !yc[0] ) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0 );\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if ( a = xe - ye ) {\r\n\r\n if ( xLTy = a < 0 ) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for ( b = a; b--; t.push(0) );\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\r\n\r\n for ( a = b = 0; b < j; b++ ) {\r\n\r\n if ( xc[b] != yc[b] ) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\r\n\r\n b = ( j = yc.length ) - ( i = xc.length );\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for ( ; j > a; ) {\r\n\r\n if ( xc[--j] < yc[j] ) {\r\n for ( i = j; i && !xc[--i]; xc[i] = b );\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for ( ; xc[0] == 0; xc.splice(0, 1), --ye );\r\n\r\n // Zero?\r\n if ( !xc[0] ) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [ y.e = 0 ];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function ( y, b ) {\r\n var q, s,\r\n x = this;\r\n\r\n id = 11;\r\n y = new BigNumber( y, b );\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if ( !y.c || x.c && !x.c[0] ) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if ( MODULO_MODE == 9 ) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div( x, y, 0, 3 );\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div( x, y, 0, MODULO_MODE );\r\n }\r\n\r\n return x.minus( q.times(y) );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = P.neg = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = P.add = function ( y, b ) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n id = 12;\r\n y = new BigNumber( y, b );\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if ( !a || !b ) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if ( a != b ) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if ( !xe || !ye ) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if ( !xc || !yc ) return new BigNumber( a / 0 );\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if ( a = xe - ye ) {\r\n if ( a > 0 ) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for ( ; a--; t.push(0) );\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for ( a = 0; b; ) {\r\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise( y, xc, ye );\r\n };\r\n\r\n\r\n /*\r\n * Return the number of significant digits of the value of this BigNumber.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n */\r\n P.precision = P.sd = function (z) {\r\n var n, v,\r\n x = this,\r\n c = x.c;\r\n\r\n // 'precision() argument not a boolean or binary digit: {z}'\r\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\r\n if (ERRORS) raise( 13, 'argument' + notBool, z );\r\n if ( z != !!z ) z = null;\r\n }\r\n\r\n if ( !c ) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if ( v = c[v] ) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for ( ; v % 10 == 0; v /= 10, n-- );\r\n\r\n // Add the number of digits of the first element.\r\n for ( v = c[0]; v >= 10; v /= 10, n++ );\r\n }\r\n\r\n if ( z && x.e + 1 > n ) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\r\n * omitted.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'round() decimal places out of range: {dp}'\r\n * 'round() decimal places not an integer: {dp}'\r\n * 'round() rounding mode not an integer: {rm}'\r\n * 'round() rounding mode out of range: {rm}'\r\n */\r\n P.round = function ( dp, rm ) {\r\n var n = new BigNumber(this);\r\n\r\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\r\n round( n, ~~dp + this.e + 1, rm == null ||\r\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\r\n }\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\r\n * otherwise.\r\n *\r\n * 'shift() argument not an integer: {k}'\r\n * 'shift() argument out of range: {k}'\r\n */\r\n P.shift = function (k) {\r\n var n = this;\r\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\r\n\r\n // k < 1e+21, or truncate(k) will produce exponential notation.\r\n ? n.times( '1e' + truncate(k) )\r\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\r\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\r\n : n );\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt( N) = N\r\n * sqrt(-I) = N\r\n * sqrt( I) = I\r\n * sqrt( 0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if ( s !== 1 || !c || !c[0] ) {\r\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt( +x );\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if ( s == 0 || s == 1 / 0 ) {\r\n n = coeffToString(c);\r\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\r\n s = Math.sqrt(n);\r\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\r\n\r\n if ( s == 1 / 0 ) {\r\n n = '1e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber( s + '' );\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if ( r.c[0] ) {\r\n e = r.e;\r\n s = e + dp;\r\n if ( s < 3 ) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for ( ; ; ) {\r\n t = r;\r\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\r\n\r\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\r\n coeffToString( r.c ) ).slice( 0, s ) ) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if ( r.e < e ) --s;\r\n n = n.slice( s - 3, s + 1 );\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if ( n == '9999' || !rep && n == '4999' ) {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if ( !rep ) {\r\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\r\n\r\n if ( t.times(t).eq(x) ) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\r\n\r\n // Truncate to the first rounding digit.\r\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\r\n * BigNumber(y, b).\r\n */\r\n P.times = P.mul = function ( y, b ) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if ( !xc || !yc ) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\r\n\r\n // Initialise the result array with zeros.\r\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for ( i = ycL; --i >= 0; ) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for ( k = xcL, j = i + k; j > i; ) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\r\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise( y, zc, e );\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\r\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toDigits() precision out of range: {sd}'\r\n * 'toDigits() precision not an integer: {sd}'\r\n * 'toDigits() rounding mode not an integer: {rm}'\r\n * 'toDigits() rounding mode out of range: {rm}'\r\n */\r\n P.toDigits = function ( sd, rm ) {\r\n var n = new BigNumber(this);\r\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\r\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\r\n return sd ? round( n, sd, rm ) : n;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toExponential() decimal places not an integer: {dp}'\r\n * 'toExponential() decimal places out of range: {dp}'\r\n * 'toExponential() rounding mode not an integer: {rm}'\r\n * 'toExponential() rounding mode out of range: {rm}'\r\n */\r\n P.toExponential = function ( dp, rm ) {\r\n return format( this,\r\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFixed() decimal places not an integer: {dp}'\r\n * 'toFixed() decimal places out of range: {dp}'\r\n * 'toFixed() rounding mode not an integer: {rm}'\r\n * 'toFixed() rounding mode out of range: {rm}'\r\n */\r\n P.toFixed = function ( dp, rm ) {\r\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\r\n ? ~~dp + this.e + 1 : null, rm, 20 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the FORMAT object (see BigNumber.config).\r\n *\r\n * FORMAT = {\r\n * decimalSeparator : '.',\r\n * groupSeparator : ',',\r\n * groupSize : 3,\r\n * secondaryGroupSize : 0,\r\n * fractionGroupSeparator : '\\xA0', // non-breaking space\r\n * fractionGroupSize : 0\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toFormat() decimal places not an integer: {dp}'\r\n * 'toFormat() decimal places out of range: {dp}'\r\n * 'toFormat() rounding mode not an integer: {rm}'\r\n * 'toFormat() rounding mode out of range: {rm}'\r\n */\r\n P.toFormat = function ( dp, rm ) {\r\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\r\n ? ~~dp + this.e + 1 : null, rm, 21 );\r\n\r\n if ( this.c ) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +FORMAT.groupSize,\r\n g2 = +FORMAT.secondaryGroupSize,\r\n groupSeparator = FORMAT.groupSeparator,\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = this.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\r\n\r\n if ( g1 > 0 && len > 0 ) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr( 0, i );\r\n\r\n for ( ; i < len; i += g1 ) {\r\n intPart += groupSeparator + intDigits.substr( i, g1 );\r\n }\r\n\r\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\r\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\r\n '$&' + FORMAT.fractionGroupSeparator )\r\n : fractionPart )\r\n : intPart;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a string array representing the value of this BigNumber as a simple fraction with\r\n * an integer numerator and an integer denominator. The denominator will be a positive\r\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\r\n * denominator is not specified, the denominator will be the lowest value necessary to\r\n * represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\r\n *\r\n * 'toFraction() max denominator not an integer: {md}'\r\n * 'toFraction() max denominator out of range: {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var arr, d0, d2, e, exp, n, n0, q, s,\r\n k = ERRORS,\r\n x = this,\r\n xc = x.c,\r\n d = new BigNumber(ONE),\r\n n1 = d0 = new BigNumber(ONE),\r\n d1 = n0 = new BigNumber(ONE);\r\n\r\n if ( md != null ) {\r\n ERRORS = false;\r\n n = new BigNumber(md);\r\n ERRORS = k;\r\n\r\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\r\n\r\n if (ERRORS) {\r\n raise( 22,\r\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\r\n }\r\n\r\n // ERRORS is false:\r\n // If md is a finite non-integer >= 1, round it to an integer and use it.\r\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\r\n }\r\n }\r\n\r\n if ( !xc ) return x.toString();\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\r\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for ( ; ; ) {\r\n q = div( n, d, 0, 1 );\r\n d2 = d0.plus( q.times(d1) );\r\n if ( d2.cmp(md) == 1 ) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus( q.times( d2 = n1 ) );\r\n n0 = d2;\r\n d = n.minus( q.times( d2 = d ) );\r\n n = d2;\r\n }\r\n\r\n d2 = div( md.minus(d0), d1, 0, 1 );\r\n n0 = n0.plus( d2.times(n1) );\r\n d0 = d0.plus( d2.times(d1) );\r\n n0.s = n1.s = x.s;\r\n e *= 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\r\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\r\n ? [ n1.toString(), d1.toString() ]\r\n : [ n0.toString(), d0.toString() ];\r\n\r\n MAX_EXP = exp;\r\n return arr;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +this;\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using\r\n * ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are positive integers,\r\n * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).\r\n *\r\n * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * 'pow() exponent not an integer: {n}'\r\n * 'pow() exponent out of range: {n}'\r\n *\r\n * Performs 54 loop iterations for n of 9007199254740991.\r\n */\r\n P.toPower = P.pow = function ( n, m ) {\r\n var k, y, z,\r\n i = mathfloor( n < 0 ? -n : +n ),\r\n x = this;\r\n\r\n if ( m != null ) {\r\n id = 23;\r\n m = new BigNumber(m);\r\n }\r\n\r\n // Pass ±Infinity to Math.pow if exponent is out of range.\r\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\r\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\r\n parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {\r\n k = Math.pow( +x, n );\r\n return new BigNumber( m ? k % m : k );\r\n }\r\n\r\n if (m) {\r\n if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {\r\n x = x.mod(m);\r\n } else {\r\n z = m;\r\n\r\n // Nullify m so only a single mod operation is performed at the end.\r\n m = null;\r\n }\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n // (Using + 1.5 would give [9, 21] guard digits.)\r\n k = mathceil( POW_PRECISION / LOG_BASE + 2 );\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n for ( ; ; ) {\r\n if ( i % 2 ) {\r\n y = y.times(x);\r\n if ( !y.c ) break;\r\n if (k) {\r\n if ( y.c.length > k ) y.c.length = k;\r\n } else if (m) {\r\n y = y.mod(m);\r\n }\r\n }\r\n\r\n i = mathfloor( i / 2 );\r\n if ( !i ) break;\r\n x = x.times(x);\r\n if (k) {\r\n if ( x.c && x.c.length > k ) x.c.length = k;\r\n } else if (m) {\r\n x = x.mod(m);\r\n }\r\n }\r\n\r\n if (m) return y;\r\n if ( n < 0 ) y = ONE.div(y);\r\n\r\n return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toPrecision() precision not an integer: {sd}'\r\n * 'toPrecision() precision out of range: {sd}'\r\n * 'toPrecision() rounding mode not an integer: {rm}'\r\n * 'toPrecision() rounding mode out of range: {rm}'\r\n */\r\n P.toPrecision = function ( sd, rm ) {\r\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\r\n ? sd | 0 : null, rm, 24 );\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to 64 inclusive.\r\n *\r\n * 'toString() base not an integer: {b}'\r\n * 'toString() base out of range: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if ( e === null ) {\r\n\r\n if (s) {\r\n str = 'Infinity';\r\n if ( s < 0 ) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n str = coeffToString( n.c );\r\n\r\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n } else {\r\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\r\n }\r\n\r\n if ( s < 0 && n.c[0] ) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\r\n * number.\r\n */\r\n P.truncated = P.trunc = function () {\r\n return round( new BigNumber(this), this.e + 1, 1 );\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n var str,\r\n n = this,\r\n e = n.e;\r\n\r\n if ( e === null ) return n.toString();\r\n\r\n str = coeffToString( n.c );\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential( str, e )\r\n : toFixedPoint( str, e );\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n };\r\n\r\n\r\n P.isBigNumber = true;\r\n\r\n if ( config != null ) BigNumber.config(config);\r\n\r\n return BigNumber;\r\n }\r\n\r\n\r\n // PRIVATE HELPER FUNCTIONS\r\n\r\n\r\n function bitFloor(n) {\r\n var i = n | 0;\r\n return n > 0 || n === i ? i : i - 1;\r\n }\r\n\r\n\r\n // Return a coefficient array as a string of base 10 digits.\r\n function coeffToString(a) {\r\n var s, z,\r\n i = 1,\r\n j = a.length,\r\n r = a[0] + '';\r\n\r\n for ( ; i < j; ) {\r\n s = a[i++] + '';\r\n z = LOG_BASE - s.length;\r\n for ( ; z--; s = '0' + s );\r\n r += s;\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( j = r.length; r.charCodeAt(--j) === 48; );\r\n return r.slice( 0, j + 1 || 1 );\r\n }\r\n\r\n\r\n // Compare the value of BigNumbers x and y.\r\n function compare( x, y ) {\r\n var a, b,\r\n xc = x.c,\r\n yc = y.c,\r\n i = x.s,\r\n j = y.s,\r\n k = x.e,\r\n l = y.e;\r\n\r\n // Either NaN?\r\n if ( !i || !j ) return null;\r\n\r\n a = xc && !xc[0];\r\n b = yc && !yc[0];\r\n\r\n // Either zero?\r\n if ( a || b ) return a ? b ? 0 : -j : i;\r\n\r\n // Signs differ?\r\n if ( i != j ) return i;\r\n\r\n a = i < 0;\r\n b = k == l;\r\n\r\n // Either Infinity?\r\n if ( !xc || !yc ) return b ? 0 : !xc ^ a ? 1 : -1;\r\n\r\n // Compare exponents.\r\n if ( !b ) return k > l ^ a ? 1 : -1;\r\n\r\n j = ( k = xc.length ) < ( l = yc.length ) ? k : l;\r\n\r\n // Compare digit by digit.\r\n for ( i = 0; i < j; i++ ) if ( xc[i] != yc[i] ) return xc[i] > yc[i] ^ a ? 1 : -1;\r\n\r\n // Compare lengths.\r\n return k == l ? 0 : k > l ^ a ? 1 : -1;\r\n }\r\n\r\n\r\n /*\r\n * Return true if n is a valid number in range, otherwise false.\r\n * Use for argument validation when ERRORS is false.\r\n * Note: parseInt('1e+1') == 1 but parseFloat('1e+1') == 10.\r\n */\r\n function intValidatorNoErrors( n, min, max ) {\r\n return ( n = truncate(n) ) >= min && n <= max;\r\n }\r\n\r\n\r\n function isArray(obj) {\r\n return Object.prototype.toString.call(obj) == '[object Array]';\r\n }\r\n\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. convertBase('255', 10, 16) returns [15, 15].\r\n * Eg. convertBase('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut( str, baseIn, baseOut ) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for ( ; i < len; ) {\r\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\r\n for ( ; j < arr.length; j++ ) {\r\n\r\n if ( arr[j] > baseOut - 1 ) {\r\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n\r\n function toExponential( str, e ) {\r\n return ( str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str ) +\r\n ( e < 0 ? 'e' : 'e+' ) + e;\r\n }\r\n\r\n\r\n function toFixedPoint( str, e ) {\r\n var len, z;\r\n\r\n // Negative exponent?\r\n if ( e < 0 ) {\r\n\r\n // Prepend zeros.\r\n for ( z = '0.'; ++e; z += '0' );\r\n str = z + str;\r\n\r\n // Positive exponent\r\n } else {\r\n len = str.length;\r\n\r\n // Append zeros.\r\n if ( ++e > len ) {\r\n for ( z = '0', e -= len; --e; z += '0' );\r\n str += z;\r\n } else if ( e < len ) {\r\n str = str.slice( 0, e ) + '.' + str.slice(e);\r\n }\r\n }\r\n\r\n return str;\r\n }\r\n\r\n\r\n function truncate(n) {\r\n n = parseFloat(n);\r\n return n < 0 ? mathceil(n) : mathfloor(n);\r\n }\r\n\r\n\r\n // EXPORT\r\n\r\n\r\n BigNumber = constructorFactory();\r\n BigNumber['default'] = BigNumber.BigNumber = BigNumber;\r\n\r\n\r\n // AMD.\r\n if ( typeof define == 'function' && define.amd ) {\r\n define( function () { return BigNumber; } );\r\n\r\n // Node.js and other environments that support module.exports.\r\n } else if ( typeof module != 'undefined' && module.exports ) {\r\n module.exports = BigNumber;\r\n\r\n // Browser.\r\n } else {\r\n if ( !globalObj ) globalObj = typeof self != 'undefined' ? self : Function('return this')();\r\n globalObj.BigNumber = BigNumber;\r\n }\r\n})(this);\r\n","/*!\n * Copyright (c) 2017 Benjamin Van Ryseghem\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nmodule.exports = {\n languageTag: \"en-US\",\n delimiters: {\n thousands: \",\",\n decimal: \".\"\n },\n abbreviations: {\n thousand: \"k\",\n million: \"m\",\n billion: \"b\",\n trillion: \"t\"\n },\n spaceSeparated: false,\n ordinal: function(number) {\n let b = number % 10;\n return (~~(number % 100 / 10) === 1) ? \"th\" : (b === 1) ? \"st\" : (b === 2) ? \"nd\" : (b === 3) ? \"rd\" : \"th\";\n },\n currency: {\n symbol: \"$\",\n position: \"prefix\",\n code: \"USD\"\n },\n currencyFormat: {\n thousandSeparated: true,\n totalLength: 4,\n spaceSeparated: true\n },\n formats: {\n fourDigits: {\n totalLength: 4,\n spaceSeparated: true\n },\n fullWithTwoDecimals: {\n output: \"currency\",\n thousandSeparated: true,\n mantissa: 2\n },\n fullWithTwoDecimalsNoCurrency: {\n thousandSeparated: true,\n mantissa: 2\n },\n fullWithNoDecimals: {\n output: \"currency\",\n thousandSeparated: true,\n mantissa: 0\n }\n }\n};\n","/*!\n * Copyright (c) 2017 Benjamin Van Ryseghem\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst globalState = require(\"./globalState\");\nconst validating = require(\"./validating\");\nconst parsing = require(\"./parsing\");\n\nconst binarySuffixes = [\"B\", \"KiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\", \"EiB\", \"ZiB\", \"YiB\"];\nconst decimalSuffixes = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"];\nconst bytes = {\n general: {scale: 1024, suffixes: decimalSuffixes, marker: \"bd\"},\n binary: {scale: 1024, suffixes: binarySuffixes, marker: \"b\"},\n decimal: {scale: 1000, suffixes: decimalSuffixes, marker: \"d\"}\n};\n\nconst defaultOptions = {\n totalLength: 0,\n characteristic: 0,\n forceAverage: false,\n average: false,\n mantissa: -1,\n optionalMantissa: true,\n thousandSeparated: false,\n spaceSeparated: false,\n negative: \"sign\",\n forceSign: false\n};\n\n/**\n * Entry point. Format the provided INSTANCE according to the PROVIDEDFORMAT.\n * This method ensure the prefix and postfix are added as the last step.\n *\n * @param {Numbro} instance - numbro instance to format\n * @param {NumbroFormat|string} [providedFormat] - specification for formatting\n * @param numbro - the numbro singleton\n * @return {string}\n */\nfunction format(instance, providedFormat = {}, numbro) {\n if (typeof providedFormat === \"string\") {\n providedFormat = parsing.parseFormat(providedFormat);\n }\n\n let valid = validating.validateFormat(providedFormat);\n\n if (!valid) {\n return \"ERROR: invalid format\";\n }\n\n let prefix = providedFormat.prefix || \"\";\n let postfix = providedFormat.postfix || \"\";\n\n let output = formatNumbro(instance, providedFormat, numbro);\n output = insertPrefix(output, prefix);\n output = insertPostfix(output, postfix);\n return output;\n}\n\n/**\n * Format the provided INSTANCE according to the PROVIDEDFORMAT.\n *\n * @param {Numbro} instance - numbro instance to format\n * @param {{}} providedFormat - specification for formatting\n * @param numbro - the numbro singleton\n * @return {string}\n */\nfunction formatNumbro(instance, providedFormat, numbro) {\n switch (providedFormat.output) {\n case \"currency\": {\n providedFormat = formatOrDefault(providedFormat, globalState.currentCurrencyDefaultFormat());\n return formatCurrency(instance, providedFormat, globalState, numbro);\n }\n case \"percent\": {\n providedFormat = formatOrDefault(providedFormat, globalState.currentPercentageDefaultFormat());\n return formatPercentage(instance, providedFormat, globalState, numbro);\n }\n case \"byte\":\n providedFormat = formatOrDefault(providedFormat, globalState.currentByteDefaultFormat());\n return formatByte(instance, providedFormat, globalState, numbro);\n case \"time\":\n providedFormat = formatOrDefault(providedFormat, globalState.currentTimeDefaultFormat());\n return formatTime(instance, providedFormat, globalState, numbro);\n case \"ordinal\":\n providedFormat = formatOrDefault(providedFormat, globalState.currentOrdinalDefaultFormat());\n return formatOrdinal(instance, providedFormat, globalState, numbro);\n case \"number\":\n default:\n return formatNumber({\n instance,\n providedFormat,\n numbro\n });\n }\n}\n\n/**\n * Get the decimal byte unit (MB) for the provided numbro INSTANCE.\n * We go from one unit to another using the decimal system (1000).\n *\n * @param {Numbro} instance - numbro instance to compute\n * @return {String}\n */\nfunction getDecimalByteUnit(instance) {\n let data = bytes.decimal;\n return getFormatByteUnits(instance._value, data.suffixes, data.scale).suffix;\n}\n\n/**\n * Get the binary byte unit (MiB) for the provided numbro INSTANCE.\n * We go from one unit to another using the decimal system (1024).\n *\n * @param {Numbro} instance - numbro instance to compute\n * @return {String}\n */\nfunction getBinaryByteUnit(instance) {\n let data = bytes.binary;\n return getFormatByteUnits(instance._value, data.suffixes, data.scale).suffix;\n}\n\n/**\n * Get the decimal byte unit (MB) for the provided numbro INSTANCE.\n * We go from one unit to another using the decimal system (1024).\n *\n * @param {Numbro} instance - numbro instance to compute\n * @return {String}\n */\nfunction getByteUnit(instance) {\n let data = bytes.general;\n return getFormatByteUnits(instance._value, data.suffixes, data.scale).suffix;\n}\n\n/**\n * Return the value and the suffix computed in byte.\n * It uses the SUFFIXES and the SCALE provided.\n *\n * @param {number} value - Number to format\n * @param {[String]} suffixes - List of suffixes\n * @param {number} scale - Number in-between two units\n * @return {{value: Number, suffix: String}}\n */\nfunction getFormatByteUnits(value, suffixes, scale) {\n let suffix = suffixes[0];\n let abs = Math.abs(value);\n\n if (abs >= scale) {\n for (let power = 1; power < suffixes.length; ++power) {\n let min = Math.pow(scale, power);\n let max = Math.pow(scale, power + 1);\n\n if (abs >= min && abs < max) {\n suffix = suffixes[power];\n value = value / min;\n break;\n }\n }\n\n // values greater than or equal to [scale] YB never set the suffix\n if (suffix === suffixes[0]) {\n value = value / Math.pow(scale, suffixes.length - 1);\n suffix = suffixes[suffixes.length - 1];\n }\n }\n\n return {value, suffix};\n}\n\n/**\n * Format the provided INSTANCE as bytes using the PROVIDEDFORMAT, and STATE.\n *\n * @param {Numbro} instance - numbro instance to format\n * @param {{}} providedFormat - specification for formatting\n * @param {globalState} state - shared state of the library\n * @param numbro - the numbro singleton\n * @return {string}\n */\nfunction formatByte(instance, providedFormat, state, numbro) {\n let base = providedFormat.base || \"binary\";\n let baseInfo = bytes[base];\n\n let {value, suffix} = getFormatByteUnits(instance._value, baseInfo.suffixes, baseInfo.scale);\n let output = formatNumber({\n instance: numbro(value),\n providedFormat,\n state,\n defaults: state.currentByteDefaultFormat()\n });\n let abbreviations = state.currentAbbreviations();\n return `${output}${abbreviations.spaced ? \" \" : \"\"}${suffix}`;\n}\n\n/**\n * Format the provided INSTANCE as an ordinal using the PROVIDEDFORMAT,\n * and the STATE.\n *\n * @param {Numbro} instance - numbro instance to format\n * @param {{}} providedFormat - specification for formatting\n * @param {globalState} state - shared state of the library\n * @return {string}\n */\nfunction formatOrdinal(instance, providedFormat, state) {\n let ordinalFn = state.currentOrdinal();\n let options = Object.assign({}, defaultOptions, providedFormat);\n\n let output = formatNumber({\n instance,\n providedFormat,\n state\n });\n let ordinal = ordinalFn(instance._value);\n\n return `${output}${options.spaceSeparated ? \" \" : \"\"}${ordinal}`;\n}\n\n/**\n * Format the provided INSTANCE as a time HH:MM:SS.\n *\n * @param {Numbro} instance - numbro instance to format\n * @return {string}\n */\nfunction formatTime(instance) {\n let hours = Math.floor(instance._value / 60 / 60);\n let minutes = Math.floor((instance._value - (hours * 60 * 60)) / 60);\n let seconds = Math.round(instance._value - (hours * 60 * 60) - (minutes * 60));\n return `${hours}:${(minutes < 10) ? \"0\" : \"\"}${minutes}:${(seconds < 10) ? \"0\" : \"\"}${seconds}`;\n}\n\n/**\n * Format the provided INSTANCE as a percentage using the PROVIDEDFORMAT,\n * and the STATE.\n *\n * @param {Numbro} instance - numbro instance to format\n * @param {{}} providedFormat - specification for formatting\n * @param {globalState} state - shared state of the library\n * @param numbro - the numbro singleton\n * @return {string}\n */\nfunction formatPercentage(instance, providedFormat, state, numbro) {\n let prefixSymbol = providedFormat.prefixSymbol;\n\n let output = formatNumber({\n instance: numbro(instance._value * 100),\n providedFormat,\n state\n });\n let options = Object.assign({}, defaultOptions, providedFormat);\n\n if (prefixSymbol) {\n return `%${options.spaceSeparated ? \" \" : \"\"}${output}`;\n }\n\n return `${output}${options.spaceSeparated ? \" \" : \"\"}%`;\n}\n\n/**\n * Format the provided INSTANCE as a percentage using the PROVIDEDFORMAT,\n * and the STATE.\n *\n * @param {Numbro} instance - numbro instance to format\n * @param {{}} providedFormat - specification for formatting\n * @param {globalState} state - shared state of the library\n * @return {string}\n */\nfunction formatCurrency(instance, providedFormat, state) {\n const currentCurrency = state.currentCurrency();\n let options = Object.assign({}, defaultOptions, providedFormat);\n let decimalSeparator = undefined;\n let space = \"\";\n let average = !!options.totalLength || !!options.forceAverage || options.average;\n\n if (options.spaceSeparated) {\n space = \" \";\n }\n\n if (currentCurrency.position === \"infix\") {\n decimalSeparator = space + currentCurrency.symbol + space;\n }\n\n let output = formatNumber({\n instance,\n providedFormat,\n state,\n decimalSeparator\n });\n\n if (currentCurrency.position === \"prefix\") {\n if (instance._value < 0 && options.negative === \"sign\") {\n output = `-${space}${currentCurrency.symbol}${output.slice(1)}`;\n } else {\n output = currentCurrency.symbol + space + output;\n }\n }\n\n if (!currentCurrency.position || currentCurrency.position === \"postfix\") {\n space = average ? \"\" : space;\n output = output + space + currentCurrency.symbol;\n }\n\n return output;\n}\n\n/**\n * Compute the average value out of VALUE.\n * The other parameters are computation options.\n *\n * @param {number} value - value to compute\n * @param {string} [forceAverage] - forced unit used to compute\n * @param {{}} abbreviations - part of the language specification\n * @param {boolean} spaceSeparated - `true` if a space must be inserted between the value and the abbreviation\n * @param {number} [totalLength] - total length of the output including the characteristic and the mantissa\n * @return {{value: number, abbreviation: string, mantissaPrecision: number}}\n */\nfunction computeAverage({value, forceAverage, abbreviations, spaceSeparated = false, totalLength = 0}) {\n let abbreviation = \"\";\n let abs = Math.abs(value);\n let mantissaPrecision = -1;\n\n if ((abs >= Math.pow(10, 12) && !forceAverage) || (forceAverage === \"trillion\")) {\n // trillion\n abbreviation = abbreviations.trillion;\n value = value / Math.pow(10, 12);\n } else if ((abs < Math.pow(10, 12) && abs >= Math.pow(10, 9) && !forceAverage) || (forceAverage === \"billion\")) {\n // billion\n abbreviation = abbreviations.billion;\n value = value / Math.pow(10, 9);\n } else if ((abs < Math.pow(10, 9) && abs >= Math.pow(10, 6) && !forceAverage) || (forceAverage === \"million\")) {\n // million\n abbreviation = abbreviations.million;\n value = value / Math.pow(10, 6);\n } else if ((abs < Math.pow(10, 6) && abs >= Math.pow(10, 3) && !forceAverage) || (forceAverage === \"thousand\")) {\n // thousand\n abbreviation = abbreviations.thousand;\n value = value / Math.pow(10, 3);\n }\n\n let optionalSpace = spaceSeparated ? \" \" : \"\";\n\n if (abbreviation) {\n abbreviation = optionalSpace + abbreviation;\n }\n\n if (totalLength) {\n let characteristic = value.toString().split(\".\")[0];\n mantissaPrecision = Math.max(totalLength - characteristic.length, 0);\n }\n\n return {value, abbreviation, mantissaPrecision};\n}\n\n/**\n * Compute an exponential form for VALUE, taking into account CHARACTERISTIC\n * if provided.\n * @param {number} value - value to compute\n * @param {number} [characteristicPrecision] - optional characteristic length\n * @return {{value: number, abbreviation: string}}\n */\nfunction computeExponential({value, characteristicPrecision = 0}) {\n let [numberString, exponential] = value.toExponential().split(\"e\");\n let number = +numberString;\n\n if (!characteristicPrecision) {\n return {\n value: number,\n abbreviation: `e${exponential}`\n };\n }\n\n let characteristicLength = 1; // see `toExponential`\n\n if (characteristicLength < characteristicPrecision) {\n number = number * Math.pow(10, characteristicPrecision - characteristicLength);\n exponential = +exponential - (characteristicPrecision - characteristicLength);\n exponential = exponential >= 0 ? `+${exponential}` : exponential;\n }\n\n return {\n value: number,\n abbreviation: `e${exponential}`\n };\n}\n\n/**\n * Return a string of NUMBER zero.\n *\n * @param {number} number - Length of the output\n * @return {string}\n */\nfunction zeroes(number) {\n let result = \"\";\n for (let i = 0; i < number; i++) {\n result += \"0\";\n }\n\n return result;\n}\n\n/**\n * Return a string representing VALUE with a PRECISION-long mantissa.\n * This method is for large/small numbers only (a.k.a. including a \"e\").\n *\n * @param {number} value - number to precise\n * @param {number} precision - desired length for the mantissa\n * @return {string}\n */\nfunction toFixedLarge(value, precision) {\n let result = value.toString();\n\n let [base, exp] = result.split(\"e\");\n\n let [characteristic, mantissa = \"\"] = base.split(\".\");\n\n if (+exp > 0) {\n result = characteristic + mantissa + zeroes(exp - mantissa.length);\n } else {\n let prefix = \".\";\n\n if (+characteristic < 0) {\n prefix = `-0${prefix}`;\n } else {\n prefix = `0${prefix}`;\n }\n\n let suffix = (zeroes(-exp - 1) + Math.abs(characteristic) + mantissa).substr(0, precision);\n if (suffix.length < precision) {\n suffix += zeroes(precision - suffix.length);\n }\n result = prefix + suffix;\n }\n\n if (+exp > 0 && precision > 0) {\n result += `.${zeroes(precision)}`;\n }\n\n return result;\n}\n\n/**\n * Return a string representing VALUE with a PRECISION-long mantissa.\n *\n * @param {number} value - number to precise\n * @param {number} precision - desired length for the mantissa\n * @return {string}\n */\nfunction toFixed(value, precision) {\n if (value.toString().indexOf(\"e\") !== -1) {\n return toFixedLarge(value, precision);\n }\n\n return (Math.round(+`${value}e+${precision}`) / (Math.pow(10, precision))).toFixed(precision);\n}\n\n/**\n * Return the current OUTPUT with a mantissa precions of PRECISION.\n *\n * @param {string} output - output being build in the process of formatting\n * @param {number} value - number being currently formatted\n * @param {boolean} optionalMantissa - `true` if the mantissa is omitted when it's only zeroes\n * @param {number} precision - desired precision of the mantissa\n * @return {string}\n */\nfunction setMantissaPrecision(output, value, optionalMantissa, precision) {\n if (precision === -1) {\n return output;\n }\n\n let result = toFixed(value, precision);\n let [currentCharacteristic, currentMantissa = \"\"] = result.toString().split(\".\");\n\n if (currentMantissa.match(/^0+$/) && optionalMantissa) {\n return currentCharacteristic;\n }\n\n return result.toString();\n}\n\n/**\n * Return the current OUTPUT with a characteristic precions of PRECISION.\n *\n * @param {string} output - output being build in the process of formatting\n * @param {number} value - number being currently formatted\n * @param {boolean} optionalCharacteristic - `true` if the characteristic is omitted when it's only zeroes\n * @param {number} precision - desired precision of the characteristic\n * @return {string}\n */\nfunction setCharacteristicPrecision(output, value, optionalCharacteristic, precision) {\n let result = output;\n let [currentCharacteristic, currentMantissa] = result.toString().split(\".\");\n\n if (currentCharacteristic.match(/^-?0$/) && optionalCharacteristic) {\n if (!currentMantissa) {\n return currentCharacteristic.replace(\"0\", \"\");\n }\n\n return `${currentCharacteristic.replace(\"0\", \"\")}.${currentMantissa}`;\n }\n\n if (currentCharacteristic.length < precision) {\n let missingZeros = precision - currentCharacteristic.length;\n for (let i = 0; i < missingZeros; i++) {\n result = `0${result}`;\n }\n }\n\n return result.toString();\n}\n\n/**\n * Return the indexes where are the group separations after splitting\n * `totalLength` in group of `groupSize` size.\n * Important: we start grouping from the right hand side.\n *\n * @param {number} totalLength - total length of the characteristic to split\n * @param {number} groupSize - length of each group\n * @return {[number]}\n */\nfunction indexesOfGroupSpaces(totalLength, groupSize) {\n let result = [];\n let counter = 0;\n for (let i = totalLength; i > 0; i--) {\n if (counter === groupSize) {\n result.unshift(i);\n counter = 0;\n }\n counter++;\n }\n\n return result;\n}\n\n/**\n * Replace the decimal separator with DECIMALSEPARATOR and insert thousand\n * separators.\n *\n * @param {string} output - output being build in the process of formatting\n * @param {number} value - number being currently formatted\n * @param {boolean} thousandSeparated - `true` if the characteristic must be separated\n * @param {globalState} state - shared state of the library\n * @param {string} decimalSeparator - string to use as decimal separator\n * @return {string}\n */\nfunction replaceDelimiters(output, value, thousandSeparated, state, decimalSeparator) {\n let delimiters = state.currentDelimiters();\n let thousandSeparator = delimiters.thousands;\n decimalSeparator = decimalSeparator || delimiters.decimal;\n let thousandsSize = delimiters.thousandsSize || 3;\n\n let result = output.toString();\n let characteristic = result.split(\".\")[0];\n let mantissa = result.split(\".\")[1];\n\n if (thousandSeparated) {\n if (value < 0) {\n // Remove the minus sign\n characteristic = characteristic.slice(1);\n }\n\n let indexesToInsertThousandDelimiters = indexesOfGroupSpaces(characteristic.length, thousandsSize);\n indexesToInsertThousandDelimiters.forEach((position, index) => {\n characteristic = characteristic.slice(0, position + index) + thousandSeparator + characteristic.slice(position + index);\n });\n\n if (value < 0) {\n // Add back the minus sign\n characteristic = `-${characteristic}`;\n }\n }\n\n if (!mantissa) {\n result = characteristic;\n } else {\n result = characteristic + decimalSeparator + mantissa;\n }\n return result;\n}\n\n/**\n * Insert the provided ABBREVIATION at the end of OUTPUT.\n *\n * @param {string} output - output being build in the process of formatting\n * @param {string} abbreviation - abbreviation to append\n * @return {*}\n */\nfunction insertAbbreviation(output, abbreviation) {\n return output + abbreviation;\n}\n\n/**\n * Insert the positive/negative sign according to the NEGATIVE flag.\n * If the value is negative but still output as 0, the negative sign is removed.\n *\n * @param {string} output - output being build in the process of formatting\n * @param {number} value - number being currently formatted\n * @param {string} negative - flag for the negative form (\"sign\" or \"parenthesis\")\n * @return {*}\n */\nfunction insertSign(output, value, negative) {\n if (value === 0) {\n return output;\n }\n\n if (+output === 0) {\n return output.replace(\"-\", \"\");\n }\n\n if (value > 0) {\n return `+${output}`;\n }\n\n if (negative === \"sign\") {\n return output;\n }\n\n return `(${output.replace(\"-\", \"\")})`;\n}\n\n/**\n * Insert the provided PREFIX at the start of OUTPUT.\n *\n * @param {string} output - output being build in the process of formatting\n * @param {string} prefix - abbreviation to prepend\n * @return {*}\n */\nfunction insertPrefix(output, prefix) {\n return prefix + output;\n}\n\n/**\n * Insert the provided POSTFIX at the end of OUTPUT.\n *\n * @param {string} output - output being build in the process of formatting\n * @param {string} postfix - abbreviation to append\n * @return {*}\n */\nfunction insertPostfix(output, postfix) {\n return output + postfix;\n}\n\n/**\n * Format the provided INSTANCE as a number using the PROVIDEDFORMAT,\n * and the STATE.\n * This is the key method of the framework!\n *\n * @param {Numbro} instance - numbro instance to format\n * @param {{}} [providedFormat] - specification for formatting\n * @param {globalState} state - shared state of the library\n * @param {string} decimalSeparator - string to use as decimal separator\n * @param {{}} defaults - Set of default values used for formatting\n * @return {string}\n */\nfunction formatNumber({instance, providedFormat, state = globalState, decimalSeparator, defaults = state.currentDefaults()}) {\n let value = instance._value;\n\n if (value === 0 && state.hasZeroFormat()) {\n return state.getZeroFormat();\n }\n\n if (!isFinite(value)) {\n return value.toString();\n }\n\n let options = Object.assign({}, defaultOptions, defaults, providedFormat);\n\n let totalLength = options.totalLength;\n let characteristicPrecision = totalLength ? 0 : options.characteristic;\n let optionalCharacteristic = options.optionalCharacteristic;\n let forceAverage = options.forceAverage;\n let average = !!totalLength || !!forceAverage || options.average;\n\n // default when averaging is to chop off decimals\n let mantissaPrecision = totalLength ? -1 : (average && providedFormat.mantissa === undefined ? 0 : options.mantissa);\n let optionalMantissa = totalLength ? false : options.optionalMantissa;\n let thousandSeparated = options.thousandSeparated;\n let spaceSeparated = options.spaceSeparated;\n let negative = options.negative;\n let forceSign = options.forceSign;\n let exponential = options.exponential;\n\n let abbreviation = \"\";\n\n if (average) {\n let data = computeAverage({\n value,\n forceAverage,\n abbreviations: state.currentAbbreviations(),\n spaceSeparated: spaceSeparated,\n totalLength\n });\n\n value = data.value;\n abbreviation += data.abbreviation;\n\n if (totalLength) {\n mantissaPrecision = data.mantissaPrecision;\n }\n }\n\n if (exponential) {\n let data = computeExponential({\n value,\n characteristicPrecision\n });\n\n value = data.value;\n abbreviation = data.abbreviation + abbreviation;\n }\n\n let output = setMantissaPrecision(value.toString(), value, optionalMantissa, mantissaPrecision);\n output = setCharacteristicPrecision(output, value, optionalCharacteristic, characteristicPrecision);\n output = replaceDelimiters(output, value, thousandSeparated, state, decimalSeparator);\n\n if (average || exponential) {\n output = insertAbbreviation(output, abbreviation);\n }\n\n if (forceSign || value < 0) {\n output = insertSign(output, value, negative);\n }\n\n return output;\n}\n\n/**\n * If FORMAT is non-null and not just an output, return FORMAT.\n * Return DEFAULTFORMAT otherwise.\n *\n * @param providedFormat\n * @param defaultFormat\n */\nfunction formatOrDefault(providedFormat, defaultFormat) {\n if (!providedFormat) {\n return defaultFormat;\n }\n\n let keys = Object.keys(providedFormat);\n if (keys.length === 1 && keys[0] === \"output\") {\n return defaultFormat;\n }\n\n return providedFormat;\n}\n\nmodule.exports = (numbro) => ({\n format: (...args) => format(...args, numbro),\n getByteUnit: (...args) => getByteUnit(...args, numbro),\n getBinaryByteUnit: (...args) => getBinaryByteUnit(...args, numbro),\n getDecimalByteUnit: (...args) => getDecimalByteUnit(...args, numbro),\n formatOrDefault\n});\n","/*!\n * Copyright (c) 2017 Benjamin Van Ryseghem\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst enUS = require(\"./en-US\");\nconst validating = require(\"./validating\");\nconst parsing = require(\"./parsing\");\n\nlet state = {};\n\nlet currentLanguageTag = undefined;\nlet languages = {};\n\nlet zeroFormat = null;\n\nlet globalDefaults = {};\n\nfunction chooseLanguage(tag) { currentLanguageTag = tag; }\n\nfunction currentLanguageData() { return languages[currentLanguageTag]; }\n\n/**\n * Return all the register languages\n *\n * @return {{}}\n */\nstate.languages = () => Object.assign({}, languages);\n\n//\n// Current language accessors\n//\n\n/**\n * Return the current language tag\n *\n * @return {string}\n */\nstate.currentLanguage = () => currentLanguageTag;\n\n/**\n * Return the current language currency data\n *\n * @return {{}}\n */\nstate.currentCurrency = () => currentLanguageData().currency;\n\n/**\n * Return the current language abbreviations data\n *\n * @return {{}}\n */\nstate.currentAbbreviations = () => currentLanguageData().abbreviations;\n\n/**\n * Return the current language delimiters data\n *\n * @return {{}}\n */\nstate.currentDelimiters = () => currentLanguageData().delimiters;\n\n/**\n * Return the current language ordinal function\n *\n * @return {function}\n */\nstate.currentOrdinal = () => currentLanguageData().ordinal;\n\n//\n// Defaults\n//\n\n/**\n * Return the current formatting defaults.\n * Use first uses the current language default, then fallback to the globally defined defaults.\n *\n * @return {{}}\n */\nstate.currentDefaults = () => Object.assign({}, currentLanguageData().defaults, globalDefaults);\n\n/**\n * Return the ordinal default-format.\n * Use first uses the current language ordinal default, then fallback to the regular defaults.\n *\n * @return {{}}\n */\nstate.currentOrdinalDefaultFormat = () => Object.assign({}, state.currentDefaults(), currentLanguageData().ordinalFormat);\n\n/**\n * Return the byte default-format.\n * Use first uses the current language byte default, then fallback to the regular defaults.\n *\n * @return {{}}\n */\nstate.currentByteDefaultFormat = () => Object.assign({}, state.currentDefaults(), currentLanguageData().byteFormat);\n\n/**\n * Return the percentage default-format.\n * Use first uses the current language percentage default, then fallback to the regular defaults.\n *\n * @return {{}}\n */\nstate.currentPercentageDefaultFormat = () => Object.assign({}, state.currentDefaults(), currentLanguageData().percentageFormat);\n\n/**\n * Return the currency default-format.\n * Use first uses the current language currency default, then fallback to the regular defaults.\n *\n * @return {{}}\n */\nstate.currentCurrencyDefaultFormat = () => Object.assign({}, state.currentDefaults(), currentLanguageData().currencyFormat);\n\n/**\n * Return the time default-format.\n * Use first uses the current language currency default, then fallback to the regular defaults.\n *\n * @return {{}}\n */\nstate.currentTimeDefaultFormat = () => Object.assign({}, state.currentDefaults(), currentLanguageData().timeFormat);\n\n/**\n * Set the global formatting defaults.\n *\n * @param {{}|string} format - formatting options to use as defaults\n */\nstate.setDefaults = (format) => {\n format = parsing.parseFormat(format);\n if (validating.validateFormat(format)) {\n globalDefaults = format;\n }\n};\n\n//\n// Zero format\n//\n\n/**\n * Return the format string for 0.\n *\n * @return {string}\n */\nstate.getZeroFormat = () => zeroFormat;\n\n/**\n * Set a STRING to output when the value is 0.\n *\n * @param {{}|string} string - string to set\n */\nstate.setZeroFormat = (string) => zeroFormat = typeof(string) === \"string\" ? string : null;\n\n/**\n * Return true if a format for 0 has been set already.\n *\n * @return {boolean}\n */\nstate.hasZeroFormat = () => zeroFormat !== null;\n\n//\n// Getters/Setters\n//\n\n/**\n * Return the language data for the provided TAG.\n * Return the current language data if no tag is provided.\n *\n * Throw an error if the tag doesn't match any registered language.\n *\n * @param {string} [tag] - language tag of a registered language\n * @return {{}}\n */\nstate.languageData = (tag) => {\n if (tag) {\n if (languages[tag]) {\n return languages[tag];\n }\n throw new Error(`Unknown tag \"${tag}\"`);\n }\n\n return currentLanguageData();\n};\n\n/**\n * Register the provided DATA as a language if and only if the data is valid.\n * If the data is not valid, an error is thrown.\n *\n * When USELANGUAGE is true, the registered language is then used.\n *\n * @param {{}} data - language data to register\n * @param {boolean} [useLanguage] - `true` if the provided data should become the current language\n */\nstate.registerLanguage = (data, useLanguage = false) => {\n if (!validating.validateLanguage(data)) {\n throw new Error(\"Invalid language data\");\n }\n\n languages[data.languageTag] = data;\n\n if (useLanguage) {\n chooseLanguage(data.languageTag);\n }\n};\n\n/**\n * Set the current language according to TAG.\n * If TAG doesn't match a registered language, another language matching\n * the \"language\" part of the tag (according to BCP47: https://tools.ietf.org/rfc/bcp/bcp47.txt).\n * If none, the FALLBACKTAG is used. If the FALLBACKTAG doesn't match a register language,\n * `en-US` is finally used.\n *\n * @param tag\n * @param fallbackTag\n */\nstate.setLanguage = (tag, fallbackTag = enUS.languageTag) => {\n if (!languages[tag]) {\n let suffix = tag.split(\"-\")[0];\n\n let matchingLanguageTag = Object.keys(languages).find(each => {\n return each.split(\"-\")[0] === suffix;\n });\n\n if (!languages[matchingLanguageTag]) {\n chooseLanguage(fallbackTag);\n return;\n }\n\n chooseLanguage(matchingLanguageTag);\n }\n\n chooseLanguage(tag);\n};\n\nstate.registerLanguage(enUS);\ncurrentLanguageTag = enUS.languageTag;\n\nmodule.exports = state;\n","/*!\n * Copyright (c) 2017 Benjamin Van Ryseghem\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * Load languages matching TAGS. Silently pass over the failing load.\n *\n * We assume here that we are in a node environment, so we don't check for it.\n * @param {[String]} tags - list of tags to load\n * @param {Numbro} numbro - the numbro singleton\n */\nfunction loadLanguagesInNode(tags, numbro) {\n tags.forEach((tag) => {\n let data = undefined;\n try {\n data = require(`../languages/${tag}`);\n } catch (e) {\n console.error(`Unable to load \"${tag}\". No matching language file found.`); // eslint-disable-line no-console\n }\n\n if (data) {\n numbro.registerLanguage(data);\n }\n });\n}\n\nmodule.exports = (numbro) => ({\n loadLanguagesInNode: (tags) => loadLanguagesInNode(tags, numbro)\n});\n","/*!\n * Copyright (c) 2017 Benjamin Van Ryseghem\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst BigNumber = require(\"bignumber.js\");\n\n/**\n * Add a number or a numbro to N.\n *\n * @param {Numbro} n - augend\n * @param {number|Numbro} other - addend\n * @param {numbro} numbro - numbro singleton\n * @return {Numbro} n\n */\nfunction add(n, other, numbro) {\n let value = new BigNumber(n._value);\n let otherValue = other;\n\n if (numbro.isNumbro(other)) {\n otherValue = other._value;\n }\n\n otherValue = new BigNumber(otherValue);\n\n n._value = value.add(otherValue).toNumber();\n return n;\n}\n\n/**\n * Subtract a number or a numbro from N.\n *\n * @param {Numbro} n - minuend\n * @param {number|Numbro} other - subtrahend\n * @param {numbro} numbro - numbro singleton\n * @return {Numbro} n\n */\nfunction subtract(n, other, numbro) {\n let value = new BigNumber(n._value);\n let otherValue = other;\n\n if (numbro.isNumbro(other)) {\n otherValue = other._value;\n }\n\n otherValue = new BigNumber(otherValue);\n\n n._value = value.minus(otherValue).toNumber();\n return n;\n}\n\n/**\n * Multiply N by a number or a numbro.\n *\n * @param {Numbro} n - multiplicand\n * @param {number|Numbro} other - multiplier\n * @param {numbro} numbro - numbro singleton\n * @return {Numbro} n\n */\nfunction multiply(n, other, numbro) {\n let value = new BigNumber(n._value);\n let otherValue = other;\n\n if (numbro.isNumbro(other)) {\n otherValue = other._value;\n }\n\n otherValue = new BigNumber(otherValue);\n\n n._value = value.times(otherValue).toNumber();\n return n;\n}\n\n/**\n * Divide N by a number or a numbro.\n *\n * @param {Numbro} n - dividend\n * @param {number|Numbro} other - divisor\n * @param {numbro} numbro - numbro singleton\n * @return {Numbro} n\n */\nfunction divide(n, other, numbro) {\n let value = new BigNumber(n._value);\n let otherValue = other;\n\n if (numbro.isNumbro(other)) {\n otherValue = other._value;\n }\n\n otherValue = new BigNumber(otherValue);\n\n n._value = value.dividedBy(otherValue).toNumber();\n return n;\n}\n\n/**\n * Set N to the OTHER (or the value of OTHER when it's a numbro instance).\n *\n * @param {Numbro} n - numbro instance to mutate\n * @param {number|Numbro} other - new value to assign to N\n * @param {numbro} numbro - numbro singleton\n * @return {Numbro} n\n */\nfunction set (n, other, numbro) {\n let value = other;\n\n if (numbro.isNumbro(other)) {\n value = other._value;\n }\n\n n._value = value;\n return n;\n}\n\n/**\n * Return the distance between N and OTHER.\n *\n * @param {Numbro} n\n * @param {number|Numbro} other\n * @param {numbro} numbro - numbro singleton\n * @return {number}\n */\nfunction difference(n, other, numbro) {\n let clone = numbro(n._value);\n subtract(clone, other, numbro);\n\n return Math.abs(clone._value);\n}\n\nmodule.exports = numbro => ({\n add: (n, other) => add(n, other, numbro),\n subtract: (n, other) => subtract(n, other, numbro),\n multiply: (n, other) => multiply(n, other, numbro),\n divide: (n, other) => divide(n, other, numbro),\n set: (n, other) => set(n, other, numbro),\n difference: (n, other) => difference(n, other, numbro)\n});\n","/*!\n * Copyright (c) 2017 Benjamin Van Ryseghem\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst VERSION = \"2.0.2\";\n\nconst globalState = require(\"./globalState\");\nconst validator = require(\"./validating\");\nconst loader = require(\"./loading\")(numbro);\nconst unformatter = require(\"./unformatting\");\nlet formatter = require(\"./formatting\")(numbro);\nlet manipulate = require(\"./manipulating\")(numbro);\n\nclass Numbro {\n constructor(number) {\n this._value = number;\n }\n\n clone() { return numbro(this._value); }\n\n format(format = {}) { return formatter.format(this, format); }\n\n formatCurrency(format) {\n format = formatter.formatOrDefault(format, globalState.currentCurrencyDefaultFormat());\n format.output = \"currency\";\n return formatter.format(this, format);\n }\n\n formatTime(format = {}) {\n format.output = \"time\";\n return formatter.format(this, format);\n }\n\n binaryByteUnits() { return formatter.getBinaryByteUnit(this);}\n\n decimalByteUnits() { return formatter.getDecimalByteUnit(this);}\n\n byteUnits() { return formatter.getByteUnit(this);}\n\n difference(other) { return manipulate.difference(this, other); }\n\n add(other) { return manipulate.add(this, other); }\n\n subtract(other) { return manipulate.subtract(this, other); }\n\n multiply(other) { return manipulate.multiply(this, other); }\n\n divide(other) { return manipulate.divide(this, other); }\n\n set(input) { return manipulate.set(this, normalizeInput(input)); }\n\n value() { return this._value; }\n\n valueOf() { return this._value; }\n}\n\n/**\n * Make its best to convert input into a number.\n *\n * @param {numbro|string|number} input - Input to convert\n * @return {number}\n */\nfunction normalizeInput(input) {\n let result = input;\n if (numbro.isNumbro(input)) {\n result = input._value;\n } else if (typeof input === \"string\") {\n result = numbro.unformat(input);\n } else if (isNaN(input)) {\n result = NaN;\n }\n\n return result;\n}\n\nfunction numbro(input) {\n return new Numbro(normalizeInput(input));\n}\n\nnumbro.version = VERSION;\n\nnumbro.isNumbro = function(object) {\n return object instanceof Numbro;\n};\n\n//\n// `numbro` static methods\n//\n\nnumbro.language = globalState.currentLanguage;\nnumbro.registerLanguage = globalState.registerLanguage;\nnumbro.setLanguage = globalState.setLanguage;\nnumbro.languages = globalState.languages;\nnumbro.languageData = globalState.languageData;\nnumbro.zeroFormat = globalState.setZeroFormat;\nnumbro.defaultFormat = globalState.currentDefaults;\nnumbro.setDefaults = globalState.setDefaults;\nnumbro.defaultCurrencyFormat = globalState.currentCurrencyDefaultFormat;\nnumbro.validate = validator.validate;\nnumbro.loadLanguagesInNode = loader.loadLanguagesInNode;\nnumbro.unformat = unformatter.unformat;\n\nmodule.exports = numbro;\n","/*!\n * Copyright (c) 2017 Benjamin Van Ryseghem\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * Parse the format STRING looking for a prefix. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parsePrefix(string, result) {\n let match = string.match(/^{([^}]*)}/);\n if (match) {\n result.prefix = match[1];\n return string.slice(match[0].length);\n }\n\n return string;\n}\n\n/**\n * Parse the format STRING looking for a postfix. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parsePostfix(string, result) {\n let match = string.match(/{([^}]*)}$/);\n if (match) {\n result.postfix = match[1];\n\n return string.slice(0, -match[0].length);\n }\n\n return string;\n}\n\n/**\n * Parse the format STRING looking for the output value. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n */\nfunction parseOutput(string, result) {\n if (string.indexOf(\"$\") !== -1) {\n result.output = \"currency\";\n return;\n }\n\n if (string.indexOf(\"%\") !== -1) {\n result.output = \"percent\";\n return;\n }\n\n if (string.indexOf(\"bd\") !== -1) {\n result.output = \"byte\";\n result.base = \"general\";\n return;\n }\n\n if (string.indexOf(\"b\") !== -1) {\n result.output = \"byte\";\n result.base = \"binary\";\n return;\n\n }\n\n if (string.indexOf(\"d\") !== -1) {\n result.output = \"byte\";\n result.base = \"decimal\";\n return;\n\n }\n\n if (string.indexOf(\":\") !== -1) {\n result.output = \"time\";\n return;\n }\n\n if (string.indexOf(\"o\") !== -1) {\n result.output = \"ordinal\";\n }\n}\n\n/**\n * Parse the format STRING looking for the thousand separated value. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parseThousandSeparated(string, result) {\n if (string.indexOf(\",\") !== -1) {\n result.thousandSeparated = true;\n }\n}\n\n/**\n * Parse the format STRING looking for the space separated value. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parseSpaceSeparated(string, result) {\n if (string.indexOf(\" \") !== -1) {\n result.spaceSeparated = true;\n }\n}\n\n/**\n * Parse the format STRING looking for the total length. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parseTotalLength(string, result) {\n let match = string.match(/[1-9]+[0-9]*/);\n\n if (match) {\n result.totalLength = +match[0];\n }\n}\n\n/**\n * Parse the format STRING looking for the characteristic length. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parseCharacteristic(string, result) {\n let characteristic = string.split(\".\")[0];\n let match = characteristic.match(/0+/);\n if (match) {\n result.characteristic = match[0].length;\n }\n}\n\n/**\n * Parse the format STRING looking for the mantissa length. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parseMantissa(string, result) {\n let mantissa = string.split(\".\")[1];\n if (mantissa) {\n let match = mantissa.match(/0+/);\n if (match) {\n result.mantissa = match[0].length;\n }\n }\n}\n\n/**\n * Parse the format STRING looking for the average value. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parseAverage(string, result) {\n if (string.indexOf(\"a\") !== -1) {\n result.average = true;\n }\n}\n\n/**\n * Parse the format STRING looking for a forced average precision. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parseForceAverage(string, result) {\n if (string.indexOf(\"K\") !== -1) {\n result.forceAverage = \"thousand\";\n } else if (string.indexOf(\"M\") !== -1) {\n result.forceAverage = \"million\";\n } else if (string.indexOf(\"B\") !== -1) {\n result.forceAverage = \"billion\";\n } else if (string.indexOf(\"T\") !== -1) {\n result.forceAverage = \"trillion\";\n }\n}\n\n/**\n * Parse the format STRING finding if the mantissa is optional. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parseOptionalMantissa(string, result) {\n if (string.match(/\\[\\.]/)) {\n result.optionalMantissa = true;\n } else if (string.match(/\\./)) {\n result.optionalMantissa = false;\n }\n}\n\n/**\n * Parse the format STRING finding if the characteristic is optional. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parseOptionalCharacteristic(string, result) {\n if (string.indexOf(\".\") !== -1) {\n let characteristic = string.split(\".\")[0];\n result.optionalCharacteristic = characteristic.indexOf(\"0\") === -1;\n }\n}\n\n/**\n * Parse the format STRING looking for the negative format. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {string} - format\n */\nfunction parseNegative(string, result) {\n if (string.match(/^\\+?\\([^)]*\\)$/)) {\n result.negative = \"parenthesis\";\n }\n if (string.match(/^\\+?-/)) {\n result.negative = \"sign\";\n }\n}\n\n/**\n * Parse the format STRING finding if the sign is mandatory. Append it to RESULT when found.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n */\nfunction parseForceSign(string, result) {\n if (string.match(/^\\+/)) {\n result.forceSign = true;\n }\n}\n\n/**\n * Parse the format STRING and accumulating the values ie RESULT.\n *\n * @param {string} string - format\n * @param {NumbroFormat} result - Result accumulator\n * @return {NumbroFormat} - format\n */\nfunction parseFormat(string, result = {}) {\n if (typeof string !== \"string\") {\n return string;\n }\n\n string = parsePrefix(string, result);\n string = parsePostfix(string, result);\n parseOutput(string, result);\n parseTotalLength(string, result);\n parseCharacteristic(string, result);\n parseOptionalCharacteristic(string, result);\n parseAverage(string, result);\n parseForceAverage(string, result);\n parseMantissa(string, result);\n parseOptionalMantissa(string, result);\n parseThousandSeparated(string, result);\n parseSpaceSeparated(string, result);\n parseNegative(string, result);\n parseForceSign(string, result);\n\n return result;\n}\n\nmodule.exports = {\n parseFormat\n};\n","/*!\n * Copyright (c) 2017 Benjamin Van Ryseghem\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nconst allSuffixes = [\n {key: \"ZiB\", factor: Math.pow(1024, 7)},\n {key: \"ZB\", factor: Math.pow(1000, 7)},\n {key: \"YiB\", factor: Math.pow(1024, 8)},\n {key: \"YB\", factor: Math.pow(1000, 8)},\n {key: \"TiB\", factor: Math.pow(1024, 4)},\n {key: \"TB\", factor: Math.pow(1000, 4)},\n {key: \"PiB\", factor: Math.pow(1024, 5)},\n {key: \"PB\", factor: Math.pow(1000, 5)},\n {key: \"MiB\", factor: Math.pow(1024, 2)},\n {key: \"MB\", factor: Math.pow(1000, 2)},\n {key: \"KiB\", factor: Math.pow(1024, 1)},\n {key: \"KB\", factor: Math.pow(1000, 1)},\n {key: \"GiB\", factor: Math.pow(1024, 3)},\n {key: \"GB\", factor: Math.pow(1000, 3)},\n {key: \"EiB\", factor: Math.pow(1024, 6)},\n {key: \"EB\", factor: Math.pow(1000, 6)},\n {key: \"B\", factor: 1}\n];\n\n/**\n * Generate a RegExp where S get all RegExp specific characters escaped.\n *\n * @param {string} s - string representing a RegExp\n * @return {string}\n */\nfunction escapeRegExp(s) {\n return s.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n}\n\n/**\n * Recursively compute the unformatted value.\n *\n * @param {string} inputString - string to unformat\n * @param {*} delimiters - Delimiters used to generate the inputString\n * @param {string} [currencySymbol] - symbol used for currency while generating the inputString\n * @param {function} ordinal - function used to generate an ordinal out of a number\n * @param {string} zeroFormat - string representing zero\n * @param {*} abbreviations - abbreviations used while generating the inputString\n * @param {NumbroFormat} format - format used while generating the inputString\n * @return {number|undefined}\n */\nfunction computeUnformattedValue(inputString, delimiters, currencySymbol = \"\", ordinal, zeroFormat, abbreviations, format) {\n if (!isNaN(+inputString)) {\n return +inputString;\n }\n\n let stripped = \"\";\n // Negative\n\n let newInput = inputString.replace(/(^[^(]*)\\((.*)\\)([^)]*$)/, \"$1$2$3\");\n\n if (newInput !== inputString) {\n return -1 * computeUnformattedValue(newInput, delimiters, currencySymbol, ordinal, zeroFormat, abbreviations, format);\n }\n\n // Byte\n\n for (let i = 0; i < allSuffixes.length; i++) {\n let suffix = allSuffixes[i];\n stripped = inputString.replace(suffix.key, \"\");\n\n if (stripped !== inputString) {\n return computeUnformattedValue(stripped, delimiters, currencySymbol, ordinal, zeroFormat, abbreviations, format) * suffix.factor;\n }\n }\n\n // Percent\n\n stripped = inputString.replace(\"%\", \"\");\n\n if (stripped !== inputString) {\n return computeUnformattedValue(stripped, delimiters, currencySymbol, ordinal, zeroFormat, abbreviations, format) / 100;\n }\n\n // Ordinal\n\n let possibleOrdinalValue = parseFloat(inputString);\n\n if (isNaN(possibleOrdinalValue)) {\n return undefined;\n }\n\n let ordinalString = ordinal(possibleOrdinalValue);\n if (ordinalString && ordinalString !== \".\") { // if ordinal is \".\" it will be caught next round in the +inputString\n stripped = inputString.replace(new RegExp(`${escapeRegExp(ordinalString)}$`), \"\");\n\n if (stripped !== inputString) {\n return computeUnformattedValue(stripped, delimiters, currencySymbol, ordinal, zeroFormat, abbreviations, format);\n }\n }\n\n // Average\n\n let inversedAbbreviations = {};\n Object.keys(abbreviations).forEach((key) => {\n inversedAbbreviations[abbreviations[key]] = key;\n });\n\n let abbreviationValues = Object.keys(inversedAbbreviations).sort().reverse();\n let numberOfAbbreviations = abbreviationValues.length;\n\n for (let i = 0; i < numberOfAbbreviations; i++) {\n let value = abbreviationValues[i];\n let key = inversedAbbreviations[value];\n\n stripped = inputString.replace(value, \"\");\n if (stripped !== inputString) {\n let factor = undefined;\n switch (key) { // eslint-disable-line default-case\n case \"thousand\":\n factor = Math.pow(10, 3);\n break;\n case \"million\":\n factor = Math.pow(10, 6);\n break;\n case \"billion\":\n factor = Math.pow(10, 9);\n break;\n case \"trillion\":\n factor = Math.pow(10, 12);\n break;\n }\n return computeUnformattedValue(stripped, delimiters, currencySymbol, ordinal, zeroFormat, abbreviations, format) * factor;\n }\n }\n\n return undefined;\n}\n\n/**\n * Removes in one pass all formatting symbols.\n *\n * @param {string} inputString - string to unformat\n * @param {*} delimiters - Delimiters used to generate the inputString\n * @param {string} [currencySymbol] - symbol used for currency while generating the inputString\n * @return {string}\n */\nfunction removeFormattingSymbols(inputString, delimiters, currencySymbol = \"\") {\n // Currency\n\n let stripped = inputString.replace(currencySymbol, \"\");\n\n // Thousand separators\n\n stripped = stripped.replace(new RegExp(`([0-9])${escapeRegExp(delimiters.thousands)}([0-9])`, \"g\"), \"$1$2\");\n\n // Decimal\n\n stripped = stripped.replace(delimiters.decimal, \".\");\n\n return stripped;\n}\n\n/**\n * Unformat a numbro-generated string to retrieve the original value.\n *\n * @param {string} inputString - string to unformat\n * @param {*} delimiters - Delimiters used to generate the inputString\n * @param {string} [currencySymbol] - symbol used for currency while generating the inputString\n * @param {function} ordinal - function used to generate an ordinal out of a number\n * @param {string} zeroFormat - string representing zero\n * @param {*} abbreviations - abbreviations used while generating the inputString\n * @param {NumbroFormat} format - format used while generating the inputString\n * @return {number|undefined}\n */\nfunction unformatValue(inputString, delimiters, currencySymbol = \"\", ordinal, zeroFormat, abbreviations, format) {\n if (inputString === \"\") {\n return undefined;\n }\n\n if (!isNaN(+inputString)) {\n return +inputString;\n }\n\n // Zero Format\n\n if (inputString === zeroFormat) {\n return 0;\n }\n\n let value = removeFormattingSymbols(inputString, delimiters, currencySymbol);\n return computeUnformattedValue(value, delimiters, currencySymbol, ordinal, zeroFormat, abbreviations, format);\n}\n\n/**\n * Check if the INPUTSTRING represents a time.\n *\n * @param {string} inputString - string to check\n * @param {*} delimiters - Delimiters used while generating the inputString\n * @return {boolean}\n */\nfunction matchesTime(inputString, delimiters) {\n let separators = inputString.indexOf(\":\") && delimiters.thousands !== \":\";\n\n if (!separators) {\n return false;\n }\n\n let segments = inputString.split(\":\");\n if (segments.length !== 3) {\n return false;\n }\n\n let hours = +segments[0];\n let minutes = +segments[1];\n let seconds = +segments[2];\n\n return !isNaN(hours) && !isNaN(minutes) && !isNaN(seconds);\n}\n\n/**\n * Unformat a numbro-generated string representing a time to retrieve the original value.\n *\n * @param {string} inputString - string to unformat\n * @return {number}\n */\nfunction unformatTime(inputString) {\n let segments = inputString.split(\":\");\n\n let hours = +segments[0];\n let minutes = +segments[1];\n let seconds = +segments[2];\n\n return seconds + 60 * minutes + 3600 * hours;\n}\n\n/**\n * Unformat a numbro-generated string to retrieve the original value.\n *\n * @param {string} inputString - string to unformat\n * @param {NumbroFormat} format - format used while generating the inputString\n * @return {number}\n */\nfunction unformat(inputString, format) {\n // Avoid circular references\n const globalState = require(\"./globalState\");\n\n let delimiters = globalState.currentDelimiters();\n let currencySymbol = globalState.currentCurrency().symbol;\n let ordinal = globalState.currentOrdinal();\n let zeroFormat = globalState.getZeroFormat();\n let abbreviations = globalState.currentAbbreviations();\n\n let value = undefined;\n\n if (typeof inputString === \"string\") {\n if (matchesTime(inputString, delimiters)) {\n value = unformatTime(inputString);\n } else {\n value = unformatValue(inputString, delimiters, currencySymbol, ordinal, zeroFormat, abbreviations, format);\n }\n } else if (typeof inputString === \"number\") {\n value = inputString;\n } else {\n return undefined;\n }\n\n if (value === undefined) {\n return undefined;\n }\n\n return value;\n}\n\nmodule.exports = {\n unformat\n};\n","/*!\n * Copyright (c) 2017 Benjamin Van Ryseghem\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nlet unformatter = require(\"./unformatting\");\n\n// Simplified regexp supporting only `language`, `script`, and `region`\nconst bcp47RegExp = /^[a-z]{2,3}(-[a-zA-Z]{4})?(-([A-Z]{2}|[0-9]{3}))?$/;\n\nconst validOutputValues = [\n \"currency\",\n \"percent\",\n \"byte\",\n \"time\",\n \"ordinal\",\n \"number\"\n];\n\nconst validForceAverageValues = [\n \"trillion\",\n \"billion\",\n \"million\",\n \"thousand\"\n];\n\nconst validNegativeValues = [\n \"sign\",\n \"parenthesis\"\n];\n\nconst validMandatoryAbbreviations = {\n type: \"object\",\n children: {\n thousand: {\n type: \"string\",\n mandatory: true\n },\n million: {\n type: \"string\",\n mandatory: true\n },\n billion: {\n type: \"string\",\n mandatory: true\n },\n trillion: {\n type: \"string\",\n mandatory: true\n }\n },\n mandatory: true\n};\n\nconst validAbbreviations = {\n type: \"object\",\n children: {\n thousand: \"string\",\n million: \"string\",\n billion: \"string\",\n trillion: \"string\"\n }\n};\n\nconst validBaseValues = [\n \"decimal\",\n \"binary\",\n \"general\"\n];\n\nconst validFormat = {\n output: {\n type: \"string\",\n validValues: validOutputValues\n },\n base: {\n type: \"string\",\n validValues: validBaseValues,\n restriction: (number, format) => format.output === \"byte\",\n message: \"`base` must be provided only when the output is `byte`\",\n mandatory: (format) => format.output === \"byte\"\n },\n characteristic: {\n type: \"number\",\n restriction: (number) => number >= 0,\n message: \"value must be positive\"\n },\n prefix: \"string\",\n postfix: \"string\",\n forceAverage: {\n type: \"string\",\n validValues: validForceAverageValues\n },\n average: \"boolean\",\n totalLength: {\n type: \"number\",\n restrictions: [\n {\n restriction: (number) => number >= 0,\n message: \"value must be positive\"\n },\n {\n restriction: (number, format) => !format.exponential,\n message: \"`totalLength` is incompatible with `exponential`\"\n }\n ]\n },\n mantissa: {\n type: \"number\",\n restriction: (number) => number >= 0,\n message: \"value must be positive\"\n },\n optionalMantissa: \"boolean\",\n optionalCharacteristic: \"boolean\",\n thousandSeparated: \"boolean\",\n spaceSeparated: \"boolean\",\n abbreviations: validAbbreviations,\n negative: {\n type: \"string\",\n validValues: validNegativeValues\n },\n forceSign: \"boolean\",\n exponential: {\n type: \"boolean\"\n },\n prefixSymbol: {\n type: \"boolean\",\n restriction: (number, format) => format.output === \"percent\",\n message: \"`prefixSymbol` can be provided only when the output is `percent`\"\n }\n};\n\nconst validLanguage = {\n languageTag: {\n type: \"string\",\n mandatory: true,\n restriction: (tag) => {\n return tag.match(bcp47RegExp);\n },\n message: \"the language tag must follow the BCP 47 specification (see https://tools.ieft.org/html/bcp47)\"\n },\n delimiters: {\n type: \"object\",\n children: {\n thousands: \"string\",\n decimal: \"string\"\n },\n mandatory: true\n },\n abbreviations: validMandatoryAbbreviations,\n spaceSeparated: \"boolean\",\n ordinal: {\n type: \"function\",\n mandatory: true\n },\n currency: {\n type: \"object\",\n children: {\n symbol: \"string\",\n position: \"string\",\n code: \"string\"\n },\n mandatory: true\n },\n defaults: \"format\",\n ordinalFormat: \"format\",\n byteFormat: \"format\",\n percentageFormat: \"format\",\n currencyFormat: \"format\",\n timeDefaults: \"format\",\n formats: {\n type: \"object\",\n children: {\n fourDigits: {\n type: \"format\",\n mandatory: true\n },\n fullWithTwoDecimals: {\n type: \"format\",\n mandatory: true\n },\n fullWithTwoDecimalsNoCurrency: {\n type: \"format\",\n mandatory: true\n },\n fullWithNoDecimals: {\n type: \"format\",\n mandatory: true\n }\n }\n }\n};\n\n/**\n * Check the validity of the provided input and format.\n * The check is NOT lazy.\n *\n * @param {string|number|Numbro} input - input to check\n * @param {NumbroFormat} format - format to check\n * @return {boolean} True when everything is correct\n */\nfunction validate(input, format) {\n let validInput = validateInput(input);\n let isFormatValid = validateFormat(format);\n\n return validInput && isFormatValid;\n}\n\n/**\n * Check the validity of the numbro input.\n *\n * @param {string|number|Numbro} input - input to check\n * @return {boolean} True when everything is correct\n */\nfunction validateInput(input) {\n let value = unformatter.unformat(input);\n\n return !!value;\n}\n\n/**\n * Check the validity of the provided format TOVALIDATE against SPEC.\n *\n * @param {NumbroFormat} toValidate - format to check\n * @param {*} spec - specification against which to check\n * @param {string} prefix - prefix use for error messages\n * @param {boolean} skipMandatoryCheck - `true` when the check for mandatory key must be skipped\n * @return {boolean} True when everything is correct\n */\nfunction validateSpec(toValidate, spec, prefix, skipMandatoryCheck = false) {\n let results = Object.keys(toValidate).map((key) => {\n if (!spec[key]) {\n console.error(`${prefix} Invalid key: ${key}`); // eslint-disable-line no-console\n return false;\n }\n\n let value = toValidate[key];\n let data = spec[key];\n\n if (typeof data === \"string\") {\n data = {type: data};\n }\n\n if (data.type === \"format\") { // all formats are partial (a.k.a will be merged with some default values) thus no need to check mandatory values\n let valid = validateSpec(value, validFormat, `[Validate ${key}]`, true);\n\n if (!valid) {\n return false;\n }\n } else if (typeof value !== data.type) {\n console.error(`${prefix} ${key} type mismatched: \"${data.type}\" expected, \"${typeof value}\" provided`); // eslint-disable-line no-console\n return false;\n }\n\n if (data.restrictions && data.restrictions.length) {\n let length = data.restrictions.length;\n for (let i = 0; i < length; i++) {\n let {restriction, message} = data.restrictions[i];\n if (!restriction(value, toValidate)) {\n console.error(`${prefix} ${key} invalid value: ${message}`); // eslint-disable-line no-console\n return false;\n }\n }\n }\n\n if (data.restriction && !data.restriction(value, toValidate)) {\n console.error(`${prefix} ${key} invalid value: ${data.message}`); // eslint-disable-line no-console\n return false;\n }\n\n if (data.validValues && data.validValues.indexOf(value) === -1) {\n console.error(`${prefix} ${key} invalid value: must be among ${JSON.stringify(data.validValues)}, \"${value}\" provided`); // eslint-disable-line no-console\n return false;\n }\n\n if (data.children) {\n let valid = validateSpec(value, data.children, `[Validate ${key}]`);\n\n if (!valid) {\n return false;\n }\n }\n\n return true;\n });\n\n if (!skipMandatoryCheck) {\n results.push(...Object.keys(spec).map((key) => {\n let data = spec[key];\n if (typeof data === \"string\") {\n data = {type: data};\n }\n\n if (data.mandatory) {\n let mandatory = data.mandatory;\n if (typeof mandatory === \"function\") {\n mandatory = mandatory(toValidate);\n }\n\n if (mandatory && toValidate[key] === undefined) {\n console.error(`${prefix} Missing mandatory key \"${key}\"`); // eslint-disable-line no-console\n return false;\n }\n }\n\n return true;\n }));\n }\n\n return results.reduce((acc, current) => {\n return acc && current;\n }, true);\n}\n\n/**\n * Check the provided FORMAT.\n *\n * @param {NumbroFormat} format - format to check\n * @return {boolean}\n */\nfunction validateFormat(format) {\n return validateSpec(format, validFormat, \"[Validate format]\");\n}\n\n/**\n * Check the provided LANGUAGE.\n *\n * @param {NumbroLanguage} language - language to check\n * @return {boolean}\n */\nfunction validateLanguage(language) {\n return validateSpec(language, validLanguage, \"[Validate language]\");\n}\n\nmodule.exports = {\n validate,\n validateFormat,\n validateInput,\n validateLanguage\n};\n"]}