57.5 kBSource Map (JSON)View Raw
1{"version":3,"file":"redux-persist.min.js","sources":["../src/constants.js","../src/stateReconciler/autoMergeLevel1.js","../src/createPersistoid.js","../src/getStoredState.js","../src/purgeStoredState.js","../src/persistReducer.js","../node_modules/lodash-es/_freeGlobal.js","../node_modules/lodash-es/_root.js","../node_modules/lodash-es/_Symbol.js","../node_modules/lodash-es/_getRawTag.js","../node_modules/lodash-es/_objectToString.js","../node_modules/lodash-es/_baseGetTag.js","../node_modules/lodash-es/_getPrototype.js","../node_modules/lodash-es/_overArg.js","../node_modules/lodash-es/isPlainObject.js","../node_modules/symbol-observable/es/index.js","../node_modules/symbol-observable/es/ponyfill.js","../node_modules/redux/es/createStore.js","../node_modules/lodash-es/isObjectLike.js","../node_modules/redux/es/combineReducers.js","../src/stateReconciler/autoMergeLevel2.js","../src/persistStore.js","../src/persistCombineReducers.js","../src/createMigrate.js","../src/createTransform.js"],"sourcesContent":["// @flow\n\nexport const KEY_PREFIX = 'persist:'\nexport const FLUSH = 'persist/FLUSH'\nexport const REHYDRATE = 'persist/REHYDRATE'\nexport const PAUSE = 'persist/PAUSE'\nexport const PERSIST = 'persist/PERSIST'\nexport const PURGE = 'persist/PURGE'\nexport const REGISTER = 'persist/REGISTER'\nexport const DEFAULT_VERSION = -1\n","// @flow\n\n/*\n autoMergeLevel1: \n - merges 1 level of substate\n - skips substate if already modified\n*/\n\nimport type { PersistConfig } from '../types'\n\nexport default function autoMergeLevel1<State: Object>(\n inboundState: State,\n originalState: State,\n reducedState: State,\n { debug }: PersistConfig\n): State {\n let newState = { ...reducedState }\n // only rehydrate if inboundState exists and is an object\n if (inboundState && typeof inboundState === 'object') {\n Object.keys(inboundState).forEach(key => {\n // ignore _persist data\n if (key === '_persist') return\n // if reducer modifies substate, skip auto rehydration\n if (originalState[key] !== reducedState[key]) {\n if (process.env.NODE_ENV !== 'production' && debug)\n console.log(\n 'redux-persist/stateReconciler: sub state for key `%s` modified, skipping.',\n key\n )\n return\n }\n // otherwise hard set the new value\n newState[key] = inboundState[key]\n })\n }\n\n if (\n process.env.NODE_ENV !== 'production' &&\n debug &&\n inboundState &&\n typeof inboundState === 'object'\n )\n console.log(\n `redux-persist/stateReconciler: rehydrated keys '${Object.keys(\n inboundState\n ).join(', ')}'`\n )\n\n return newState\n}\n","// @flow\n\nimport { KEY_PREFIX, REHYDRATE } from './constants'\n\nimport type { Persistoid, PersistConfig, Transform } from './types'\n\ntype IntervalID = any // @TODO remove once flow < 0.63 support is no longer required.\n\nexport default function createPersistoid(config: PersistConfig): Persistoid {\n // defaults\n const blacklist: ?Array<string> = config.blacklist || null\n const whitelist: ?Array<string> = config.whitelist || null\n const transforms = config.transforms || []\n const throttle = config.throttle || 0\n const storageKey = `${\n config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX\n }${config.key}`\n const storage = config.storage\n const serialize = config.serialize === false ? x => x : defaultSerialize\n\n // initialize stateful values\n let lastState = {}\n let stagedState = {}\n let keysToProcess = []\n let timeIterator: ?IntervalID = null\n let writePromise = null\n\n const update = (state: Object) => {\n // add any changed keys to the queue\n Object.keys(state).forEach(key => {\n if (!passWhitelistBlacklist(key)) return // is keyspace ignored? noop\n if (lastState[key] === state[key]) return // value unchanged? noop\n if (keysToProcess.indexOf(key) !== -1) return // is key already queued? noop\n keysToProcess.push(key) // add key to queue\n })\n\n //if any key is missing in the new state which was present in the lastState,\n //add it for processing too\n Object.keys(lastState).forEach(key => {\n if (state[key] === undefined) {\n keysToProcess.push(key)\n }\n })\n\n // start the time iterator if not running (read: throttle)\n if (timeIterator === null) {\n timeIterator = setInterval(processNextKey, throttle)\n }\n\n lastState = state\n }\n\n function processNextKey() {\n if (keysToProcess.length === 0) {\n if (timeIterator) clearInterval(timeIterator)\n timeIterator = null\n return\n }\n\n let key = keysToProcess.shift()\n let endState = transforms.reduce((subState, transformer) => {\n return transformer.in(subState, key, lastState)\n }, lastState[key])\n\n if (endState !== undefined) {\n try {\n stagedState[key] = serialize(endState)\n } catch (err) {\n console.error(\n 'redux-persist/createPersistoid: error serializing state',\n err\n )\n }\n } else {\n //if the endState is undefined, no need to persist the existing serialized content\n delete stagedState[key]\n }\n\n if (keysToProcess.length === 0) {\n writeStagedState()\n }\n }\n\n function writeStagedState() {\n // cleanup any removed keys just before write.\n Object.keys(stagedState).forEach(key => {\n if (lastState[key] === undefined) {\n delete stagedState[key]\n }\n })\n\n writePromise = storage\n .setItem(storageKey, serialize(stagedState))\n .catch(onWriteFail)\n }\n\n function passWhitelistBlacklist(key) {\n if (whitelist && whitelist.indexOf(key) === -1 && key !== '_persist')\n return false\n if (blacklist && blacklist.indexOf(key) !== -1) return false\n return true\n }\n\n function onWriteFail(err) {\n // @TODO add fail handlers (typically storage full)\n if (err && process.env.NODE_ENV !== 'production') {\n console.error('Error storing data', err)\n }\n }\n\n const flush = () => {\n while (keysToProcess.length !== 0) {\n processNextKey()\n }\n return writePromise || Promise.resolve()\n }\n\n // return `persistoid`\n return {\n update,\n flush,\n }\n}\n\n// @NOTE in the future this may be exposed via config\nfunction defaultSerialize(data) {\n return JSON.stringify(data)\n}\n","// @flow\n\nimport type { PersistConfig } from './types'\n\nimport { KEY_PREFIX } from './constants'\n\nexport default function getStoredState(\n config: PersistConfig\n): Promise<Object | void> {\n const transforms = config.transforms || []\n const storageKey = `${\n config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX\n }${config.key}`\n const storage = config.storage\n const debug = config.debug\n const deserialize = config.serialize === false ? x => x : defaultDeserialize\n return storage.getItem(storageKey).then(serialized => {\n if (!serialized) return undefined\n else {\n try {\n let state = {}\n let rawState = deserialize(serialized)\n Object.keys(rawState).forEach(key => {\n state[key] = transforms.reduceRight((subState, transformer) => {\n return transformer.out(subState, key, rawState)\n }, deserialize(rawState[key]))\n })\n return state\n } catch (err) {\n if (process.env.NODE_ENV !== 'production' && debug)\n console.log(\n `redux-persist/getStoredState: Error restoring data ${serialized}`,\n err\n )\n throw err\n }\n }\n })\n}\n\nfunction defaultDeserialize(serial) {\n return JSON.parse(serial)\n}\n","// @flow\n\nimport type { PersistConfig } from './types'\n\nimport { KEY_PREFIX } from './constants'\n\nexport default function purgeStoredState(config: PersistConfig) {\n const storage = config.storage\n const storageKey = `${\n config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX\n }${config.key}`\n return storage.removeItem(storageKey, warnIfRemoveError)\n}\n\nfunction warnIfRemoveError(err) {\n if (err && process.env.NODE_ENV !== 'production') {\n console.error(\n 'redux-persist/purgeStoredState: Error purging data stored state',\n err\n )\n }\n}\n","// @flow\nimport {\n FLUSH,\n PAUSE,\n PERSIST,\n PURGE,\n REHYDRATE,\n DEFAULT_VERSION,\n} from './constants'\n\nimport type {\n PersistConfig,\n MigrationManifest,\n PersistState,\n Persistoid,\n} from './types'\n\nimport autoMergeLevel1 from './stateReconciler/autoMergeLevel1'\nimport createPersistoid from './createPersistoid'\nimport defaultGetStoredState from './getStoredState'\nimport purgeStoredState from './purgeStoredState'\n\ntype PersistPartial = { _persist: PersistState }\nconst DEFAULT_TIMEOUT = 5000\n/*\n @TODO add validation / handling for:\n - persisting a reducer which has nested _persist\n - handling actions that fire before reydrate is called\n*/\nexport default function persistReducer<State: Object, Action: Object>(\n config: PersistConfig,\n baseReducer: (State, Action) => State\n): (State, Action) => State & PersistPartial {\n if (process.env.NODE_ENV !== 'production') {\n if (!config) throw new Error('config is required for persistReducer')\n if (!config.key) throw new Error('key is required in persistor config')\n if (!config.storage)\n throw new Error(\n \"redux-persist: config.storage is required. Try using one of the provided storage engines `import storage from 'redux-persist/lib/storage'`\"\n )\n }\n\n const version =\n config.version !== undefined ? config.version : DEFAULT_VERSION\n const debug = config.debug || false\n const stateReconciler =\n config.stateReconciler === undefined\n ? autoMergeLevel1\n : config.stateReconciler\n const getStoredState = config.getStoredState || defaultGetStoredState\n const timeout =\n config.timeout !== undefined ? config.timeout : DEFAULT_TIMEOUT\n let _persistoid = null\n let _purge = false\n let _paused = true\n const conditionalUpdate = state => {\n // update the persistoid only if we are rehydrated and not paused\n state._persist.rehydrated &&\n _persistoid &&\n !_paused &&\n _persistoid.update(state)\n return state\n }\n\n return (state: State, action: Action) => {\n let { _persist, ...rest } = state || {}\n let restState: State = rest\n\n if (action.type === PERSIST) {\n let _sealed = false\n let _rehydrate = (payload, err) => {\n // dev warning if we are already sealed\n if (process.env.NODE_ENV !== 'production' && _sealed)\n console.error(\n `redux-persist: rehydrate for \"${\n config.key\n }\" called after timeout.`,\n payload,\n err\n )\n\n // only rehydrate if we are not already sealed\n if (!_sealed) {\n action.rehydrate(config.key, payload, err)\n _sealed = true\n }\n }\n timeout &&\n setTimeout(() => {\n !_sealed &&\n _rehydrate(\n undefined,\n new Error(\n `redux-persist: persist timed out for persist key \"${\n config.key\n }\"`\n )\n )\n }, timeout)\n\n // @NOTE PERSIST resumes if paused.\n _paused = false\n\n // @NOTE only ever create persistoid once, ensure we call it at least once, even if _persist has already been set\n if (!_persistoid) _persistoid = createPersistoid(config)\n\n // @NOTE PERSIST can be called multiple times, noop after the first\n if (_persist) return state\n if (\n typeof action.rehydrate !== 'function' ||\n typeof action.register !== 'function'\n )\n throw new Error(\n 'redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.'\n )\n\n action.register(config.key)\n\n getStoredState(config).then(\n restoredState => {\n const migrate = config.migrate || ((s, v) => Promise.resolve(s))\n migrate(restoredState, version).then(\n migratedState => {\n _rehydrate(migratedState)\n },\n migrateErr => {\n if (process.env.NODE_ENV !== 'production' && migrateErr)\n console.error('redux-persist: migration error', migrateErr)\n _rehydrate(undefined, migrateErr)\n }\n )\n },\n err => {\n _rehydrate(undefined, err)\n }\n )\n\n return {\n ...baseReducer(restState, action),\n _persist: { version, rehydrated: false },\n }\n } else if (action.type === PURGE) {\n _purge = true\n action.result(purgeStoredState(config))\n return {\n ...baseReducer(restState, action),\n _persist,\n }\n } else if (action.type === FLUSH) {\n action.result(_persistoid && _persistoid.flush())\n return {\n ...baseReducer(restState, action),\n _persist,\n }\n } else if (action.type === PAUSE) {\n _paused = true\n } else if (action.type === REHYDRATE) {\n // noop on restState if purging\n if (_purge)\n return {\n ...restState,\n _persist: { ..._persist, rehydrated: true },\n }\n\n // @NOTE if key does not match, will continue to default else below\n if (action.key === config.key) {\n let reducedState = baseReducer(restState, action)\n let inboundState = action.payload\n // only reconcile state if stateReconciler and inboundState are both defined\n let reconciledRest: State =\n stateReconciler !== false && inboundState !== undefined\n ? stateReconciler(inboundState, state, reducedState, config)\n : reducedState\n\n let newState = {\n ...reconciledRest,\n _persist: { ..._persist, rehydrated: true },\n }\n return conditionalUpdate(newState)\n }\n }\n\n // if we have not already handled PERSIST, straight passthrough\n if (!_persist) return baseReducer(state, action)\n\n // run base reducer:\n // is state modified ? return original : return updated\n let newState = baseReducer(restState, action)\n if (newState === restState) return state\n else {\n newState._persist = _persist\n return conditionalUpdate(newState)\n }\n }\n}\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n","import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n","/* global window */\nimport ponyfill from './ponyfill.js';\n\nvar root;\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = ponyfill(root);\nexport default result;\n","export default function symbolObservablePonyfill(root) {\n\tvar result;\n\tvar Symbol = root.Symbol;\n\n\tif (typeof Symbol === 'function') {\n\t\tif (Symbol.observable) {\n\t\t\tresult = Symbol.observable;\n\t\t} else {\n\t\t\tresult = Symbol('observable');\n\t\t\tSymbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n","import isPlainObject from 'lodash-es/isPlainObject';\nimport $$observable from 'symbol-observable';\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nexport var ActionTypes = {\n INIT: '@@redux/INIT'\n\n /**\n * Creates a Redux store that holds the state tree.\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n};export default function createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error('Expected the enhancer to be a function.');\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error('Expected the reducer to be a function.');\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n function getState() {\n return currentState;\n }\n\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error('Expected listener to be a function.');\n }\n\n var isSubscribed = true;\n\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n isSubscribed = false;\n\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n };\n }\n\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing “what changed”. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error('Actions may not have an undefined \"type\" property. ' + 'Have you misspelled a constant?');\n }\n\n if (isDispatching) {\n throw new Error('Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error('Expected the nextReducer to be a function.');\n }\n\n currentReducer = nextReducer;\n dispatch({ type: ActionTypes.INIT });\n }\n\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object') {\n throw new TypeError('Expected the observer to be an object.');\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return { unsubscribe: unsubscribe };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n }\n\n // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n dispatch({ type: ActionTypes.INIT });\n\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import { ActionTypes } from './createStore';\nimport isPlainObject from 'lodash-es/isPlainObject';\nimport warning from './utils/warning';\n\nfunction getUndefinedStateErrorMessage(key, action) {\n var actionType = action && action.type;\n var actionName = actionType && '\"' + actionType.toString() + '\"' || 'an action';\n\n return 'Given action ' + actionName + ', 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.';\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n 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('\", \"') + '\"');\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n\n if (unexpectedKeys.length > 0) {\n 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.');\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, { type: ActionTypes.INIT });\n\n if (typeof initialState === 'undefined') {\n 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.');\n }\n\n var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');\n if (typeof reducer(undefined, { type: type }) === 'undefined') {\n 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.');\n }\n });\n}\n\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\nexport default function combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning('No reducer provided for key \"' + key + '\"');\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n var finalReducerKeys = Object.keys(finalReducers);\n\n var unexpectedKeyCache = void 0;\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError = void 0;\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var action = arguments[1];\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n if (typeof nextStateForKey === 'undefined') {\n var errorMessage = getUndefinedStateErrorMessage(_key, action);\n throw new Error(errorMessage);\n }\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n return hasChanged ? nextState : state;\n };\n}","// @flow\n\n/*\n autoMergeLevel2: \n - merges 2 level of substate\n - skips substate if already modified\n - this is essentially redux-perist v4 behavior\n*/\n\nimport type { PersistConfig } from '../types'\n\nexport default function autoMergeLevel2<State: Object>(\n inboundState: State,\n originalState: State,\n reducedState: State,\n { debug }: PersistConfig\n): State {\n let newState = { ...reducedState }\n // only rehydrate if inboundState exists and is an object\n if (inboundState && typeof inboundState === 'object') {\n Object.keys(inboundState).forEach(key => {\n // ignore _persist data\n if (key === '_persist') return\n // if reducer modifies substate, skip auto rehydration\n if (originalState[key] !== reducedState[key]) {\n if (process.env.NODE_ENV !== 'production' && debug)\n console.log(\n 'redux-persist/stateReconciler: sub state for key `%s` modified, skipping.',\n key\n )\n return\n }\n if (isPlainEnoughObject(reducedState[key])) {\n // if object is plain enough shallow merge the new values (hence \"Level2\")\n newState[key] = { ...newState[key], ...inboundState[key] }\n return\n }\n // otherwise hard set\n newState[key] = inboundState[key]\n })\n }\n\n if (\n process.env.NODE_ENV !== 'production' &&\n debug &&\n inboundState &&\n typeof inboundState === 'object'\n )\n console.log(\n `redux-persist/stateReconciler: rehydrated keys '${Object.keys(\n inboundState\n ).join(', ')}'`\n )\n\n return newState\n}\n\nfunction isPlainEnoughObject(o) {\n return o !== null && !Array.isArray(o) && typeof o === 'object'\n}\n","// @flow\n\nimport type {\n Persistor,\n PersistConfig,\n PersistorOptions,\n PersistorState,\n MigrationManifest,\n RehydrateAction,\n RehydrateErrorType,\n} from './types'\n\nimport { createStore } from 'redux'\nimport persistReducer from './persistReducer'\nimport { FLUSH, PAUSE, PERSIST, PURGE, REGISTER, REHYDRATE } from './constants'\n\ntype PendingRehydrate = [Object, RehydrateErrorType, PersistConfig]\ntype Persist = <R>(PersistConfig, MigrationManifest) => R => R\ntype CreatePersistor = Object => void\ntype BoostrappedCb = () => any\n\nconst initialState: PersistorState = {\n registry: [],\n bootstrapped: false,\n}\n\nconst persistorReducer = (state = initialState, action) => {\n switch (action.type) {\n case REGISTER:\n return { ...state, registry: [...state.registry, action.key] }\n case REHYDRATE:\n let firstIndex = state.registry.indexOf(action.key)\n let registry = [...state.registry]\n registry.splice(firstIndex, 1)\n return { ...state, registry, bootstrapped: registry.length === 0 }\n default:\n return state\n }\n}\n\nexport default function persistStore(\n store: Object,\n options?: ?PersistorOptions,\n cb?: BoostrappedCb\n): Persistor {\n // help catch incorrect usage of passing PersistConfig in as PersistorOptions\n if (process.env.NODE_ENV !== 'production') {\n let optionsToTest: Object = options || {}\n let bannedKeys = [\n 'blacklist',\n 'whitelist',\n 'transforms',\n 'storage',\n 'keyPrefix',\n 'migrate',\n ]\n bannedKeys.forEach(k => {\n if (!!optionsToTest[k])\n console.error(\n `redux-persist: invalid option passed to persistStore: \"${k}\". You may be incorrectly passing persistConfig into persistStore, whereas it should be passed into persistReducer.`\n )\n })\n }\n let boostrappedCb = cb || false\n\n let _pStore = createStore(\n persistorReducer,\n initialState,\n options ? options.enhancer : undefined\n )\n let register = (key: string) => {\n _pStore.dispatch({\n type: REGISTER,\n key,\n })\n }\n\n let rehydrate = (key: string, payload: Object, err: any) => {\n let rehydrateAction = {\n type: REHYDRATE,\n payload,\n err,\n key,\n }\n // dispatch to `store` to rehydrate and `persistor` to track result\n store.dispatch(rehydrateAction)\n _pStore.dispatch(rehydrateAction)\n if (boostrappedCb && persistor.getState().bootstrapped) {\n boostrappedCb()\n boostrappedCb = false\n }\n }\n\n let persistor: Persistor = {\n ..._pStore,\n purge: () => {\n let results = []\n store.dispatch({\n type: PURGE,\n result: purgeResult => {\n results.push(purgeResult)\n },\n })\n return Promise.all(results)\n },\n flush: () => {\n let results = []\n store.dispatch({\n type: FLUSH,\n result: flushResult => {\n results.push(flushResult)\n },\n })\n return Promise.all(results)\n },\n pause: () => {\n store.dispatch({\n type: PAUSE,\n })\n },\n persist: () => {\n store.dispatch({ type: PERSIST, register, rehydrate })\n },\n }\n\n persistor.persist()\n\n return persistor\n}\n","// @flow\n\nimport { combineReducers } from 'redux'\nimport persistReducer from './persistReducer'\nimport autoMergeLevel2 from './stateReconciler/autoMergeLevel2'\n\nimport type { PersistConfig } from './types'\n\ntype Reducers = {\n [key: string]: Function,\n}\n\ntype Reducer = (state: Object, action: Object) => Object\n\n// combineReducers + persistReducer with stateReconciler defaulted to autoMergeLevel2\nexport default function persistCombineReducers(\n config: PersistConfig,\n reducers: Reducers\n): Reducer {\n config.stateReconciler =\n config.stateReconciler === undefined\n ? autoMergeLevel2\n : config.stateReconciler\n return persistReducer(config, combineReducers(reducers))\n}\n","// @flow\n\nimport { DEFAULT_VERSION } from './constants'\n\nimport type { PersistedState, MigrationManifest } from './types'\n\nexport default function createMigrate(\n migrations: MigrationManifest,\n config?: { debug: boolean }\n) {\n let { debug } = config || {}\n return function(\n state: PersistedState,\n currentVersion: number\n ): Promise<PersistedState> {\n if (!state) {\n if (process.env.NODE_ENV !== 'production' && debug)\n console.log('redux-persist: no inbound state, skipping migration')\n return Promise.resolve(undefined)\n }\n\n let inboundVersion: number =\n state._persist && state._persist.version !== undefined\n ? state._persist.version\n : DEFAULT_VERSION\n if (inboundVersion === currentVersion) {\n if (process.env.NODE_ENV !== 'production' && debug)\n console.log('redux-persist: versions match, noop migration')\n return Promise.resolve(state)\n }\n if (inboundVersion > currentVersion) {\n if (process.env.NODE_ENV !== 'production')\n console.error('redux-persist: downgrading version is not supported')\n return Promise.resolve(state)\n }\n\n let migrationKeys = Object.keys(migrations)\n .map(ver => parseInt(ver))\n .filter(key => currentVersion >= key && key > inboundVersion)\n .sort((a, b) => a - b)\n\n if (process.env.NODE_ENV !== 'production' && debug)\n console.log('redux-persist: migrationKeys', migrationKeys)\n try {\n let migratedState = migrationKeys.reduce((state, versionKey) => {\n if (process.env.NODE_ENV !== 'production' && debug)\n console.log(\n 'redux-persist: running migration for versionKey',\n versionKey\n )\n return migrations[versionKey](state)\n }, state)\n return Promise.resolve(migratedState)\n } catch (err) {\n return Promise.reject(err)\n }\n }\n}\n","// @flow\n\ntype TransformConfig = {\n whitelist?: Array<string>,\n blacklist?: Array<string>,\n}\n\nexport default function createTransform(\n // @NOTE inbound: transform state coming from redux on its way to being serialized and stored\n inbound: ?Function,\n // @NOTE outbound: transform state coming from storage, on its way to be rehydrated into redux\n outbound: ?Function,\n config: TransformConfig = {}\n) {\n let whitelist = config.whitelist || null\n let blacklist = config.blacklist || null\n\n function whitelistBlacklistCheck(key) {\n if (whitelist && whitelist.indexOf(key) === -1) return true\n if (blacklist && blacklist.indexOf(key) !== -1) return true\n return false\n }\n\n return {\n in: (state: Object, key: string, fullState: Object) =>\n !whitelistBlacklistCheck(key) && inbound\n ? inbound(state, key, fullState)\n : state,\n out: (state: Object, key: string, fullState: Object) =>\n !whitelistBlacklistCheck(key) && outbound\n ? outbound(state, key, fullState)\n : state,\n }\n}\n"],"names":["KEY_PREFIX","FLUSH","REHYDRATE","PAUSE","PERSIST","PURGE","REGISTER","DEFAULT_VERSION","autoMergeLevel1","inboundState","originalState","reducedState","newState","keys","forEach","key","createPersistoid","config","blacklist","whitelist","transforms","throttle","storageKey","undefined","keyPrefix","storage","serialize","x","defaultSerialize","lastState","stagedState","keysToProcess","timeIterator","writePromise","processNextKey","length","clearInterval","shift","endState","reduce","subState","transformer","in","err","error","setItem","catch","onWriteFail","state","indexOf","passWhitelistBlacklist","push","setInterval","Promise","resolve","data","JSON","stringify","getStoredState","deserialize","defaultDeserialize","getItem","then","serialized","rawState","reduceRight","out","serial","parse","purgeStoredState","removeItem","warnIfRemoveError","DEFAULT_TIMEOUT","persistReducer","baseReducer","version","stateReconciler","defaultGetStoredState","timeout","_persistoid","_purge","_paused","conditionalUpdate","_persist","rehydrated","update","action","restState","type","_sealed","_rehydrate","payload","rehydrate","setTimeout","Error","register","migrate","s","v","restoredState","migratedState","migrateErr","result","flush","reconciledRest","freeGlobal","global","Object","freeSelf","self","Symbol","Function","objectProto","prototype","hasOwnProperty","nativeObjectToString","toString","symToStringTag","toStringTag","nullTag","undefinedTag","baseGetTag","value","isOwn","call","tag","unmasked","e","getRawTag","objectToString","func","transform","getPrototype","getPrototypeOf","arg","objectTag","funcToString","objectCtorString","root","observable","ponyfill","window","module","ActionTypes","INIT","createStore","reducer","preloadedState","enhancer","_ref2","currentReducer","currentState","currentListeners","nextListeners","isDispatching","ensureCanMutateNextListeners","slice","getState","subscribe","listener","isSubscribed","index","splice","dispatch","isObjectLike","proto","Ctor","constructor","isPlainObject","listeners","i","replaceReducer","nextReducer","$$observable","_ref","outerSubscribe","observer","TypeError","observeState","next","unsubscribe","this","getUndefinedStateErrorMessage","actionType","combineReducers","reducers","reducerKeys","finalReducers","finalReducerKeys","shapeAssertionError","Math","random","substring","split","join","assertReducerShape","arguments","hasChanged","nextState","_i","_key","previousStateForKey","nextStateForKey","errorMessage","autoMergeLevel2","o","Array","isArray","initialState","persistorReducer","registry","firstIndex","bootstrapped","store","options","cb","boostrappedCb","_pStore","rehydrateAction","persistor","results","purgeResult","all","flushResult","persist","migrations","currentVersion","inboundVersion","migrationKeys","map","parseInt","ver","filter","sort","a","b","versionKey","reject","inbound","outbound","whitelistBlacklistCheck","fullState"],"mappings":"+LAEO,IAAMA,EAAa,WACbC,EAAQ,gBACRC,EAAY,oBACZC,EAAQ,gBACRC,EAAU,kBACVC,EAAQ,gBACRC,EAAW,mBACXC,GAAmB,omBCCjB,SAASC,EACtBC,EACAC,EACAC,SAGIC,OAAgBD,UAEhBF,GAAwC,qBAAjBA,gBAAAA,YAClBI,KAAKJ,GAAcK,QAAQ,YAEpB,aAARC,GAEAL,EAAcK,KAASJ,EAAaI,OAS/BA,GAAON,EAAaM,MAgB1BH,ECxCT,SAAwBI,EAAiBC,OAEjCC,EAA4BD,EAAOC,WAAa,KAChDC,EAA4BF,EAAOE,WAAa,KAChDC,EAAaH,EAAOG,eACpBC,EAAWJ,EAAOI,UAAY,EAC9BC,WACiBC,IAArBN,EAAOO,UAA0BP,EAAOO,UAAYxB,GACnDiB,EAAOF,IACJU,EAAUR,EAAOQ,QACjBC,GAAiC,IAArBT,EAAOS,UAAsB,mBAAKC,GAAIC,EAGpDC,KACAC,KACAC,KACAC,EAA4B,KAC5BC,EAAe,cA2BVC,OACsB,IAAzBH,EAAcI,cACZH,GAAcI,cAAcJ,UACjB,UAIbjB,EAAMgB,EAAcM,QACpBC,EAAWlB,EAAWmB,OAAO,SAACC,EAAUC,UACnCA,EAAYC,GAAGF,EAAUzB,EAAKc,IACpCA,EAAUd,YAEIQ,IAAbe,QAEYvB,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