import React__default from 'react';
import { u as useOpenChannelContext } from '../../OpenChannelProvider-995a7397.js';
import OpenChannelInput from './OpenChannelInput.js';
import FrozenNotification from './FrozenChannelNotification.js';
import OpenchannelConversationHeader from './OpenChannelHeader.js';
import { P as PlaceHolder, a as PlaceHolderTypes } from '../../index-11fe17e1.js';
import OpenChannelMessageList from './OpenChannelMessageList.js';
import '../../index-5a62f6b7.js';
import '../../index-ff8f2f61.js';
import '../../UserProfileContext-74e9a128.js';
import 'prop-types';
import '../../_rollupPluginBabelHelpers-cc035350.js';
import '../../compareIds-367bb030.js';
import '../../topics-0b30f52b.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../uuid-8b344dd2.js';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../LocalizationContext-1701e5c8.js';
import '../../stringSet-e9bb0333.js';
import '../../ui/MessageInput.js';
import '../../const-2e67461b.js';
import '../../const-7c266a95.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../index-f50d7ab0.js';
import 'dompurify';
import '../../consts-a0834b70.js';
import '../../ui/Icon.js';
import '../../index-99ab01f6.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../consts-3a33a0a8.js';
import '../../consts-b3274b3d.js';
import '../../tokenize-d12690c3.js';
import '../../index.module-d24badee.js';
import '../../ui/Avatar.js';
import '../../ui/ImageRenderer.js';
import '../../MediaQueryContext-e5b401d0.js';
import '../../ui/Loader.js';
import '../../index-3f8e1a51.js';
import './OpenChannelMessage.js';
import '../../ui/OpenchannelUserMessage.js';
import '../../ui/ContextMenu.js';
import 'react-dom';
import '../../ui/SortByRow.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../utils-05aa9060.js';
import '../../utils-a59107a2.js';
import '../../index-e30c58e0.js';
import '../../useLongPress-6d0b6619.js';
import '../../ui/OpenChannelAdminMessage.js';
import '../../ui/OpenchannelOGMessage.js';
import '../../ui/LinkLabel.js';
import '../../index-a31ee68d.js';
import '../../Message/context.js';
import '../../ui/MentionLabel.js';
import '../../ui/OpenchannelThumbnailMessage.js';
import '../../ui/OpenchannelFileMessage.js';
import '../../ui/TextButton.js';
import '../../color-ea3bf5b8.js';
import '../../ui/DateSeparator.js';
import '../../ui/FileViewer.js';
import '../../index-44c86e58.js';
import '../../ui/Modal.js';
import '../../index-3461216d.js';
import '../../consts-44eaef6b.js';

const COMPONENT_CLASS_NAME = 'sendbird-openchannel-conversation';
const OpenChannelUI = _ref => {
  let {
    renderMessage,
    renderHeader,
    renderInput,
    renderPlaceHolderEmptyList,
    renderPlaceHolderError,
    renderPlaceHolderLoading
  } = _ref;
  const {
    currentOpenChannel,
    amIBanned,
    loading,
    isInvalid,
    messageInputRef,
    conversationScrollRef
  } = useOpenChannelContext();
  if (!currentOpenChannel || !(currentOpenChannel !== null && currentOpenChannel !== void 0 && currentOpenChannel.url) || amIBanned) {
    return (renderPlaceHolderError === null || renderPlaceHolderError === void 0 ? void 0 : renderPlaceHolderError()) || /*#__PURE__*/React__default.createElement("div", {
      className: COMPONENT_CLASS_NAME
    }, /*#__PURE__*/React__default.createElement(PlaceHolder, {
      type: PlaceHolderTypes.NO_CHANNELS
    }));
  }
  if (loading) {
    return (renderPlaceHolderLoading === null || renderPlaceHolderLoading === void 0 ? void 0 : renderPlaceHolderLoading()) || /*#__PURE__*/React__default.createElement("div", {
      className: COMPONENT_CLASS_NAME
    }, /*#__PURE__*/React__default.createElement(PlaceHolder, {
      type: PlaceHolderTypes.LOADING
    }));
  }
  if (isInvalid) {
    return (renderPlaceHolderError === null || renderPlaceHolderError === void 0 ? void 0 : renderPlaceHolderError()) || /*#__PURE__*/React__default.createElement("div", {
      className: COMPONENT_CLASS_NAME
    }, /*#__PURE__*/React__default.createElement(PlaceHolder, {
      type: PlaceHolderTypes.WRONG
    }));
  }
  return /*#__PURE__*/React__default.createElement("div", {
    className: COMPONENT_CLASS_NAME
  }, (renderHeader === null || renderHeader === void 0 ? void 0 : renderHeader()) || /*#__PURE__*/React__default.createElement(OpenchannelConversationHeader, null), (currentOpenChannel === null || currentOpenChannel === void 0 ? void 0 : currentOpenChannel.isFrozen) && /*#__PURE__*/React__default.createElement(FrozenNotification, null), /*#__PURE__*/React__default.createElement(OpenChannelMessageList, {
    ref: conversationScrollRef,
    renderMessage: renderMessage,
    renderPlaceHolderEmptyList: renderPlaceHolderEmptyList
  }), (renderInput === null || renderInput === void 0 ? void 0 : renderInput()) || /*#__PURE__*/React__default.createElement(OpenChannelInput, {
    ref: messageInputRef
  }));
};

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