"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_insert_modal = require("./modals/insert-modal.js");
const toolbarsToAddIn = [
  import_editor_common.TOOLBARS.FOOTER,
  import_editor_common.TOOLBARS.SIDE,
  import_editor_common.TOOLBARS.MOBILE
];
const getAddButtons = (config, services) => {
  const { exposeEmbedButtons = [], fetchData } = config || {};
  const {
    modals,
    context: { isMobile }
  } = services;
  const toggleInsertModal = ({
    id,
    socialType,
    referenceElement
  }) => {
    modals?.togglePluginPanel({
      id,
      Component: import_insert_modal.InsertModal,
      componentProps: {
        fetchData,
        socialType
      },
      isMobile,
      positioning: {
        referenceElement,
        placement: "bottom"
      },
      mobileLayout: "drawer"
    });
  };
  const buttonsMap = {
    Instagram: {
      id: `${import_ricos_types.Node_Type.LINK_PREVIEW}.instagram`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.INSTAGRAM,
      dataHook: import_data_hooks.INSERT_INSTAGRAM_BUTTON,
      icon: import_wix_ui_icons_common.Instagram,
      tooltip: "InstagramPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_consts.socialModals.instagram,
          socialType: "Instagram",
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "Instagram_plugin_search_tags",
        group: "embed"
      }
    },
    Twitter: {
      id: `${import_ricos_types.Node_Type.LINK_PREVIEW}.twitter`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.TWITTER,
      dataHook: import_data_hooks.INSERT_TWITTER_BUTTON,
      icon: import_wix_ui_icons_common.XCorp,
      tooltip: "TwitterPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_consts.socialModals.twitter,
          socialType: "Twitter",
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "YouTube_plugin_search_tags",
        group: "embed"
      }
    },
    Pinterest: {
      id: `${import_ricos_types.Node_Type.LINK_PREVIEW}.pinterest`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.PINTEREST,
      dataHook: import_data_hooks.INSERT_PINTEREST_BUTTON,
      icon: import_wix_ui_icons_common.Pinterest,
      tooltip: "PinterestPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_consts.socialModals.pinterest,
          socialType: "Pinterest",
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "Pinterestsearch_tags",
        group: "embed"
      }
    },
    Facebook: {
      id: `${import_ricos_types.Node_Type.LINK_PREVIEW}.facebook`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.FACEBOOK,
      dataHook: import_data_hooks.INSERT_FACEBOOK_BUTTON,
      icon: import_wix_ui_icons_common.Facebook,
      tooltip: "FacebookPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_consts.socialModals.facebook,
          socialType: "Facebook",
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "Facebook_plugin_search_tags",
        group: "embed"
      }
    },
    TikTok: {
      id: `${import_ricos_types.Node_Type.LINK_PREVIEW}.tiktok`,
      label: import_editor_common.INSERT_PLUGIN_BUTTONS.TIKTOK,
      dataHook: import_data_hooks.INSERT_TIKTOK_BUTTON,
      icon: import_wix_ui_icons_common.TikTok,
      tooltip: "TikTokPlugin_InsertButton_Tooltip",
      toolbars: toolbarsToAddIn,
      command: ({ referenceElement }) => {
        toggleInsertModal({
          id: import_consts.socialModals.tiktok,
          socialType: "TikTok",
          referenceElement
        });
        return true;
      },
      menuConfig: {
        tags: "YouTube_plugin_search_tags",
        group: "embed"
      }
    }
  };
  return import_lodash.default.compact(exposeEmbedButtons.map((buttonType) => buttonsMap[buttonType]));
};
//# sourceMappingURL=get-add-buttons.js.map
