'use strict';

var _tslib = require('../../chunks/bundle-Conb-pOy.js');
var React = require('react');
var Channel_context = require('../context.js');
var index = require('../../chunks/bundle-fYxs1lss.js');
var utils = require('../../chunks/bundle-B78tdF27.js');
var MessageView = require('../../chunks/bundle-CPoi7VvJ.js');
var Channel_components_FileViewer = require('./FileViewer.js');
var Channel_components_RemoveMessageModal = require('./RemoveMessageModal.js');
var useSendbird = require('../../chunks/bundle-Bq15P9qk.js');
require('@sendbird/uikit-tools');
require('../../chunks/bundle-Bnb8seJF.js');
require('../../chunks/bundle-BLz2EOZ5.js');
require('../../chunks/bundle-CXbYckbN.js');
require('../../chunks/bundle-BbrBawlX.js');
require('../../chunks/bundle-CHAKEXIJ.js');
require('../../chunks/bundle-CVJwHwWn.js');
require('../../chunks/bundle-Cyl6_qLo.js');
require('@sendbird/chat/message');
require('../../chunks/bundle-Dobj18FB.js');
require('../../chunks/bundle-DGb1FlkJ.js');
require('../../chunks/bundle-Cfh78Xnm.js');
require('../../chunks/bundle-CZ38Etcw.js');
require('@sendbird/chat/groupChannel');
require('../../chunks/bundle-t8BQsgL5.js');
require('../../chunks/bundle-C8INNeGk.js');
require('../../chunks/bundle-dUH189qO.js');
require('../../chunks/bundle-BPUhuptz.js');
require('../../chunks/bundle-BLLzQxHS.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-DPDyqKIJ.js');
require('../../chunks/bundle-C6rru8Hj.js');
require('../../chunks/bundle-DAdgL6r8.js');
require('../../chunks/bundle-PVDrKOjZ.js');
require('../../Message/hooks/useDirtyGetMentions.js');
require('../../ui/DateSeparator.js');
require('../../chunks/bundle-DurllD3r.js');
require('../../chunks/bundle-zgmRG2KL.js');
require('../../ui/MessageInput.js');
require('../../chunks/bundle-Bomzwcdt.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../chunks/bundle-VKi81862.js');
require('dompurify');
require('../../chunks/bundle-DHuNGmIj.js');
require('../../chunks/bundle-2PCdBxVA.js');
require('../../chunks/bundle-BkgFGPs_.js');
require('../../ui/Icon.js');
require('../../chunks/bundle-CkQrhwR6.js');
require('../../chunks/bundle-CzkEKbFB.js');
require('../../ui/MessageContent.js');
require('../../chunks/bundle-DO5FgbkI.js');
require('../../ui/Loader.js');
require('../../chunks/bundle-ptQgj0WJ.js');
require('../../chunks/bundle-DQaXgp8o.js');
require('../../chunks/bundle-Y-wq3CF0.js');
require('../../chunks/bundle-DGV1BX0m.js');
require('react-dom');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');
require('../../ui/SortByRow.js');
require('../../chunks/bundle-B19RHFpR.js');
require('../../ui/MessageItemReactionMenu.js');
require('../../ui/ImageRenderer.js');
require('../../ui/ReactionButton.js');
require('../../chunks/bundle-C5p82xwC.js');
require('../../chunks/bundle-Fv6PNPGZ.js');
require('../../ui/EmojiReactions.js');
require('../../ui/ReactionBadge.js');
require('../../ui/BottomSheet.js');
require('../../hooks/useModal.js');
require('../../chunks/bundle-DZlJeh0V.js');
require('../../ui/UserListItem.js');
require('../../chunks/bundle-B7KG10z2.js');
require('../../chunks/bundle-C99t7tzf.js');
require('../../ui/MutedAvatarOverlay.js');
require('../../ui/Checkbox.js');
require('../../ui/UserProfile.js');
require('../../sendbirdSelectors.js');
require('../../ui/Tooltip.js');
require('../../ui/TooltipWrapper.js');
require('../../Message/context.js');
require('../../ui/AdminMessage.js');
require('../../ui/QuoteMessage.js');
require('../../chunks/bundle-D9d0Qum8.js');
require('../../ui/MobileMenu.js');
require('../../ui/ThreadReplies.js');
require('../../chunks/bundle-DYon6O60.js');
require('../../ui/OGMessageItemBody.js');
require('../../chunks/bundle-CX7K4z2J.js');
require('../../ui/MentionLabel.js');
require('../../ui/LinkLabel.js');
require('../../ui/TextMessageItemBody.js');
require('../../ui/FileMessageItemBody.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-KzwW_H6y.js');
require('../../ui/FileViewer.js');
require('../../chunks/bundle-Yq_R9TAN.js');
require('../../ui/VoiceMessageItemBody.js');
require('../../ui/ProgressBar.js');
require('../../VoicePlayer/useVoicePlayer.js');
require('../../chunks/bundle-BHp3N9Mz.js');
require('../../VoiceRecorder/context.js');
require('../../ui/PlaybackTime.js');
require('../../ui/ThumbnailMessageItemBody.js');
require('../../ui/UnknownMessageItemBody.js');
require('../../ui/TemplateMessageItemBody.js');
require('../../chunks/bundle-Bt1qvip8.js');
require('../../ui/FallbackTemplateMessageItemBody.tsx.js');
require('../../ui/LoadingTemplateMessageItemBody.tsx.js');
require('../../ui/MessageFeedbackFailedModal.js');
require('../../ui/FeedbackIconButton.js');
require('../../ui/MobileFeedbackMenu.js');
require('../../ui/MessageFeedbackModal.js');
require('../../ui/Input.js');
require('../../chunks/bundle-BwwNS3QS.js');
require('../../GroupChannel/components/SuggestedReplies.js');
require('../../chunks/bundle-B7tlFbQZ.js');
require('../../chunks/bundle-8juyGk3c.js');
require('../../chunks/bundle-COgAaDxc.js');
require('../../chunks/bundle-B2b-r84m.js');

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

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

/**
 * @deprecated This component is deprecated and will be removed in the next major update.
 * Please use the `GroupChannel` component from '@sendbird/uikit-react/GroupChannel' instead.
 * For more information, please refer to the migration guide:
 * https://docs.sendbird.com/docs/chat/uikit/v3/react/introduction/group-channel-migration-guide
 */
var Message = function (props) {
    var _a, _b;
    var config = useSendbird.useSendbird().state.config;
    var _c = Channel_context.useChannelContext(), initialized = _c.initialized, currentGroupChannel = _c.currentGroupChannel, animatedMessageId = _c.animatedMessageId, setAnimatedMessageId = _c.setAnimatedMessageId, updateMessage = _c.updateMessage, scrollToMessage = _c.scrollToMessage, replyType = _c.replyType, threadReplySelectType = _c.threadReplySelectType, isReactionEnabled = _c.isReactionEnabled, toggleReaction = _c.toggleReaction, emojiContainer = _c.emojiContainer, nicknamesMap = _c.nicknamesMap, setQuoteMessage = _c.setQuoteMessage, resendMessage = _c.resendMessage, deleteMessage = _c.deleteMessage, renderUserMentionItem = _c.renderUserMentionItem, onReplyInThread = _c.onReplyInThread, onQuoteMessageClick = _c.onQuoteMessageClick, onMessageAnimated = _c.onMessageAnimated, sendMessage = _c.sendMessage, localMessages = _c.localMessages, allMessages = _c.allMessages;
    var message = props.message;
    if (!currentGroupChannel)
        return null;
    return (React__default.default.createElement(MessageView.MessageView, _tslib.__assign({}, props, { channel: currentGroupChannel, emojiContainer: emojiContainer, editInputDisabled: !initialized || utils.isDisabledBecauseFrozen(currentGroupChannel) || utils.isDisabledBecauseMuted(currentGroupChannel) || !config.isOnline, shouldRenderSuggestedReplies: ((_a = config === null || config === void 0 ? void 0 : config.groupChannel) === null || _a === void 0 ? void 0 : _a.enableSuggestedReplies)
            && (((_b = config === null || config === void 0 ? void 0 : config.groupChannel) === null || _b === void 0 ? void 0 : _b.showSuggestedRepliesFor) === 'all_messages'
                ? true
                : message.messageId === allMessages[allMessages.length - 1].messageId
            // Use `allMessages[allMessages.length - 1]` instead of `currentGroupChannel.lastMessage`
            // because lastMessage is not updated when **Bot** sends messages
            )
            // the options should appear only when there's no failed or pending messages
            && (localMessages === null || localMessages === void 0 ? void 0 : localMessages.length) === 0
            && index.getSuggestedReplies(message).length > 0, isReactionEnabled: isReactionEnabled, replyType: replyType, threadReplySelectType: threadReplySelectType, nicknamesMap: nicknamesMap, renderUserMentionItem: renderUserMentionItem, scrollToMessage: scrollToMessage, toggleReaction: toggleReaction, setQuoteMessage: setQuoteMessage, onQuoteMessageClick: onQuoteMessageClick, onReplyInThreadClick: onReplyInThread, sendUserMessage: function (params) {
            sendMessage({
                message: params.message,
                mentionedUsers: params.mentionedUsers,
                mentionTemplate: params.mentionedMessageTemplate,
            });
        }, updateUserMessage: function (messageId, params) {
            var _a;
            updateMessage({
                messageId: messageId,
                message: (_a = params.message) !== null && _a !== void 0 ? _a : '',
                mentionedUsers: params.mentionedUsers,
                mentionTemplate: params.mentionedMessageTemplate,
            });
        }, resendMessage: resendMessage, deleteMessage: deleteMessage, animatedMessageId: animatedMessageId, setAnimatedMessageId: setAnimatedMessageId, onMessageAnimated: onMessageAnimated, renderFileViewer: function (props) { return React__default.default.createElement(Channel_components_FileViewer.FileViewer, _tslib.__assign({}, props)); }, renderRemoveMessageModal: function (props) { return React__default.default.createElement(Channel_components_RemoveMessageModal, _tslib.__assign({}, props)); } })));
};

module.exports = Message;
//# sourceMappingURL=Message.js.map
