import React__default from 'react';
import { u as useOpenChannelContext } from '../../chunks/bundle-scS3KeKI.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-U_0F9z8c.js';
import '../../chunks/bundle-0vtSUcHY.js';
import '../../chunks/bundle-TlXrstq8.js';
import '../../chunks/bundle-KwnXXB-s.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../chunks/bundle-brky8TnE.js';
import '../../chunks/bundle-Y0R5tada.js';
import '../../chunks/bundle-TEGbbRiE.js';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../hooks/useModal.js';
import '../../chunks/bundle-9wFvMqxF.js';
import '../../chunks/bundle-4ab6nIKe.js';
import '../../chunks/bundle-92kzAxsw.js';
import 'react-dom';
import '../../chunks/bundle-zOkaSZl3.js';
import '../../chunks/bundle-_NUeDv_m.js';
import '../../chunks/bundle-YOec1wfw.js';
import '../../chunks/bundle-1XQGq5tE.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../chunks/bundle-RzWTDZDo.js';
import '../../ui/Icon.js';
import '../../chunks/bundle-e5lT4U6_.js';
import '../../ui/MessageInput.js';
import '../../chunks/bundle-K3gy6I7U.js';
import '../../chunks/bundle-QUJKjMCy.js';
import '../../chunks/bundle-fNYexgBr.js';
import 'dompurify';
import '../../chunks/bundle-72sPkBu4.js';
import '../../chunks/bundle-5x-SH0ln.js';
import '../../chunks/bundle--M9av9I5.js';
import '../../chunks/bundle-hrqkDKRD.js';
import '@sendbird/chat/groupChannel';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-2xEG_fol.js';
import '../../chunks/bundle-7RyEqo9-.js';
import '../../ui/ImageRenderer.js';
import '../../ui/Loader.js';
import '../../chunks/bundle-BnMLjoeD.js';
import '../../chunks/bundle-IKRolu9P.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-l7rDKrwx.js';
import '../../chunks/bundle-u_1-OZu0.js';
import '../../chunks/bundle-AAE0evYg.js';
import '../../ui/OpenChannelAdminMessage.js';
import '../../ui/OpenchannelOGMessage.js';
import '../../ui/LinkLabel.js';
import '../../chunks/bundle-zqJVlTpN.js';
import '../../Message/context.js';
import '../../ui/MentionLabel.js';
import '../../ui/OpenchannelThumbnailMessage.js';
import '../../ui/OpenchannelFileMessage.js';
import '../../ui/TextButton.js';
import '../../chunks/bundle-3hGhEhNx.js';
import '../../ui/DateSeparator.js';
import '../../chunks/bundle-7gnDs7-N.js';
import '../../chunks/bundle-Npg4qQQD.js';
import '@sendbird/uikit-tools';
import '../../chunks/bundle-ncF5Vx6b.js';
import '../../chunks/bundle-A9vhM7uK.js';
import '../../chunks/bundle-kP3o9aRv.js';
import '../../chunks/bundle-QWYghVSN.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, renderInput = _a.renderInput, renderPlaceHolderEmptyList = _a.renderPlaceHolderEmptyList, renderPlaceHolderError = _a.renderPlaceHolderError, renderPlaceHolderLoading = _a.renderPlaceHolderLoading;
    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 })));
    }
    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 }),
        (renderInput === null || renderInput === void 0 ? void 0 : renderInput()) || (React__default.createElement(OpenChannelInput, { ref: messageInputRef }))));
};

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