'use strict';

var React = require('react');
var ui_Modal = require('../../ui/Modal.js');
var ui_Button = require('../../ui/Button.js');
var LocalizationContext = require('../../LocalizationContext-af96cf5f.js');
var Channel_context = require('../../ChannelProvider-620bb354.js');
require('react-dom');
require('../../index-68c57136.js');
require('../../ui/Icon.js');
require('prop-types');
require('../../ui/IconButton.js');
require('../../_rollupPluginBabelHelpers-c5955c81.js');
require('../../index-73643285.js');
require('../../stringSet-68748705.js');
require('../../MediaQueryContext-8ec3f647.js');
require('../../index-83d1d15e.js');
require('../../UserProfileContext-f068b0ba.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../index-f65677b1.js');
require('../../topics-825e5d42.js');
require('../../index-f2146bae.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../compareIds-18b3b1d6.js');
require('../../const-6691e574.js');
require('@sendbird/chat/groupChannel');
require('../../uuid-0b4ed44c.js');
require('@sendbird/chat/message');
require('../../ui/ContextMenu.js');
require('../../ui/SortByRow.js');
require('../../ui/ReactionButton.js');
require('../../ui/ImageRenderer.js');
require('../../consts-a5382bc1.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
