tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

redux.js (25092B)


      1 /**
      2 * react-redux v4.0.5
      3 */
      4 (function (global, factory) {
      5 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
      6 typeof define === 'function' && define.amd ? define(['exports'], factory) :
      7 (global = global || self, factory(global.Redux = {}));
      8 }(this, function (exports) { 'use strict';
      9 
     10 function symbolObservablePonyfill(root) {
     11 var result;
     12 var Symbol = root.Symbol;
     13 
     14 if (typeof Symbol === 'function') {
     15 	if (Symbol.observable) {
     16 		result = Symbol.observable;
     17 	} else {
     18 		result = Symbol('observable');
     19 		Symbol.observable = result;
     20 	}
     21 } else {
     22 	result = '@@observable';
     23 }
     24 
     25 return result;
     26 }
     27 
     28 /* global window */
     29 
     30 var root;
     31 
     32 if (typeof self !== 'undefined') {
     33  root = self;
     34 } else if (typeof window !== 'undefined') {
     35  root = window;
     36 } else if (typeof global !== 'undefined') {
     37  root = global;
     38 } else if (typeof module !== 'undefined') {
     39  root = module;
     40 } else {
     41  root = globalThis;
     42 }
     43 
     44 var result = symbolObservablePonyfill(root);
     45 
     46 /**
     47 * These are private action types reserved by Redux.
     48 * For any unknown actions, you must return the current state.
     49 * If the current state is undefined, you must return the initial state.
     50 * Do not reference these action types directly in your code.
     51 */
     52 var randomString = function randomString() {
     53  return Math.random().toString(36).substring(7).split('').join('.');
     54 };
     55 
     56 var ActionTypes = {
     57  INIT: "@@redux/INIT" + randomString(),
     58  REPLACE: "@@redux/REPLACE" + randomString(),
     59  PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
     60    return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
     61  }
     62 };
     63 
     64 /**
     65 * @param {any} obj The object to inspect.
     66 * @returns {boolean} True if the argument appears to be a plain object.
     67 */
     68 function isPlainObject(obj) {
     69  if (typeof obj !== 'object' || obj === null) return false;
     70  var proto = obj;
     71 
     72  while (Object.getPrototypeOf(proto) !== null) {
     73    proto = Object.getPrototypeOf(proto);
     74  }
     75 
     76  return Object.getPrototypeOf(obj) === proto;
     77 }
     78 
     79 /**
     80 * Creates a Redux store that holds the state tree.
     81 * The only way to change the data in the store is to call `dispatch()` on it.
     82 *
     83 * There should only be a single store in your app. To specify how different
     84 * parts of the state tree respond to actions, you may combine several reducers
     85 * into a single reducer function by using `combineReducers`.
     86 *
     87 * @param {Function} reducer A function that returns the next state tree, given
     88 * the current state tree and the action to handle.
     89 *
     90 * @param {any} [preloadedState] The initial state. You may optionally specify it
     91 * to hydrate the state from the server in universal apps, or to restore a
     92 * previously serialized user session.
     93 * If you use `combineReducers` to produce the root reducer function, this must be
     94 * an object with the same shape as `combineReducers` keys.
     95 *
     96 * @param {Function} [enhancer] The store enhancer. You may optionally specify it
     97 * to enhance the store with third-party capabilities such as middleware,
     98 * time travel, persistence, etc. The only store enhancer that ships with Redux
     99 * is `applyMiddleware()`.
    100 *
    101 * @returns {Store} A Redux store that lets you read the state, dispatch actions
    102 * and subscribe to changes.
    103 */
    104 
    105 function createStore(reducer, preloadedState, enhancer) {
    106  var _ref2;
    107 
    108  if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
    109    throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.');
    110  }
    111 
    112  if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
    113    enhancer = preloadedState;
    114    preloadedState = undefined;
    115  }
    116 
    117  if (typeof enhancer !== 'undefined') {
    118    if (typeof enhancer !== 'function') {
    119      throw new Error('Expected the enhancer to be a function.');
    120    }
    121 
    122    return enhancer(createStore)(reducer, preloadedState);
    123  }
    124 
    125  if (typeof reducer !== 'function') {
    126    throw new Error('Expected the reducer to be a function.');
    127  }
    128 
    129  var currentReducer = reducer;
    130  var currentState = preloadedState;
    131  var currentListeners = [];
    132  var nextListeners = currentListeners;
    133  var isDispatching = false;
    134  /**
    135   * This makes a shallow copy of currentListeners so we can use
    136   * nextListeners as a temporary list while dispatching.
    137   *
    138   * This prevents any bugs around consumers calling
    139   * subscribe/unsubscribe in the middle of a dispatch.
    140   */
    141 
    142  function ensureCanMutateNextListeners() {
    143    if (nextListeners === currentListeners) {
    144      nextListeners = currentListeners.slice();
    145    }
    146  }
    147  /**
    148   * Reads the state tree managed by the store.
    149   *
    150   * @returns {any} The current state tree of your application.
    151   */
    152 
    153 
    154  function getState() {
    155    if (isDispatching) {
    156      throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
    157    }
    158 
    159    return currentState;
    160  }
    161  /**
    162   * Adds a change listener. It will be called any time an action is dispatched,
    163   * and some part of the state tree may potentially have changed. You may then
    164   * call `getState()` to read the current state tree inside the callback.
    165   *
    166   * You may call `dispatch()` from a change listener, with the following
    167   * caveats:
    168   *
    169   * 1. The subscriptions are snapshotted just before every `dispatch()` call.
    170   * If you subscribe or unsubscribe while the listeners are being invoked, this
    171   * will not have any effect on the `dispatch()` that is currently in progress.
    172   * However, the next `dispatch()` call, whether nested or not, will use a more
    173   * recent snapshot of the subscription list.
    174   *
    175   * 2. The listener should not expect to see all state changes, as the state
    176   * might have been updated multiple times during a nested `dispatch()` before
    177   * the listener is called. It is, however, guaranteed that all subscribers
    178   * registered before the `dispatch()` started will be called with the latest
    179   * state by the time it exits.
    180   *
    181   * @param {Function} listener A callback to be invoked on every dispatch.
    182   * @returns {Function} A function to remove this change listener.
    183   */
    184 
    185 
    186  function subscribe(listener) {
    187    if (typeof listener !== 'function') {
    188      throw new Error('Expected the listener to be a function.');
    189    }
    190 
    191    if (isDispatching) {
    192      throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.');
    193    }
    194 
    195    var isSubscribed = true;
    196    ensureCanMutateNextListeners();
    197    nextListeners.push(listener);
    198    return function unsubscribe() {
    199      if (!isSubscribed) {
    200        return;
    201      }
    202 
    203      if (isDispatching) {
    204        throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.');
    205      }
    206 
    207      isSubscribed = false;
    208      ensureCanMutateNextListeners();
    209      var index = nextListeners.indexOf(listener);
    210      nextListeners.splice(index, 1);
    211      currentListeners = null;
    212    };
    213  }
    214  /**
    215   * Dispatches an action. It is the only way to trigger a state change.
    216   *
    217   * The `reducer` function, used to create the store, will be called with the
    218   * current state tree and the given `action`. Its return value will
    219   * be considered the **next** state of the tree, and the change listeners
    220   * will be notified.
    221   *
    222   * The base implementation only supports plain object actions. If you want to
    223   * dispatch a Promise, an Observable, a thunk, or something else, you need to
    224   * wrap your store creating function into the corresponding middleware. For
    225   * example, see the documentation for the `redux-thunk` package. Even the
    226   * middleware will eventually dispatch plain object actions using this method.
    227   *
    228   * @param {Object} action A plain object representing “what changed”. It is
    229   * a good idea to keep actions serializable so you can record and replay user
    230   * sessions, or use the time travelling `redux-devtools`. An action must have
    231   * a `type` property which may not be `undefined`. It is a good idea to use
    232   * string constants for action types.
    233   *
    234   * @returns {Object} For convenience, the same action object you dispatched.
    235   *
    236   * Note that, if you use a custom middleware, it may wrap `dispatch()` to
    237   * return something else (for example, a Promise you can await).
    238   */
    239 
    240 
    241  function dispatch(action) {
    242    if (!isPlainObject(action)) {
    243      throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
    244    }
    245 
    246    if (typeof action.type === 'undefined') {
    247      throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
    248    }
    249 
    250    if (isDispatching) {
    251      throw new Error('Reducers may not dispatch actions.');
    252    }
    253 
    254    try {
    255      isDispatching = true;
    256      currentState = currentReducer(currentState, action);
    257    } finally {
    258      isDispatching = false;
    259    }
    260 
    261    var listeners = currentListeners = nextListeners;
    262 
    263    for (var i = 0; i < listeners.length; i++) {
    264      var listener = listeners[i];
    265      listener();
    266    }
    267 
    268    return action;
    269  }
    270  /**
    271   * Replaces the reducer currently used by the store to calculate the state.
    272   *
    273   * You might need this if your app implements code splitting and you want to
    274   * load some of the reducers dynamically. You might also need this if you
    275   * implement a hot reloading mechanism for Redux.
    276   *
    277   * @param {Function} nextReducer The reducer for the store to use instead.
    278   * @returns {void}
    279   */
    280 
    281 
    282  function replaceReducer(nextReducer) {
    283    if (typeof nextReducer !== 'function') {
    284      throw new Error('Expected the nextReducer to be a function.');
    285    }
    286 
    287    currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
    288    // Any reducers that existed in both the new and old rootReducer
    289    // will receive the previous state. This effectively populates
    290    // the new state tree with any relevant data from the old one.
    291 
    292    dispatch({
    293      type: ActionTypes.REPLACE
    294    });
    295  }
    296  /**
    297   * Interoperability point for observable/reactive libraries.
    298   * @returns {observable} A minimal observable of state changes.
    299   * For more information, see the observable proposal:
    300   * https://github.com/tc39/proposal-observable
    301   */
    302 
    303 
    304  function observable() {
    305    var _ref;
    306 
    307    var outerSubscribe = subscribe;
    308    return _ref = {
    309      /**
    310       * The minimal observable subscription method.
    311       * @param {Object} observer Any object that can be used as an observer.
    312       * The observer object should have a `next` method.
    313       * @returns {subscription} An object with an `unsubscribe` method that can
    314       * be used to unsubscribe the observable from the store, and prevent further
    315       * emission of values from the observable.
    316       */
    317      subscribe: function subscribe(observer) {
    318        if (typeof observer !== 'object' || observer === null) {
    319          throw new TypeError('Expected the observer to be an object.');
    320        }
    321 
    322        function observeState() {
    323          if (observer.next) {
    324            observer.next(getState());
    325          }
    326        }
    327 
    328        observeState();
    329        var unsubscribe = outerSubscribe(observeState);
    330        return {
    331          unsubscribe: unsubscribe
    332        };
    333      }
    334    }, _ref[result] = function () {
    335      return this;
    336    }, _ref;
    337  } // When a store is created, an "INIT" action is dispatched so that every
    338  // reducer returns their initial state. This effectively populates
    339  // the initial state tree.
    340 
    341 
    342  dispatch({
    343    type: ActionTypes.INIT
    344  });
    345  return _ref2 = {
    346    dispatch: dispatch,
    347    subscribe: subscribe,
    348    getState: getState,
    349    replaceReducer: replaceReducer
    350  }, _ref2[result] = observable, _ref2;
    351 }
    352 
    353 /**
    354 * Prints a warning in the console if it exists.
    355 *
    356 * @param {String} message The warning message.
    357 * @returns {void}
    358 */
    359 function warning(message) {
    360  /* eslint-disable no-console */
    361  if (typeof console !== 'undefined' && typeof console.error === 'function') {
    362    console.error(message);
    363  }
    364  /* eslint-enable no-console */
    365 
    366 
    367  try {
    368    // This error was thrown as a convenience so that if you enable
    369    // "break on all exceptions" in your console,
    370    // it would pause the execution at this line.
    371    throw new Error(message);
    372  } catch (e) {} // eslint-disable-line no-empty
    373 
    374 }
    375 
    376 function getUndefinedStateErrorMessage(key, action) {
    377  var actionType = action && action.type;
    378  var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action';
    379  return "Given " + actionDescription + ", reducer \"" + key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.";
    380 }
    381 
    382 function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
    383  var reducerKeys = Object.keys(reducers);
    384  var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
    385 
    386  if (reducerKeys.length === 0) {
    387    return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
    388  }
    389 
    390  if (!isPlainObject(inputState)) {
    391    return "The " + argumentName + " has unexpected type of \"" + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
    392  }
    393 
    394  var unexpectedKeys = Object.keys(inputState).filter(function (key) {
    395    return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
    396  });
    397  unexpectedKeys.forEach(function (key) {
    398    unexpectedKeyCache[key] = true;
    399  });
    400  if (action && action.type === ActionTypes.REPLACE) return;
    401 
    402  if (unexpectedKeys.length > 0) {
    403    return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
    404  }
    405 }
    406 
    407 function assertReducerShape(reducers) {
    408  Object.keys(reducers).forEach(function (key) {
    409    var reducer = reducers[key];
    410    var initialState = reducer(undefined, {
    411      type: ActionTypes.INIT
    412    });
    413 
    414    if (typeof initialState === 'undefined') {
    415      throw new Error("Reducer \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined.");
    416    }
    417 
    418    if (typeof reducer(undefined, {
    419      type: ActionTypes.PROBE_UNKNOWN_ACTION()
    420    }) === 'undefined') {
    421      throw new Error("Reducer \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle " + ActionTypes.INIT + " or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null.");
    422    }
    423  });
    424 }
    425 /**
    426 * Turns an object whose values are different reducer functions, into a single
    427 * reducer function. It will call every child reducer, and gather their results
    428 * into a single state object, whose keys correspond to the keys of the passed
    429 * reducer functions.
    430 *
    431 * @param {Object} reducers An object whose values correspond to different
    432 * reducer functions that need to be combined into one. One handy way to obtain
    433 * it is to use ES6 `import * as reducers` syntax. The reducers may never return
    434 * undefined for any action. Instead, they should return their initial state
    435 * if the state passed to them was undefined, and the current state for any
    436 * unrecognized action.
    437 *
    438 * @returns {Function} A reducer function that invokes every reducer inside the
    439 * passed object, and builds a state object with the same shape.
    440 */
    441 
    442 
    443 function combineReducers(reducers) {
    444  var reducerKeys = Object.keys(reducers);
    445  var finalReducers = {};
    446 
    447  for (var i = 0; i < reducerKeys.length; i++) {
    448    var key = reducerKeys[i];
    449 
    450    {
    451      if (typeof reducers[key] === 'undefined') {
    452        warning("No reducer provided for key \"" + key + "\"");
    453      }
    454    }
    455 
    456    if (typeof reducers[key] === 'function') {
    457      finalReducers[key] = reducers[key];
    458    }
    459  }
    460 
    461  var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
    462  // keys multiple times.
    463 
    464  var unexpectedKeyCache;
    465 
    466  {
    467    unexpectedKeyCache = {};
    468  }
    469 
    470  var shapeAssertionError;
    471 
    472  try {
    473    assertReducerShape(finalReducers);
    474  } catch (e) {
    475    shapeAssertionError = e;
    476  }
    477 
    478  return function combination(state, action) {
    479    if (state === void 0) {
    480      state = {};
    481    }
    482 
    483    if (shapeAssertionError) {
    484      throw shapeAssertionError;
    485    }
    486 
    487    {
    488      var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
    489 
    490      if (warningMessage) {
    491        warning(warningMessage);
    492      }
    493    }
    494 
    495    var hasChanged = false;
    496    var nextState = {};
    497 
    498    for (var _i = 0; _i < finalReducerKeys.length; _i++) {
    499      var _key = finalReducerKeys[_i];
    500      var reducer = finalReducers[_key];
    501      var previousStateForKey = state[_key];
    502      var nextStateForKey = reducer(previousStateForKey, action);
    503 
    504      if (typeof nextStateForKey === 'undefined') {
    505        var errorMessage = getUndefinedStateErrorMessage(_key, action);
    506        throw new Error(errorMessage);
    507      }
    508 
    509      nextState[_key] = nextStateForKey;
    510      hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
    511    }
    512 
    513    hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
    514    return hasChanged ? nextState : state;
    515  };
    516 }
    517 
    518 function bindActionCreator(actionCreator, dispatch) {
    519  return function () {
    520    return dispatch(actionCreator.apply(this, arguments));
    521  };
    522 }
    523 /**
    524 * Turns an object whose values are action creators, into an object with the
    525 * same keys, but with every function wrapped into a `dispatch` call so they
    526 * may be invoked directly. This is just a convenience method, as you can call
    527 * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
    528 *
    529 * For convenience, you can also pass an action creator as the first argument,
    530 * and get a dispatch wrapped function in return.
    531 *
    532 * @param {Function|Object} actionCreators An object whose values are action
    533 * creator functions. One handy way to obtain it is to use ES6 `import * as`
    534 * syntax. You may also pass a single function.
    535 *
    536 * @param {Function} dispatch The `dispatch` function available on your Redux
    537 * store.
    538 *
    539 * @returns {Function|Object} The object mimicking the original object, but with
    540 * every action creator wrapped into the `dispatch` call. If you passed a
    541 * function as `actionCreators`, the return value will also be a single
    542 * function.
    543 */
    544 
    545 
    546 function bindActionCreators(actionCreators, dispatch) {
    547  if (typeof actionCreators === 'function') {
    548    return bindActionCreator(actionCreators, dispatch);
    549  }
    550 
    551  if (typeof actionCreators !== 'object' || actionCreators === null) {
    552    throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
    553  }
    554 
    555  var boundActionCreators = {};
    556 
    557  for (var key in actionCreators) {
    558    var actionCreator = actionCreators[key];
    559 
    560    if (typeof actionCreator === 'function') {
    561      boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
    562    }
    563  }
    564 
    565  return boundActionCreators;
    566 }
    567 
    568 function _defineProperty(obj, key, value) {
    569  if (key in obj) {
    570    Object.defineProperty(obj, key, {
    571      value: value,
    572      enumerable: true,
    573      configurable: true,
    574      writable: true
    575    });
    576  } else {
    577    obj[key] = value;
    578  }
    579 
    580  return obj;
    581 }
    582 
    583 function ownKeys(object, enumerableOnly) {
    584  var keys = Object.keys(object);
    585 
    586  if (Object.getOwnPropertySymbols) {
    587    keys.push.apply(keys, Object.getOwnPropertySymbols(object));
    588  }
    589 
    590  if (enumerableOnly) keys = keys.filter(function (sym) {
    591    return Object.getOwnPropertyDescriptor(object, sym).enumerable;
    592  });
    593  return keys;
    594 }
    595 
    596 function _objectSpread2(target) {
    597  for (var i = 1; i < arguments.length; i++) {
    598    var source = arguments[i] != null ? arguments[i] : {};
    599 
    600    if (i % 2) {
    601      ownKeys(source, true).forEach(function (key) {
    602        _defineProperty(target, key, source[key]);
    603      });
    604    } else if (Object.getOwnPropertyDescriptors) {
    605      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    606    } else {
    607      ownKeys(source).forEach(function (key) {
    608        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
    609      });
    610    }
    611  }
    612 
    613  return target;
    614 }
    615 
    616 /**
    617 * Composes single-argument functions from right to left. The rightmost
    618 * function can take multiple arguments as it provides the signature for
    619 * the resulting composite function.
    620 *
    621 * @param {...Function} funcs The functions to compose.
    622 * @returns {Function} A function obtained by composing the argument functions
    623 * from right to left. For example, compose(f, g, h) is identical to doing
    624 * (...args) => f(g(h(...args))).
    625 */
    626 function compose() {
    627  for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
    628    funcs[_key] = arguments[_key];
    629  }
    630 
    631  if (funcs.length === 0) {
    632    return function (arg) {
    633      return arg;
    634    };
    635  }
    636 
    637  if (funcs.length === 1) {
    638    return funcs[0];
    639  }
    640 
    641  return funcs.reduce(function (a, b) {
    642    return function () {
    643      return a(b.apply(void 0, arguments));
    644    };
    645  });
    646 }
    647 
    648 /**
    649 * Creates a store enhancer that applies middleware to the dispatch method
    650 * of the Redux store. This is handy for a variety of tasks, such as expressing
    651 * asynchronous actions in a concise manner, or logging every action payload.
    652 *
    653 * See `redux-thunk` package as an example of the Redux middleware.
    654 *
    655 * Because middleware is potentially asynchronous, this should be the first
    656 * store enhancer in the composition chain.
    657 *
    658 * Note that each middleware will be given the `dispatch` and `getState` functions
    659 * as named arguments.
    660 *
    661 * @param {...Function} middlewares The middleware chain to be applied.
    662 * @returns {Function} A store enhancer applying the middleware.
    663 */
    664 
    665 function applyMiddleware() {
    666  for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
    667    middlewares[_key] = arguments[_key];
    668  }
    669 
    670  return function (createStore) {
    671    return function () {
    672      var store = createStore.apply(void 0, arguments);
    673 
    674      var _dispatch = function dispatch() {
    675        throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
    676      };
    677 
    678      var middlewareAPI = {
    679        getState: store.getState,
    680        dispatch: function dispatch() {
    681          return _dispatch.apply(void 0, arguments);
    682        }
    683      };
    684      var chain = middlewares.map(function (middleware) {
    685        return middleware(middlewareAPI);
    686      });
    687      _dispatch = compose.apply(void 0, chain)(store.dispatch);
    688      return _objectSpread2({}, store, {
    689        dispatch: _dispatch
    690      });
    691    };
    692  };
    693 }
    694 
    695 /*
    696 * This is a dummy function to check if the function name has been altered by minification.
    697 * If the function has been minified and NODE_ENV !== 'production', warn the user.
    698 */
    699 
    700 function isCrushed() {}
    701 
    702 if ( typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
    703  warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
    704 }
    705 
    706 exports.__DO_NOT_USE__ActionTypes = ActionTypes;
    707 exports.applyMiddleware = applyMiddleware;
    708 exports.bindActionCreators = bindActionCreators;
    709 exports.combineReducers = combineReducers;
    710 exports.compose = compose;
    711 exports.createStore = createStore;
    712 
    713 Object.defineProperty(exports, '__esModule', { value: true });
    714 
    715 }));