import React__default from 'react';
import { u as useOpenChannelContext } from '../../chunks/bundle-BZ4wmw9U.js';
import OpenChannelInput from './OpenChannelInput.js';
import FrozenNotification from './FrozenChannelNotification.js';
import OpenchannelConversationHeader from './OpenChannelHeader.js';
import PlaceHolder, { PlaceHolderTypes } from '../../ui/PlaceHolder.js';
import OpenChannelMessageList from './OpenChannelMessageList.js';
import '../../chunks/bundle-BH6pGtIL.js';
import '../../chunks/bundle-CMZSpHeh.js';
import '../../chunks/bundle-BF8Qdge0.js';
import '../../chunks/bundle-DQ2TqmPV.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../chunks/bundle-GCGSXAv2.js';
import '../../chunks/bundle-jpdMhsoB.js';
import '../../chunks/bundle-Bzds2Ucm.js';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../hooks/useModal.js';
import '../../chunks/bundle-DI-PfZ0q.js';
import '../../chunks/bundle-DRN8Ufbc.js';
import '../../chunks/bundle-DYAiU0qn.js';
import 'react-dom';
import '../../chunks/bundle-Aca68v_Z.js';
import '../../chunks/bundle-XCQLW6rR.js';
import '../../chunks/bundle-eddZycld.js';
import '../../chunks/bundle-CAdHlM56.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../chunks/bundle-CIcpyYvw.js';
import '../../ui/Icon.js';
import '../../chunks/bundle-Csv255vx.js';
import '../../ui/MessageInput.js';
import '../../chunks/bundle-B2uB4TXG.js';
import '../../chunks/bundle-DBqo_XXO.js';
import '../../chunks/bundle-CRA9P1Ar.js';
import 'dompurify';
import '../../chunks/bundle-BI7jBgEO.js';
import '../../chunks/bundle-C6a7C-OU.js';
import '../../chunks/bundle-Dorruixf.js';
import '../../chunks/bundle-BdOcjdmg.js';
import '@sendbird/chat/groupChannel';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-CawmTzdt.js';
import '../../chunks/bundle-BlN1UcdM.js';
import '../../ui/ImageRenderer.js';
import '../../ui/Loader.js';
import '../../chunks/bundle-pMKSbn_-.js';
import '../../chunks/bundle-BsoAxhbJ.js';
import './OpenChannelMessage.js';
import '../../ui/OpenchannelUserMessage.js';
import '../../ui/ContextMenu.js';
import '../../ui/SortByRow.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../chunks/bundle-QXkA0r0j.js';
import '../../chunks/bundle-VjnnO2d0.js';
import '../../chunks/bundle-w_-mtnA_.js';
import '../../ui/OpenChannelAdminMessage.js';
import '../../ui/OpenchannelOGMessage.js';
import '../../ui/LinkLabel.js';
import '../../chunks/bundle-4qXDtSKj.js';
import '../../Message/context.js';
import '../../ui/MentionLabel.js';
import '../../ui/OpenchannelThumbnailMessage.js';
import '../../ui/OpenchannelFileMessage.js';
import '../../ui/TextButton.js';
import '../../chunks/bundle-DrCrimot.js';
import '../../ui/DateSeparator.js';
import '../../chunks/bundle-Cyeay9b0.js';
import '../../chunks/bundle-BXieK_Uz.js';
import '@sendbird/uikit-tools';
import '../../chunks/bundle-CrN7EoKs.js';
import '../../chunks/bundle-CBZIpr5d.js';
import '../../chunks/bundle-DehMr9Ib.js';
import '../../chunks/bundle-9-bZdwX6.js';
import '@sendbird/chat/message';
import '../../Channel/utils/compareMessagesForGrouping.js';

var COMPONENT_CLASS_NAME = 'sendbird-openchannel-conversation';
var OpenChannelUI = function (_a) {
    var renderMessage = _a.renderMessage, renderHeader = _a.renderHeader, renderPlaceHolderEmptyList = _a.renderPlaceHolderEmptyList, renderPlaceHolderError = _a.renderPlaceHolderError, renderPlaceHolderLoading = _a.renderPlaceHolderLoading, renderMessageInput = _a.renderMessageInput, renderInput = _a.renderInput;
    var _b = 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__default.createElement("div", { className: COMPONENT_CLASS_NAME },
                React__default.createElement(PlaceHolder, { type: PlaceHolderTypes.NO_CHANNELS })));
    }
    if (loading) {
        return ((renderPlaceHolderLoading === null || renderPlaceHolderLoading === void 0 ? void 0 : renderPlaceHolderLoading())
            || React__default.createElement("div", { className: COMPONENT_CLASS_NAME },
                React__default.createElement(PlaceHolder, { type: PlaceHolderTypes.LOADING })));
    }
    if (isInvalid) {
        return ((renderPlaceHolderError === null || renderPlaceHolderError === void 0 ? void 0 : renderPlaceHolderError())
            || React__default.createElement("div", { className: COMPONENT_CLASS_NAME },
                React__default.createElement(PlaceHolder, { type: PlaceHolderTypes.WRONG })));
    }
    var renderInputComponent = renderMessageInput || renderInput;
    return (React__default.createElement("div", { className: COMPONENT_CLASS_NAME },
        (renderHeader === null || renderHeader === void 0 ? void 0 : renderHeader()) || React__default.createElement(OpenchannelConversationHeader, null),
        (currentOpenChannel === null || currentOpenChannel === void 0 ? void 0 : currentOpenChannel.isFrozen) && React__default.createElement(FrozenNotification, null),
        React__default.createElement(OpenChannelMessageList, { ref: conversationScrollRef, renderMessage: renderMessage, renderPlaceHolderEmptyList: renderPlaceHolderEmptyList }),
        (renderInputComponent === null || renderInputComponent === void 0 ? void 0 : renderInputComponent()) || React__default.createElement(OpenChannelInput, { ref: messageInputRef })));
};

export { OpenChannelUI as default };
//# sourceMappingURL=OpenChannelUI.js.map
