import "../../utils/type.js";
import l from "../../utils/unpack.js";
import n from "../../utils/last.js";
import e from "./hsl2css.js";
import f from "../hsl/rgb2hsl.js";
import p from "./lab2css.js";
import a from "../lab/rgb2lab.js";
import h from "./lch2css.js";
import u from "../lch/rgb2lch.js";
import g from "../oklab/rgb2oklab.js";
import k from "./oklab2css.js";
import d from "../oklch/rgb2oklch.js";
import P from "./oklch2css.js";
import { setLabWhitePoint as t, getLabWhitePoint as c } from "../lab/lab-constants.js";
const { round: m } = Math, D = (...b) => {
  const r = l(b, "rgba");
  let o = n(b) || "rgb";
  if (o.substr(0, 3) === "hsl")
    return e(f(r), o);
  if (o.substr(0, 3) === "lab") {
    const s = c();
    t("d50");
    const i = p(a(r), o);
    return t(s), i;
  }
  if (o.substr(0, 3) === "lch") {
    const s = c();
    t("d50");
    const i = h(u(r), o);
    return t(s), i;
  }
  return o.substr(0, 5) === "oklab" ? k(g(r)) : o.substr(0, 5) === "oklch" ? P(d(r)) : (r[0] = m(r[0]), r[1] = m(r[1]), r[2] = m(r[2]), (o === "rgba" || r.length > 3 && r[3] < 1) && (r[3] = "/ " + (r.length > 3 ? r[3] : 1), o = "rgba"), `${o.substr(0, 3)}(${r.slice(0, o === "rgb" ? 3 : 4).join(" ")})`);
};
export {
  D as default
};
//# sourceMappingURL=rgb2css.js.map
