'use strict';

var React = require('react');
var LocalizationContext = require('../../LocalizationContext-6adf6aa8.js');
var ui_MessageInput = require('../../ui/MessageInput.js');
var OpenChannel_context = require('../../OpenChannelProvider-966adafd.js');
require('../../stringSet-5157206d.js');
require('../../index-6a7f94de.js');
require('../../_rollupPluginBabelHelpers-ea66c137.js');
require('prop-types');
require('../../const-d9157ccd.js');
require('../../const-f6c8086e.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../index-bff918b2.js');
require('dompurify');
require('../../consts-c7178b6e.js');
require('../../ui/Icon.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../index-86e680cb.js');
require('../../utils/message/getOutgoingMessageState.js');
require('../../consts-bac93d6f.js');
require('../../consts-3a74400a.js');
require('../../tokenize-bc5f4e11.js');
require('../../index.module-15d2b97f.js');
require('../../index-358554d2.js');
require('../../UserProfileContext-2ff8462c.js');
require('../../compareIds-7b0e4960.js');
require('../../topics-2fe6fef6.js');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');
require('../../uuid-f1d9be11.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

const MessageInputWrapper = (props, ref) => {
  const {
    currentOpenChannel,
    disabled,
    handleSendMessage,
    handleFileUpload,
    amIMuted
  } = OpenChannel_context.useOpenChannelContext();
  const channel = currentOpenChannel;
  const {
    stringSet
  } = React.useContext(LocalizationContext.LocalizationContext);
  const {
    value
  } = props;
  function getPlaceHolderString() {
    if (amIMuted) {
      return stringSet.MESSAGE_INPUT__PLACE_HOLDER__MUTED;
    }
    if (disabled) {
      return stringSet.MESSAGE_INPUT__PLACE_HOLDER__DISABLED;
    }
    return '';
  }
  if (!channel) {
    return null;
  }
  return /*#__PURE__*/React__default["default"].createElement("div", {
    className: "sendbird-openchannel-footer"
  }, /*#__PURE__*/React__default["default"].createElement(ui_MessageInput, {
    channel: currentOpenChannel,
    ref: ref,
    value: value,
    disabled: disabled,
    isVoiceMessageEnabled: false,
    onSendMessage: handleSendMessage,
    onFileUpload: handleFileUpload,
    placeholder: getPlaceHolderString()
  }));
};
var OpenChannelInput = /*#__PURE__*/React__default["default"].forwardRef(MessageInputWrapper);

module.exports = OpenChannelInput;
//# sourceMappingURL=OpenChannelInput.js.map
