define(['exports', 'react', 'hoist-non-react-statics', 'react-redux', 'invariant', 'lodash', './TopicsListComponent-d0f74d18', 'styled-components'], function (exports, React, hoistNonReactStatics, reactRedux, invariant, lodash, TopicsListComponent, styled) { 'use strict';

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

  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
  var invariant__default = /*#__PURE__*/_interopDefaultLegacy(invariant);
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);

  /**
   * Validate the shape of redux store
   */

  function checkStore(store) {
    const shape = {
      dispatch: lodash.isFunction,
      subscribe: lodash.isFunction,
      getState: lodash.isFunction,
      replaceReducer: lodash.isFunction,
      runSaga: lodash.isFunction,
      injectedReducers: lodash.isObject,
      injectedSagas: lodash.isObject
    };
    invariant__default['default'](lodash.conformsTo(store, shape), '(app/utils...) injectors: Expected a valid redux store');
  }

  function injectReducerFactory(store, isValid) {
    return function injectReducer(key, reducer) {
      if (!isValid) checkStore(store);
      invariant__default['default'](lodash.isString(key) && !lodash.isEmpty(key) && lodash.isFunction(reducer), '(app/utils...) injectReducer: Expected `reducer` to be a reducer function'); // Check `store.injectedReducers[key] === reducer` for hot reloading when a key is the same but a reducer is different

      if (Reflect.has(store.injectedReducers, key) && store.injectedReducers[key] === reducer) return;
      store.injectedReducers[key] = reducer; // eslint-disable-line no-param-reassign

      store.replaceReducer(TopicsListComponent.createReducer(store.injectedReducers));
    };
  }
  function getInjectors(store) {
    checkStore(store);
    return {
      injectReducer: injectReducerFactory(store, true)
    };
  }

  const useInjectReducer = ({
    key,
    reducer
  }) => {
    const context = React__default['default'].useContext(reactRedux.ReactReduxContext);
    React__default['default'].useEffect(() => {
      getInjectors(context.store).injectReducer(key, reducer);
    }, []);
  };

  const RESTART_ON_REMOUNT = '@@saga-injector/restart-on-remount';
  const DAEMON = '@@saga-injector/daemon';
  const ONCE_TILL_UNMOUNT = '@@saga-injector/once-till-unmount'; // const conf = window.REACT_COMMENTS_DJANGO_CONFIG

  const conf = window.REACT_COMMENTS_DJANGO_CONFIG;
  let API_URL_POSTFIX = '';
  let API_URL_DOMAIN = '';

  if (conf) {
    ({
      API_URL_POSTFIX
    } = conf);

    if ('API_URL_DOMAIN' in conf) {
      ({
        API_URL_DOMAIN
      } = conf);
    }
  }

  const API_PREFIX = `${API_URL_DOMAIN}/api/v1/${API_URL_POSTFIX}`;

  const H2 = styled__default['default'].h2.withConfig({
    displayName: "H2",
    componentId: "sc-1ujnxqo-0"
  })(["font-size:1.5em;"]);

  exports.API_PREFIX = API_PREFIX;
  exports.DAEMON = DAEMON;
  exports.H2 = H2;
  exports.ONCE_TILL_UNMOUNT = ONCE_TILL_UNMOUNT;
  exports.RESTART_ON_REMOUNT = RESTART_ON_REMOUNT;
  exports.checkStore = checkStore;
  exports.useInjectReducer = useInjectReducer;

});
//# sourceMappingURL=index-ba8ec889.js.map
