import lodash from "lodash";
const BG_COLOR = 11;
const DISABLED_COLOR = 13;
const TEXT_COLOR_LOW = 14;
const TEXT_COLOR = 15;
const ACTION_COLOR = 18;
const COLORS = { BG_COLOR, DISABLED_COLOR, TEXT_COLOR_LOW, TEXT_COLOR, ACTION_COLOR };
const assertWixPalette = (palette) => {
  if (palette.length === 0) {
    throw Error("Received empty palette colors array");
  }
  const receivedColors = palette.map((val) => val.name);
  const missingColors = lodash.difference(
    Object.values(COLORS).map((num) => `color_${num}`),
    receivedColors
  );
  if (missingColors.length > 0) {
    const error = [];
    error.push(
      "Some palette colors were not supplied:",
      `
${missingColors}
`,
      "Palette array must include the following colors:",
      Object.entries(COLORS).map((entry) => `${entry[1]} - ${entry[0]}`).toString().split(",").join("\n"),
      ""
    );
    throw Error(error.join("\n"));
  }
  return palette;
};
const isRicosPalette = (palette) => palette && typeof palette !== "string" && !Array.isArray(palette) && ("actionColor" in palette && palette.actionColor || "textColor" in palette && palette.textColor || "bgColor" in palette && palette.bgColor);
const getColorByCode = (wixPalette, code) => {
  const idx = code <= 5 ? code - 1 : code - 6;
  return wixPalette[idx];
};
const getColorValue = (wixPalette, code) => getColorByCode(wixPalette, code).value;
export {
  COLORS,
  assertWixPalette,
  getColorValue,
  isRicosPalette
};
//# sourceMappingURL=wix-palette-utils.js.map
