"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 toggle_quick_actions_modal_exports = {};
__export(toggle_quick_actions_modal_exports, {
  toggleQuickActionsModal: () => toggleQuickActionsModal
});
module.exports = __toCommonJS(toggle_quick_actions_modal_exports);
var import_modal = require("../modal/modal.js");
var import_types = require("../types.js");
const toggleQuickActionsModal = (props) => {
  const { modalService, referenceElement, supportedPlugins } = props;
  modalService.isModalOpen(import_types.QUICK_ACTIONS_MODAL_ID) ? modalService.closeModal(import_types.QUICK_ACTIONS_MODAL_ID) : modalService.openModal({
    id: import_types.QUICK_ACTIONS_MODAL_ID,
    Component: import_modal.QuickActionsModal,
    componentProps: { supportedPlugins },
    layout: {
      desktop: "floating",
      mobile: "drawer"
    },
    onClickOutside: {
      on: "pointerdown",
      handler: (e) => {
        const isToggleButton = e.target === referenceElement || referenceElement?.contains(e.target);
        if (isToggleButton) {
          return;
        }
        modalService.closeModal(import_types.QUICK_ACTIONS_MODAL_ID);
      }
    },
    positioning: {
      referenceElement,
      placement: props.isMobile ? "bottom" : "bottom-start"
    },
    autoFocus: true,
    type: "exclusive"
  });
};
//# sourceMappingURL=toggle-quick-actions-modal.js.map
