import React__default from 'react';
import { u as useOpenChannelContext } from '../../OpenChannelProvider-b634e564.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-0f22e96e.js';
import OpenChannelMessageList from './OpenChannelMessageList.js';
import '../../index-f1701c11.js';
import '../../index-865112db.js';
import '../../UserProfileContext-29074346.js';
import 'prop-types';
import '../../_rollupPluginBabelHelpers-0bc76382.js';
import '../../compareIds-bc881fe7.js';
import '../../topics-5ff88d6f.js';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../uuid-1f1bbd9c.js';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../LocalizationContext-57b46f6c.js';
import '../../stringSet-7a8ce1ce.js';
import '../../ui/MessageInput.js';
import '../../const-8daee9fc.js';
import '../../const-e51dda0c.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../index-4023d1b2.js';
import 'dompurify';
import '../../consts-d0b365df.js';
import '../../ui/Icon.js';
import '../../index-e2601165.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../consts-d0cfee49.js';
import '../../consts-7aab5aff.js';
import '../../tokenize-003bf3f7.js';
import '../../ui/Avatar.js';
import '../../ui/ImageRenderer.js';
import '../../MediaQueryContext-fbe7af77.js';
import '../../ui/Loader.js';
import '../../index-37531f98.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-388a790e.js';
import '../../utils-0d88f863.js';
import '../../index-fa37119a.js';
import '../../useLongPress-fbab35a9.js';
import '../../ui/OpenChannelAdminMessage.js';
import '../../ui/OpenchannelOGMessage.js';
import '../../ui/LinkLabel.js';
import '../../index-5141f766.js';
import '../../index.module-9202ebbd.js';
import '../../Message/context.js';
import '../../ui/MentionLabel.js';
import '../../ui/OpenchannelThumbnailMessage.js';
import '../../ui/OpenchannelFileMessage.js';
import '../../ui/TextButton.js';
import '../../color-2ed716e6.js';
import '../../ui/DateSeparator.js';
import '../../ui/FileViewer.js';
import '../../index-7bff4ce0.js';
import '../../ui/Modal.js';
import '../../index-3f1fa3f9.js';
import '../../consts-3c0ff1ed.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
