import { GradientType } from "@wix/ambassador-ricos-v1-ricos-conversation/types";
import { hexToRgba } from "./color-utils.js";
const gradientToBackgroundImage = (gradient) => {
  if (gradient?.type === GradientType.LINEAR) {
    return `linear-gradient(${gradient.linearOptions}deg, ${[...gradient.stops ?? []].sort((a, b) => (a.position ?? 0) - (b.position ?? 0)).map(
      (stop) => `${hexToRgba(stop.color ?? void 0, (stop.opacity ?? 1) * 100)} ${((stop.position ?? 0) * 100).toFixed(2)}%`
    ).join(", ")})`;
  }
  if (gradient?.type === GradientType.RADIAL) {
    return `radial-gradient(circle at ${gradient.radialOptions?.x}% ${gradient.radialOptions?.y}%, ${[...gradient.stops ?? []].sort((a, b) => (a.position ?? 0) - (b.position ?? 0)).map(
      (stop) => `${hexToRgba(stop.color ?? void 0, (stop.opacity ?? 1) * 100)} ${((stop.position ?? 0) * 100).toFixed(2)}%`
    ).join(", ")})`;
  }
  return "";
};
export {
  gradientToBackgroundImage
};
//# sourceMappingURL=gradient-to-background-image.js.map
