'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');

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

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

// todo@v4.0.0: combine with the provider in core-ts, see:
const MessageContext = /*#__PURE__*/React__default["default"].createContext(undefined);
const MessageProvider = props => {
  const {
    children,
    message,
    isByMe = false
  } = props;
  return /*#__PURE__*/React__default["default"].createElement(MessageContext.Provider, {
    value: {
      message,
      isByMe
    }
  }, children);
};
const useMessageContext = () => {
  const value = React__default["default"].useContext(MessageContext);
  if (value === undefined) {
    throw new Error('useMessageContext must be used within a MessageProvider');
  }
  return value;
};

exports.MessageProvider = MessageProvider;
exports.useMessageContext = useMessageContext;
//# sourceMappingURL=context.js.map
