"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 testkit_exports = {};
__export(testkit_exports, {
  createVerticalEmbedTestkit: () => createVerticalEmbedTestkit
});
module.exports = __toCommonJS(testkit_exports);
var import_unidriver = require("@wix/design-system/dist/testkit/unidriver.js");
var import_ricos_types = require("./../ricos-types/index.js");
var import_data_hooks = require("./../_shared/data-hooks.js");
var import_wix_rich_content_common = require("./../wix-rich-content-common/index.js");
var import_testkit = require("./../ui-components/testkit.js");
var import_data_hooks2 = require("./data-hooks.js");
var import_get_add_buttons = require("./get-add-buttons.js");
const createVerticalEmbedTestkit = (getBase) => {
  const getVerticalEmbed = async (index, options) => {
    const verticalEmbed = await getBase().getAll((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.ROOT), options);
    return verticalEmbed.at(index);
  };
  const getInsertVerticalEmbedModal = async () => await getBase().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_VERTICAL_EMBED_MODAL));
  const getVerticalLinkElement = async () => getBase().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.ROOT));
  const getSettingsModal = async () => getBase().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_MODAL));
  const getTitle = (base) => base.get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.VERTICAL_EMBED_TITLE));
  const getSubtitle = (base) => base.get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.VERTICAL_EMBED_SUBTITLE));
  const getButton = (base) => base.get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.VERTICAL_EMBED_BUTTON));
  return {
    content: {
      atIndex: (index) => {
        return {
          exists: async (options) => {
            try {
              const verticalEmbed = await getVerticalEmbed(index, options);
              return verticalEmbed.exists();
            } catch {
              return false;
            }
          },
          getLink: async () => {
            const embedLink = await getVerticalLinkElement();
            return embedLink.attr("data-url");
          },
          getTitle: async () => {
            const embedLink = await getVerticalLinkElement();
            const title = await getTitle(embedLink);
            return title.text();
          },
          getSubtitle: async () => {
            const embedLink = await getVerticalLinkElement();
            const subtitle = await getSubtitle(embedLink);
            return subtitle.text();
          },
          getButtonText: async () => {
            const verticalEmbed = await getVerticalEmbed(index);
            const button = await getButton(verticalEmbed);
            return button.text();
          },
          click: async () => {
            const verticalEmbed = await getVerticalEmbed(index);
            await verticalEmbed.click();
          }
        };
      }
    },
    insertVerticalEmbedModal: {
      exists: async () => {
        try {
          const insertEventModal = await getInsertVerticalEmbedModal();
          return insertEventModal.exists();
        } catch {
          return false;
        }
      },
      listItemAt: async (index) => {
        const insertEventModal = await getInsertVerticalEmbedModal();
        const listItems = await insertEventModal.getAll((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_VERTICAL_EMBED_MODAL_ITEM));
        return (0, import_unidriver.ListItemSelectUniDriver)(listItems.at(index), getBase());
      },
      ...(0, import_testkit.createFooterActionsUnidriver)(getBase)
    },
    settingsModal: {
      exists: async () => (await getSettingsModal()).exists(),
      waitForElement: async () => {
        const modal = await getSettingsModal();
        await modal.wait();
      }
    },
    tabs: {
      ...(0, import_unidriver.TabsUniDriver)(getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_TABS)), getBase()),
      waitForElement: async () => {
        const tabs = await getBase().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_TABS));
        await tabs.wait();
      }
    },
    settings: {
      imageToggle: (0, import_unidriver.ToggleSwitchUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_IMAGE_TOGGLE)),
        getBase()
      ),
      priceToggle: (0, import_unidriver.ToggleSwitchUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_PRICE_TOGGLE)),
        getBase()
      ),
      dateTimeToggle: (0, import_unidriver.ToggleSwitchUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_DATETIME_TOGGLE)),
        getBase()
      ),
      locationToggle: (0, import_unidriver.ToggleSwitchUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_LOCATION_TOGGLE)),
        getBase()
      ),
      durationToggle: (0, import_unidriver.ToggleSwitchUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_DURATION_TOGGLE)),
        getBase()
      ),
      buttonToggle: (0, import_unidriver.ToggleSwitchUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_BUTTON_TOGGLE)),
        getBase()
      ),
      buttonTextInput: {
        ...(0, import_unidriver.InputUniDriver)(
          getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_BUTTON_TEXT_INPUT)),
          getBase()
        ),
        waitForElement: async () => {
          await getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_BUTTON_TEXT_INPUT)).wait();
        }
      },
      ribbonToggle: (0, import_unidriver.ToggleSwitchUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_RIBBON_TOGGLE)),
        getBase()
      ),
      ribbonTextInput: {
        ...(0, import_unidriver.InputUniDriver)(
          getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_RIBBON_TEXT_INPUT)),
          getBase()
        ),
        waitForElement: async () => {
          await getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_RIBBON_TEXT_INPUT)).wait();
        }
      }
    },
    layout: {
      positionStart: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_POSITION_START")),
        getBase()
      ),
      positionTop: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_POSITION_TOP")),
        getBase()
      ),
      positionEnd: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_POSITION_END")),
        getBase()
      ),
      ratioSquare: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_RATIO_SQUARE")),
        getBase()
      ),
      ratioRectangle: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_RATIO_RECTANGLE")),
        getBase()
      ),
      resizingDropdown: (0, import_unidriver.DropdownUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_RESIZING_DROPDOWN")),
        getBase()
      ),
      alignmentStart: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_ALIGNMENT_LEFT")),
        getBase()
      ),
      alignmentCenter: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_ALIGNMENT_CENTER")),
        getBase()
      ),
      alignmentEnd: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_ALIGNMENT_RIGHT")),
        getBase()
      ),
      titlePriceStacked: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_TITLE_PRICE_STACKED")),
        getBase()
      ),
      titlePriceSideBySide: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_TITLE_PRICE_SIDE_BY_SIDE")),
        getBase()
      ),
      ribbonPlacementOnImage: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_RIBBON_PLACEMENT_ON_IMAGE")),
        getBase()
      ),
      ribbonPlacementAboveInfo: (0, import_unidriver.ThumbnailUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)("VERTICAL_EMBED_RIBBON_PLACEMENT_ABOVE_INFO")),
        getBase()
      )
    },
    design: {
      titleColorPicker: (0, import_unidriver.FillPreviewUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_TITLE_COLOR_PICKER_TRIGGER)),
        getBase()
      ),
      textColorPicker: (0, import_unidriver.FillPreviewUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_SUBTITLE_COLOR_PICKER_TRIGGER)),
        getBase()
      ),
      backgroundColorPicker: (0, import_unidriver.FillPreviewUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_BACKGROUND_COLOR_TRIGGER)),
        getBase()
      ),
      borderColorPicker: (0, import_unidriver.FillPreviewUniDriver)(
        getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_BORDER_COLOR_TRIGGER)),
        getBase()
      ),
      borderWidthInput: {
        ...(0, import_unidriver.InputUniDriver)(
          getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_BORDER_WIDTH_INPUT)),
          getBase()
        ),
        waitForElement: async () => {
          await getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_BORDER_WIDTH_INPUT)).wait();
        }
      },
      cornerRadiusInput: {
        ...(0, import_unidriver.InputUniDriver)(
          getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_CORNER_RADIUS_INPUT)),
          getBase()
        ),
        waitForElement: async () => {
          await getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.SETTINGS_VERTICAL_EMBED_CORNER_RADIUS_INPUT)).wait();
        }
      },
      colorPickerModal: (0, import_testkit.createNewColorPickerUniDriver)(getBase)
    },
    toolbars: {
      createAddButtonToolbars: (getAddButtonToolbarBase) => ({
        clickEvents: async () => {
          const clickEvents = await getAddButtonToolbarBase().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_EVENT_BUTTON));
          await clickEvents.click();
        },
        clickBookings: async () => {
          const clickBookigns = await getAddButtonToolbarBase().get(
            (0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_BOOKINGS_BUTTON)
          );
          await clickBookigns.click();
        },
        clickStores: async () => {
          const clickStores = await getAddButtonToolbarBase().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_STORES_BUTTON));
          await clickStores.click();
        },
        toolbarsToAddIn: import_get_add_buttons.toolbarsToAddIn
      }),
      createPluginToolbar: (getPluginToolbarBase) => ({
        clickDelete: async () => {
          const deleteButton = await getPluginToolbarBase(import_ricos_types.RicosPluginToolbarNames.APP_EMBED).get(
            (0, import_wix_rich_content_common.dataHook)(import_data_hooks.PLUGIN_TOOLBAR_DELETE_BUTTON)
          );
          await deleteButton.click();
        },
        clickReplace: async () => {
          const replaceButton = await getPluginToolbarBase(import_ricos_types.RicosPluginToolbarNames.APP_EMBED).get(
            (0, import_wix_rich_content_common.dataHook)(import_data_hooks.PLUGIN_TOOLBAR_REPLACE_BUTTON)
          );
          await replaceButton.click();
        },
        exists: async () => {
          try {
            return getPluginToolbarBase(import_ricos_types.RicosPluginToolbarNames.APP_EMBED).exists();
          } catch {
            return false;
          }
        },
        openSettingsModal: async () => {
          const settings = await getPluginToolbarBase(import_ricos_types.RicosPluginToolbarNames.APP_EMBED).getAll(
            (0, import_wix_rich_content_common.dataHook)(import_data_hooks.PLUGIN_TOOLBAR_SETTINGS_BUTTON)
          );
          await settings.at(1).click();
        },
        openPresetsModal: async () => {
          const settings = await getPluginToolbarBase(import_ricos_types.RicosPluginToolbarNames.APP_EMBED).getAll(
            (0, import_wix_rich_content_common.dataHook)(import_data_hooks.PLUGIN_TOOLBAR_SETTINGS_BUTTON)
          );
          await settings.at(0).click();
        }
      })
    }
  };
};
//# sourceMappingURL=testkit.js.map
