import React__default from 'react';
import { u as useOpenChannelContext } from '../../OpenChannelProvider-d0f0bf3a.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-49ff1ed1.js';
import OpenChannelMessageList from './OpenChannelMessageList.js';
import '../../index-2dc53ac2.js';
import '../../index-67135027.js';
import '../../UserProfileContext-d5787c95.js';
import 'prop-types';
import '../../_rollupPluginBabelHelpers-4f8ebde4.js';
import '../../compareIds-7800035f.js';
import '../../topics-f3629ea0.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../uuid-a79b5ba8.js';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../LocalizationContext-b2390bf8.js';
import '../../stringSet-eefbc798.js';
import '../../ui/MessageInput.js';
import '../../const-922f4cc5.js';
import '../../const-97fac210.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../index-4372fcec.js';
import 'dompurify';
import '../../consts-8ce876a0.js';
import '../../ui/Icon.js';
import '../../index-eefb44ba.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../consts-e3e03145.js';
import '../../consts-cdccf171.js';
import '../../tokenize-b97bc343.js';
import '../../index.module-2885df8c.js';
import '../../ui/Avatar.js';
import '../../ui/ImageRenderer.js';
import '../../MediaQueryContext-b4904a2e.js';
import '../../ui/Loader.js';
import '../../index-39306dfb.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-b53fe532.js';
import '../../utils-3b418b35.js';
import '../../index-1fefb8e6.js';
import '../../useLongPress-cb2d23be.js';
import '../../ui/OpenChannelAdminMessage.js';
import '../../ui/OpenchannelOGMessage.js';
import '../../ui/LinkLabel.js';
import '../../index-8aa7880e.js';
import '../../Message/context.js';
import '../../ui/MentionLabel.js';
import '../../ui/OpenchannelThumbnailMessage.js';
import '../../ui/OpenchannelFileMessage.js';
import '../../ui/TextButton.js';
import '../../color-9519a526.js';
import '../../ui/DateSeparator.js';
import '../../ui/FileViewer.js';
import '../../index-896545a0.js';
import '../../ui/Modal.js';
import '../../index-28ad85ee.js';
import '../../consts-33537265.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
