const b = (r) => {
  if (r === 0)
    return "0";
  const c = r.toString();
  if (!c.includes("e"))
    return c;
  const [n = "", f = ""] = c.split("e");
  let t = n.replace(".", "");
  const e = parseInt(f, 10), i = n.indexOf(".");
  if (e < 0) {
    const l = Math.abs(e) - (i === -1 ? 0 : i);
    return t = "0".repeat(l) + t, `0.${t}`;
  }
  if (i === -1)
    return e >= t.length ? t + "0".repeat(e - t.length) : `${t.slice(0, e)}.${t.slice(e)}`;
  const s = i + e;
  return s >= t.length ? t + "0".repeat(s - t.length) : `${t.slice(0, s)}.${t.slice(s)}`;
}, L = (r, { leadingZeros: c = 1, maxNonZeroPartDecimals: n = 3, minZeros: f = 3 } = {}) => {
  if (r < 1 && r > 0.099999999999) {
    const a = `${r}`.substring(0, n + 2);
    return parseFloat(a).toLocaleString();
  }
  if (r > 1) {
    const [a = "0", h = ""] = `${r}`.split(".");
    if (!h)
      return parseFloat(a).toLocaleString();
    const u = `${a}.${h.substring(0, n)}`;
    return parseFloat(u).toLocaleString();
  }
  if (r >= 1 / 10 ** c || r <= 0) {
    const a = `${r}`;
    return parseFloat(a).toLocaleString();
  }
  const e = b(r).split(".")[1] ?? "", i = e.match(/^0+/), o = i ? i[0].length : 0, s = e.slice(o);
  if (o <= f)
    return `0.${"0".repeat(o)}${s.substring(0, n)}`;
  const l = Math.min(c, o), g = o - l;
  if (g === 0)
    return `${r}`;
  const p = [], $ = `0.${"0".repeat(l)}`;
  return p.push($), p.push(`${g + 1}`), s.length > 0 && p.push(s.substring(0, n)), p;
};
export {
  L as formatTinyNumber
};
//# sourceMappingURL=formatTinyNumber.js.map
