import{u as e,i as r,bk as t,A as o}from"./main.chunk.N-eZ2ybB.js";const n=()=>{const{appConfig:n}=e(),a=n[o.Payment],{currency:s="$:USD",currency_position:c="before",decimal_places:i=2,decimal_separator:p=".",thousand_separator:u=","}=a??{};return{toCurrency:(e,o=!0)=>{if(!r(e))return"";const n="string"==typeof e?t(e)?Number(e):"":e;if(""===n)return n;const a=n<0,$=Math.abs(n).toFixed(i).replace(".",p).replace(/\B(?=(\d{3})+(?!\d))/g,u),l=r(s)?s:"$:USD",f=o?l.split(":")[0]:l.split(":")[1]??"",d="before"===c?`${f}${$}`:`${$}${f}`;return a?`-${d}`:d},toCurrencyCompact:(e,o=!0)=>{if(!r(e))return"";const n="string"==typeof e?t(e)?Number(e):"":e;if(""===n)return n;const a=r(s)?s:"$:USD",i=o?a.split(":")[0]:a.split(":")[1]??"",p=n<0,u=Math.abs(n);let $="";$=u>=1e9?(u/1e9).toFixed(1).replace(/\.0$/,"")+"B":u>=1e6?(u/1e6).toFixed(1).replace(/\.0$/,"")+"M":u>=1e3?(u/1e3).toFixed(1).replace(/\.0$/,"")+"K":u.toString();const l="before"===c?`${i}${$}`:`${$}${i}`;return p?`-${l}`:l}}};export{n as u};
