import { TWOPI as w } from "../utils/index.js";
import d from "../chroma.js";
import m from "../utils/type.js";
import I from "../utils/clip_rgb.js";
const { pow: M, sin: O, cos: P } = Math;
function v(i = 300, l = -1.5, o = 1, e = 1, t = [0, 1]) {
  let c = 0, f;
  m(t) === "array" ? f = t[1] - t[0] : (f = 0, t = [t, t]);
  const n = function(r) {
    const y = w * ((i + 120) / 360 + l * r), u = M(t[0] + f * r, e), a = (c !== 0 ? o[0] + r * c : o) * u * (1 - u) / 2, p = P(y), b = O(y), _ = u + a * (-0.14861 * p + 1.78277 * b), s = u + a * (-0.29227 * p - 0.90649 * b), x = u + a * (1.97294 * p);
    return d(I([_ * 255, s * 255, x * 255, 1]));
  };
  return n.start = function(r) {
    return r == null ? i : (i = r, n);
  }, n.rotations = function(r) {
    return r == null ? l : (l = r, n);
  }, n.gamma = function(r) {
    return r == null ? e : (e = r, n);
  }, n.hue = function(r) {
    return r == null ? o : (o = r, m(o) === "array" ? (c = o[1] - o[0], c === 0 && (o = o[1])) : c = 0, n);
  }, n.lightness = function(r) {
    return r == null ? t : (m(r) === "array" ? (t = r, f = r[1] - r[0]) : (t = [r, r], f = 0), n);
  }, n.scale = () => d.scale(n), n.hue(o), n;
}
export {
  v as default
};
//# sourceMappingURL=cubehelix.js.map
