koboprice/dist/koboprice.js

3 lines
29 KiB
JavaScript
Raw Normal View History

2024-07-15 20:52:41 +03:00
(()=>{var Ue=Object.create;var B=Object.defineProperty,Ke=Object.defineProperties,Ze=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyDescriptors,tt=Object.getOwnPropertyNames,ce=Object.getOwnPropertySymbols,rt=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable;var se=(e,t,r)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,I=(e,t)=>{for(var r in t||(t={}))ue.call(t,r)&&se(e,r,t[r]);if(ce)for(var r of ce(t))nt.call(t,r)&&se(e,r,t[r]);return e},F=(e,t)=>Ke(e,et(t));var ot=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var at=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of tt(t))!ue.call(e,o)&&o!==r&&B(e,o,{get:()=>t[o],enumerable:!(n=Ze(t,o))||n.enumerable});return e};var it=(e,t,r)=>(r=e!=null?Ue(rt(e)):{},at(t||!e||!e.__esModule?B(r,"default",{value:e,enumerable:!0}):r,e));var Ge=ot((z,J)=>{(function(e,t){typeof z=="object"&&typeof J<"u"?J.exports=t():typeof define=="function"&&define.amd?define(t):(e=e||self,e.currency=t())})(z,function(){function e(a,i){if(!(this instanceof e))return new e(a,i);i=Object.assign({},r,i);var c=Math.pow(10,i.precision);this.intValue=a=t(a,i),this.value=a/c,i.increment=i.increment||1/c,i.groups=i.useVedic?o:n,this.s=i,this.p=c}function t(a,i){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!0,s=i.decimal,f=i.errorOnInvalid,h=i.fromCents,y=Math.pow(10,i.precision),d=a instanceof e;if(d&&h)return a.intValue;if(typeof a=="number"||d)s=d?a.value:a;else if(typeof a=="string")f=new RegExp("[^-\\d"+s+"]","g"),s=new RegExp("\\"+s,"g"),s=(s=a.replace(/\((.*)\)/,"-$1").replace(f,"").replace(s,"."))||0;else{if(f)throw Error("Invalid Input");s=0}return h||(s=(s*y).toFixed(4)),c?Math.round(s):s}var r={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:function(a,i){var c=i.pattern,s=i.negativePattern,f=i.symbol,h=i.separator,y=i.decimal;i=i.groups;var d=(""+a).replace(/^-/,"").split("."),w=d[0];return d=d[1],(0<=a.value?c:s).replace("!",f).replace("#",w.replace(i,"$1"+h)+(d?y+d:""))},fromCents:!1},n=/(\d)(?=(\d{3})+\b)/g,o=/(\d)(?=(\d\d)+\d\b)/g;return e.prototype={add:function(a){var i=this.s,c=this.p;return e((this.intValue+t(a,i))/(i.fromCents?1:c),i)},subtract:function(a){var i=this.s,c=this.p;return e((this.intValue-t(a,i))/(i.fromCents?1:c),i)},multiply:function(a){var i=this.s;return e(this.intValue*a/(i.fromCents?1:Math.pow(10,i.precision)),i)},divide:function(a){var i=this.s;return e(this.intValue/t(a,i,!1),i)},distribute:function(a){var i=this.intValue,c=this.p,s=this.s,f=[],h=Math[0<=i?"floor":"ceil"](i/a),y=Math.abs(i-h*a);for(c=s.fromCents?1:c;a!==0;a--){var d=e(h/c,s);0<y--&&(d=d[0<=i?"add":"subtract"](1/c)),f.push(d)}return f},dollars:function(){return~~this.value},cents:function(){return~~(this.intValue%this.p)},format:function(a){var i=this.s;return typeof a=="function"?a(this,i):i.format(this,Object.assign({},i,a))},toString:function(){var a=this.s,i=a.increment;return(Math.round(this.intValue/this.p/i)*i).toFixed(a.precision)},toJSON:function(){return this.value}},e})});globalThis.l=(...e)=>console.log("KOBOPRICE",...e);var de=[{countryCode:"ww",currencyCode:"usd"},{countryCode:"ca",currencyCode:"cad"},{countryCode:"us",currencyCode:"usd"},{countryCode:"in",currencyCode:"inr"},{countryCode:"za",currencyCode:"zar"},{countryCode:"au",currencyCode:"aud"},{countryCode:"hk",currencyCode:"hkd"},{countryCode:"jp",currencyCode:"jpy"},{countryCode:"my",currencyCode:"myr"},{countryCode:"nz",currencyCode:"nzd"},{countryCode:"ph",currencyCode:"php"},{countryCode:"sg",currencyCode:"sgd"},{countryCode:"tw",currencyCode:"twd"},{countryCode:"th",currencyCode:"usd"},{countryCode:"at",currencyCode:"eur"},{countryCode:"be",currencyCode:"eur"},{countryCode:"cy",currencyCode:"eur"},{countryCode:"cz",currencyCode:"czk"},{countryCode:"dk",currencyCode:"dkk"},{countryCode:"ee",currencyCode:"eur"},{countryCode:"fi",currencyCode:"eur"},{countryCode:"fr",currencyCode:"eur"},{countryCode:"de",currencyCode:"eur"},{countryCode:"gr",
//# sourceMappingURL=koboprice.js.map