import React__default from 'react';
import { u as useOpenChannelContext } from '../../OpenChannelProvider-1efcabea.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-8b2036e8.js';
import OpenChannelMessageList from './OpenChannelMessageList.js';
import '../../index-e7f4cbdf.js';
import '../../index-90420b99.js';
import '../../UserProfileContext-a59f0533.js';
import 'prop-types';
import '../../_rollupPluginBabelHelpers-a69fd1ce.js';
import '../../compareIds-aca19765.js';
import '../../topics-247fcf3a.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../uuid-2e8efc75.js';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../LocalizationContext-426f3d58.js';
import '../../stringSet-a62108b2.js';
import '../../ui/MessageInput.js';
import '../../const-ddd9d461.js';
import '../../const-9982664a.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../index-4105bc4d.js';
import 'dompurify';
import '../../consts-15e764c0.js';
import '../../ui/Icon.js';
import '../../index-f83f0aac.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../consts-f99cd0da.js';
import '../../consts-2eeaa3de.js';
import '../../tokenize-eec42500.js';
import '../../index.module-8bb7760e.js';
import '../../ui/Avatar.js';
import '../../ui/ImageRenderer.js';
import '../../MediaQueryContext-b531adc9.js';
import '../../ui/Loader.js';
import '../../index-e40d8b24.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-4bf6e4e6.js';
import '../../utils-8e1b51bf.js';
import '../../index-2528bdee.js';
import '../../useLongPress-c0ba590c.js';
import '../../ui/OpenChannelAdminMessage.js';
import '../../ui/OpenchannelOGMessage.js';
import '../../ui/LinkLabel.js';
import '../../index-89c84c27.js';
import '../../Message/context.js';
import '../../ui/MentionLabel.js';
import '../../ui/OpenchannelThumbnailMessage.js';
import '../../ui/OpenchannelFileMessage.js';
import '../../ui/TextButton.js';
import '../../color-e708f53d.js';
import '../../ui/DateSeparator.js';
import '../../ui/FileViewer.js';
import '../../index-3e548496.js';
import '../../ui/Modal.js';
import '../../index-80b9e974.js';
import '../../consts-e64103c6.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
