import React__default, { useContext } from 'react';
import Modal from './ui/Modal.js';
import { ButtonTypes } from './ui/Button.js';
import { a as LocalizationContext } from './LocalizationContext-1701e5c8.js';
import { u as useThreadContext } from './ThreadProvider-dea308a0.js';

const RemoveMessage = props => {
  var _message$threadInfo;
  const {
    onCancel,
    onSubmit,
    message
  } = props;
  const {
    stringSet
  } = useContext(LocalizationContext);
  const {
    deleteMessage
  } = useThreadContext();
  return /*#__PURE__*/React__default.createElement(Modal, {
    type: ButtonTypes.DANGER,
    disabled: (message === null || message === void 0 ? void 0 : (_message$threadInfo = message.threadInfo) === null || _message$threadInfo === void 0 ? void 0 : _message$threadInfo.replyCount) > 0,
    onCancel: onCancel,
    onSubmit: () => {
      deleteMessage(message).then(() => {
        onCancel === null || onCancel === void 0 ? void 0 : onCancel();
        onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
      });
    },
    submitText: stringSet.MESSAGE_MENU__DELETE,
    titleText: stringSet.MODAL__DELETE_MESSAGE__TITLE
  });
};

export { RemoveMessage as R };
//# sourceMappingURL=RemoveMessageModal-bf0ab3b2.js.map
