"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_consts = require("./consts.js");
var import_data_hooks = require("./data-hooks.js");
var import_defaults = require("./defaults.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 { exposeButtons = [import_types.audioButtonsTypes.audio], disableDownload = true } = config || {};
  const {
    modals,
    context: { isMobile }
  } = services;
  const toggleInsertModal = ({
    referenceElement,
    id,
    embedType
  }) => {
    modals?.togglePluginPanel({
      id,
      Component: import_insert_modal.InsertModal,
      componentProps: {
        componentData: { ...import_defaults.RICOS_DEFAULTS, disableDownload },
        modalId: id,
        embedType
      },
      isMobile,
      positioning: {
        referenceElement,
        placement: "bottom"
      },
      mobileLayout: "drawer"
    });
  };
  const buttonsMap = {
    [import_types.audioButtonsTypes.audio]: {
      id: `${import_ricos_types.Node_Type.AUDIO}.audio`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.AUDIO,
      dataHook: import_data_hooks.INSERT_AUDIO_BUTTON,
      icon: import_wix_ui_icons_common.Sound,
      tooltip: "AudioPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_consts.AUDIO_INSERT_AUDIO_MODAL_ID,
          embedType: false,
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "Audio_plugin_search_tags"
      }
    },
    [import_types.audioButtonsTypes.soundCloud]: {
      id: `${import_ricos_types.Node_Type.AUDIO}.soundCloud`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.SOUND_CLOUD,
      dataHook: import_data_hooks.INSERT_SOUNDCLOUD_BUTTON,
      icon: import_wix_ui_icons_common.SoundCloud,
      tooltip: "SoundCloudPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_consts.AUDIO_INSERT_SOUNDCLOUD_MODAL_ID,
          embedType: true,
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "SoundCloud_plugin_search_tags",
        group: "embed"
      }
    },
    [import_types.audioButtonsTypes.spotify]: {
      id: `${import_ricos_types.Node_Type.AUDIO}.spotify`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.SPOTIFY,
      dataHook: import_data_hooks.INSERT_SPOTIFY_BUTTON,
      icon: import_wix_ui_icons_common.Spotify,
      tooltip: "Spotify_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_consts.AUDIO_INSERT_SPOTIFY_MODAL_ID,
          embedType: true,
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "AudioPlugin_InsertButton",
        group: "embed"
      }
    }
  };
  return import_lodash.default.compact(exposeButtons.map((buttonType) => buttonsMap[buttonType]));
};
//# sourceMappingURL=get-add-buttons.js.map
