'use strict';

var React = require('react');
var OpenChannel_context = require('../../chunks/bundle-pp7tp7GG.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-TPy0gj60.js');
require('../../chunks/bundle-DhtZdKsr.js');
require('../../chunks/bundle-NZvAE9FS.js');
require('../../chunks/bundle-77qvrXp8.js');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');
require('../../chunks/bundle-TB_UEIPg.js');
require('../../chunks/bundle-PSEoX-EH.js');
require('../../chunks/bundle-HQAiUNev.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../hooks/useModal.js');
require('../../chunks/bundle-xM2DAzE6.js');
require('../../chunks/bundle-Y-_KhZFq.js');
require('../../chunks/bundle-6L4HCLmb.js');
require('react-dom');
require('../../chunks/bundle-6SzyBwQ5.js');
require('../../chunks/bundle-H9rcn1PJ.js');
require('../../chunks/bundle-AN4eZ2xs.js');
require('../../chunks/bundle-6zBNmPOP.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../chunks/bundle-VxcYXhwp.js');
require('../../ui/Icon.js');
require('../../chunks/bundle-UAspU0bH.js');
require('../../ui/MessageInput.js');
require('../../chunks/bundle--tki3Ejh.js');
require('../../chunks/bundle-MNUU2JEo.js');
require('../../chunks/bundle-t2GWOYzL.js');
require('dompurify');
require('../../chunks/bundle-nYBtJl9e.js');
require('../../chunks/bundle-RUqSDidW.js');
require('../../chunks/bundle-0zagc7hR.js');
require('../../chunks/bundle-nox41MG6.js');
require('@sendbird/chat/groupChannel');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-haAptps1.js');
require('../../chunks/bundle-w0ATt2gt.js');
require('../../ui/ImageRenderer.js');
require('../../ui/Loader.js');
require('../../chunks/bundle-RquYsY0d.js');
require('../../chunks/bundle-tntEm-Mv.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-1dcvUZjP.js');
require('../../chunks/bundle-ekyeVpZG.js');
require('../../chunks/bundle-2hJhRu5W.js');
require('../../ui/OpenChannelAdminMessage.js');
require('../../ui/OpenchannelOGMessage.js');
require('../../ui/LinkLabel.js');
require('../../chunks/bundle-3_XFLnnt.js');
require('../../Message/context.js');
require('../../ui/MentionLabel.js');
require('../../ui/OpenchannelThumbnailMessage.js');
require('../../ui/OpenchannelFileMessage.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-vMF9NM5u.js');
require('../../ui/DateSeparator.js');
require('../../chunks/bundle-NPzNlnHJ.js');
require('../../chunks/bundle-zDh-X-Q4.js');
require('@sendbird/uikit-tools');
require('../../chunks/bundle-wZDX1pVR.js');
require('../../chunks/bundle-OdZXNc-g.js');
require('../../chunks/bundle-Njt4gDEW.js');
require('../../chunks/bundle-CrbMqpah.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
