'use strict';

var React = require('react');
var OpenChannel_context = require('../../chunks/bundle-2u-XbJ1o.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-DUlN8JG0.js');
require('../../chunks/bundle-Dwj4MFbu.js');
require('../../chunks/bundle-CNo3XvY2.js');
require('../../chunks/bundle-DBUexy6W.js');
require('@sendbird/uikit-tools');
require('../../withSendbird.js');
require('../../chunks/bundle-28_kUN83.js');
require('../../chunks/bundle-Dsga0STu.js');
require('@sendbird/chat/groupChannel');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-CNOy0SKq.js');
require('../../chunks/bundle-CpC9YeBR.js');
require('../../chunks/bundle-fHhNYi5k.js');
require('../../chunks/bundle-7F-J6w2L.js');
require('react-dom');
require('../../chunks/bundle-D027Tr-j.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../chunks/bundle-q_NwnODB.js');
require('../../ui/Icon.js');
require('css-vars-ponyfill');
require('@sendbird/chat');
require('../../chunks/bundle-D_L8wtf_.js');
require('@sendbird/chat/openChannel');
require('../../chunks/bundle-V5e7Iz-M.js');
require('../../useSendbirdStateContext.js');
require('../../chunks/bundle-DsDVN_6R.js');
require('../../ui/SortByRow.js');
require('../../chunks/bundle-uYwxiwiJ.js');
require('../../chunks/bundle-WAp-MTVO.js');
require('../../chunks/bundle-PY0nrU1R.js');
require('../../chunks/bundle-DYd16-N-.js');
require('../../ui/MessageInput.js');
require('../../chunks/bundle-CTDM43-k.js');
require('../../chunks/bundle-CfwVjrki.js');
require('../../chunks/bundle-BdcIzrzX.js');
require('dompurify');
require('../../chunks/bundle-CGQPCPQH.js');
require('../../chunks/bundle-UNETZ57a.js');
require('../../chunks/bundle-Dy478tIp.js');
require('../../chunks/bundle-SpBht3pR.js');
require('../../chunks/bundle-BLMOFXug.js');
require('../../ui/ImageRenderer.js');
require('../../ui/Loader.js');
require('../../chunks/bundle-DfHbVMlf.js');
require('./OpenChannelMessage.js');
require('../../chunks/bundle-BOCMTfPs.js');
require('../../ui/OpenchannelUserMessage.js');
require('../../ui/UserProfile.js');
require('../../sendbirdSelectors.js');
require('../../chunks/bundle-Dx3JU8Wx.js');
require('../../chunks/bundle-FhyLRF9q.js');
require('../../chunks/bundle-5TSvGYIo.js');
require('../../ui/OpenChannelAdminMessage.js');
require('../../ui/OpenchannelOGMessage.js');
require('../../ui/LinkLabel.js');
require('../../chunks/bundle-DraJ_wBk.js');
require('../../Message/context.js');
require('../../ui/MentionLabel.js');
require('../../ui/OpenchannelThumbnailMessage.js');
require('../../ui/OpenchannelFileMessage.js');
require('../../ui/TextButton.js');
require('../../chunks/bundle-IoTRqH9_.js');
require('../../ui/DateSeparator.js');
require('../../ui/FileViewer.js');
require('../../chunks/bundle-DFxc2FDf.js');
require('../../chunks/bundle-DbLH7rSK.js');
require('../../chunks/bundle-CEq2SLvK.js');
require('../../chunks/bundle-hT5koe7z.js');
require('../../chunks/bundle-ClrDxDE5.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
