'use strict';

var index = require('../numbers/index.js');
var sanitize = require('../utils/sanitize.js');
var utils = require('./utils.js');
var clamp = require('../../../../../../../../motion-utils@12.36.0/node_modules/motion-utils/dist/es/clamp.js');

const clampRgbUnit = (v) => clamp.clamp(0, 255, v);
const rgbUnit = {
    ...index.number,
    transform: (v) => Math.round(clampRgbUnit(v)),
};
const rgba = {
    test: /*@__PURE__*/ utils.isColorString("rgb", "red"),
    parse: /*@__PURE__*/ utils.splitColor("red", "green", "blue"),
    transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" +
        rgbUnit.transform(red) +
        ", " +
        rgbUnit.transform(green) +
        ", " +
        rgbUnit.transform(blue) +
        ", " +
        sanitize.sanitize(index.alpha.transform(alpha$1)) +
        ")",
};

exports.rgbUnit = rgbUnit;
exports.rgba = rgba;
