"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var color_swatches_unidriver_exports = {};
__export(color_swatches_unidriver_exports, {
  createColorSwatchesUnidriver: () => createColorSwatchesUnidriver
});
module.exports = __toCommonJS(color_swatches_unidriver_exports);
var import_unidriver = require("@wix/design-system/dist/testkit/unidriver.js");
var import_ricos_styles = require("./../../../ricos-styles/index.js");
var import_wix_rich_content_common = require("./../../../wix-rich-content-common/index.js");
var import_data_hooks = require("./data-hooks.js");
const createColorSwatchesUnidriver = (getBase) => {
  const getSwatchesBase = async () => getBase().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks.SWATCHES));
  const getSwatch = async (index) => {
    const swatches = await getSwatchesBase();
    return swatches.$$((0, import_wix_rich_content_common.dataHook)(import_data_hooks.SWATCH)).get(index);
  };
  return {
    addCustomColorButton: (0, import_unidriver.FillButtonUniDriver)(
      getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks.ADD_CUSTOM_COLOR_BUTTON)),
      getBase()
    ),
    resetColorButton: (0, import_unidriver.FillButtonUniDriver)(getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks.RESET_COLOR_BUTTON)), getBase()),
    getSwatch: async (index) => {
      const swatch = await getSwatch(index);
      return {
        ...(0, import_unidriver.FillPreviewUniDriver)(swatch, getBase()),
        getColor: async () => {
          const el = await swatch.$(`button`);
          const style = await el.prop("style");
          return (0, import_ricos_styles.toHexFormat)(style.getPropertyValue("--fill-preview-background-color-0"));
        },
        getStyle: async () => {
          const el = await swatch.$(`button`);
          const style = await el.prop("style");
          return style;
        },
        getNativeElement: async () => await swatch.$(`button`).unwrap()
      };
    }
  };
};
//# sourceMappingURL=color-swatches-unidriver.js.map
