function m({
  base: t = 1024,
  decimals: n = 2,
  inputUnit: e = "B",
  targetUnit: r = "B",
  value: s
}) {
  const i = {
    B: 1,
    GB: t ** 3,
    KB: t,
    MB: t ** 2,
    TB: t ** 4
  }, o = {
    Gb: t ** 3 / 8,
    Kb: t / 8,
    Mb: t ** 2 / 8,
    Tb: t ** 4 / 8,
    b: 1 / 8
  }, u = { ...i, ...o }, d = u[r], f = s * u[e], c = Number.parseFloat((f / d).toFixed(n));
  return Number.isNaN(c) ? 0 : c;
}
function N(t) {
  return t > 360 ? 360 : t < -360 ? -360 : t;
}
function a(t, n) {
  return n === 0 ? t : a(n, t % n);
}
function h(t, n) {
  if (!t || !n)
    return "-- / --";
  const e = a(t, n);
  return `${t / e} / ${n / e}`;
}
function l(t, n) {
  const e = Math.round(t), r = Math.round(n), s = a(e, r);
  return {
    height: r / s,
    width: e / s
  };
}
function b(t, n, e) {
  const r = e * Math.PI / 180;
  if (e % 90 === 0)
    return {
      height: e % 180 === 0 ? n : t,
      width: e % 180 === 0 ? t : n
    };
  const s = Math.abs(Math.cos(r)), i = Math.abs(Math.sin(r)), o = t * s + n * i, u = t * i + n * s;
  return {
    height: Math.round(u),
    width: Math.round(o)
  };
}
function g(t) {
  if (!t || typeof t != "string")
    return 0;
  const n = t.trim();
  if (!n)
    return 0;
  if (n.endsWith("s") && !n.endsWith("ms")) {
    const e = Number.parseFloat(n);
    return Number.isNaN(e) || e < 0 ? 0 : e * 1e3;
  }
  if (n.endsWith("m")) {
    const e = Number.parseFloat(n);
    return Number.isNaN(e) || e < 0 ? 0 : e * 60 * 1e3;
  }
  if (n.endsWith("h")) {
    const e = Number.parseFloat(n);
    return Number.isNaN(e) || e < 0 ? 0 : e * 60 * 60 * 1e3;
  }
  if (n.endsWith("ms")) {
    const e = Number.parseFloat(n);
    return Number.isNaN(e) || e < 0 ? 0 : e;
  }
  return 0;
}
function p(t) {
  const n = /^(-?\d*\.?\d+)([a-zA-Z%]*)$/.exec(t.trim());
  if (!n)
    return null;
  const e = Number.parseFloat(n[1]);
  return { unit: n[2] || "", value: e };
}
function v(t) {
  if (!Number.isFinite(t))
    return "0";
  const [n, e] = String(t).split("."), r = n.startsWith("-"), i = (r ? n.slice(1) : n).replace(
    /\B(?=(\d{3})+(?!\d))/g,
    ","
  ), o = r ? "-" : "";
  return e !== void 0 ? `${o}${i}.${e}` : `${o}${i}`;
}
export {
  m as a,
  g as b,
  l as c,
  h as d,
  p as e,
  v as f,
  a as g,
  b as r,
  N as s
};
