"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var get_add_buttons_exports = {};
__export(get_add_buttons_exports, {
  getAddButtons: () => getAddButtons,
  toolbarsToAddIn: () => toolbarsToAddIn
});
module.exports = __toCommonJS(get_add_buttons_exports);
var import_wix_ui_icons_common = require("@wix/wix-ui-icons-common");
var import_lodash = __toESM(require("lodash"));
var import_ricos_types = require("./../ricos-types/index.js");
var import_editor_common = require("./../editor-common/index.js");
var import_constants = require("./constants.js");
var import_data_hooks = require("./data-hooks.js");
var import_insert_modal = require("./modals/insert-modal.js");
var import_types = require("./types.js");
const toolbarsToAddIn = [
  import_editor_common.TOOLBARS.FOOTER,
  import_editor_common.TOOLBARS.SIDE,
  import_editor_common.TOOLBARS.MOBILE
];
const getAddButtons = (config, services) => {
  const {
    disableDownloadDefault,
    getVideoUrl,
    exposeButtons = [import_types.videoButtonsTypes.video]
  } = config || {};
  const {
    modals,
    context: { isMobile }
  } = services;
  const modalBaseProps = {
    disableDownloadDefault,
    getVideoUrl
  };
  const buttonsMap = {
    [import_types.videoButtonsTypes.video]: {
      id: `${import_ricos_types.Node_Type.VIDEO}.video`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.VIDEO,
      dataHook: import_data_hooks.INSERT_VIDEO_BUTTON,
      icon: import_wix_ui_icons_common.VideoCamera,
      tooltip: "VideoPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        modals?.togglePluginPanel({
          id: import_constants.VIDEO_INSERT_VIDEO_MODAL_ID,
          Component: import_insert_modal.InsertModal,
          componentProps: {
            componentData: { ...import_constants.RICOS_DEFAULTS },
            modalId: import_constants.VIDEO_INSERT_VIDEO_MODAL_ID,
            ...modalBaseProps
          },
          isMobile,
          positioning: {
            referenceElement,
            placement: "bottom"
          },
          mobileLayout: "drawer"
        });
        return true;
      },
      menuConfig: {
        tags: "Video_plugin_search_tags"
      }
    },
    [import_types.videoButtonsTypes.youTube]: {
      id: `${import_ricos_types.Node_Type.VIDEO}.youTube`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.YOUTUBE,
      dataHook: import_data_hooks.INSERT_YOUTUBE_BUTTON,
      icon: import_wix_ui_icons_common.Youtube,
      tooltip: "YouTubePlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        modals?.togglePluginPanel({
          id: import_constants.VIDEO_INSERT_YOUTUBE_MODAL_ID,
          Component: import_insert_modal.InsertModal,
          componentProps: {
            componentData: { ...import_constants.RICOS_DEFAULTS, type: import_types.videoButtonsTypes.youTube },
            modalId: import_constants.VIDEO_INSERT_YOUTUBE_MODAL_ID,
            ...modalBaseProps
          },
          isMobile,
          positioning: {
            referenceElement,
            placement: "bottom"
          },
          mobileLayout: "drawer"
        });
        return true;
      },
      menuConfig: {
        tags: "YouTube_plugin_search_tags",
        group: "embed"
      }
    }
  };
  return import_lodash.default.compact(exposeButtons.map((buttonType) => buttonsMap[buttonType]));
};
//# sourceMappingURL=get-add-buttons.js.map
