import React__default, { useContext } from 'react';
import Modal from './ui/Modal.js';
import { ButtonTypes } from './ui/Button.js';
import { a as LocalizationContext } from './LocalizationContext-426f3d58.js';
import { u as useThreadContext } from './ThreadProvider-7f67575f.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-3d9ef84c.js.map
