"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, {
  createGiphyTestkit: () => createGiphyTestkit
});
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_data_hooks2 = require("./data-hooks.js");
var import_get_add_buttons = require("./get-add-buttons.js");
const createGiphyTestkit = (getBase) => {
  const getGiphy = async (index, options) => {
    const giphy = await getBase().getAll((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.ROOT), options);
    return giphy.at(index);
  };
  return {
    content: {
      atIndex: (index) => {
        return {
          exists: async (options) => {
            try {
              const gif = await getGiphy(index, options);
              return gif.exists();
            } catch {
              return false;
            }
          },
          getSrc: async () => (await getGiphy(index)).attr("src"),
          click: async () => {
            const gif = await getGiphy(index);
            await gif.click();
          },
          getNativeElement: async () => {
            const gif = await getGiphy(index);
            return gif.getNative();
          },
          getAttr: async (attr) => {
            const gif = await getGiphy(index);
            return gif.attr(attr);
          }
        };
      }
    },
    modal: {
      gifsTab: {
        clickAddGifAtIndex: async (index) => {
          const addGifButton = await getBase().getAll((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_GIF_MODAL_GIF_ITEM));
          await addGifButton.at(index).click();
        },
        search: (0, import_unidriver.SearchUniDriver)(
          getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_GIF_MODAL_GIF_SEARCH_INPUT)),
          getBase()
        )
      },
      stickersTab: {
        clickAddStickerAtIndex: async (index) => {
          const addGifButton = await getBase().getAll((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_GIF_MODAL_STICKER_ITEM));
          await addGifButton.at(index).click();
        },
        search: (0, import_unidriver.SearchUniDriver)(
          getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_GIF_MODAL_STICKER_SEARCH_INPUT)),
          getBase()
        )
      },
      tabs: {
        ...(0, import_unidriver.TabsUniDriver)(getBase().$((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_GIF_MODAL_GIF_TAB)), getBase()),
        waitForElement: async () => {
          const tabs = await getBase().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_GIF_MODAL_GIF_TAB));
          await tabs.wait();
        }
      }
    },
    toolbars: {
      createAddButtonToolbars: (getAddButtonToolbarBase) => ({
        click: async () => {
          const button = await getAddButtonToolbarBase().get((0, import_wix_rich_content_common.dataHook)(import_data_hooks2.INSERT_GIF_BUTTON));
          await button.click();
        },
        toolbarsToAddIn: import_get_add_buttons.toolbarsToAddIn
      }),
      createPluginToolbar: (getPluginToolbarBase) => ({
        clickReplace: async () => {
          const button = await getPluginToolbarBase(import_ricos_types.RicosPluginToolbarNames.GIF).get(
            (0, import_wix_rich_content_common.dataHook)(import_data_hooks.PLUGIN_TOOLBAR_REPLACE_BUTTON)
          );
          await button.click();
        },
        clickDelete: async () => {
          const button = await getPluginToolbarBase(import_ricos_types.RicosPluginToolbarNames.GIF).get(
            (0, import_wix_rich_content_common.dataHook)(import_data_hooks.PLUGIN_TOOLBAR_DELETE_BUTTON)
          );
          await button.click();
        },
        exists: async () => {
          try {
            return getPluginToolbarBase(import_ricos_types.RicosPluginToolbarNames.GIF).exists();
          } catch {
            return false;
          }
        }
      })
    }
  };
};
//# sourceMappingURL=testkit.js.map
