const c=r=>({US:"USD",GB:"GBP",EU:"EUR",AT:"EUR",BE:"EUR",CY:"EUR",EE:"EUR",FI:"EUR",FR:"EUR",DE:"EUR",GR:"EUR",IE:"EUR",IT:"EUR",LV:"EUR",LT:"EUR",LU:"EUR",MT:"EUR",NL:"EUR",PT:"EUR",SK:"EUR",SI:"EUR",RU:"RUB",BR:"BRL",JP:"JPY",ID:"IDR",MY:"MYR",PH:"PHP",TH:"THB",VN:"VND",KR:"KRW",TR:"TRY",UA:"UAH",MX:"MXN",CA:"CAD",NZ:"NZD",NO:"NOK",PL:"PLN",CH:"CHF",LI:"CHF",IN:"INR",CL:"CLP",PE:"PEN",CO:"COP",ZA:"ZAR",HK:"HKD",AR:"ARS",KZ:"KZT",UY:"UYU",CN:"CNY",AU:"AUD",TW:"TWD",SA:"SAR",QA:"QAR"})[r]??"USD",i=(r,a,n,e=!1)=>{let o=new Intl.NumberFormat(r,{style:"currency",currency:n});const s=o.resolvedOptions().maximumFractionDigits,l=a/Math.pow(10,s);let t=s;return e&&Number.isInteger(l)&&(t=0),o=new Intl.NumberFormat(r,{style:"currency",currency:n,minimumFractionDigits:t}),o.format(l)},m=(r,a,n=12)=>{const e=r*n;return Math.floor((e-a)/e*100)},u=(r,a,n)=>{const e=getComputedStyle(document.body),o=r.elements({appearance:{variables:{colorPrimary:e.getPropertyValue("--color-brand"),colorBackground:e.getPropertyValue("--color-button-bg"),colorText:e.getPropertyValue("--color-base"),colorTextPlaceholder:e.getPropertyValue("--color-secondary"),colorDanger:e.getPropertyValue("--color-red"),fontFamily:e.getPropertyValue("--font-standard"),spacingUnit:"0.25rem",borderRadius:"0.75rem"}},loader:"never",...n}),s=o.create("payment");s.mount("#payment-element");const l=o.create("address",{mode:"billing",contacts:a?[...new Set(a.map(t=>({address:t.billing_details.address,email:t.billing_details.email,name:t.billing_details.name})))]:void 0});return l.mount("#address-element"),l.on("change",t=>{t.value&&t.value.address&&t.value.address.country&&o.update({currency:c(t.value.address.country).toLowerCase()})}),{elements:o,paymentElement:s,addressElement:l}};export{u as a,m as c,i as f,c as g};