'use strict';

var React = require('react');
var OpenChannel_context = require('../../chunks/bundle-zhrtSnPT.js');
var OpenChannel_components_OpenChannelInput = require('./OpenChannelInput.js');
var OpenChannel_components_FrozenChannelNotification = require('./FrozenChannelNotification.js');
var OpenChannel_components_OpenChannelHeader = require('./OpenChannelHeader.js');
var ui_PlaceHolder = require('../../ui/PlaceHolder.js');
var OpenChannel_components_OpenChannelMessageList = require('./OpenChannelMessageList.js');
require('../../chunks/bundle-bOij3dXU.js');
require('../../chunks/bundle-9l41IWgC.js');
require('../../chunks/bundle-uyvcZB8I.js');
require('../../chunks/bundle-1BET8ZYY.js');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');
require('../../chunks/bundle-5zZ25-q8.js');
require('../../chunks/bundle-0Io7rZH6.js');
require('../../chunks/bundle-xbuS1NJI.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../hooks/useModal.js');
require('../../chunks/bundle-SWOq3kxG.js');
require('../../chunks/bundle-BdWL3kB4.js');
require('../../chunks/bundle-Myh0hGtf.js');
require('react-dom');
require('../../chunks/bundle-2dTv415Y.js');
require('../../chunks/bundle-xtUT3duD.js');
require('../../chunks/bundle-qYN98FNj.js');
require('../../chunks/bundle-UOOPIGjG.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../chunks/bundle-5i9-ntZ5.js');
require('../../ui/Icon.js');
require('../../chunks/bundle-qD5w2tyR.js');
require('../../ui/MessageInput.js');
require('../../chunks/bundle-A45IMFSi.js');
require('../../chunks/bundle-wbFvXCMi.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('../../chunks/bundle-Gw-7KmmG.js');
require('@sendbird/chat/groupChannel');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-QvRptclZ.js');
require('../../chunks/bundle-Sxjv83JD.js');
require('../../ui/ImageRenderer.js');
require('../../ui/Loader.js');
require('../../chunks/bundle-VBjH2Gyx.js');
require('../../chunks/bundle-DsdDiOQc.js');
require('./OpenChannelMessage.js');
require('../../ui/OpenchannelUserMessage.js');
require('../../ui/ContextMenu.js');
require('../../ui/SortByRow.js');
require('../../ui/UserProfile.js');
require('../../sendbirdSelectors.js');
require('../../chunks/bundle-tMR11mG8.js');
require('../../chunks/bundle-WALfBkn-.js');
require('../../chunks/bundle-eVmdXbX4.js');
require('../../ui/OpenChannelAdminMessage.js');
require('../../ui/OpenchannelOGMessage.js');
require('../../ui/LinkLabel.js');
require('../../chunks/bundle-_1OqWxYy.js');
require('../../Message/context.js');
require('../../ui/MentionLabel.js');
require('../../ui/OpenchannelThumbnailMessage.js');
require('../../ui/OpenchannelFileMessage.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-yQR_oAnV.js');
require('../../ui/DateSeparator.js');
require('../../chunks/bundle-M7S2ba5_.js');
require('../../chunks/bundle-nvUhM4Jt.js');
require('@sendbird/uikit-tools');
require('../../chunks/bundle-8JrMDacP.js');
require('../../chunks/bundle-0RoC5AKT.js');
require('../../chunks/bundle-aggH3_MP.js');
require('../../chunks/bundle-tBuSzzHI.js');
require('@sendbird/chat/message');
require('../../Channel/utils/compareMessagesForGrouping.js');

var COMPONENT_CLASS_NAME = 'sendbird-openchannel-conversation';
var OpenChannelUI = function (_a) {
    var renderMessage = _a.renderMessage, renderHeader = _a.renderHeader, renderInput = _a.renderInput, renderPlaceHolderEmptyList = _a.renderPlaceHolderEmptyList, renderPlaceHolderError = _a.renderPlaceHolderError, renderPlaceHolderLoading = _a.renderPlaceHolderLoading;
    var _b = OpenChannel_context.useOpenChannelContext(), currentOpenChannel = _b.currentOpenChannel, amIBanned = _b.amIBanned, loading = _b.loading, isInvalid = _b.isInvalid, messageInputRef = _b.messageInputRef, conversationScrollRef = _b.conversationScrollRef;
    if (!currentOpenChannel
        || !(currentOpenChannel === null || currentOpenChannel === void 0 ? void 0 : currentOpenChannel.url)
        || amIBanned) {
        return ((renderPlaceHolderError === null || renderPlaceHolderError === void 0 ? void 0 : renderPlaceHolderError())
            || React.createElement("div", { className: COMPONENT_CLASS_NAME },
                React.createElement(ui_PlaceHolder.default, { type: ui_PlaceHolder.PlaceHolderTypes.NO_CHANNELS })));
    }
    if (loading) {
        return ((renderPlaceHolderLoading === null || renderPlaceHolderLoading === void 0 ? void 0 : renderPlaceHolderLoading())
            || React.createElement("div", { className: COMPONENT_CLASS_NAME },
                React.createElement(ui_PlaceHolder.default, { type: ui_PlaceHolder.PlaceHolderTypes.LOADING })));
    }
    if (isInvalid) {
        return ((renderPlaceHolderError === null || renderPlaceHolderError === void 0 ? void 0 : renderPlaceHolderError())
            || React.createElement("div", { className: COMPONENT_CLASS_NAME },
                React.createElement(ui_PlaceHolder.default, { type: ui_PlaceHolder.PlaceHolderTypes.WRONG })));
    }
    return (React.createElement("div", { className: COMPONENT_CLASS_NAME },
        (renderHeader === null || renderHeader === void 0 ? void 0 : renderHeader()) || (React.createElement(OpenChannel_components_OpenChannelHeader, null)),
        (currentOpenChannel === null || currentOpenChannel === void 0 ? void 0 : currentOpenChannel.isFrozen) && (React.createElement(OpenChannel_components_FrozenChannelNotification, null)),
        React.createElement(OpenChannel_components_OpenChannelMessageList, { ref: conversationScrollRef, renderMessage: renderMessage, renderPlaceHolderEmptyList: renderPlaceHolderEmptyList }),
        (renderInput === null || renderInput === void 0 ? void 0 : renderInput()) || (React.createElement(OpenChannel_components_OpenChannelInput, { ref: messageInputRef }))));
};

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