"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 plugin_testkit_exports = {};
__export(plugin_testkit_exports, {
  createPluginToolbarTestkit: () => createPluginToolbarTestkit
});
module.exports = __toCommonJS(plugin_testkit_exports);
var import_wix_rich_content_common = require("./../../../../wix-rich-content-common/index.js");
var import_Toolbar = require("../../../components/Toolbar/index.js");
var import__ = require("../index.js");
const createPluginToolbarTestkit = (getBase, createPluginToolbarPluginTestkits) => {
  const getPluginToolbar = () => getBase().$((0, import_wix_rich_content_common.dataHook)([import__.FLOATING_PLUGIN_TOOLBAR])).$((0, import_wix_rich_content_common.dataHook)(import_Toolbar.TOOLBAR_VISIBLE));
  const getPluginToolbarByType = (pluginType) => getBase().$((0, import_wix_rich_content_common.dataHook)([import__.FLOATING_PLUGIN_TOOLBAR, pluginType])).$((0, import_wix_rich_content_common.dataHook)(import_Toolbar.TOOLBAR_VISIBLE));
  return {
    waitForElement: async () => {
      const pluginToolbar = getPluginToolbar();
      await pluginToolbar.wait();
      return pluginToolbar;
    },
    getButtonsAmount: async () => {
      const pluginToolbar = getPluginToolbar();
      const buttons = pluginToolbar.$$("button");
      return await buttons.count();
    },
    scrollToElementByIndex: async (index) => {
      const pluginToolbar = getPluginToolbar();
      const button = pluginToolbar.$$("button").get(index);
      if (!button) {
        throw new Error(`Plugin toolbar doesn't have a button at index ${index}`);
      }
      await button.scrollIntoView?.();
    },
    plugins: createPluginToolbarPluginTestkits(getPluginToolbarByType)
  };
};
//# sourceMappingURL=plugin.testkit.js.map
