'use strict';

var React = require('react');
var sendbirdSelectors = require('./sendbirdSelectors.js');
var useSendbirdStateContext = require('./useSendbirdStateContext.js');

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

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

let CHANNEL_TYPE = /*#__PURE__*/function (CHANNEL_TYPE) {
  CHANNEL_TYPE["GROUP"] = "group";
  CHANNEL_TYPE["SUPERGROUP"] = "supergroup";
  CHANNEL_TYPE["BROADCAST"] = "broadcast";
  return CHANNEL_TYPE;
}({});

const CreateChannelContext = /*#__PURE__*/React__default["default"].createContext(undefined);
const CreateChannelProvider = props => {
  var _store$config;
  const {
    children,
    onCreateChannel,
    onBeforeCreateChannel,
    overrideInviteUser,
    userListQuery
  } = props;
  const store = useSendbirdStateContext();
  const userListQuery_ = store === null || store === void 0 ? void 0 : (_store$config = store.config) === null || _store$config === void 0 ? void 0 : _store$config.userListQuery;
  const createChannel = sendbirdSelectors.getCreateGroupChannel(store);
  const [step, setStep] = React.useState(0);
  const [type, setType] = React.useState(CHANNEL_TYPE.GROUP);
  return /*#__PURE__*/React__default["default"].createElement(CreateChannelContext.Provider, {
    value: {
      onBeforeCreateChannel,
      createChannel,
      onCreateChannel,
      overrideInviteUser,
      userListQuery: userListQuery || userListQuery_,
      step,
      setStep,
      type,
      setType
    }
  }, children);
};
const useCreateChannelContext = () => React__default["default"].useContext(CreateChannelContext);

exports.CHANNEL_TYPE = CHANNEL_TYPE;
exports.CreateChannelProvider = CreateChannelProvider;
exports.useCreateChannelContext = useCreateChannelContext;
//# sourceMappingURL=CreateChannelProvider-36e598db.js.map
