import u from "../constants/currency-codes.js";
import a from "../constants/currency-decimals.js";
const l = (t) => a[t] || 100, y = (t) => !!u[t], d = (t) => y(t) ? u[t] : null, C = (t, o) => {
  const r = l(o);
  return parseInt(String(t), 10) / r;
}, A = (t, o, r, e = !1, n = {}) => {
  const c = t.toString(), s = C(c, r), i = o.replace("_", "-"), m = {
    style: "currency",
    currency: r,
    currencyDisplay: "symbol",
    ...n
  };
  try {
    return e ? f(i, m, s) : s.toLocaleString(i, m);
  } catch {
    return c;
  }
}, f = (t, o, r) => Intl.NumberFormat(t, o).formatToParts(r).filter((e) => e.type !== "currency").reduce((e, n) => e + n.value, "").trim();
export {
  f as formatAmountWithoutCurrency,
  d as getCurrencyCode,
  C as getDecimalAmount,
  l as getDivider,
  A as getLocalisedAmount,
  y as isValidCurrencyCode
};
