dinero.js
Version:
An immutable library to create, calculate and format monetary values.
2 lines (1 loc) • 48.3 kB
JavaScript
;var commonjsGlobal="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis;function createCommonjsModule(e,t){return t={exports:{}},e(t,t.exports),t.exports}var check=function(e){return e&&e.Math==Math&&e},global_1=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof commonjsGlobal&&commonjsGlobal)||Function("return this")(),fails=function(e){try{return!!e()}catch(e){return!0}},descriptors=!fails(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),nativePropertyIsEnumerable={}.propertyIsEnumerable,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor&&!nativePropertyIsEnumerable.call({1:2},1),f=NASHORN_BUG?function(e){var t=getOwnPropertyDescriptor(this,e);return!!t&&t.enumerable}:nativePropertyIsEnumerable,objectPropertyIsEnumerable={f:f},createPropertyDescriptor=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},toString={}.toString,classofRaw=function(e){return toString.call(e).slice(8,-1)},split="".split,indexedObject=fails(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return"String"==classofRaw(e)?split.call(e,""):Object(e)}:Object,requireObjectCoercible=function(e){if(e==null)throw TypeError("Can't call method on "+e);return e},toIndexedObject=function(e){return indexedObject(requireObjectCoercible(e))},isObject=function(e){return"object"==typeof e?null!==e:"function"==typeof e},toPrimitive=function(e,t){if(!isObject(e))return e;var r,n;if(t&&"function"==typeof(r=e.toString)&&!isObject(n=r.call(e)))return n;if("function"==typeof(r=e.valueOf)&&!isObject(n=r.call(e)))return n;if(!t&&"function"==typeof(r=e.toString)&&!isObject(n=r.call(e)))return n;throw TypeError("Can't convert object to primitive value")},hasOwnProperty={}.hasOwnProperty,has=function(e,t){return hasOwnProperty.call(e,t)},document$1=global_1.document,EXISTS=isObject(document$1)&&isObject(document$1.createElement),documentCreateElement=function(e){return EXISTS?document$1.createElement(e):{}},ie8DomDefine=!descriptors&&!fails(function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a}),nativeGetOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,f$1=descriptors?nativeGetOwnPropertyDescriptor:function(e,t){if(e=toIndexedObject(e),t=toPrimitive(t,!0),ie8DomDefine)try{return nativeGetOwnPropertyDescriptor(e,t)}catch(e){}return has(e,t)?createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(e,t),e[t]):void 0},objectGetOwnPropertyDescriptor={f:f$1},anObject=function(e){if(!isObject(e))throw TypeError(e+" is not an object");return e},nativeDefineProperty=Object.defineProperty,f$2=descriptors?nativeDefineProperty:function(e,t,r){if(anObject(e),t=toPrimitive(t,!0),anObject(r),ie8DomDefine)try{return nativeDefineProperty(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(e[t]=r.value),e},objectDefineProperty={f:f$2},createNonEnumerableProperty=descriptors?function(e,t,r){return objectDefineProperty.f(e,t,createPropertyDescriptor(1,r))}:function(e,t,r){return e[t]=r,e},setGlobal=function(e,t){try{createNonEnumerableProperty(global_1,e,t)}catch(r){global_1[e]=t}return t},SHARED="__core-js_shared__",store=global_1[SHARED]||setGlobal(SHARED,{}),sharedStore=store,functionToString=Function.toString;"function"!=typeof sharedStore.inspectSource&&(sharedStore.inspectSource=function(e){return functionToString.call(e)});var set,get,has$1,inspectSource=sharedStore.inspectSource,WeakMap=global_1.WeakMap,nativeWeakMap="function"==typeof WeakMap&&/native code/.test(inspectSource(WeakMap)),shared=createCommonjsModule(function(e){(e.exports=function(e,t){return sharedStore[e]||(sharedStore[e]=t===void 0?{}:t)})("versions",[]).push({version:"3.6.4",mode:"global",copyright:"\xA9 2020 Denis Pushkarev (zloirock.ru)"})}),id=0,postfix=Math.random(),uid=function(e){return"Symbol("+((e===void 0?"":e)+"")+")_"+(++id+postfix).toString(36)},keys=shared("keys"),sharedKey=function(e){return keys[e]||(keys[e]=uid(e))},hiddenKeys={},WeakMap$1=global_1.WeakMap,enforce=function(e){return has$1(e)?get(e):set(e,{})},getterFor=function(e){return function(t){var r;if(!isObject(t)||(r=get(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return r}};if(nativeWeakMap){var store$1=new WeakMap$1,wmget=store$1.get,wmhas=store$1.has,wmset=store$1.set;set=function(e,t){return wmset.call(store$1,e,t),t},get=function(e){return wmget.call(store$1,e)||{}},has$1=function(e){return wmhas.call(store$1,e)}}else{var STATE=sharedKey("state");hiddenKeys[STATE]=!0,set=function(e,t){return createNonEnumerableProperty(e,STATE,t),t},get=function(e){return has(e,STATE)?e[STATE]:{}},has$1=function(e){return has(e,STATE)}}var internalState={set:set,get:get,has:has$1,enforce:enforce,getterFor:getterFor},redefine=createCommonjsModule(function(e){var t=internalState.get,r=internalState.enforce,n=(String+"").split("String");(e.exports=function(e,t,o,a){var i=!!a&&!!a.unsafe,s=!!a&&!!a.enumerable,l=!!a&&!!a.noTargetGet;return("function"==typeof o&&("string"==typeof t&&!has(o,"name")&&createNonEnumerableProperty(o,"name",t),r(o).source=n.join("string"==typeof t?t:"")),e===global_1)?void(s?e[t]=o:setGlobal(t,o)):void(i?!l&&e[t]&&(s=!0):delete e[t],s?e[t]=o:createNonEnumerableProperty(e,t,o))})(Function.prototype,"toString",function(){return"function"==typeof this&&t(this).source||inspectSource(this)})}),path=global_1,aFunction=function(e){return"function"==typeof e?e:void 0},getBuiltIn=function(e,t){return 2>arguments.length?aFunction(path[e])||aFunction(global_1[e]):path[e]&&path[e][t]||global_1[e]&&global_1[e][t]},ceil=Math.ceil,floor=Math.floor,toInteger=function(e){return isNaN(e=+e)?0:(0<e?floor:ceil)(e)},min=Math.min,toLength=function(e){return 0<e?min(toInteger(e),9007199254740991):0},max=Math.max,min$1=Math.min,toAbsoluteIndex=function(e,t){var r=toInteger(e);return 0>r?max(r+t,0):min$1(r,t)},createMethod=function(e){return function(t,r,n){var o,a=toIndexedObject(t),i=toLength(a.length),s=toAbsoluteIndex(n,i);if(e&&r!=r){for(;i>s;)if(o=a[s++],o!=o)return!0;}else for(;i>s;s++)if((e||s in a)&&a[s]===r)return e||s||0;return!e&&-1}},arrayIncludes={includes:createMethod(!0),indexOf:createMethod(!1)},indexOf=arrayIncludes.indexOf,objectKeysInternal=function(e,t){var r,n=toIndexedObject(e),o=0,a=[];for(r in n)!has(hiddenKeys,r)&&has(n,r)&&a.push(r);for(;t.length>o;)has(n,r=t[o++])&&(~indexOf(a,r)||a.push(r));return a},enumBugKeys=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],hiddenKeys$1=enumBugKeys.concat("length","prototype"),f$3=Object.getOwnPropertyNames||function(e){return objectKeysInternal(e,hiddenKeys$1)},objectGetOwnPropertyNames={f:f$3},f$4=Object.getOwnPropertySymbols,objectGetOwnPropertySymbols={f:f$4},ownKeys=getBuiltIn("Reflect","ownKeys")||function(e){var t=objectGetOwnPropertyNames.f(anObject(e)),r=objectGetOwnPropertySymbols.f;return r?t.concat(r(e)):t},copyConstructorProperties=function(e,t){for(var r,n=ownKeys(t),o=objectDefineProperty.f,a=objectGetOwnPropertyDescriptor.f,s=0;s<n.length;s++)r=n[s],has(e,r)||o(e,r,a(t,r))},replacement=/#|\.prototype\./,isForced=function(e,t){var r=data[normalize(e)];return!(r!=POLYFILL)||r!=NATIVE&&("function"==typeof t?fails(t):!!t)},normalize=isForced.normalize=function(e){return(e+"").replace(replacement,".").toLowerCase()},data=isForced.data={},NATIVE=isForced.NATIVE="N",POLYFILL=isForced.POLYFILL="P",isForced_1=isForced,getOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,_export=function(e,t){var r,n,o,a,i,s,l=e.target,c=e.global,u=e.stat;if(n=c?global_1:u?global_1[l]||setGlobal(l,{}):(global_1[l]||{}).prototype,n)for(o in t){if(i=t[o],e.noTargetGet?(s=getOwnPropertyDescriptor$1(n,o),a=s&&s.value):a=n[o],r=isForced_1(c?o:l+(u?".":"#")+o,e.forced),!r&&void 0!==a){if(typeof i==typeof a)continue;copyConstructorProperties(i,a)}(e.sham||a&&a.sham)&&createNonEnumerableProperty(i,"sham",!0),redefine(n,o,i,e)}},aFunction$1=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return e},functionBindContext=function(e,t,r){return(aFunction$1(e),void 0===t)?e:0===r?function(){return e.call(t)}:1===r?function(r){return e.call(t,r)}:2===r?function(r,n){return e.call(t,r,n)}:3===r?function(r,n,o){return e.call(t,r,n,o)}:function(){return e.apply(t,arguments)}},toObject=function(e){return Object(requireObjectCoercible(e))},isArray=Array.isArray||function(e){return"Array"==classofRaw(e)},nativeSymbol=!!Object.getOwnPropertySymbols&&!fails(function(){return!(Symbol()+"")}),useSymbolAsUid=nativeSymbol&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,WellKnownSymbolsStore=shared("wks"),Symbol$1=global_1.Symbol,createWellKnownSymbol=useSymbolAsUid?Symbol$1:Symbol$1&&Symbol$1.withoutSetter||uid,wellKnownSymbol=function(e){return has(WellKnownSymbolsStore,e)||(nativeSymbol&&has(Symbol$1,e)?WellKnownSymbolsStore[e]=Symbol$1[e]:WellKnownSymbolsStore[e]=createWellKnownSymbol("Symbol."+e)),WellKnownSymbolsStore[e]},SPECIES=wellKnownSymbol("species"),arraySpeciesCreate=function(e,t){var r;return isArray(e)&&(r=e.constructor,"function"==typeof r&&(r===Array||isArray(r.prototype))?r=void 0:isObject(r)&&(r=r[SPECIES],null===r&&(r=void 0))),new(void 0===r?Array:r)(0===t?0:t)},push=[].push,createMethod$1=function(e){var t=1==e,r=4==e,n=6==e;return function(o,a,i,s){for(var l,c,u=toObject(o),d=indexedObject(u),g=functionBindContext(a,i,3),p=toLength(d.length),m=0,y=s||arraySpeciesCreate,f=t?y(o,p):2==e?y(o,0):void 0;p>m;m++)if((5==e||n||m in d)&&(l=d[m],c=g(l,m,u),e))if(t)f[m]=c;else if(c)switch(e){case 3:return!0;case 5:return l;case 6:return m;case 2:push.call(f,l);}else if(r)return!1;return n?-1:3==e||r?r:f}},arrayIteration={forEach:createMethod$1(0),map:createMethod$1(1),filter:createMethod$1(2),some:createMethod$1(3),every:createMethod$1(4),find:createMethod$1(5),findIndex:createMethod$1(6)},arrayMethodIsStrict=function(e,t){var r=[][e];return!!r&&fails(function(){r.call(null,t||function(){throw 1},1)})},defineProperty=Object.defineProperty,cache={},thrower=function(e){throw e},arrayMethodUsesToLength=function(e,t){if(has(cache,e))return cache[e];t||(t={});var r=[][e],n=!!has(t,"ACCESSORS")&&t.ACCESSORS,o=has(t,0)?t[0]:thrower,a=has(t,1)?t[1]:void 0;return cache[e]=!!r&&!fails(function(){if(n&&!descriptors)return!0;var e={length:-1};n?defineProperty(e,1,{enumerable:!0,get:thrower}):e[1]=1,r.call(e,o,a)})},$every=arrayIteration.every,STRICT_METHOD=arrayMethodIsStrict("every"),USES_TO_LENGTH=arrayMethodUsesToLength("every");_export({target:"Array",proto:!0,forced:!STRICT_METHOD||!USES_TO_LENGTH},{every:function(e){return $every(this,e,1<arguments.length?arguments[1]:void 0)}});var activeXDocument,call=Function.call,entryUnbind=function(e,t,r){return functionBindContext(call,global_1[e].prototype[t],r)},every=entryUnbind("Array","every"),objectKeys=Object.keys||function(e){return objectKeysInternal(e,enumBugKeys)},objectDefineProperties=descriptors?Object.defineProperties:function(e,t){anObject(e);for(var r,n=objectKeys(t),o=n.length,a=0;o>a;)objectDefineProperty.f(e,r=n[a++],t[r]);return e},html=getBuiltIn("document","documentElement"),GT=">",LT="<",PROTOTYPE="prototype",SCRIPT="script",IE_PROTO=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return LT+SCRIPT+GT+e+LT+"/"+SCRIPT+GT},NullProtoObjectViaActiveX=function(e){e.write(scriptTag("")),e.close();var t=e.parentWindow.Object;return e=null,t},NullProtoObjectViaIFrame=function(){var e,t=documentCreateElement("iframe");return t.style.display="none",html.appendChild(t),t.src="java"+SCRIPT+":"+"",e=t.contentWindow.document,e.open(),e.write(scriptTag("document.F=Object")),e.close(),e.F},NullProtoObject=function(){try{activeXDocument=document.domain&&new ActiveXObject("htmlfile")}catch(e){}NullProtoObject=activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame();for(var e=enumBugKeys.length;e--;)delete NullProtoObject[PROTOTYPE][enumBugKeys[e]];return NullProtoObject()};hiddenKeys[IE_PROTO]=!0;var objectCreate=Object.create||function(e,t){var r;return null===e?r=NullProtoObject():(EmptyConstructor[PROTOTYPE]=anObject(e),r=new EmptyConstructor,EmptyConstructor[PROTOTYPE]=null,r[IE_PROTO]=e),void 0===t?r:objectDefineProperties(r,t)},UNSCOPABLES=wellKnownSymbol("unscopables"),ArrayPrototype=Array.prototype;ArrayPrototype[UNSCOPABLES]==null&&objectDefineProperty.f(ArrayPrototype,UNSCOPABLES,{configurable:!0,value:objectCreate(null)});var addToUnscopables=function(e){ArrayPrototype[UNSCOPABLES][e]=!0},$findIndex=arrayIteration.findIndex,FIND_INDEX="findIndex",SKIPS_HOLES=!0,USES_TO_LENGTH$1=arrayMethodUsesToLength(FIND_INDEX);FIND_INDEX in[]&&[,][FIND_INDEX](function(){SKIPS_HOLES=!1}),_export({target:"Array",proto:!0,forced:SKIPS_HOLES||!USES_TO_LENGTH$1},{findIndex:function(e){return $findIndex(this,e,1<arguments.length?arguments[1]:void 0)}}),addToUnscopables(FIND_INDEX);var findIndex=entryUnbind("Array","findIndex"),$find=arrayIteration.find,FIND="find",SKIPS_HOLES$1=!0,USES_TO_LENGTH$2=arrayMethodUsesToLength(FIND);FIND in[]&&[,][FIND](function(){SKIPS_HOLES$1=!1}),_export({target:"Array",proto:!0,forced:SKIPS_HOLES$1||!USES_TO_LENGTH$2},{find:function(e){return $find(this,e,1<arguments.length?arguments[1]:void 0)}}),addToUnscopables(FIND);var IteratorPrototype,PrototypeOfArrayIteratorPrototype,arrayIterator,find=entryUnbind("Array","find"),iterators={},correctPrototypeGetter=!fails(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),IE_PROTO$1=sharedKey("IE_PROTO"),ObjectPrototype=Object.prototype,objectGetPrototypeOf=correctPrototypeGetter?Object.getPrototypeOf:function(e){return e=toObject(e),has(e,IE_PROTO$1)?e[IE_PROTO$1]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?ObjectPrototype:null},ITERATOR=wellKnownSymbol("iterator"),BUGGY_SAFARI_ITERATORS=!1,returnThis=function(){return this};[].keys&&(arrayIterator=[].keys(),"next"in arrayIterator?(PrototypeOfArrayIteratorPrototype=objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator)),PrototypeOfArrayIteratorPrototype!==Object.prototype&&(IteratorPrototype=PrototypeOfArrayIteratorPrototype)):BUGGY_SAFARI_ITERATORS=!0),IteratorPrototype==null&&(IteratorPrototype={}),has(IteratorPrototype,ITERATOR)||createNonEnumerableProperty(IteratorPrototype,ITERATOR,returnThis);var iteratorsCore={IteratorPrototype:IteratorPrototype,BUGGY_SAFARI_ITERATORS:BUGGY_SAFARI_ITERATORS},defineProperty$1=objectDefineProperty.f,TO_STRING_TAG=wellKnownSymbol("toStringTag"),setToStringTag=function(e,t,r){e&&!has(e=r?e:e.prototype,TO_STRING_TAG)&&defineProperty$1(e,TO_STRING_TAG,{configurable:!0,value:t})},IteratorPrototype$1=iteratorsCore.IteratorPrototype,returnThis$1=function(){return this},createIteratorConstructor=function(e,t,r){var n=t+" Iterator";return e.prototype=objectCreate(IteratorPrototype$1,{next:createPropertyDescriptor(1,r)}),setToStringTag(e,n,!1),iterators[n]=returnThis$1,e},aPossiblePrototype=function(e){if(!isObject(e)&&null!==e)throw TypeError("Can't set "+(e+" as a prototype"));return e},objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,e.call(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return anObject(r),aPossiblePrototype(n),t?e.call(r,n):r.__proto__=n,r}}():void 0),IteratorPrototype$2=iteratorsCore.IteratorPrototype,BUGGY_SAFARI_ITERATORS$1=iteratorsCore.BUGGY_SAFARI_ITERATORS,ITERATOR$1=wellKnownSymbol("iterator"),KEYS="keys",VALUES="values",ENTRIES="entries",returnThis$2=function(){return this},defineIterator=function(e,t,r,n,o,a,i){createIteratorConstructor(r,t,n);var s,l,c,u=function(e){return e===o&&m?m:!BUGGY_SAFARI_ITERATORS$1&&e in g?g[e]:e===KEYS?function(){return new r(this,e)}:e===VALUES?function(){return new r(this,e)}:e===ENTRIES?function(){return new r(this,e)}:function(){return new r(this)}},d=!1,g=e.prototype,p=g[ITERATOR$1]||g["@@iterator"]||o&&g[o],m=!BUGGY_SAFARI_ITERATORS$1&&p||u(o),y="Array"==t?g.entries||p:p;if(y&&(s=objectGetPrototypeOf(y.call(new e)),IteratorPrototype$2!==Object.prototype&&s.next&&(objectGetPrototypeOf(s)!==IteratorPrototype$2&&(objectSetPrototypeOf?objectSetPrototypeOf(s,IteratorPrototype$2):"function"!=typeof s[ITERATOR$1]&&createNonEnumerableProperty(s,ITERATOR$1,returnThis$2)),setToStringTag(s,t+" Iterator",!0))),o==VALUES&&p&&p.name!==VALUES&&(d=!0,m=function(){return p.call(this)}),g[ITERATOR$1]!==m&&createNonEnumerableProperty(g,ITERATOR$1,m),iterators[t]=m,o)if(l={values:u(VALUES),keys:a?m:u(KEYS),entries:u(ENTRIES)},i)for(c in l)(BUGGY_SAFARI_ITERATORS$1||d||!(c in g))&&redefine(g,c,l[c]);else _export({target:t,proto:!0,forced:BUGGY_SAFARI_ITERATORS$1||d},l);return l},ARRAY_ITERATOR="Array Iterator",setInternalState=internalState.set,getInternalState=internalState.getterFor(ARRAY_ITERATOR),es_array_iterator=defineIterator(Array,"Array",function(e,t){setInternalState(this,{type:ARRAY_ITERATOR,target:toIndexedObject(e),index:0,kind:t})},function(){var e=getInternalState(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}},"values");iterators.Arguments=iterators.Array,addToUnscopables("keys"),addToUnscopables("values"),addToUnscopables("entries");var keys$1=entryUnbind("Array","keys"),$some=arrayIteration.some,STRICT_METHOD$1=arrayMethodIsStrict("some"),USES_TO_LENGTH$3=arrayMethodUsesToLength("some");_export({target:"Array",proto:!0,forced:!STRICT_METHOD$1||!USES_TO_LENGTH$3},{some:function(e){return $some(this,e,1<arguments.length?arguments[1]:void 0)}});var some=entryUnbind("Array","some"),nativeAssign=Object.assign,defineProperty$2=Object.defineProperty,objectAssign=!nativeAssign||fails(function(){if(descriptors&&1!==nativeAssign({b:1},nativeAssign(defineProperty$2({},"a",{enumerable:!0,get:function(){defineProperty$2(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!=nativeAssign({},e)[r]||objectKeys(nativeAssign({},t)).join("")!=n})?function(e){for(var t=toObject(e),r=arguments.length,n=1,o=objectGetOwnPropertySymbols.f,a=objectPropertyIsEnumerable.f;r>n;)for(var i,s=indexedObject(arguments[n++]),l=o?objectKeys(s).concat(o(s)):objectKeys(s),c=l.length,u=0;c>u;)i=l[u++],(!descriptors||a.call(s,i))&&(t[i]=s[i]);return t}:nativeAssign;_export({target:"Object",stat:!0,forced:Object.assign!==objectAssign},{assign:objectAssign});var assign=path.Object.assign,propertyIsEnumerable=objectPropertyIsEnumerable.f,createMethod$2=function(e){return function(t){for(var r,n=toIndexedObject(t),o=objectKeys(n),a=o.length,s=0,l=[];a>s;)r=o[s++],(!descriptors||propertyIsEnumerable.call(n,r))&&l.push(e?[r,n[r]]:n[r]);return l}},objectToArray={entries:createMethod$2(!0),values:createMethod$2(!1)},$entries=objectToArray.entries;_export({target:"Object",stat:!0},{entries:function(e){return $entries(e)}});var entries=path.Object.entries,floor$1=Math.floor,isInteger=function(e){return!isObject(e)&&isFinite(e)&&floor$1(e)===e};_export({target:"Number",stat:!0},{isInteger:isInteger});var isInteger$1=path.Number.isInteger,mathSign=Math.sign||function(e){return 0==(e=+e)||e!=e?e:0>e?-1:1};_export({target:"Math",stat:!0},{sign:mathSign});var sign=path.Math.sign,TO_STRING_TAG$1=wellKnownSymbol("toStringTag"),test={};test[TO_STRING_TAG$1]="z";var toStringTagSupport="[object z]"===test+"",TO_STRING_TAG$2=wellKnownSymbol("toStringTag"),CORRECT_ARGUMENTS="Arguments"==classofRaw(function(){return arguments}()),tryGet=function(e,t){try{return e[t]}catch(e){}},classof=function(e){var t,r,n;return e===void 0?"Undefined":null===e?"Null":"string"==typeof(r=tryGet(t=Object(e),TO_STRING_TAG$2))?r:CORRECT_ARGUMENTS?classofRaw(t):"Object"==(n=classofRaw(t))&&"function"==typeof t.callee?"Arguments":n},objectToString=function(){return"[object "+classof(this)+"]"};toStringTagSupport||redefine(Object.prototype,"toString",objectToString,{unsafe:!0});var createMethod$3=function(e){return function(t,r){var n,o,a=requireObjectCoercible(t)+"",i=toInteger(r),s=a.length;return 0>i||i>=s?e?"":void 0:(n=a.charCodeAt(i),55296>n||56319<n||i+1===s||56320>(o=a.charCodeAt(i+1))||57343<o?e?a.charAt(i):n:e?a.slice(i,i+2):(n-55296<<10)+(o-56320)+65536)}},stringMultibyte={codeAt:createMethod$3(!1),charAt:createMethod$3(!0)},charAt=stringMultibyte.charAt,STRING_ITERATOR="String Iterator",setInternalState$1=internalState.set,getInternalState$1=internalState.getterFor(STRING_ITERATOR);defineIterator(String,"String",function(e){setInternalState$1(this,{type:STRING_ITERATOR,string:e+"",index:0})},function(){var e,t=getInternalState$1(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=charAt(r,n),t.index+=e.length,{value:e,done:!1})});var domIterables={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ITERATOR$2=wellKnownSymbol("iterator"),TO_STRING_TAG$3=wellKnownSymbol("toStringTag"),ArrayValues=es_array_iterator.values;for(var COLLECTION_NAME in domIterables){var Collection=global_1[COLLECTION_NAME],CollectionPrototype=Collection&&Collection.prototype;if(CollectionPrototype){if(CollectionPrototype[ITERATOR$2]!==ArrayValues)try{createNonEnumerableProperty(CollectionPrototype,ITERATOR$2,ArrayValues)}catch(e){CollectionPrototype[ITERATOR$2]=ArrayValues}if(CollectionPrototype[TO_STRING_TAG$3]||createNonEnumerableProperty(CollectionPrototype,TO_STRING_TAG$3,COLLECTION_NAME),domIterables[COLLECTION_NAME])for(var METHOD_NAME in es_array_iterator)if(CollectionPrototype[METHOD_NAME]!==es_array_iterator[METHOD_NAME])try{createNonEnumerableProperty(CollectionPrototype,METHOD_NAME,es_array_iterator[METHOD_NAME])}catch(e){CollectionPrototype[METHOD_NAME]=es_array_iterator[METHOD_NAME]}}}var nativePromiseConstructor=global_1.Promise,redefineAll=function(e,t,r){for(var n in t)redefine(e,n,t[n],r);return e},SPECIES$1=wellKnownSymbol("species"),setSpecies=function(e){var t=getBuiltIn(e),r=objectDefineProperty.f;descriptors&&t&&!t[SPECIES$1]&&r(t,SPECIES$1,{configurable:!0,get:function(){return this}})},anInstance=function(e,t,r){if(!(e instanceof t))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation");return e},ITERATOR$3=wellKnownSymbol("iterator"),ArrayPrototype$1=Array.prototype,isArrayIteratorMethod=function(e){return e!==void 0&&(iterators.Array===e||ArrayPrototype$1[ITERATOR$3]===e)},ITERATOR$4=wellKnownSymbol("iterator"),getIteratorMethod=function(e){if(e!=null)return e[ITERATOR$4]||e["@@iterator"]||iterators[classof(e)]},callWithSafeIterationClosing=function(e,t,r,n){try{return n?t(anObject(r)[0],r[1]):t(r)}catch(t){var o=e["return"];throw void 0!==o&&anObject(o.call(e)),t}},iterate_1=createCommonjsModule(function(e){var t=function(e,t){this.stopped=e,this.result=t},r=e.exports=function(e,r,n,o,a){var i,s,l,c,u,d,g,p=functionBindContext(r,n,o?2:1);if(a)i=e;else{if(s=getIteratorMethod(e),"function"!=typeof s)throw TypeError("Target is not iterable");if(isArrayIteratorMethod(s)){for(l=0,c=toLength(e.length);c>l;l++)if(u=o?p(anObject(g=e[l])[0],g[1]):p(e[l]),u&&u instanceof t)return u;return new t(!1)}i=s.call(e)}for(d=i.next;!(g=d.call(i)).done;)if(u=callWithSafeIterationClosing(i,p,g.value,o),"object"==typeof u&&u&&u instanceof t)return u;return new t(!1)};r.stop=function(e){return new t(!0,e)}}),ITERATOR$5=wellKnownSymbol("iterator"),SAFE_CLOSING=!1;try{var called=0,iteratorWithReturn={next:function(){return{done:!!called++}},return:function(){SAFE_CLOSING=!0}};iteratorWithReturn[ITERATOR$5]=function(){return this},Array.from(iteratorWithReturn,function(){throw 2})}catch(e){}var defer,channel,port,checkCorrectnessOfIteration=function(e,t){if(!t&&!SAFE_CLOSING)return!1;var r=!1;try{var n={};n[ITERATOR$5]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},SPECIES$2=wellKnownSymbol("species"),speciesConstructor=function(e,t){var r,n=anObject(e).constructor;return n===void 0||(r=anObject(n)[SPECIES$2])==null?t:aFunction$1(r)},engineUserAgent=getBuiltIn("navigator","userAgent")||"",engineIsIos=/(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent),location=global_1.location,set$1=global_1.setImmediate,clear=global_1.clearImmediate,process=global_1.process,MessageChannel=global_1.MessageChannel,Dispatch=global_1.Dispatch,counter=0,queue={},ONREADYSTATECHANGE="onreadystatechange",run=function(e){if(queue.hasOwnProperty(e)){var t=queue[e];delete queue[e],t()}},runner=function(e){return function(){run(e)}},listener=function(e){run(e.data)},post=function(e){global_1.postMessage(e+"",location.protocol+"//"+location.host)};set$1&&clear||(set$1=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return queue[++counter]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},defer(counter),counter},clear=function(e){delete queue[e]},"process"==classofRaw(process)?defer=function(e){process.nextTick(runner(e))}:Dispatch&&Dispatch.now?defer=function(e){Dispatch.now(runner(e))}:MessageChannel&&!engineIsIos?(channel=new MessageChannel,port=channel.port2,channel.port1.onmessage=listener,defer=functionBindContext(port.postMessage,port,1)):!global_1.addEventListener||"function"!=typeof postMessage||global_1.importScripts||fails(post)?ONREADYSTATECHANGE in documentCreateElement("script")?defer=function(e){html.appendChild(documentCreateElement("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this),run(e)}}:defer=function(e){setTimeout(runner(e),0)}:(defer=post,global_1.addEventListener("message",listener,!1)));var flush,head,last,notify,toggle,node,promise,then,task={set:set$1,clear:clear},getOwnPropertyDescriptor$2=objectGetOwnPropertyDescriptor.f,macrotask=task.set,MutationObserver=global_1.MutationObserver||global_1.WebKitMutationObserver,process$1=global_1.process,Promise$1=global_1.Promise,IS_NODE="process"==classofRaw(process$1),queueMicrotaskDescriptor=getOwnPropertyDescriptor$2(global_1,"queueMicrotask"),queueMicrotask=queueMicrotaskDescriptor&&queueMicrotaskDescriptor.value;queueMicrotask||(flush=function(){var e,t;for(IS_NODE&&(e=process$1.domain)&&e.exit();head;){t=head.fn,head=head.next;try{t()}catch(e){throw head?notify():last=void 0,e}}last=void 0,e&&e.enter()},IS_NODE?notify=function(){process$1.nextTick(flush)}:MutationObserver&&!engineIsIos?(toggle=!0,node=document.createTextNode(""),new MutationObserver(flush).observe(node,{characterData:!0}),notify=function(){node.data=toggle=!toggle}):Promise$1&&Promise$1.resolve?(promise=Promise$1.resolve(void 0),then=promise.then,notify=function(){then.call(promise,flush)}):notify=function(){macrotask.call(global_1,flush)});var match,version,microtask=queueMicrotask||function(e){var t={fn:e,next:void 0};last&&(last.next=t),head||(head=t,notify()),last=t},PromiseCapability=function(e){var t,r;this.promise=new e(function(e,n){if(t!==void 0||r!==void 0)throw TypeError("Bad Promise constructor");t=e,r=n}),this.resolve=aFunction$1(t),this.reject=aFunction$1(r)},f$5=function(e){return new PromiseCapability(e)},newPromiseCapability={f:f$5},promiseResolve=function(e,t){if(anObject(e),isObject(t)&&t.constructor===e)return t;var r=newPromiseCapability.f(e),n=r.resolve;return n(t),r.promise},hostReportErrors=function(e,t){var r=global_1.console;r&&r.error&&(1===arguments.length?r.error(e):r.error(e,t))},perform=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},process$2=global_1.process,versions=process$2&&process$2.versions,v8=versions&&versions.v8;v8?(match=v8.split("."),version=match[0]+match[1]):engineUserAgent&&(match=engineUserAgent.match(/Edge\/(\d+)/),(!match||74<=match[1])&&(match=engineUserAgent.match(/Chrome\/(\d+)/),match&&(version=match[1])));var Internal,OwnPromiseCapability,PromiseWrapper,nativeThen,engineV8Version=version&&+version,task$1=task.set,SPECIES$3=wellKnownSymbol("species"),PROMISE="Promise",getInternalState$2=internalState.get,setInternalState$2=internalState.set,getInternalPromiseState=internalState.getterFor(PROMISE),PromiseConstructor=nativePromiseConstructor,TypeError$1=global_1.TypeError,document$2=global_1.document,process$3=global_1.process,$fetch=getBuiltIn("fetch"),newPromiseCapability$1=newPromiseCapability.f,newGenericPromiseCapability=newPromiseCapability$1,IS_NODE$1="process"==classofRaw(process$3),DISPATCH_EVENT=!!(document$2&&document$2.createEvent&&global_1.dispatchEvent),UNHANDLED_REJECTION="unhandledrejection",REJECTION_HANDLED="rejectionhandled",PENDING=0,FULFILLED=1,REJECTED=2,HANDLED=1,UNHANDLED=2,FORCED=isForced_1(PROMISE,function(){var e=inspectSource(PromiseConstructor)!==PromiseConstructor+"";if(!e){if(66===engineV8Version)return!0;if(!IS_NODE$1&&"function"!=typeof PromiseRejectionEvent)return!0}if(51<=engineV8Version&&/native code/.test(PromiseConstructor))return!1;var t=PromiseConstructor.resolve(1),r=function(e){e(function(){},function(){})},n=t.constructor={};return n[SPECIES$3]=r,!(t.then(function(){})instanceof r)}),INCORRECT_ITERATION=FORCED||!checkCorrectnessOfIteration(function(e){PromiseConstructor.all(e)["catch"](function(){})}),isThenable=function(e){var t;return!!(isObject(e)&&"function"==typeof(t=e.then))&&t},notify$1=function(e,t,r){if(!t.notified){t.notified=!0;var n=t.reactions;microtask(function(){for(var o=t.value,a=t.state==FULFILLED,i=0;n.length>i;){var s,l,c,u=n[i++],d=a?u.ok:u.fail,g=u.resolve,p=u.reject,m=u.domain;try{d?(!a&&(t.rejection===UNHANDLED&&onHandleUnhandled(e,t),t.rejection=HANDLED),!0===d?s=o:(m&&m.enter(),s=d(o),m&&(m.exit(),c=!0)),s===u.promise?p(TypeError$1("Promise-chain cycle")):(l=isThenable(s))?l.call(s,g,p):g(s)):p(o)}catch(e){m&&!c&&m.exit(),p(e)}}t.reactions=[],t.notified=!1,r&&!t.rejection&&onUnhandled(e,t)})}},dispatchEvent=function(e,t,r){var n,o;DISPATCH_EVENT?(n=document$2.createEvent("Event"),n.promise=t,n.reason=r,n.initEvent(e,!1,!0),global_1.dispatchEvent(n)):n={promise:t,reason:r},(o=global_1["on"+e])?o(n):e===UNHANDLED_REJECTION&&hostReportErrors("Unhandled promise rejection",r)},onUnhandled=function(e,t){task$1.call(global_1,function(){var r,n=t.value,o=isUnhandled(t);if(o&&(r=perform(function(){IS_NODE$1?process$3.emit("unhandledRejection",n,e):dispatchEvent(UNHANDLED_REJECTION,e,n)}),t.rejection=IS_NODE$1||isUnhandled(t)?UNHANDLED:HANDLED,r.error))throw r.value})},isUnhandled=function(e){return e.rejection!==HANDLED&&!e.parent},onHandleUnhandled=function(e,t){task$1.call(global_1,function(){IS_NODE$1?process$3.emit("rejectionHandled",e):dispatchEvent(REJECTION_HANDLED,e,t.value)})},bind=function(e,t,r,n){return function(o){e(t,r,o,n)}},internalReject=function(e,t,r,n){t.done||(t.done=!0,n&&(t=n),t.value=r,t.state=REJECTED,notify$1(e,t,!0))},internalResolve=function(e,t,r,n){if(!t.done){t.done=!0,n&&(t=n);try{if(e===r)throw TypeError$1("Promise can't be resolved itself");var o=isThenable(r);o?microtask(function(){var n={done:!1};try{o.call(r,bind(internalResolve,e,n,t),bind(internalReject,e,n,t))}catch(r){internalReject(e,n,r,t)}}):(t.value=r,t.state=FULFILLED,notify$1(e,t,!1))}catch(r){internalReject(e,{done:!1},r,t)}}};FORCED&&(PromiseConstructor=function(e){anInstance(this,PromiseConstructor,PROMISE),aFunction$1(e),Internal.call(this);var t=getInternalState$2(this);try{e(bind(internalResolve,this,t),bind(internalReject,this,t))}catch(e){internalReject(this,t,e)}},Internal=function(){setInternalState$2(this,{type:PROMISE,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:PENDING,value:void 0})},Internal.prototype=redefineAll(PromiseConstructor.prototype,{then:function(e,t){var r=getInternalPromiseState(this),n=newPromiseCapability$1(speciesConstructor(this,PromiseConstructor));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=IS_NODE$1?process$3.domain:void 0,r.parent=!0,r.reactions.push(n),r.state!=PENDING&¬ify$1(this,r,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),OwnPromiseCapability=function(){var e=new Internal,t=getInternalState$2(e);this.promise=e,this.resolve=bind(internalResolve,e,t),this.reject=bind(internalReject,e,t)},newPromiseCapability.f=newPromiseCapability$1=function(e){return e===PromiseConstructor||e===PromiseWrapper?new OwnPromiseCapability(e):newGenericPromiseCapability(e)},"function"==typeof nativePromiseConstructor&&(nativeThen=nativePromiseConstructor.prototype.then,redefine(nativePromiseConstructor.prototype,"then",function(e,t){var r=this;return new PromiseConstructor(function(e,t){nativeThen.call(r,e,t)}).then(e,t)},{unsafe:!0}),"function"==typeof $fetch&&_export({global:!0,enumerable:!0,forced:!0},{fetch:function(){return promiseResolve(PromiseConstructor,$fetch.apply(global_1,arguments))}}))),_export({global:!0,wrap:!0,forced:FORCED},{Promise:PromiseConstructor}),setToStringTag(PromiseConstructor,PROMISE,!1),setSpecies(PROMISE),PromiseWrapper=getBuiltIn(PROMISE),_export({target:PROMISE,stat:!0,forced:FORCED},{reject:function(e){var t=newPromiseCapability$1(this);return t.reject.call(void 0,e),t.promise}}),_export({target:PROMISE,stat:!0,forced:FORCED},{resolve:function(e){return promiseResolve(this,e)}}),_export({target:PROMISE,stat:!0,forced:INCORRECT_ITERATION},{all:function(e){var t=this,r=newPromiseCapability$1(t),n=r.resolve,o=r.reject,a=perform(function(){var r=aFunction$1(t.resolve),a=[],i=0,s=1;iterate_1(e,function(e){var l=i++,c=!1;a.push(void 0),s++,r.call(t,e).then(function(e){c||(c=!0,a[l]=e,--s||n(a))},o)}),--s||n(a)});return a.error&&o(a.value),r.promise},race:function(e){var t=this,r=newPromiseCapability$1(t),n=r.reject,o=perform(function(){var o=aFunction$1(t.resolve);iterate_1(e,function(e){o.call(t,e).then(r.resolve,n)})});return o.error&&n(o.value),r.promise}}),_export({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=newPromiseCapability.f(t),n=r.resolve,o=r.reject,a=perform(function(){var r=aFunction$1(t.resolve),o=[],a=0,i=1;iterate_1(e,function(e){var s=a++,l=!1;o.push(void 0),i++,r.call(t,e).then(function(e){l||(l=!0,o[s]={status:"fulfilled",value:e},--i||n(o))},function(t){l||(l=!0,o[s]={status:"rejected",reason:t},--i||n(o))})}),--i||n(o)});return a.error&&o(a.value),r.promise}});var NON_GENERIC=!!nativePromiseConstructor&&fails(function(){nativePromiseConstructor.prototype["finally"].call({then:function(){}},function(){})});_export({target:"Promise",proto:!0,real:!0,forced:NON_GENERIC},{finally:function(t){var r=speciesConstructor(this,getBuiltIn("Promise")),e="function"==typeof t;return this.then(e?function(e){return promiseResolve(r,t()).then(function(){return e})}:t,e?function(n){return promiseResolve(r,t()).then(function(){throw n})}:t)}}),"function"!=typeof nativePromiseConstructor||nativePromiseConstructor.prototype["finally"]||redefine(nativePromiseConstructor.prototype,"finally",getBuiltIn("Promise").prototype["finally"]);var promise$1=path.Promise,setInternalState$3=internalState.set,getInternalAggregateErrorState=internalState.getterFor("AggregateError"),$AggregateError=function(e,t){var r=this;if(!(r instanceof $AggregateError))return new $AggregateError(e,t);objectSetPrototypeOf&&(r=objectSetPrototypeOf(new Error(t),objectGetPrototypeOf(r)));var n=[];return iterate_1(e,n.push,n),descriptors?setInternalState$3(r,{errors:n,type:"AggregateError"}):r.errors=n,void 0!==t&&createNonEnumerableProperty(r,"message",t+""),r};$AggregateError.prototype=objectCreate(Error.prototype,{constructor:createPropertyDescriptor(5,$AggregateError),message:createPropertyDescriptor(5,""),name:createPropertyDescriptor(5,"AggregateError")}),descriptors&&objectDefineProperty.f($AggregateError.prototype,"errors",{get:function(){return getInternalAggregateErrorState(this).errors},configurable:!0}),_export({global:!0},{AggregateError:$AggregateError}),_export({target:"Promise",stat:!0},{try:function(e){var t=newPromiseCapability.f(this),r=perform(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var PROMISE_ANY_ERROR="No one promise resolved";_export({target:"Promise",stat:!0},{any:function(e){var t=this,r=newPromiseCapability.f(t),n=r.resolve,o=r.reject,a=perform(function(){var r=aFunction$1(t.resolve),a=[],i=0,s=1,l=!1;iterate_1(e,function(e){var c=i++,u=!1;a.push(void 0),s++,r.call(t,e).then(function(e){u||l||(l=!0,n(e))},function(t){u||l||(u=!0,a[c]=t,--s||o(new(getBuiltIn("AggregateError"))(a,PROMISE_ANY_ERROR)))})}),--s||o(new(getBuiltIn("AggregateError"))(a,PROMISE_ANY_ERROR))});return a.error&&o(a.value),r.promise}});var Defaults={defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},Globals={globalLocale:"en-US",globalFormat:"$0,0.00",globalRoundingMode:"HALF_EVEN",globalFormatRoundingMode:"HALF_AWAY_FROM_ZERO",globalExchangeRatesApi:{endpoint:void 0,headers:void 0,propertyPath:void 0}};function _typeof(e){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _toArray(e){return _arrayWithHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableRest()}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Static={normalizePrecision:function(e){var t=e.reduce(function(e,t){return Math.max(e.getPrecision(),t.getPrecision())});return e.map(function(e){return e.getPrecision()===t?e:e.convertPrecision(t)})},minimum:function(e){var t=_toArray(e),r=t[0],n=t.slice(1),o=r;return n.forEach(function(e){o=o.lessThan(e)?o:e}),o},maximum:function(e){var t=_toArray(e),r=t[0],n=t.slice(1),o=r;return n.forEach(function(e){o=o.greaterThan(e)?o:e}),o}};function isNumeric(e){return!isNaN(parseInt(e))&&isFinite(e)}function isPercentage(e){return isNumeric(e)&&100>=e&&0<=e}function areValidRatios(e){return 0<e.length&&e.every(function(e){return 0<=e})&&e.some(function(e){return 0<e})}function isEven(e){return 0==e%2}function isFloat(e){return isNumeric(e)&&!Number.isInteger(e)}function countFractionDigits(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:0,t=e.toString();if(0<t.indexOf("e-"))return parseInt(t.split("e-")[1]);var r=t.split(".")[1];return r?r.length:0}function isHalf(e){return .5==Math.abs(e)%1}function getJSON(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(r,n){var o=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){4===o.readyState&&(200<=o.status&&400>o.status?r(JSON.parse(o.responseText)):n(new Error(o.statusText)))},onerror:function(){n(new Error("Network error"))}});o.open("GET",e,!0),setXHRHeaders(o,t.headers),o.send()})}function setXHRHeaders(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};for(var r in t)e.setRequestHeader(r,t[r]);return e}function isUndefined(e){return"undefined"==typeof e}function flattenObject(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:".",r={};return Object.entries(e).forEach(function(e){if("object"===_typeof(e[1])){var n=flattenObject(e[1]);Object.entries(n).forEach(function(n){r[e[0]+t+n[0]]=n[1]})}else r[e[0]]=e[1]}),r}function isThenable$1(e){return!!e&&("object"===_typeof(e)||"function"==typeof e)&&"function"==typeof e.then}function Calculator(){var e=Math.sign,t=Math.floor,r=Math.round,n=Math.abs,o=function(e,t){var n=function(e){return Math.pow(10,countFractionDigits(e))},o=Math.max(n(e),n(t));return r(e*o)*r(t*o)/(o*o)},a={HALF_ODD:function(e){var t=r(e);return isHalf(e)?isEven(t)?t-1:t:t},HALF_EVEN:function(e){var t=r(e);return isHalf(e)?isEven(t)?t:t-1:t},HALF_UP:function(e){return r(e)},HALF_DOWN:function(e){return isHalf(e)?t(e):r(e)},HALF_TOWARDS_ZERO:function(o){return isHalf(o)?e(o)*t(n(o)):r(o)},HALF_AWAY_FROM_ZERO:function(t){return isHalf(t)?e(t)*Math.ceil(n(t)):r(t)},DOWN:function(e){return t(e)}};return{add:function(e,t){return e+t},subtract:function(e,t){return e-t},multiply:function(e,t){return isFloat(e)||isFloat(t)?o(e,t):e*t},divide:function(e,t){return e/t},modulo:function(e,t){return e%t},round:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"HALF_EVEN";return a[t](e)}}}var calculator=Calculator();function Format(e){var t=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(e);return{getMatches:function(){return null===t?[]:t.slice(1).filter(function(e){return!isUndefined(e)})},getMinimumFractionDigits:function(){var e=function(e){return"."===e};return isUndefined(this.getMatches().find(e))?0:this.getMatches()[calculator.add(this.getMatches().findIndex(e),1)].split("").length},getCurrencyDisplay:function(){return{USD:"code",dollar:"name",$:"symbol"}[this.getMatches().find(function(e){return"USD"===e||"dollar"===e||"$"===e})]},getStyle:function(){return isUndefined(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!isUndefined(this.getMatches().find(function(e){return","===e}))}}}function CurrencyConverter(e){var t=function(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"",t=1<arguments.length?arguments[1]:void 0;for(var r in t)e=e.replace("{{".concat(r,"}}"),t[r]);return e},r=function(r,n){return getJSON(t(e.endpoint,{from:r,to:n}),{headers:e.headers})};return{getExchangeRate:function(n,o){return(isThenable$1(e.endpoint)?e.endpoint:r(n,o)).then(function(r){return flattenObject(r)[t(e.propertyPath,{from:n,to:o})]})}}}function assert(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:Error;if(!e)throw new r(t)}function assertPercentage(e){assert(isPercentage(e),"You must provide a numeric value between 0 and 100.",RangeError)}function assertValidRatios(e){assert(areValidRatios(e),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}function assertInteger(e){assert(Number.isInteger(e),"You must provide an integer.",TypeError)}var calculator$1=Calculator(),Dinero=function e(t){var r=Math.floor,n=Math.pow,o=Object.assign({},{amount:e.defaultAmount,currency:e.defaultCurrency,precision:e.defaultPrecision},t),a=o.amount,i=o.currency,s=o.precision;assertInteger(a),assertInteger(s);var l=e.globalLocale,c=e.globalFormat,u=e.globalRoundingMode,d=e.globalFormatRoundingMode,g=Object.assign({},e.globalExchangeRatesApi),p=function(t){var r=Object.assign({},Object.assign({},{amount:a,currency:i,precision:s},t),Object.assign({},{locale:this.locale},t));return Object.assign(e({amount:r.amount,currency:r.currency,precision:r.precision}),{locale:r.locale})},m=function(e){assert(this.hasSameCurrency(e),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return a},getCurrency:function(){return i},getLocale:function(){return this.locale||l},setLocale:function(e){return p.call(this,{locale:e})},getPrecision:function(){return s},convertPrecision:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:d;return assertInteger(e),p.call(this,{amount:calculator$1.round(calculator$1.multiply(this.getAmount(),n(10,calculator$1.subtract(e,this.getPrecision()))),t),precision:e})},add:function(t){m.call(this,t);var r=e.normalizePrecision([this,t]);return p.call(this,{amount:calculator$1.add(r[0].getAmount(),r[1].getAmount()),precision:r[0].getPrecision()})},subtract:function(t){m.call(this,t);var r=e.normalizePrecision([this,t]);return p.call(this,{amount:calculator$1.subtract(r[0].getAmount(),r[1].getAmount()),precision:r[0].getPrecision()})},multiply:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:u;return p.call(this,{amount:calculator$1.round(calculator$1.multiply(this.getAmount(),e),t)})},divide:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:u;return p.call(this,{amount:calculator$1.round(calculator$1.divide(this.getAmount(),e),t)})},percentage:function(e){return assertPercentage(e),this.multiply(calculator$1.divide(e,100))},allocate:function(e){var t=this;assertValidRatios(e);for(var n=e.reduce(function(e,t){return calculator$1.add(e,t)}),o=this.getAmount(),a=e.map(function(e){var a=r(calculator$1.divide(calculator$1.multiply(t.getAmount(),e),n));return o=calculator$1.subtract(o,a),p.call(t,{amount:a})}),s=0;0<o;)0<e[s]&&(a[s]=a[s].add(p.call(this,{amount:1})),o=calculator$1.subtract(o,1)),s+=1;return a},convert:function(e){var t=this,r=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},n=r.endpoint,o=void 0===n?g.endpoint:n,a=r.propertyPath,i=void 0===a?g.propertyPath||"rates.{{to}}":a,s=r.headers,l=void 0===s?g.headers:s,c=r.roundingMode,d=void 0===c?u:c,m=Object.assign({},{endpoint:o,propertyPath:i,headers:l,roundingMode:d});return CurrencyConverter(m).getExchangeRate(this.getCurrency(),e).then(function(r){return assert(!isUndefined(r),"No rate was found for the destination currency \"".concat(e,"\"."),TypeError),p.call(t,{amount:calculator$1.round(calculator$1.multiply(t.getAmount(),parseFloat(r)),m.roundingMode),currency:e})})},equalsTo:function(e){return this.hasSameAmount(e)&&this.hasSameCurrency(e)},lessThan:function(t){m.call(this,t);var r=e.normalizePrecision([this,t]);return r[0].getAmount()<r[1].getAmount()},lessThanOrEqual:function(t){m.call(this,t);var r=e.normalizePrecision([this,t]);return r[0].getAmount()<=r[1].getAmount()},greaterThan:function(t){m.call(this,t);var r=e.normalizePrecision([this,t]);return r[0].getAmount()>r[1].getAmount()},greaterThanOrEqual:function(t){m.call(this,t);var r=e.normalizePrecision([this,t]);return r[0].getAmount()>=r[1].getAmount()},isZero:function(){return 0===this.getAmount()},isPositive:function(){return 0<=this.getAmount()},isNegative:function(){return 0>this.getAmount()},hasSubUnits:function(){return 0!==calculator$1.modulo(this.getAmount(),n(10,s))},hasCents:function(){return 0!==calculator$1.modulo(this.getAmount(),n(10,s))},hasSameCurrency:function(e){return this.getCurrency()===e.getCurrency()},hasSameAmount:function(t){var r=e.normalizePrecision([this,t]);return r[0].getAmount()===r[1].getAmount()},toFormat:function(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:c,t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:d,r=Format(e);return this.toRoundedUnit(r.getMinimumFractionDigits(),t).toLocaleString(this.getLocale(),{currencyDisplay:r.getCurrencyDisplay(),useGrouping:r.getUseGrouping(),minimumFractionDigits:r.getMinimumFractionDigits(),style:r.getStyle(),currency:this.getCurrency()})},toUnit:function(){return calculator$1.divide(this.getAmount(),n(10,s))},toRoundedUnit:function(e){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:d,r=n(10,e);return calculator$1.divide(calculator$1.round(calculator$1.multiply(this.toUnit(),r),t),r)},toObject:function(){return{amount:a,currency:i,precision:s}},toJSON:function(){return this.toObject()}}},Dinero$1=Object.assign(Dinero,Defaults,Globals,Static);module.exports=Dinero$1;