'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _tslib = require('../../chunks/bundle-9l41IWgC.js');
var React = require('react');
var uikitTools = require('@sendbird/uikit-tools');
var useSendbirdStateContext = require('../../useSendbirdStateContext.js');
var index = require('../../chunks/bundle-Gw-7KmmG.js');
var utils = require('../../chunks/bundle-0FJbDLYK.js');
var GroupChannel_context = require('../context.js');
var MessageView = require('../../chunks/bundle-lREr-1Hy.js');
var GroupChannel_components_FileViewer = require('./FileViewer.js');
var GroupChannel_components_RemoveMessageModal = require('./RemoveMessageModal.js');
require('../../withSendbird.js');
require('@sendbird/chat/groupChannel');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-SWOq3kxG.js');
require('@sendbird/chat/message');
require('../../chunks/bundle-bOij3dXU.js');
require('../../chunks/bundle-FYiANS7I.js');
require('../../chunks/bundle-_Hwf9prH.js');
require('../../chunks/bundle-b3QK79hX.js');
require('../../chunks/bundle-qD5w2tyR.js');
require('../../chunks/bundle-tBuSzzHI.js');
require('../../chunks/bundle-aggH3_MP.js');
require('../../chunks/bundle-OypRlCX4.js');
require('../../chunks/bundle-1BET8ZYY.js');
require('../../chunks/bundle-DsdDiOQc.js');
require('../../chunks/bundle-qYN98FNj.js');
require('../../chunks/bundle-2dTv415Y.js');
require('../../chunks/bundle-xtUT3duD.js');
require('../../chunks/bundle-wbFvXCMi.js');
require('../../Message/hooks/useDirtyGetMentions.js');
require('../../ui/DateSeparator.js');
require('../../chunks/bundle-yQR_oAnV.js');
require('../../chunks/bundle-5i9-ntZ5.js');
require('../../ui/MessageInput.js');
require('../../chunks/bundle-A45IMFSi.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../chunks/bundle-rdAhtJum.js');
require('dompurify');
require('../../chunks/bundle-ctM9C4Ol.js');
require('../../chunks/bundle-nNgkSlET.js');
require('../../chunks/bundle-RK7_ZCh1.js');
require('../../ui/Icon.js');
require('../../chunks/bundle-BdWL3kB4.js');
require('../../chunks/bundle-QvRptclZ.js');
require('../../ui/MessageContent.js');
require('../../chunks/bundle-2-AYfw-C.js');
require('../../ui/Loader.js');
require('../../chunks/bundle-pc4CZYj5.js');
require('../../chunks/bundle-VBjH2Gyx.js');
require('../../ui/MessageItemMenu.js');
require('../../ui/ContextMenu.js');
require('react-dom');
require('../../ui/SortByRow.js');
require('../../chunks/bundle-5zZ25-q8.js');
require('../../chunks/bundle-W4lK9aC2.js');
require('../../ui/MessageItemReactionMenu.js');
require('../../ui/ImageRenderer.js');
require('../../ui/ReactionButton.js');
require('../../chunks/bundle-eVmdXbX4.js');
require('../../chunks/bundle-UOOPIGjG.js');
require('../../ui/EmojiReactions.js');
require('../../ui/ReactionBadge.js');
require('../../ui/BottomSheet.js');
require('../../hooks/useModal.js');
require('../../chunks/bundle-Myh0hGtf.js');
require('../../ui/UserListItem.js');
require('../../chunks/bundle-Sxjv83JD.js');
require('../../chunks/bundle-xbuS1NJI.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-EIBGC5ds.js');
require('../../chunks/bundle-RceCnDam.js');
require('../../ui/ThreadReplies.js');
require('../../ui/OGMessageItemBody.js');
require('../../chunks/bundle-_1OqWxYy.js');
require('../../ui/MentionLabel.js');
require('../../ui/LinkLabel.js');
require('../../ui/TextMessageItemBody.js');
require('../../ui/FileMessageItemBody.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-xNnngzve.js');
require('../../chunks/bundle-M7S2ba5_.js');
require('../../chunks/bundle-nvUhM4Jt.js');
require('../../ui/VoiceMessageItemBody.js');
require('../../ui/ProgressBar.js');
require('../../VoicePlayer/useVoicePlayer.js');
require('../../chunks/bundle-xe1wuNko.js');
require('../../VoiceRecorder/context.js');
require('../../ui/PlaybackTime.js');
require('../../ui/ThumbnailMessageItemBody.js');
require('../../ui/UnknownMessageItemBody.js');
require('../../ui/TemplateMessageItemBody.js');
require('../../chunks/bundle-csbD2FCX.js');
require('../../ui/FallbackTemplateMessageItemBody.tsx.js');
require('../../ui/LoadingTemplateMessageItemBody.tsx.js');
require('../../ui/FeedbackIconButton.js');
require('../../ui/MobileFeedbackMenu.js');
require('../../Channel/components/MessageFeedbackModal.js');
require('../../ui/Input.js');
require('./SuggestedReplies.js');
require('../../chunks/bundle-NSfuzonk.js');
require('../../chunks/bundle-zkMvSSgq.js');
require('../../chunks/bundle-xhP3_T1A.js');
require('../../chunks/bundle-8JrMDacP.js');

var Message = function (props) {
    var _a = useSendbirdStateContext.useSendbirdStateContext(), config = _a.config, emojiManager = _a.emojiManager;
    var _b = GroupChannel_context.useGroupChannelContext(), loading = _b.loading, currentChannel = _b.currentChannel, animatedMessageId = _b.animatedMessageId, setAnimatedMessageId = _b.setAnimatedMessageId, scrollToMessage = _b.scrollToMessage, replyType = _b.replyType, threadReplySelectType = _b.threadReplySelectType, isReactionEnabled = _b.isReactionEnabled, toggleReaction = _b.toggleReaction, nicknamesMap = _b.nicknamesMap, setQuoteMessage = _b.setQuoteMessage, renderUserMentionItem = _b.renderUserMentionItem, onQuoteMessageClick = _b.onQuoteMessageClick, onReplyInThreadClick = _b.onReplyInThreadClick, onMessageAnimated = _b.onMessageAnimated, messages = _b.messages, updateUserMessage = _b.updateUserMessage, sendUserMessage = _b.sendUserMessage, resendMessage = _b.resendMessage, deleteMessage = _b.deleteMessage;
    var message = props.message;
    var initialized = !loading && Boolean(currentChannel);
    var groupChannelConfig = config === null || config === void 0 ? void 0 : config.groupChannel;
    var shouldRenderSuggestedReplies = uikitTools.useIIFE(function () {
        var _a;
        if (!groupChannelConfig)
            return false;
        var enableSuggestedReplies = groupChannelConfig.enableSuggestedReplies, showSuggestedRepliesFor = groupChannelConfig.showSuggestedRepliesFor;
        if (!enableSuggestedReplies)
            return false;
        if ((!showSuggestedRepliesFor || showSuggestedRepliesFor === 'last_message_only')
            && message.messageId === ((_a = currentChannel === null || currentChannel === void 0 ? void 0 : currentChannel.lastMessage) === null || _a === void 0 ? void 0 : _a.messageId))
            return false;
        if (index.getSuggestedReplies(message).length === 0)
            return false;
        var lastMessage = messages[messages.length - 1];
        if (lastMessage && index.isSendableMessage(lastMessage) && lastMessage.sendingStatus !== 'succeeded')
            return false;
        return true;
    });
    return (React.createElement(MessageView.MessageView, _tslib.__assign({}, props, { channel: currentChannel, emojiContainer: emojiManager.emojiContainer, editInputDisabled: !initialized || utils.isDisabledBecauseFrozen(currentChannel) || utils.isDisabledBecauseMuted(currentChannel) || !config.isOnline, shouldRenderSuggestedReplies: shouldRenderSuggestedReplies, isReactionEnabled: isReactionEnabled, replyType: replyType, threadReplySelectType: threadReplySelectType, nicknamesMap: nicknamesMap, renderUserMentionItem: renderUserMentionItem, scrollToMessage: scrollToMessage, toggleReaction: toggleReaction, setQuoteMessage: setQuoteMessage, onQuoteMessageClick: onQuoteMessageClick, onReplyInThreadClick: onReplyInThreadClick, sendUserMessage: sendUserMessage, updateUserMessage: updateUserMessage, resendMessage: resendMessage, deleteMessage: deleteMessage, animatedMessageId: animatedMessageId, setAnimatedMessageId: setAnimatedMessageId, onMessageAnimated: onMessageAnimated, renderFileViewer: function (props) { return React.createElement(GroupChannel_components_FileViewer.FileViewer, _tslib.__assign({}, props)); }, renderRemoveMessageModal: function (props) { return React.createElement(GroupChannel_components_RemoveMessageModal.RemoveMessageModal, _tslib.__assign({}, props)); } })));
};

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