import {
  BackgroundBackgroundType,
  ColorSwatchType
} from "@wix/ambassador-ricos-v1-ricos-conversation/types";
import { hexToRgba } from "./color-utils.js";
import { gradientToBackgroundImage } from "./gradient-to-background-image.js";
const designToContainerStyle = (design) => {
  if (design?.background?.type === BackgroundBackgroundType.IMAGE) {
    const bgColor = design.background?.imageOptions?.color?.type === ColorSwatchType.COLOR ? hexToRgba(design.background?.imageOptions?.color?.colorOptions ?? void 0) : "#ffffff";
    const bgImage = design.background?.imageOptions?.url ? `url(${design.background.imageOptions.url})` : "none";
    const bgSize = design.background.imageOptions?.scaling?.toLowerCase() || "cover";
    const bgPosition = design.background.imageOptions?.position?.toLowerCase().split("_").join(" ") || "center";
    return {
      backgroundColor: bgColor,
      backgroundImage: bgImage,
      backgroundSize: bgSize,
      backgroundPosition: bgPosition,
      backgroundRepeat: "no-repeat"
    };
  }
  if (design?.background?.type === BackgroundBackgroundType.COLOR) {
    if (design?.background?.colorOptions?.color?.type === ColorSwatchType.COLOR) {
      return {
        backgroundColor: hexToRgba(
          design.background.colorOptions?.color?.colorOptions ?? void 0
        )
      };
    }
    if (design?.background?.colorOptions?.color?.type === ColorSwatchType.GRADIENT) {
      return {
        backgroundImage: gradientToBackgroundImage(
          design.background?.colorOptions?.color?.gradientOptions
        )
      };
    }
  }
  return {
    backgroundColor: "#ffffff"
  };
};
export {
  designToContainerStyle
};
//# sourceMappingURL=design-to-container-style.js.map
