'use strict';

var React = require('react');
var ui_Modal = require('../../ui/Modal.js');
var ui_Button = require('../../ui/Button.js');
var LocalizationContext = require('../../LocalizationContext-9eda9144.js');
var Channel_context = require('../../ChannelProvider-223c2c69.js');
require('react-dom');
require('../../index-61e3f022.js');
require('../../ui/Icon.js');
require('prop-types');
require('../../ui/IconButton.js');
require('../../_rollupPluginBabelHelpers-09eba4f3.js');
require('../../index-4efb56bf.js');
require('../../stringSet-85aa5de9.js');
require('../../MediaQueryContext-d15578f3.js');
require('../../index-3a0cfa58.js');
require('../../UserProfileContext-3a37e911.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../const-85f621b6.js');
require('../../index-0ffaa79b.js');
require('../../topics-b3f004b2.js');
require('../../index-cf37de8c.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../compareIds-c82fb274.js');
require('@sendbird/chat/groupChannel');
require('../../uuid-f2b80298.js');
require('@sendbird/chat/message');
require('../../consts-eef8003b.js');
require('../../resolvedReplyType-9fb459d1.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

const RemoveMessage = props => {
  var _message$threadInfo;
  const {
    onSubmit = () => {/* noop */},
    onCancel,
    message
  } = props;
  const {
    stringSet
  } = React.useContext(LocalizationContext.LocalizationContext);
  const {
    deleteMessage
  } = Channel_context.useChannelContext();
  return /*#__PURE__*/React__default["default"].createElement(ui_Modal["default"], {
    type: ui_Button.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(() => {
        onSubmit();
        onCancel();
      });
    },
    submitText: stringSet.MESSAGE_MENU__DELETE,
    titleText: stringSet.MODAL__DELETE_MESSAGE__TITLE
  });
};

module.exports = RemoveMessage;
//# sourceMappingURL=RemoveMessageModal.js.map
