{"version":3,"file":"dinero.js-BssKEkn8.js","sources":["../../node_modules/dinero.js/build/esm/dinero.js"],"sourcesContent":["/**\n * Default values for all Dinero objects.\n *\n * You can override default values for all subsequent Dinero objects by changing them directly on the global `Dinero` object.\n * Existing instances won't be affected.\n *\n * @property {Number} defaultAmount - The default amount for new Dinero objects (see {@link module:Dinero Dinero} for format).\n * @property {String} defaultCurrency - The default currency for new Dinero objects (see {@link module:Dinero Dinero} for format).\n * @property {Number} defaultPrecision - The default precision for new Dinero objects (see {@link module:Dinero Dinero} for format).\n *\n * @example\n * // Will set currency to 'EUR' for all Dinero objects.\n * Dinero.defaultCurrency = 'EUR'\n *\n * @type {Object}\n */\nvar Defaults = {\n defaultAmount: 0,\n defaultCurrency: 'USD',\n defaultPrecision: 2\n};\n/**\n * Global settings for all Dinero objects.\n *\n * You can override global values for all subsequent Dinero objects by changing them directly on the global `Dinero` object.\n * Existing instances won't be affected.\n *\n * @property {String} globalLocale - The global locale for new Dinero objects (see {@link module:Dinero~setLocale setLocale} for format).\n * @property {String} globalFormat - The global format for new Dinero objects (see {@link module:Dinero~toFormat toFormat} for format).\n * @property {String} globalRoundingMode - The global rounding mode for new Dinero objects (see {@link module:Dinero~multiply multiply} or {@link module:Dinero~divide divide} for format).\n * @property {String} globalFormatRoundingMode - The global rounding mode to format new Dinero objects (see {@link module:Dinero~toFormat toFormat} or {@link module:Dinero~toRoundedUnit toRoundedUnit} for format).\n * @property {(String|Promise)} globalExchangeRatesApi.endpoint - The global exchange rate API endpoint for new Dinero objects, or the global promise that resolves to the exchanges rates (see {@link module:Dinero~convert convert} for format).\n * @property {String} globalExchangeRatesApi.propertyPath - The global exchange rate API property path for new Dinero objects (see {@link module:Dinero~convert convert} for format).\n * @property {Object} globalExchangeRatesApi.headers - The global exchange rate API headers for new Dinero objects (see {@link module:Dinero~convert convert} for format).\n *\n * @example\n * // Will set locale to 'fr-FR' for all Dinero objects.\n * Dinero.globalLocale = 'fr-FR'\n * @example\n * // Will set global exchange rate API parameters for all Dinero objects.\n * Dinero.globalExchangeRatesApi = {\n * endpoint: 'https://yourexchangerates.api/latest?base={{from}}',\n * propertyPath: 'data.rates.{{to}}',\n * headers: {\n * 'user-key': 'xxxxxxxxx'\n * }\n * }\n *\n * @type {Object}\n */\n\nvar Globals = {\n globalLocale: 'en-US',\n globalFormat: '$0,0.00',\n globalRoundingMode: 'HALF_EVEN',\n globalFormatRoundingMode: 'HALF_AWAY_FROM_ZERO',\n globalExchangeRatesApi: {\n endpoint: undefined,\n headers: undefined,\n propertyPath: undefined\n }\n};\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _toArray(arr) {\n return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\n/**\n * Static methods for Dinero.\n * @ignore\n *\n * @type {Object}\n */\nvar Static = {\n /**\n * Returns an array of Dinero objects, normalized to the same precision (the highest).\n *\n * @memberof module:Dinero\n * @method\n *\n * @param {Dinero[]} objects - An array of Dinero objects\n *\n * @example\n * // returns an array of Dinero objects\n * // both with a precision of 3\n * // and an amount of 1000\n * Dinero.normalizePrecision([\n * Dinero({ amount: 100, precision: 2 }),\n * Dinero({ amount: 1000, precision: 3 })\n * ])\n *\n * @return {Dinero[]}\n */\n normalizePrecision: function normalizePrecision(objects) {\n var highestPrecision = objects.reduce(function (a, b) {\n return Math.max(a.getPrecision(), b.getPrecision());\n });\n return objects.map(function (object) {\n return object.getPrecision() !== highestPrecision ? object.convertPrecision(highestPrecision) : object;\n });\n },\n\n /**\n * Returns the smallest Dinero object from an array of Dinero objects\n *\n * @memberof module:Dinero\n * @method\n *\n * @param {Dinero[]} objects - An array of Dinero objects\n *\n * @example\n * // returns the smallest Dinero object with amount of 500 from an array of Dinero objects with different precisions\n * Dinero.minimum([\n * Dinero({ amount: 500, precision: 3 }),\n * Dinero({ amount: 100, precision: 2 })\n * ])\n * @example\n * // returns the smallest Dinero object with amount of 50 from an array of Dinero objects\n * Dinero.minimum([\n * Dinero({ amount: 50 }),\n * Dinero({ amount: 100 })\n * ])\n *\n * @return {Dinero[]}\n */\n minimum: function minimum(objects) {\n var _objects = _toArray(objects),\n firstObject = _objects[0],\n tailObjects = _objects.slice(1);\n\n var currentMinimum = firstObject;\n tailObjects.forEach(function (obj) {\n currentMinimum = currentMinimum.lessThan(obj) ? currentMinimum : obj;\n });\n return currentMinimum;\n },\n\n /**\n * Returns the biggest Dinero object from an array of Dinero objects\n *\n * @memberof module:Dinero\n * @method\n *\n * @param {Dinero[]} objects - An array of Dinero objects\n *\n * @example\n * // returns the biggest Dinero object with amount of 20, from an array of Dinero objects with different precisions\n * Dinero.maximum([\n * Dinero({ amount: 20, precision: 2 }),\n * Dinero({ amount: 150, precision: 3 })\n * ])\n * @example\n * // returns the biggest Dinero object with amount of 100, from an array of Dinero objects\n * Dinero.maximum([\n * Dinero({ amount: 100 }),\n * Dinero({ amount: 50 })\n * ])\n *\n * @return {Dinero[]}\n */\n maximum: function maximum(objects) {\n var _objects2 = _toArray(objects),\n firstObject = _objects2[0],\n tailObjects = _objects2.slice(1);\n\n var currentMaximum = firstObject;\n tailObjects.forEach(function (obj) {\n currentMaximum = currentMaximum.greaterThan(obj) ? currentMaximum : obj;\n });\n return currentMaximum;\n }\n};\n\n/**\n * Returns whether a value is numeric.\n * @ignore\n *\n * @param {} value - The value to test.\n *\n * @return {Boolean}\n */\nfunction isNumeric(value) {\n return !isNaN(parseInt(value)) && isFinite(value);\n}\n/**\n * Returns whether a value is a percentage.\n * @ignore\n *\n * @param {} percentage - The percentage to test.\n *\n * @return {Boolean}\n */\n\nfunction isPercentage(percentage) {\n return isNumeric(percentage) && percentage <= 100 && percentage >= 0;\n}\n/**\n * Returns whether an array of ratios is valid.\n * @ignore\n *\n * @param {} ratios - The ratios to test.\n *\n * @return {Boolean}\n */\n\nfunction areValidRatios(ratios) {\n return ratios.length > 0 && ratios.every(function (ratio) {\n return ratio >= 0;\n }) && ratios.some(function (ratio) {\n return ratio > 0;\n });\n}\n/**\n * Returns whether a value is even.\n * @ignore\n *\n * @param {Number} value - The value to test.\n *\n * @return {Boolean}\n */\n\nfunction isEven(value) {\n return value % 2 === 0;\n}\n/**\n * Returns whether a value is a float.\n * @ignore\n *\n * @param {} value - The value to test.\n *\n * @return {Boolean}\n */\n\nfunction isFloat(value) {\n return isNumeric(value) && !Number.isInteger(value);\n}\n/**\n * Returns how many fraction digits a number has.\n * @ignore\n *\n * @param {Number} [number=0] - The number to test.\n *\n * @return {Number}\n */\n\nfunction countFractionDigits() {\n var number = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var stringRepresentation = number.toString();\n\n if (stringRepresentation.indexOf('e-') > 0) {\n // It's too small for a normal string representation, e.g. 1e-7 instead of 0.00000001\n return parseInt(stringRepresentation.split('e-')[1]);\n } else {\n var fractionDigits = stringRepresentation.split('.')[1];\n return fractionDigits ? fractionDigits.length : 0;\n }\n}\n/**\n * Returns whether a number is half.\n * @ignore\n *\n * @param {Number} number - The number to test.\n *\n * @return {Number}\n */\n\nfunction isHalf(number) {\n return Math.abs(number) % 1 === 0.5;\n}\n/**\n * Fetches a JSON resource.\n * @ignore\n *\n * @param {String} url - The resource to fetch.\n * @param {Object} [options.headers] - The headers to pass.\n *\n * @throws {Error} If `request.status` is lesser than 200 or greater or equal to 400.\n * @throws {Error} If network fails.\n *\n * @return {JSON}\n */\n\nfunction getJSON(url) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new Promise(function (resolve, reject) {\n var request = Object.assign(new XMLHttpRequest(), {\n onreadystatechange: function onreadystatechange() {\n if (request.readyState === 4) {\n if (request.status >= 200 && request.status < 400) resolve(JSON.parse(request.responseText));else reject(new Error(request.statusText));\n }\n },\n onerror: function onerror() {\n reject(new Error('Network error'));\n }\n });\n request.open('GET', url, true);\n setXHRHeaders(request, options.headers);\n request.send();\n });\n}\n/**\n * Returns an XHR object with attached headers.\n * @ignore\n *\n * @param {XMLHttpRequest} xhr - The XHR request to set headers to.\n * @param {Object} headers - The headers to set.\n *\n * @return {XMLHttpRequest}\n */\n\nfunction setXHRHeaders(xhr) {\n var headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n for (var header in headers) {\n xhr.setRequestHeader(header, headers[header]);\n }\n\n return xhr;\n}\n/**\n * Returns whether a value is undefined.\n * @ignore\n *\n * @param {} value - The value to test.\n *\n * @return {Boolean}\n */\n\nfunction isUndefined(value) {\n return typeof value === 'undefined';\n}\n/**\n * Returns an object flattened to one level deep.\n * @ignore\n *\n * @param {Object} object - The object to flatten.\n * @param {String} separator - The separator to use between flattened nodes.\n *\n * @return {Object}\n */\n\nfunction flattenObject(object) {\n var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.';\n var finalObject = {};\n Object.entries(object).forEach(function (item) {\n if (_typeof(item[1]) === 'object') {\n var flatObject = flattenObject(item[1]);\n Object.entries(flatObject).forEach(function (node) {\n finalObject[item[0] + separator + node[0]] = node[1];\n });\n } else {\n finalObject[item[0]] = item[1];\n }\n });\n return finalObject;\n}\n/**\n * Returns whether a value is thenable.\n * @ignore\n *\n * @param {} value - The value to test.\n *\n * @return {Boolean}\n */\n\nfunction isThenable(value) {\n return Boolean(value) && (_typeof(value) === 'object' || typeof value === 'function') && typeof value.then === 'function';\n}\n\nfunction Calculator() {\n var floatMultiply = function floatMultiply(a, b) {\n var getFactor = function getFactor(number) {\n return Math.pow(10, countFractionDigits(number));\n };\n\n var factor = Math.max(getFactor(a), getFactor(b));\n return Math.round(a * factor) * Math.round(b * factor) / (factor * factor);\n };\n\n var roundingModes = {\n HALF_ODD: function HALF_ODD(number) {\n var rounded = Math.round(number);\n return isHalf(number) ? isEven(rounded) ? rounded - 1 : rounded : rounded;\n },\n HALF_EVEN: function HALF_EVEN(number) {\n var rounded = Math.round(number);\n return isHalf(number) ? isEven(rounded) ? rounded : rounded - 1 : rounded;\n },\n HALF_UP: function HALF_UP(number) {\n return Math.round(number);\n },\n HALF_DOWN: function HALF_DOWN(number) {\n return isHalf(number) ? Math.floor(number) : Math.round(number);\n },\n HALF_TOWARDS_ZERO: function HALF_TOWARDS_ZERO(number) {\n return isHalf(number) ? Math.sign(number) * Math.floor(Math.abs(number)) : Math.round(number);\n },\n HALF_AWAY_FROM_ZERO: function HALF_AWAY_FROM_ZERO(number) {\n return isHalf(number) ? Math.sign(number) * Math.ceil(Math.abs(number)) : Math.round(number);\n },\n DOWN: function DOWN(number) {\n return Math.floor(number);\n }\n };\n return {\n /**\n * Returns the sum of two numbers.\n * @ignore\n *\n * @param {Number} a - The first number to add.\n * @param {Number} b - The second number to add.\n *\n * @return {Number}\n */\n add: function add(a, b) {\n return a + b;\n },\n\n /**\n * Returns the difference of two numbers.\n * @ignore\n *\n * @param {Number} a - The first number to subtract.\n * @param {Number} b - The second number to subtract.\n *\n * @return {Number}\n */\n subtract: function subtract(a, b) {\n return a - b;\n },\n\n /**\n * Returns the product of two numbers.\n * @ignore\n *\n * @param {Number} a - The first number to multiply.\n * @param {Number} b - The second number to multiply.\n *\n * @return {Number}\n */\n multiply: function multiply(a, b) {\n return isFloat(a) || isFloat(b) ? floatMultiply(a, b) : a * b;\n },\n\n /**\n * Returns the quotient of two numbers.\n * @ignore\n *\n * @param {Number} a - The first number to divide.\n * @param {Number} b - The second number to divide.\n *\n * @return {Number}\n */\n divide: function divide(a, b) {\n return a / b;\n },\n\n /**\n * Returns the remainder of two numbers.\n * @ignore\n *\n * @param {Number} a - The first number to divide.\n * @param {Number} b - The second number to divide.\n *\n * @return {Number}\n */\n modulo: function modulo(a, b) {\n return a % b;\n },\n\n /**\n * Returns a rounded number based off a specific rounding mode.\n * @ignore\n *\n * @param {Number} number - The number to round.\n * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use.\n *\n * @returns {Number}\n */\n round: function round(number) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'HALF_EVEN';\n return roundingModes[roundingMode](number);\n }\n };\n}\n\nvar calculator = Calculator();\nfunction Format(format) {\n var matches = /^(?:(\\$|USD)?0(?:(,)0)?(\\.)?(0+)?|0(?:(,)0)?(\\.)?(0+)?\\s?(dollar)?)$/gm.exec(format);\n return {\n /**\n * Returns the matches.\n * @ignore\n *\n * @return {Array}\n */\n getMatches: function getMatches() {\n return matches !== null ? matches.slice(1).filter(function (match) {\n return !isUndefined(match);\n }) : [];\n },\n\n /**\n * Returns the amount of fraction digits to display.\n * @ignore\n *\n * @return {Number}\n */\n getMinimumFractionDigits: function getMinimumFractionDigits() {\n var decimalPosition = function decimalPosition(match) {\n return match === '.';\n };\n\n return !isUndefined(this.getMatches().find(decimalPosition)) ? this.getMatches()[calculator.add(this.getMatches().findIndex(decimalPosition), 1)].split('').length : 0;\n },\n\n /**\n * Returns the currency display mode.\n * @ignore\n *\n * @return {String}\n */\n getCurrencyDisplay: function getCurrencyDisplay() {\n var modes = {\n USD: 'code',\n dollar: 'name',\n $: 'symbol'\n };\n return modes[this.getMatches().find(function (match) {\n return match === 'USD' || match === 'dollar' || match === '$';\n })];\n },\n\n /**\n * Returns the formatting style.\n * @ignore\n *\n * @return {String}\n */\n getStyle: function getStyle() {\n return !isUndefined(this.getCurrencyDisplay(this.getMatches())) ? 'currency' : 'decimal';\n },\n\n /**\n * Returns whether grouping should be used or not.\n * @ignore\n *\n * @return {Boolean}\n */\n getUseGrouping: function getUseGrouping() {\n return !isUndefined(this.getMatches().find(function (match) {\n return match === ',';\n }));\n }\n };\n}\n\nfunction CurrencyConverter(options) {\n /* istanbul ignore next */\n var mergeTags = function mergeTags() {\n var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var tags = arguments.length > 1 ? arguments[1] : undefined;\n\n for (var tag in tags) {\n string = string.replace(\"{{\".concat(tag, \"}}\"), tags[tag]);\n }\n\n return string;\n };\n /* istanbul ignore next */\n\n\n var getRatesFromRestApi = function getRatesFromRestApi(from, to) {\n return getJSON(mergeTags(options.endpoint, {\n from: from,\n to: to\n }), {\n headers: options.headers\n });\n };\n\n return {\n /**\n * Returns the exchange rate.\n * @ignore\n *\n * @param {String} from - The base currency.\n * @param {String} to - The destination currency.\n *\n * @return {Promise}\n */\n getExchangeRate: function getExchangeRate(from, to) {\n return (isThenable(options.endpoint) ? options.endpoint : getRatesFromRestApi(from, to)).then(function (data) {\n return flattenObject(data)[mergeTags(options.propertyPath, {\n from: from,\n to: to\n })];\n });\n }\n };\n}\n\n/**\n * Performs an assertion.\n * @ignore\n *\n * @param {Boolean} condition - The expression to assert.\n * @param {String} errorMessage - The message to throw if the assertion fails\n * @param {ErrorConstructor} [ErrorType=Error] - The error to throw if the assertion fails.\n *\n * @throws {Error} If `condition` returns `false`.\n */\n\nfunction assert(condition, errorMessage) {\n var ErrorType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Error;\n if (!condition) throw new ErrorType(errorMessage);\n}\n/**\n * Asserts a value is a percentage.\n * @ignore\n *\n * @param {} percentage - The percentage to test.\n *\n * @throws {RangeError} If `percentage` is out of range.\n */\n\nfunction assertPercentage(percentage) {\n assert(isPercentage(percentage), 'You must provide a numeric value between 0 and 100.', RangeError);\n}\n/**\n * Asserts an array of ratios is valid.\n * @ignore\n *\n * @param {} ratios - The ratios to test.\n *\n * @throws {TypeError} If `ratios` are invalid.\n */\n\nfunction assertValidRatios(ratios) {\n assert(areValidRatios(ratios), 'You must provide a non-empty array of numeric values greater than 0.', TypeError);\n}\n/**\n * Asserts a value is an integer.\n * @ignore\n *\n * @param {} number - The value to test.\n *\n * @throws {TypeError}\n */\n\nfunction assertInteger(number) {\n assert(Number.isInteger(number), 'You must provide an integer.', TypeError);\n}\n\nvar calculator$1 = Calculator();\n/**\n * A Dinero object is an immutable data structure representing a specific monetary value.\n * It comes with methods for creating, parsing, manipulating, testing, transforming and formatting them.\n *\n * A Dinero object has:\n *\n * * An `amount`, expressed in minor currency units, as an integer.\n * * A `currency`, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.\n * * A `precision`, expressed as an integer, to represent the number of decimal places in the `amount`.\n * This is helpful when you want to represent fractional minor currency units (e.g.: $10.4545).\n * You can also use it to represent a currency with a different [exponent](https://en.wikipedia.org/wiki/ISO_4217#Treatment_of_minor_currency_units_.28the_.22exponent.22.29) than `2` (e.g.: Iraqi dinar with 1000 fils in 1 dinar (exponent of `3`), Japanese yen with no sub-units (exponent of `0`)).\n * * An optional `locale` property that affects how output strings are formatted.\n *\n * Here's an overview of the public API:\n *\n * * **Access:** {@link module:Dinero~getAmount getAmount}, {@link module:Dinero~getCurrency getCurrency}, {@link module:Dinero~getLocale getLocale} and {@link module:Dinero~getPrecision getPrecision}.\n * * **Manipulation:** {@link module:Dinero~add add}, {@link module:Dinero~subtract subtract}, {@link module:Dinero~multiply multiply}, {@link module:Dinero~divide divide}, {@link module:Dinero~percentage percentage}, {@link module:Dinero~allocate allocate} and {@link module:Dinero~convert convert}.\n * * **Testing:** {@link module:Dinero~equalsTo equalsTo}, {@link module:Dinero~lessThan lessThan}, {@link module:Dinero~lessThanOrEqual lessThanOrEqual}, {@link module:Dinero~greaterThan greaterThan}, {@link module:Dinero~greaterThanOrEqual greaterThanOrEqual}, {@link module:Dinero~isZero isZero}, {@link module:Dinero~isPositive isPositive}, {@link module:Dinero~isNegative isNegative}, {@link module:Dinero~hasSubUnits hasSubUnits}, {@link module:Dinero~hasSameCurrency hasSameCurrency} and {@link module:Dinero~hasSameAmount hasSameAmount}.\n * * **Configuration:** {@link module:Dinero~setLocale setLocale}.\n * * **Conversion & formatting:** {@link module:Dinero~toFormat toFormat}, {@link module:Dinero~toUnit toUnit}, {@link module:Dinero~toRoundedUnit toRoundedUnit}, {@link module:Dinero~toObject toObject}, {@link module:Dinero~toJSON toJSON}, {@link module:Dinero~convertPrecision convertPrecision} and {@link module:Dinero.normalizePrecision normalizePrecision}.\n *\n * Dinero.js uses `number`s under the hood, so it's constrained by the [double-precision floating-point format](https://en.wikipedia.org/wiki/Double-precision_floating-point_format). Using values over [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MAX_SAFE_INTEGER) or below [`Number.MIN_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MIN_SAFE_INTEGER) will yield unpredictable results.\n * Same goes with performing calculations: once the internal `amount` value exceeds those limits, precision is no longer guaranteed.\n *\n * @module Dinero\n * @param {Number} [options.amount=0] - The amount in minor currency units (as an integer).\n * @param {String} [options.currency='USD'] - An ISO 4217 currency code.\n * @param {String} [options.precision=2] - The number of decimal places to represent.\n *\n * @throws {TypeError} If `amount` or `precision` is invalid. Integers over [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MAX_SAFE_INTEGER) or below [`Number.MIN_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MIN_SAFE_INTEGER) are considered valid, even though they can lead to imprecise amounts.\n *\n * @return {Object}\n */\n\nvar Dinero = function Dinero(options) {\n var _Object$assign = Object.assign({}, {\n amount: Dinero.defaultAmount,\n currency: Dinero.defaultCurrency,\n precision: Dinero.defaultPrecision\n }, options),\n amount = _Object$assign.amount,\n currency = _Object$assign.currency,\n precision = _Object$assign.precision;\n\n assertInteger(amount);\n assertInteger(precision);\n var globalLocale = Dinero.globalLocale,\n globalFormat = Dinero.globalFormat,\n globalRoundingMode = Dinero.globalRoundingMode,\n globalFormatRoundingMode = Dinero.globalFormatRoundingMode;\n var globalExchangeRatesApi = Object.assign({}, Dinero.globalExchangeRatesApi);\n /**\n * Uses ES5 function notation so `this` can be passed through call, apply and bind\n * @ignore\n */\n\n var create = function create(options) {\n var obj = Object.assign({}, Object.assign({}, {\n amount: amount,\n currency: currency,\n precision: precision\n }, options), Object.assign({}, {\n locale: this.locale\n }, options));\n return Object.assign(Dinero({\n amount: obj.amount,\n currency: obj.currency,\n precision: obj.precision\n }), {\n locale: obj.locale\n });\n };\n /**\n * Uses ES5 function notation so `this` can be passed through call, apply and bind\n * @ignore\n */\n\n\n var assertSameCurrency = function assertSameCurrency(comparator) {\n assert(this.hasSameCurrency(comparator), 'You must provide a Dinero instance with the same currency.', TypeError);\n };\n\n return {\n /**\n * Returns the amount.\n *\n * @example\n * // returns 500\n * Dinero({ amount: 500 }).getAmount()\n *\n * @return {Number}\n */\n getAmount: function getAmount() {\n return amount;\n },\n\n /**\n * Returns the currency.\n *\n * @example\n * // returns 'EUR'\n * Dinero({ currency: 'EUR' }).getCurrency()\n *\n * @return {String}\n */\n getCurrency: function getCurrency() {\n return currency;\n },\n\n /**\n * Returns the locale.\n *\n * @example\n * // returns 'fr-FR'\n * Dinero().setLocale('fr-FR').getLocale()\n *\n * @return {String}\n */\n getLocale: function getLocale() {\n return this.locale || globalLocale;\n },\n\n /**\n * Returns a new Dinero object with an embedded locale.\n *\n * @param {String} newLocale - The new locale as an {@link http://tools.ietf.org/html/rfc5646 BCP 47 language tag}.\n *\n * @example\n * // Returns a Dinero object with locale 'ja-JP'\n * Dinero().setLocale('ja-JP')\n *\n * @return {Dinero}\n */\n setLocale: function setLocale(newLocale) {\n return create.call(this, {\n locale: newLocale\n });\n },\n\n /**\n * Returns the precision.\n *\n * @example\n * // returns 3\n * Dinero({ precision: 3 }).getPrecision()\n *\n * @return {Number}\n */\n getPrecision: function getPrecision() {\n return precision;\n },\n\n /**\n * Returns a new Dinero object with a new precision and a converted amount.\n *\n * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).\n * This can be necessary when you need to convert objects to a smaller precision.\n *\n * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent conversions for safer results.\n * You can also specify a different `roundingMode` to better fit your needs.\n *\n * @param {Number} newPrecision - The new precision.\n * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // Returns a Dinero object with precision 3 and amount 1000\n * Dinero({ amount: 100, precision: 2 }).convertPrecision(3)\n *\n * @throws {TypeError} If `newPrecision` is invalid.\n *\n * @return {Dinero}\n */\n convertPrecision: function convertPrecision(newPrecision) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;\n assertInteger(newPrecision);\n var precision = this.getPrecision();\n var isNewPrecisionLarger = newPrecision > precision;\n var operation = isNewPrecisionLarger ? calculator$1.multiply : calculator$1.divide;\n var terms = isNewPrecisionLarger ? [newPrecision, precision] : [precision, newPrecision];\n var factor = Math.pow(10, calculator$1.subtract.apply(calculator$1, terms));\n return create.call(this, {\n amount: calculator$1.round(operation(this.getAmount(), factor), roundingMode),\n precision: newPrecision\n });\n },\n\n /**\n * Returns a new Dinero object that represents the sum of this and an other Dinero object.\n *\n * If Dinero objects have a different `precision`, they will be first converted to the highest.\n *\n * @param {Dinero} addend - The Dinero object to add.\n *\n * @example\n * // returns a Dinero object with amount 600\n * Dinero({ amount: 400 }).add(Dinero({ amount: 200 }))\n * @example\n * // returns a Dinero object with amount 144545 and precision 4\n * Dinero({ amount: 400 }).add(Dinero({ amount: 104545, precision: 4 }))\n *\n * @throws {TypeError} If `addend` has a different currency.\n *\n * @return {Dinero}\n */\n add: function add(addend) {\n assertSameCurrency.call(this, addend);\n var addends = Dinero.normalizePrecision([this, addend]);\n return create.call(this, {\n amount: calculator$1.add(addends[0].getAmount(), addends[1].getAmount()),\n precision: addends[0].getPrecision()\n });\n },\n\n /**\n * Returns a new Dinero object that represents the difference of this and an other Dinero object.\n *\n * If Dinero objects have a different `precision`, they will be first converted to the highest.\n *\n * @param {Dinero} subtrahend - The Dinero object to subtract.\n *\n * @example\n * // returns a Dinero object with amount 200\n * Dinero({ amount: 400 }).subtract(Dinero({ amount: 200 }))\n * @example\n * // returns a Dinero object with amount 64545 and precision 4\n * Dinero({ amount: 104545, precision: 4 }).subtract(Dinero({ amount: 400 }))\n *\n * @throws {TypeError} If `subtrahend` has a different currency.\n *\n * @return {Dinero}\n */\n subtract: function subtract(subtrahend) {\n assertSameCurrency.call(this, subtrahend);\n var subtrahends = Dinero.normalizePrecision([this, subtrahend]);\n return create.call(this, {\n amount: calculator$1.subtract(subtrahends[0].getAmount(), subtrahends[1].getAmount()),\n precision: subtrahends[0].getPrecision()\n });\n },\n\n /**\n * Returns a new Dinero object that represents the multiplied value by the given factor.\n *\n * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).\n *\n * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.\n * You can also specify a different `roundingMode` to better fit your needs.\n *\n * @param {Number} multiplier - The factor to multiply by.\n * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // returns a Dinero object with amount 1600\n * Dinero({ amount: 400 }).multiply(4)\n * @example\n * // returns a Dinero object with amount 800\n * Dinero({ amount: 400 }).multiply(2.001)\n * @example\n * // returns a Dinero object with amount 801\n * Dinero({ amount: 400 }).multiply(2.00125, 'HALF_UP')\n *\n * @return {Dinero}\n */\n multiply: function multiply(multiplier) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;\n return create.call(this, {\n amount: calculator$1.round(calculator$1.multiply(this.getAmount(), multiplier), roundingMode)\n });\n },\n\n /**\n * Returns a new Dinero object that represents the divided value by the given factor.\n *\n * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).\n *\n * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.\n * You can also specify a different `roundingMode` to better fit your needs.\n *\n * As rounding is applied, precision may be lost in the process. If you want to accurately split a Dinero object, use {@link module:Dinero~allocate allocate} instead.\n *\n * @param {Number} divisor - The factor to divide by.\n * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // returns a Dinero object with amount 100\n * Dinero({ amount: 400 }).divide(4)\n * @example\n * // returns a Dinero object with amount 52\n * Dinero({ amount: 105 }).divide(2)\n * @example\n * // returns a Dinero object with amount 53\n * Dinero({ amount: 105 }).divide(2, 'HALF_UP')\n *\n * @return {Dinero}\n */\n divide: function divide(divisor) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;\n return create.call(this, {\n amount: calculator$1.round(calculator$1.divide(this.getAmount(), divisor), roundingMode)\n });\n },\n\n /**\n * Returns a new Dinero object that represents a percentage of this.\n *\n * As rounding is applied, precision may be lost in the process. If you want to accurately split a Dinero object, use {@link module:Dinero~allocate allocate} instead.\n *\n * @param {Number} percentage - The percentage to extract (between 0 and 100).\n * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // returns a Dinero object with amount 5000\n * Dinero({ amount: 10000 }).percentage(50)\n * @example\n * // returns a Dinero object with amount 29\n * Dinero({ amount: 57 }).percentage(50, \"HALF_ODD\")\n *\n * @throws {RangeError} If `percentage` is out of range.\n *\n * @return {Dinero}\n */\n percentage: function percentage(_percentage) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;\n assertPercentage(_percentage);\n return this.multiply(calculator$1.divide(_percentage, 100), roundingMode);\n },\n\n /**\n * Allocates the amount of a Dinero object according to a list of ratios.\n *\n * Sometimes you need to split monetary values but percentages can't cut it without adding or losing pennies.\n * A good example is invoicing: let's say you need to bill $1,000.03 and you want a 50% downpayment.\n * If you use {@link module:Dinero~percentage percentage}, you'll get an accurate Dinero object but the amount won't be billable: you can't split a penny.\n * If you round it, you'll bill a penny extra.\n * With {@link module:Dinero~allocate allocate}, you can split a monetary amount then distribute the remainder as evenly as possible.\n *\n * You can use percentage style or ratio style for `ratios`: `[25, 75]` and `[1, 3]` will do the same thing.\n *\n * Since v1.8.0, you can use zero ratios (such as [0, 50, 50]). If there's a remainder to distribute, zero ratios are skipped and return a Dinero object with amount zero.\n *\n * @param {Number[]} ratios - The ratios to allocate the money to.\n *\n * @example\n * // returns an array of two Dinero objects\n * // the first one with an amount of 502\n * // the second one with an amount of 501\n * Dinero({ amount: 1003 }).allocate([50, 50])\n * @example\n * // returns an array of two Dinero objects\n * // the first one with an amount of 25\n * // the second one with an amount of 75\n * Dinero({ amount: 100 }).allocate([1, 3])\n * @example\n * // since version 1.8.0\n * // returns an array of three Dinero objects\n * // the first one with an amount of 0\n * // the second one with an amount of 502\n * // the third one with an amount of 501\n * Dinero({ amount: 1003 }).allocate([0, 50, 50])\n *\n * @throws {TypeError} If ratios are invalid.\n *\n * @return {Dinero[]}\n */\n allocate: function allocate(ratios) {\n var _this = this;\n\n assertValidRatios(ratios);\n var total = ratios.reduce(function (a, b) {\n return calculator$1.add(a, b);\n });\n var remainder = this.getAmount();\n var shares = ratios.map(function (ratio) {\n var share = Math.floor(calculator$1.divide(calculator$1.multiply(_this.getAmount(), ratio), total));\n remainder = calculator$1.subtract(remainder, share);\n return create.call(_this, {\n amount: share\n });\n });\n var i = 0;\n\n while (remainder > 0) {\n if (ratios[i] > 0) {\n shares[i] = shares[i].add(create.call(this, {\n amount: 1\n }));\n remainder = calculator$1.subtract(remainder, 1);\n }\n\n i += 1;\n }\n\n return shares;\n },\n\n /**\n * Returns a Promise containing a new Dinero object converted to another currency.\n *\n * You have two options to provide the exchange rates:\n *\n * 1. **Use an exchange rate REST API, and let Dinero handle the fetching and conversion.**\n * This is a simple option if you have access to an exchange rate REST API and want Dinero to do the rest.\n * 2. **Fetch the exchange rates on your own and provide them directly.**\n * This is useful if you're fetching your rates from somewhere else (a file, a database), use a different protocol or query language than REST (SOAP, GraphQL) or want to fetch rates once and cache them instead of making new requests every time.\n *\n * **If you want to use a REST API**, you must provide a third-party endpoint yourself. Dinero doesn't come bundled with an exchange rates endpoint.\n *\n * Here are some exchange rate APIs you can use:\n *\n * * [Fixer](https://fixer.io)\n * * [Open Exchange Rates](https://openexchangerates.org)\n * * [Coinbase](https://api.coinbase.com/v2/exchange-rates)\n * * More [foreign](https://github.com/toddmotto/public-apis#currency-exchange) and [crypto](https://github.com/toddmotto/public-apis#cryptocurrency) exchange rate APIs.\n *\n * **If you want to fetch your own rates and provide them directly**, you need to pass a promise that resolves to the exchanges rates.\n *\n * In both cases, you need to specify at least:\n *\n * * a **destination currency**: the currency in which you want to convert your Dinero object. You can specify it with `currency`.\n * * an **endpoint**: the API URL to query exchange rates, with parameters, or a promise that resolves to the exchange rates. You can specify it with `options.endpoint`.\n * * a **property path**: the path to access the wanted rate in your API's JSON response (or the custom promise's payload). For example, with a response of:\n * ```json\n * {\n * \"data\": {\n * \"base\": \"USD\",\n * \"destination\": \"EUR\",\n * \"rate\": \"0.827728919\"\n * }\n * }\n * ```\n * Then the property path is `'data.rate'`. You can specify it with `options.propertyPath`.\n *\n * The base currency (the one of your Dinero object) and the destination currency can be used as \"merge tags\" with the mustache syntax, respectively `{{from}}` and `{{to}}`.\n * You can use these tags to refer to these values in `options.endpoint` and `options.propertyPath`.\n *\n * For example, if you need to specify the base currency as a query parameter, you can do the following:\n *\n * ```js\n * {\n * endpoint: 'https://yourexchangerates.api/latest?base={{from}}'\n * }\n * ```\n *\n * @param {String} currency - The destination currency, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.\n * @param {(String|Promise)} options.endpoint - The API endpoint to retrieve exchange rates. You can substitute this with a promise that resolves to the exchanges rates if you already have them.\n * @param {String} [options.propertyPath='rates.{{to}}'] - The property path to the rate.\n * @param {Object} [options.headers] - The HTTP headers to provide, if needed.\n * @param {String} [options.roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // your global API parameters\n * Dinero.globalExchangeRatesApi = { ... }\n *\n * // returns a Promise containing a Dinero object with the destination currency\n * // and the initial amount converted to the new currency.\n * Dinero({ amount: 500 }).convert('EUR')\n * @example\n * // returns a Promise containing a Dinero object,\n * // with specific API parameters and rounding mode for this specific instance.\n * Dinero({ amount: 500 })\n * .convert('XBT', {\n * endpoint: 'https://yourexchangerates.api/latest?base={{from}}',\n * propertyPath: 'data.rates.{{to}}',\n * headers: {\n * 'user-key': 'xxxxxxxxx'\n * },\n * roundingMode: 'HALF_UP'\n * })\n * @example\n * // usage with exchange rates provided as a custom promise\n * // using the default `propertyPath` format (so it doesn't have to be specified)\n * const rates = {\n * rates: {\n * EUR: 0.81162\n * }\n * }\n *\n * Dinero({ amount: 500 })\n * .convert('EUR', {\n * endpoint: new Promise(resolve => resolve(rates))\n * })\n * @example\n * // usage with Promise.prototype.then and Promise.prototype.catch\n * Dinero({ amount: 500 })\n * .convert('EUR')\n * .then(dinero => {\n * dinero.getCurrency() // returns 'EUR'\n * })\n * .catch(err => {\n * // handle errors\n * })\n * @example\n * // usage with async/await\n * (async () => {\n * const price = await Dinero({ amount: 500 }).convert('EUR')\n * price.getCurrency() // returns 'EUR'\n * })()\n *\n * @return {Promise}\n */\n convert: function convert(currency) {\n var _this2 = this;\n\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$endpoint = _ref.endpoint,\n endpoint = _ref$endpoint === void 0 ? globalExchangeRatesApi.endpoint : _ref$endpoint,\n _ref$propertyPath = _ref.propertyPath,\n propertyPath = _ref$propertyPath === void 0 ? globalExchangeRatesApi.propertyPath || 'rates.{{to}}' : _ref$propertyPath,\n _ref$headers = _ref.headers,\n headers = _ref$headers === void 0 ? globalExchangeRatesApi.headers : _ref$headers,\n _ref$roundingMode = _ref.roundingMode,\n roundingMode = _ref$roundingMode === void 0 ? globalRoundingMode : _ref$roundingMode;\n\n var options = Object.assign({}, {\n endpoint: endpoint,\n propertyPath: propertyPath,\n headers: headers,\n roundingMode: roundingMode\n });\n return CurrencyConverter(options).getExchangeRate(this.getCurrency(), currency).then(function (rate) {\n assert(!isUndefined(rate), \"No rate was found for the destination currency \\\"\".concat(currency, \"\\\".\"), TypeError);\n return create.call(_this2, {\n amount: calculator$1.round(calculator$1.multiply(_this2.getAmount(), parseFloat(rate)), options.roundingMode),\n currency: currency\n });\n });\n },\n\n /**\n * Checks whether the value represented by this object equals to the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))\n * @example\n * // returns false\n * Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))\n * @example\n * // returns false\n * Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))\n * @example\n * // returns false\n * Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))\n * @example\n * // returns true\n * Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))\n * @example\n * // returns false\n * Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))\n *\n * @return {Boolean}\n */\n equalsTo: function equalsTo(comparator) {\n return this.hasSameAmount(comparator) && this.hasSameCurrency(comparator);\n },\n\n /**\n * Checks whether the value represented by this object is less than the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 500 }).lessThan(Dinero({ amount: 800 }))\n * @example\n * // returns false\n * Dinero({ amount: 800 }).lessThan(Dinero({ amount: 500 }))\n * @example\n * // returns true\n * Dinero({ amount: 5000, precision: 3 }).lessThan(Dinero({ amount: 800 }))\n * @example\n * // returns false\n * Dinero({ amount: 800 }).lessThan(Dinero({ amount: 5000, precision: 3 }))\n *\n * @throws {TypeError} If `comparator` has a different currency.\n *\n * @return {Boolean}\n */\n lessThan: function lessThan(comparator) {\n assertSameCurrency.call(this, comparator);\n var comparators = Dinero.normalizePrecision([this, comparator]);\n return comparators[0].getAmount() < comparators[1].getAmount();\n },\n\n /**\n * Checks whether the value represented by this object is less than or equal to the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 800 }))\n * @example\n * // returns true\n * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 500 }))\n * @example\n * // returns false\n * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 300 }))\n * @example\n * // returns true\n * Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 800 }))\n * @example\n * // returns true\n * Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 500 }))\n * @example\n * // returns false\n * Dinero({ amount: 800 }).lessThanOrEqual(Dinero({ amount: 5000, precision: 3 }))\n *\n * @throws {TypeError} If `comparator` has a different currency.\n *\n * @return {Boolean}\n */\n lessThanOrEqual: function lessThanOrEqual(comparator) {\n assertSameCurrency.call(this, comparator);\n var comparators = Dinero.normalizePrecision([this, comparator]);\n return comparators[0].getAmount() <= comparators[1].getAmount();\n },\n\n /**\n * Checks whether the value represented by this object is greater than the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns false\n * Dinero({ amount: 500 }).greaterThan(Dinero({ amount: 800 }))\n * @example\n * // returns true\n * Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 500 }))\n * @example\n * // returns true\n * Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 5000, precision: 3 }))\n * @example\n * // returns false\n * Dinero({ amount: 5000, precision: 3 }).greaterThan(Dinero({ amount: 800 }))\n *\n * @throws {TypeError} If `comparator` has a different currency.\n *\n * @return {Boolean}\n */\n greaterThan: function greaterThan(comparator) {\n assertSameCurrency.call(this, comparator);\n var comparators = Dinero.normalizePrecision([this, comparator]);\n return comparators[0].getAmount() > comparators[1].getAmount();\n },\n\n /**\n * Checks whether the value represented by this object is greater than or equal to the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 300 }))\n * @example\n * // returns true\n * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 500 }))\n * @example\n * // returns false\n * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 800 }))\n * @example\n * // returns true\n * Dinero({ amount: 800 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))\n * @example\n * // returns true\n * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))\n * @example\n * // returns false\n * Dinero({ amount: 5000, precision: 3 }).greaterThanOrEqual(Dinero({ amount: 800 }))\n *\n * @throws {TypeError} If `comparator` has a different currency.\n *\n * @return {Boolean}\n */\n greaterThanOrEqual: function greaterThanOrEqual(comparator) {\n assertSameCurrency.call(this, comparator);\n var comparators = Dinero.normalizePrecision([this, comparator]);\n return comparators[0].getAmount() >= comparators[1].getAmount();\n },\n\n /**\n * Checks if the value represented by this object is zero.\n *\n * @example\n * // returns true\n * Dinero({ amount: 0 }).isZero()\n * @example\n * // returns false\n * Dinero({ amount: 100 }).isZero()\n *\n * @return {Boolean}\n */\n isZero: function isZero() {\n return this.getAmount() === 0;\n },\n\n /**\n * Checks if the value represented by this object is positive.\n *\n * @example\n * // returns false\n * Dinero({ amount: -10 }).isPositive()\n * @example\n * // returns true\n * Dinero({ amount: 10 }).isPositive()\n * @example\n * // returns true\n * Dinero({ amount: 0 }).isPositive()\n *\n * @return {Boolean}\n */\n isPositive: function isPositive() {\n return this.getAmount() >= 0;\n },\n\n /**\n * Checks if the value represented by this object is negative.\n *\n * @example\n * // returns true\n * Dinero({ amount: -10 }).isNegative()\n * @example\n * // returns false\n * Dinero({ amount: 10 }).isNegative()\n * @example\n * // returns false\n * Dinero({ amount: 0 }).isNegative()\n *\n * @return {Boolean}\n */\n isNegative: function isNegative() {\n return this.getAmount() < 0;\n },\n\n /**\n * Checks if this has minor currency units.\n * Deprecates {@link module:Dinero~hasCents hasCents}.\n *\n * @example\n * // returns false\n * Dinero({ amount: 1100 }).hasSubUnits()\n * @example\n * // returns true\n * Dinero({ amount: 1150 }).hasSubUnits()\n *\n * @return {Boolean}\n */\n hasSubUnits: function hasSubUnits() {\n return calculator$1.modulo(this.getAmount(), Math.pow(10, precision)) !== 0;\n },\n\n /**\n * Checks if this has minor currency units.\n *\n * @deprecated since version 1.4.0, will be removed in 2.0.0\n * Use {@link module:Dinero~hasSubUnits hasSubUnits} instead.\n *\n * @example\n * // returns false\n * Dinero({ amount: 1100 }).hasCents()\n * @example\n * // returns true\n * Dinero({ amount: 1150 }).hasCents()\n *\n * @return {Boolean}\n */\n hasCents: function hasCents() {\n return calculator$1.modulo(this.getAmount(), Math.pow(10, precision)) !== 0;\n },\n\n /**\n * Checks whether the currency represented by this object equals to the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 2000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'EUR' }))\n * @example\n * // returns false\n * Dinero({ amount: 1000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'USD' }))\n *\n * @return {Boolean}\n */\n hasSameCurrency: function hasSameCurrency(comparator) {\n return this.getCurrency() === comparator.getCurrency();\n },\n\n /**\n * Checks whether the amount represented by this object equals to the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 1000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000 }))\n * @example\n * // returns false\n * Dinero({ amount: 2000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000, currency: 'EUR' }))\n * @example\n * // returns true\n * Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))\n * @example\n * // returns false\n * Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))\n *\n * @return {Boolean}\n */\n hasSameAmount: function hasSameAmount(comparator) {\n var comparators = Dinero.normalizePrecision([this, comparator]);\n return comparators[0].getAmount() === comparators[1].getAmount();\n },\n\n /**\n * Returns this object formatted as a string.\n *\n * The format is a mask which defines how the output string will be formatted.\n * It defines whether to display a currency, in what format, how many fraction digits to display and whether to use grouping separators.\n * The output is formatted according to the applying locale.\n *\n * Object | Format | String\n * :--------------------------- | :---------------- | :---\n * `Dinero({ amount: 500050 })` | `'$0,0.00'` | $5,000.50\n * `Dinero({ amount: 500050 })` | `'$0,0'` | $5,001\n * `Dinero({ amount: 500050 })` | `'$0'` | $5001\n * `Dinero({ amount: 500050 })` | `'$0.0'` | $5000.5\n * `Dinero({ amount: 500050 })` | `'USD0,0.0'` | USD5,000.5\n * `Dinero({ amount: 500050 })` | `'0,0.0 dollar'` | 5,000.5 dollars\n *\n * Don't try to substitute the `$` sign or the `USD` code with your target currency, nor adapt the format string to the exact format you want.\n * The format is a mask which defines a pattern and returns a valid, localized currency string.\n * If you want to display the object in a custom way, either use {@link module:Dinero~getAmount getAmount}, {@link module:Dinero~toUnit toUnit} or {@link module:Dinero~toRoundedUnit toRoundedUnit} and manipulate the output string as you wish.\n *\n * {@link module:Dinero~toFormat toFormat} wraps around `Number.prototype.toLocaleString`. For that reason, **format will vary depending on how it's implemented in the end user's environment**.\n *\n * You can also use `toLocaleString` directly:\n * `Dinero().toRoundedUnit(digits, roundingMode).toLocaleString(locale, options)`.\n *\n * By default, amounts are rounded using the **half away from zero** rule ([commercial rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)).\n * You can also specify a different `roundingMode` to better fit your needs.\n *\n * @param {String} [format='$0,0.00'] - The format mask to format to.\n * @param {String} [roundingMode='HALF_AWAY_FROM_ZERO'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // returns $2,000\n * Dinero({ amount: 200000 }).toFormat('$0,0')\n * @example\n * // returns €50.5\n * Dinero({ amount: 5050, currency: 'EUR' }).toFormat('$0,0.0')\n * @example\n * // returns 100 euros\n * Dinero({ amount: 10000, currency: 'EUR' }).setLocale('fr-FR').toFormat('0,0 dollar')\n * @example\n * // returns 2000\n * Dinero({ amount: 200000, currency: 'EUR' }).toFormat()\n * @example\n * // returns $10\n * Dinero({ amount: 1050 }).toFormat('$0', 'HALF_EVEN')\n *\n * @return {String}\n */\n toFormat: function toFormat() {\n var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalFormat;\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;\n var formatter = Format(format);\n return this.toRoundedUnit(formatter.getMinimumFractionDigits(), roundingMode).toLocaleString(this.getLocale(), {\n currencyDisplay: formatter.getCurrencyDisplay(),\n useGrouping: formatter.getUseGrouping(),\n minimumFractionDigits: formatter.getMinimumFractionDigits(),\n style: formatter.getStyle(),\n currency: this.getCurrency()\n });\n },\n\n /**\n * Returns the amount represented by this object in units.\n *\n * @example\n * // returns 10.5\n * Dinero({ amount: 1050 }).toUnit()\n * @example\n * // returns 10.545\n * Dinero({ amount: 10545, precision: 3 }).toUnit()\n *\n * @return {Number}\n */\n toUnit: function toUnit() {\n return calculator$1.divide(this.getAmount(), Math.pow(10, precision));\n },\n\n /**\n * Returns the amount represented by this object in rounded units.\n *\n * By default, the method uses the **half away from zero** rule ([commercial rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)).\n * You can also specify a different `roundingMode` to better fit your needs.\n *\n * @example\n * // returns 10.6\n * Dinero({ amount: 1055 }).toRoundedUnit(1)\n * @example\n * // returns 10\n * Dinero({ amount: 1050 }).toRoundedUnit(0, 'HALF_EVEN')\n *\n * @param {Number} digits - The number of fraction digits to round to.\n * @param {String} [roundingMode='HALF_AWAY_FROM_ZERO'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @return {Number}\n */\n toRoundedUnit: function toRoundedUnit(digits) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;\n var factor = Math.pow(10, digits);\n return calculator$1.divide(calculator$1.round(calculator$1.multiply(this.toUnit(), factor), roundingMode), factor);\n },\n\n /**\n * Returns the object's data as an object literal.\n *\n * @example\n * // returns { amount: 500, currency: 'EUR', precision: 2 }\n * Dinero({ amount: 500, currency: 'EUR', precision: 2 }).toObject()\n *\n * @return {Object}\n */\n toObject: function toObject() {\n return {\n amount: amount,\n currency: currency,\n precision: precision\n };\n },\n\n /**\n * Returns the object's data as an object literal.\n *\n * Alias of {@link module:Dinero~toObject toObject}.\n * It is defined so that calling `JSON.stringify` on a Dinero object will automatically extract the relevant data.\n *\n * @example\n * // returns '{\"amount\":500,\"currency\":\"EUR\",\"precision\":2}'\n * JSON.stringify(Dinero({ amount: 500, currency: 'EUR', precision: 2 }))\n *\n * @return {Object}\n */\n toJSON: function toJSON() {\n return this.toObject();\n }\n };\n};\n\nvar dinero = Object.assign(Dinero, Defaults, Globals, Static);\n\nexport default dinero;\n"],"names":["e","n","Defaults","Globals","_typeof","obj","_toArray","arr","_arrayWithHoles","_iterableToArray","_unsupportedIterableToArray","_nonIterableRest","iter","o","minLen","_arrayLikeToArray","len","i","arr2","Static","objects","highestPrecision","a","b","object","_objects","firstObject","tailObjects","currentMinimum","_objects2","currentMaximum","isNumeric","value","isPercentage","percentage","areValidRatios","ratios","ratio","isEven","isFloat","countFractionDigits","number","stringRepresentation","fractionDigits","isHalf","getJSON","url","options","resolve","reject","request","setXHRHeaders","xhr","headers","header","isUndefined","flattenObject","separator","finalObject","item","flatObject","node","isThenable","Calculator","floatMultiply","getFactor","factor","roundingModes","rounded","roundingMode","calculator","Format","format","matches","match","decimalPosition","modes","CurrencyConverter","mergeTags","string","tags","tag","getRatesFromRestApi","from","to","data","assert","condition","errorMessage","ErrorType","assertPercentage","assertValidRatios","assertInteger","calculator$1","Dinero","_Object$assign","amount","currency","precision","globalLocale","globalFormat","globalRoundingMode","globalFormatRoundingMode","globalExchangeRatesApi","create","assertSameCurrency","comparator","newLocale","newPrecision","isNewPrecisionLarger","operation","terms","addend","addends","subtrahend","subtrahends","multiplier","divisor","_percentage","_this","total","remainder","shares","share","_this2","_ref","_ref$endpoint","endpoint","_ref$propertyPath","propertyPath","_ref$headers","_ref$roundingMode","rate","comparators","formatter","digits","dinero","Dinero$1"],"mappings":"CAgBA,UAAA,CAAA,GAAA,CAAA,IAAAA,EAAA,OAAA,OAAA,IAAA,OAAA,OAAA,OAAA,IAAA,OAAA,OAAA,KAAA,IAAA,KAAA,CAAA,EAAAC,EAAA,IAAA,QAAA,MAAAA,IAAAD,EAAA,gBAAAA,EAAA,iBAAA,CAAA,EAAAA,EAAA,gBAAAC,CAAA,EAAA,uCAAAD,EAAA,yBAAA,mDAAA,MAAA,CAAA,CAAA,GAAA,EAAA,IAAIE,EAAW,CACb,cAAe,EACf,gBAAiB,MACjB,iBAAkB,CACpB,EA+BIC,EAAU,CACZ,aAAc,QACd,aAAc,UACd,mBAAoB,YACpB,yBAA0B,sBAC1B,uBAAwB,CACtB,SAAU,OACV,QAAS,OACT,aAAc,MACf,CACH,EAEA,SAASC,EAAQC,EAAK,CACpB,0BAEA,OAAI,OAAO,QAAW,YAAc,OAAO,OAAO,UAAa,SAC7DD,EAAU,SAAUC,EAAK,CACvB,OAAO,OAAOA,CACpB,EAEID,EAAU,SAAUC,EAAK,CACvB,OAAOA,GAAO,OAAO,QAAW,YAAcA,EAAI,cAAgB,QAAUA,IAAQ,OAAO,UAAY,SA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