"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 media_item_action_menu_exports = {};
__export(media_item_action_menu_exports, {
  MediaItemActionMenu: () => MediaItemActionMenu
});
module.exports = __toCommonJS(media_item_action_menu_exports);
var import_design_system = require("@wix/design-system");
var import_react = __toESM(require("react"));
var import_ricos_context = require("./../../../../../ricos-context/index.js");
var import_data_hooks = require("../../../../data-hooks.js");
const MediaItemActionMenu = ({
  onSelectAllClick,
  onUnselectAllClick,
  onDeleteClick,
  items,
  onEditClick,
  logBi
}) => {
  const { t } = (0, import_react.useContext)(import_ricos_context.RicosContext);
  const selectedItems = items.filter((item) => item.selected);
  return /* @__PURE__ */ import_react.default.createElement(import_design_system.Box, { maxHeight: "fit-content", align: "space-between", marginBottom: "SP3" }, selectedItems.length === 0 ? /* @__PURE__ */ import_react.default.createElement(
    ItemActionButton,
    {
      key: "selectAllButton",
      dataHook: import_data_hooks.MEDIA_SETTINGS_SELECT_ALL_ITEMS_BUTTON,
      onClick: onSelectAllClick,
      label: t("GallerySettings_Select_All") + ` (${items.length})`,
      logBi
    }
  ) : /* @__PURE__ */ import_react.default.createElement(
    ItemActionButton,
    {
      key: "deselectAllButton",
      dataHook: import_data_hooks.MEDIA_SETTINGS_DESELECT_ALL_ITEMS_BUTTON,
      onClick: onUnselectAllClick,
      label: t("GallerySettings_Deselect") + ` (${selectedItems.length})`,
      logBi
    }
  ), /* @__PURE__ */ import_react.default.createElement(import_design_system.Box, { gap: "SP2" }, selectedItems.length >= 1 && /* @__PURE__ */ import_react.default.createElement(
    ItemActionButton,
    {
      key: "deleteButton",
      dataHook: import_data_hooks.MEDIA_SETTINGS_DELETE_ITEMS_BUTTON,
      onClick: onDeleteClick,
      label: t("GallerySettings_Delete"),
      logBi
    }
  ), selectedItems.length === 1 && /* @__PURE__ */ import_react.default.createElement(
    ItemActionButton,
    {
      key: "itemSettingsButton",
      dataHook: import_data_hooks.MEDIA_SETTINGS_EDIT_ITEM_BUTTON,
      onClick: () => onEditClick(true),
      label: t("GallerySettings_Image_Settings"),
      logBi
    }
  )));
};
const ItemActionButton = ({ label, onClick, dataHook, logBi }) => {
  return /* @__PURE__ */ import_react.default.createElement(
    import_design_system.TextButton,
    {
      "aria-label": label,
      role: "menuitem",
      size: "small",
      onClick: () => {
        logBi({ dataHook });
        onClick();
      },
      dataHook,
      underline: "always"
    },
    label
  );
};
//# sourceMappingURL=media-item-action-menu.js.map
