'use strict';

var React = require('react');
var OpenChannel_context = require('../../chunks/bundle-Dwc89Q_t.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-BmMxoxjN.js');
require('../../chunks/bundle-Dqor5-v9.js');
require('../../chunks/bundle-pG37uJy2.js');
require('../../chunks/bundle-DJNCbN6b.js');
require('@sendbird/uikit-tools');
require('../../withSendbird.js');
require('../../chunks/bundle-dudJtubx.js');
require('../../chunks/bundle-slo-uj1z.js');
require('@sendbird/chat/groupChannel');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-BS4UAC4Z.js');
require('../../chunks/bundle-DRUCFhOE.js');
require('../../chunks/bundle-CXXt3nEF.js');
require('../../chunks/bundle-DXT1Y4Vj.js');
require('react-dom');
require('../../chunks/bundle-CTIC4U7B.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../chunks/bundle-CY_gcwTl.js');
require('../../ui/Icon.js');
require('css-vars-ponyfill');
require('@sendbird/chat');
require('../../chunks/bundle-DIZXTVPY.js');
require('@sendbird/chat/openChannel');
require('../../chunks/bundle-BbgSFL3H.js');
require('../../useSendbirdStateContext.js');
require('../../chunks/bundle-B6pik6Q8.js');
require('../../ui/SortByRow.js');
require('../../chunks/bundle-DCSdwR_f.js');
require('../../chunks/bundle-DCgRyaAA.js');
require('../../chunks/bundle-DCgXy78i.js');
require('../../chunks/bundle-CT-nv6tW.js');
require('../../ui/MessageInput.js');
require('../../chunks/bundle-DpraIGlW.js');
require('../../chunks/bundle-BsNnhtXP.js');
require('../../chunks/bundle-BEl3UJGv.js');
require('dompurify');
require('../../chunks/bundle-CULVYVIF.js');
require('../../chunks/bundle-CmCUchSm.js');
require('../../chunks/bundle-CpIO_wkc.js');
require('../../chunks/bundle-ClfGWuhE.js');
require('../../chunks/bundle-DWCO2Wap.js');
require('../../ui/ImageRenderer.js');
require('../../ui/Loader.js');
require('../../chunks/bundle-BAzcsb-a.js');
require('./OpenChannelMessage.js');
require('../../chunks/bundle-CR--sdNU.js');
require('../../ui/OpenchannelUserMessage.js');
require('../../ui/UserProfile.js');
require('../../sendbirdSelectors.js');
require('../../chunks/bundle-koPwS2m-.js');
require('../../chunks/bundle-D8L2MEo8.js');
require('../../chunks/bundle-BO9j61_n.js');
require('../../ui/OpenChannelAdminMessage.js');
require('../../ui/OpenchannelOGMessage.js');
require('../../ui/LinkLabel.js');
require('../../chunks/bundle-DqM28K5U.js');
require('../../Message/context.js');
require('../../ui/MentionLabel.js');
require('../../ui/OpenchannelThumbnailMessage.js');
require('../../ui/OpenchannelFileMessage.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-Bnhdg5Rm.js');
require('../../ui/DateSeparator.js');
require('../../ui/FileViewer.js');
require('../../chunks/bundle-CaDCOzgc.js');
require('../../chunks/bundle-CAWSUNQl.js');
require('../../chunks/bundle-DNuZ431n.js');
require('../../chunks/bundle-D-MC1CM2.js');
require('../../chunks/bundle-DRHHz9fP.js');
require('@sendbird/chat/message');
require('../../Channel/utils/compareMessagesForGrouping.js');

function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefaultCompat(React);

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 = 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__default.default.createElement("div", { className: COMPONENT_CLASS_NAME },
                React__default.default.createElement(ui_PlaceHolder.default, { type: ui_PlaceHolder.PlaceHolderTypes.NO_CHANNELS })));
    }
    if (loading) {
        return ((renderPlaceHolderLoading === null || renderPlaceHolderLoading === void 0 ? void 0 : renderPlaceHolderLoading())
            || React__default.default.createElement("div", { className: COMPONENT_CLASS_NAME },
                React__default.default.createElement(ui_PlaceHolder.default, { type: ui_PlaceHolder.PlaceHolderTypes.LOADING })));
    }
    if (isInvalid) {
        return ((renderPlaceHolderError === null || renderPlaceHolderError === void 0 ? void 0 : renderPlaceHolderError())
            || React__default.default.createElement("div", { className: COMPONENT_CLASS_NAME },
                React__default.default.createElement(ui_PlaceHolder.default, { type: ui_PlaceHolder.PlaceHolderTypes.WRONG })));
    }
    var renderInputComponent = renderMessageInput || renderInput;
    return (React__default.default.createElement("div", { className: COMPONENT_CLASS_NAME },
        (renderHeader === null || renderHeader === void 0 ? void 0 : renderHeader()) || React__default.default.createElement(OpenChannel_components_OpenChannelHeader, null),
        (currentOpenChannel === null || currentOpenChannel === void 0 ? void 0 : currentOpenChannel.isFrozen) && React__default.default.createElement(OpenChannel_components_FrozenChannelNotification, null),
        React__default.default.createElement(OpenChannel_components_OpenChannelMessageList, { ref: conversationScrollRef, renderMessage: renderMessage, renderPlaceHolderEmptyList: renderPlaceHolderEmptyList }),
        (renderInputComponent === null || renderInputComponent === void 0 ? void 0 : renderInputComponent()) || React__default.default.createElement(OpenChannel_components_OpenChannelInput, { ref: messageInputRef })));
};

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