redux-simple-router
Advanced tools
Comparing version 1.0.2 to 2.0.0
## HEAD | ||
## [1.0.0](https://github.com/jlongster/redux-simple-router/compare/1.0.0...1.0.1) | ||
* New API that uses middleware to trap history calls for a better | ||
unidirectional data flow. New docs and updates coming soon (#141) | ||
## [1.0.2](https://github.com/jlongster/redux-simple-router/compare/1.0.1...1.0.2) | ||
* Only publish relevant files to npm | ||
## [1.0.1](https://github.com/jlongster/redux-simple-router/compare/1.0.0...1.0.1) | ||
* Solve problem with `basename` causing infinite redirects (#103) | ||
@@ -7,0 +14,0 @@ * Switched to ES6 imports/exports internally, but should not affect outside users |
236
lib/index.js
'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.routeReducer = exports.UPDATE_PATH = undefined; | ||
exports.pushPath = pushPath; | ||
exports.replacePath = replacePath; | ||
exports.syncReduxAndRouter = syncReduxAndRouter; | ||
exports.routeReducer = routeReducer; | ||
exports.syncHistory = syncHistory; | ||
// Constants | ||
var _deepEqual = require('deep-equal'); | ||
var TRANSITION = exports.TRANSITION = '@@router/TRANSITION'; | ||
var UPDATE_LOCATION = exports.UPDATE_LOCATION = '@@router/UPDATE_LOCATION'; | ||
var _deepEqual2 = _interopRequireDefault(_deepEqual); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// Constants | ||
var INIT_PATH = '@@router/INIT_PATH'; | ||
var UPDATE_PATH = exports.UPDATE_PATH = '@@router/UPDATE_PATH'; | ||
var SELECT_STATE = function SELECT_STATE(state) { | ||
@@ -27,74 +17,40 @@ return state.routing; | ||
// Action creators | ||
function initPath(path, state) { | ||
return { | ||
type: INIT_PATH, | ||
payload: { | ||
path: path, | ||
state: state, | ||
replace: false, | ||
avoidRouterUpdate: true | ||
} | ||
function transition(method) { | ||
return function (arg) { | ||
return { | ||
type: TRANSITION, | ||
method: method, arg: arg | ||
}; | ||
}; | ||
} | ||
function pushPath(path, state) { | ||
var _ref = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var push = exports.push = transition('push'); | ||
var replace = exports.replace = transition('replace'); | ||
var _ref$avoidRouterUpdat = _ref.avoidRouterUpdate; | ||
var avoidRouterUpdate = _ref$avoidRouterUpdat === undefined ? false : _ref$avoidRouterUpdat; | ||
// TODO: Add go, goBack, goForward. | ||
function updateLocation(location) { | ||
return { | ||
type: UPDATE_PATH, | ||
payload: { | ||
path: path, | ||
state: state, | ||
replace: false, | ||
avoidRouterUpdate: !!avoidRouterUpdate | ||
} | ||
type: UPDATE_LOCATION, | ||
location: location | ||
}; | ||
} | ||
function replacePath(path, state) { | ||
var _ref2 = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var _ref2$avoidRouterUpda = _ref2.avoidRouterUpdate; | ||
var avoidRouterUpdate = _ref2$avoidRouterUpda === undefined ? false : _ref2$avoidRouterUpda; | ||
return { | ||
type: UPDATE_PATH, | ||
payload: { | ||
path: path, | ||
state: state, | ||
replace: true, | ||
avoidRouterUpdate: !!avoidRouterUpdate | ||
} | ||
}; | ||
} | ||
// Reducer | ||
var initialState = { | ||
changeId: 1, | ||
path: undefined, | ||
state: undefined, | ||
replace: false | ||
location: undefined | ||
}; | ||
function update() { | ||
function routeReducer() { | ||
var state = arguments.length <= 0 || arguments[0] === undefined ? initialState : arguments[0]; | ||
var _ref3 = arguments[1]; | ||
var type = _ref3.type; | ||
var payload = _ref3.payload; | ||
var _ref = arguments[1]; | ||
var type = _ref.type; | ||
var location = _ref.location; | ||
if (type === INIT_PATH || type === UPDATE_PATH) { | ||
return _extends({}, state, { | ||
path: payload.path, | ||
changeId: state.changeId + (payload.avoidRouterUpdate ? 0 : 1), | ||
state: payload.state, | ||
replace: payload.replace | ||
}); | ||
if (type !== UPDATE_LOCATION) { | ||
return state; | ||
} | ||
return state; | ||
return { location: location }; | ||
} | ||
@@ -104,93 +60,87 @@ | ||
function locationsAreEqual(a, b) { | ||
return a != null && b != null && a.path === b.path && (0, _deepEqual2.default)(a.state, b.state); | ||
} | ||
function syncHistory(history) { | ||
var unsubscribeHistory = undefined, | ||
currentKey = undefined, | ||
unsubscribeStore = undefined; | ||
var connected = false, | ||
syncing = false; | ||
function createPath(location) { | ||
var pathname = location.pathname; | ||
var search = location.search; | ||
var hash = location.hash; | ||
function middleware(store) { | ||
unsubscribeHistory = history.listen(function (location) { | ||
currentKey = location.key; | ||
if (syncing) { | ||
// Don't dispatch a new action if we're replaying location. | ||
return; | ||
} | ||
var result = pathname; | ||
if (search) result += search; | ||
if (hash) result += hash; | ||
return result; | ||
} | ||
store.dispatch(updateLocation(location)); | ||
}); | ||
function syncReduxAndRouter(history, store) { | ||
var selectRouterState = arguments.length <= 2 || arguments[2] === undefined ? SELECT_STATE : arguments[2]; | ||
connected = true; | ||
var getRouterState = function getRouterState() { | ||
return selectRouterState(store.getState()); | ||
}; | ||
return function (next) { | ||
return function (action) { | ||
if (action.type !== TRANSITION || !connected) { | ||
next(action); | ||
return; | ||
} | ||
// To properly handle store updates we need to track the last route. | ||
// This route contains a `changeId` which is updated on every | ||
// `pushPath` and `replacePath`. If this id changes we always | ||
// trigger a history update. However, if the id does not change, we | ||
// check if the location has changed, and if it is we trigger a | ||
// history update. It's possible for this to happen when something | ||
// reloads the entire app state such as redux devtools. | ||
var lastRoute = undefined; | ||
// FIXME: Is it correct to swallow the TRANSITION action here and replace | ||
// it with UPDATE_LOCATION instead? We could also use the same type in | ||
// both places instead and just set the location on the action. | ||
if (!getRouterState()) { | ||
throw new Error('Cannot sync router: route state does not exist. Did you ' + 'install the routing reducer?'); | ||
var method = action.method; | ||
var arg = action.arg; | ||
history[method](arg); | ||
}; | ||
}; | ||
} | ||
var unsubscribeHistory = history.listen(function (location) { | ||
var route = { | ||
path: createPath(location), | ||
state: location.state | ||
middleware.syncHistoryToStore = function (store) { | ||
var selectRouterState = arguments.length <= 1 || arguments[1] === undefined ? SELECT_STATE : arguments[1]; | ||
var getRouterState = function getRouterState() { | ||
return selectRouterState(store.getState()); | ||
}; | ||
if (!lastRoute) { | ||
// `initialState` *should* represent the current location when | ||
// the app loads, but we cannot get the current location when it | ||
// is defined. What happens is `history.listen` is called | ||
// immediately when it is registered, and it updates the app | ||
// state with an UPDATE_PATH action. This causes problem when | ||
// users are listening to UPDATE_PATH actions just for | ||
// *changes*, and with redux devtools because "revert" will use | ||
// `initialState` and it won't revert to the original URL. | ||
// Instead, we specialize the first route notification and do | ||
// different things based on it. | ||
initialState = { | ||
changeId: 1, | ||
path: route.path, | ||
state: route.state, | ||
replace: false | ||
}; | ||
var _getRouterState = getRouterState(); | ||
// Also set `lastRoute` so that the store subscriber doesn't | ||
// trigger an unnecessary `pushState` on load | ||
lastRoute = initialState; | ||
var initialLocation = _getRouterState.location; | ||
store.dispatch(initPath(route.path, route.state)); | ||
} else if (!locationsAreEqual(getRouterState(), route)) { | ||
// The above check avoids dispatching an action if the store is | ||
// already up-to-date | ||
var method = location.action === 'REPLACE' ? replacePath : pushPath; | ||
store.dispatch(method(route.path, route.state, { avoidRouterUpdate: true })); | ||
} | ||
}); | ||
unsubscribeStore = store.subscribe(function () { | ||
var _getRouterState2 = getRouterState(); | ||
var unsubscribeStore = store.subscribe(function () { | ||
var routing = getRouterState(); | ||
var location = _getRouterState2.location; | ||
// Only trigger history update if this is a new change or the | ||
// location has changed. | ||
if (lastRoute.changeId !== routing.changeId || !locationsAreEqual(lastRoute, routing)) { | ||
// If we're resetting to the beginning, use the saved initial value. We | ||
// need to dispatch a new action at this point to populate the store | ||
// appropriately. | ||
lastRoute = routing; | ||
var method = routing.replace ? 'replaceState' : 'pushState'; | ||
history[method](routing.state, routing.path); | ||
if (!location) { | ||
history.transitionTo(initialLocation); | ||
return; | ||
} | ||
// Otherwise, if we need to update the history location, do so without | ||
// dispatching a new action, as we're just bringing history in sync | ||
// with the store. | ||
if (location.key !== currentKey) { | ||
syncing = true; | ||
history.transitionTo(location); | ||
syncing = false; | ||
} | ||
}); | ||
}; | ||
middleware.unsubscribe = function () { | ||
unsubscribeHistory(); | ||
if (unsubscribeStore) { | ||
unsubscribeStore(); | ||
} | ||
}); | ||
return function unsubscribe() { | ||
unsubscribeHistory(); | ||
unsubscribeStore(); | ||
connected = false; | ||
}; | ||
return middleware; | ||
} | ||
exports.routeReducer = update; |
@@ -1,9 +0,57 @@ | ||
## HEAD | ||
## [HEAD] | ||
> Unreleased | ||
- **Bugfix:** Don't throw in memory history when out of history entries ([#170]) | ||
- **Bugfix:** Fix the deprecation warnings on `createPath` and `createHref` ([#189]) | ||
[HEAD]: https://github.com/rackt/history/compare/latest...HEAD | ||
[#170]: https://github.com/rackt/history/pull/170 | ||
[#189]: https://github.com/rackt/history/pull/189 | ||
## [v1.16.0] | ||
- **Bugfix:** Silence all warnings that were introduced since 1.13 (see [rackt/react-router#2682]) | ||
- **Deprecation:** Deprecate the `createLocation` method in the top-level exports | ||
- **Deprecation:** Deprecate the `state` arg to `history.createLocation` | ||
[v1.16.0]: https://github.com/rackt/history/compare/v1.15.0...v1.16.0 | ||
[rackt/react-router#2682]: https://github.com/rackt/react-router/issues/2682 | ||
## [v1.15.0] | ||
> Dec 7, 2015 | ||
- **Feature:** Accept location descriptors in `createPath` and `createHref` ([#173]) | ||
- **Deprecation:** Deprecate the `query` arg to `createPath` and `createHref` in favor of using location descriptor objects ([#173]) | ||
[v1.15.0]: https://github.com/rackt/history/compare/v1.14.0...v1.15.0 | ||
[#173]: https://github.com/rackt/history/pull/173 | ||
## [v1.14.0] | ||
> Dec 6, 2015 | ||
- **Feature:** Accept objects in `history.push` and `history.replace` ([#141]) | ||
- **Deprecation:** Deprecate `history.pushState` and `history.replaceState` in favor of passing objects to `history.push` and `history.replace` ([#168]) | ||
- **Bugfix:** Disable browser history on Chrome iOS ([#146]) | ||
- **Bugfix:** Do not convert same-path PUSH to REPLACE if the hash has changed ([#167]) | ||
- Add ES2015 module build ([#152]) | ||
- Use query-string module instead of qs to save on bytes ([#121]) | ||
[v1.14.0]: https://github.com/rackt/history/compare/v1.13.1...v1.14.0 | ||
[#121]: https://github.com/rackt/history/issues/121 | ||
[#141]: https://github.com/rackt/history/pull/141 | ||
[#146]: https://github.com/rackt/history/pull/146 | ||
[#152]: https://github.com/rackt/history/pull/152 | ||
[#167]: https://github.com/rackt/history/pull/167 | ||
[#168]: https://github.com/rackt/history/pull/168 | ||
## [v1.13.1] | ||
> Nov 13, 2015 | ||
- Fail gracefully when Safari security settings prevent access to window.sessionStorage | ||
- Pushing the currently active path will result in a replace to not create additional browser history entries (see [#43]) | ||
- Strip the protocol and domain from `<base href>` (see [#139]) | ||
- Pushing the currently active path will result in a replace to not create additional browser history entries ([#43]) | ||
- Strip the protocol and domain from `<base href>` ([#139]) | ||
[v1.13.1]: https://github.com/rackt/history/compare/v1.13.0...v1.13.1 | ||
[#43]: https://github.com/rackt/history/pull/43 | ||
[#139]: https://github.com/rackt/history/pull/139 | ||
[#139]: https://github.com/rackt/history/pull/139 | ||
@@ -13,5 +61,5 @@ ## [v1.13.0] | ||
- `useBasename` transparently handles trailing slashes (see [#108]) | ||
- `useBasename` transparently handles trailing slashes ([#108]) | ||
- `useBasename` automatically uses the value of `<base href>` when no | ||
`basename` option is provided (see [#94]) | ||
`basename` option is provided ([#94]) | ||
@@ -26,3 +74,3 @@ [v1.13.0]: https://github.com/rackt/history/compare/v1.12.6...v1.13.0 | ||
- Add `forceRefresh` option to `createBrowserHistory` that forces | ||
full page refreshes even when the browser supports pushState (see [#95]) | ||
full page refreshes even when the browser supports pushState ([#95]) | ||
@@ -38,3 +86,3 @@ [v1.12.6]: https://github.com/rackt/history/compare/v1.12.5...v1.12.6 | ||
a path can be used | ||
- Fix `useQueries` handling of hashes (see [#93]) | ||
- Fix `useQueries` handling of hashes ([#93]) | ||
@@ -47,3 +95,3 @@ [v1.12.5]: https://github.com/rackt/history/compare/v1.12.4...v1.12.5 | ||
- Fix npm postinstall hook on Windows (see [#62]) | ||
- Fix npm postinstall hook on Windows ([#62]) | ||
@@ -56,4 +104,4 @@ [v1.12.4]: https://github.com/rackt/history/compare/v1.12.3...v1.12.4 | ||
- Fix listenBefore hooks not being called unless a listen hook was also registered (see [#71]) | ||
- Add a warning when we cannot save state in Safari private mode (see [#42]) | ||
- Fix listenBefore hooks not being called unless a listen hook was also registered ([#71]) | ||
- Add a warning when we cannot save state in Safari private mode ([#42]) | ||
@@ -91,6 +139,7 @@ [v1.12.3]: https://github.com/rackt/history/compare/v1.12.2...v1.12.3 | ||
- Fix `location.basename` when location matches exactly (see #68) | ||
- Fix `location.basename` when location matches exactly ([#68]) | ||
- Allow transitions to be interrupted by another | ||
[v1.11.1]: https://github.com/rackt/history/compare/v1.11.0...v1.11.1 | ||
[#68]: https://github.com/rackt/history/issues/68 | ||
@@ -97,0 +146,0 @@ ## [v1.11.0] |
@@ -20,7 +20,6 @@ ## Basename Support | ||
Basename-enhanced histories also automatically prepend the basename to paths used in `pushState`, `push`, `replaceState`, `replace`, `createPath`, and `createHref`. | ||
Basename-enhanced histories also automatically prepend the basename to paths used in `push`, `replace`, `createPath`, and `createHref`. | ||
```js | ||
history.createPath('/the/path') // /base/the/path | ||
history.pushState(null, '/the/path') // push /base/the/path | ||
history.push('/the/path') // push /base/the/path | ||
@@ -27,0 +26,0 @@ ``` |
@@ -30,4 +30,4 @@ ## Getting Started | ||
- `pushState(state, path)` | ||
- `replaceState(state, path)` | ||
- `push(location)` | ||
- `replace(location)` | ||
- `go(n)` | ||
@@ -37,19 +37,23 @@ - `goBack()` | ||
There are also two handy methods that allow you not to specify `state` object during transitions: | ||
The `push` and `replace` methods take a [path string](Glossary.md#path) that represents a complete URL path, including the [search string](Glossary.md#search) and [hash](Glossary.md#hash). | ||
- `push(path[, state])` | ||
- `replace(path[, state])` | ||
They can also accept a [location descriptor](Glossary.md#locationdescriptor) object that defines the path as a combination of [`pathname`](Glossary.md#pathname), [`search`](Glossary.md#search), and [`hash`](Glossary.md#hash). This object can also include [`state`](Glossary.md#locationstate) as a JSON-serializable object. | ||
The [`path`](Glossary.md#path) argument to `pushState`, `push`, `replaceState` and `replace` represents a complete URL path, including the [search string](Glossary.md#search) and [hash](Glossary.md#hash). The [`state`](Glossary.md#locationstate) argument should be a JSON-serializable object. | ||
```js | ||
// Push a new entry onto the history stack. | ||
history.pushState({ some: 'state' }, '/home') | ||
history.push('/home') | ||
// Replace the current entry on the history stack. | ||
history.replaceState({ some: 'other state' }, '/profile') | ||
history.replace('/profile') | ||
// Push a new history entry, omitting `state` object (it will be set to `null`) | ||
history.push('/about') | ||
// Push a new entry with state onto the history stack. | ||
history.push({ | ||
pathname: '/about', | ||
search: '?the=search', | ||
state: { some: 'state' } | ||
}) | ||
// Change just the search on an existing location. | ||
history.push({ ...location, search: '?the=other+search' }) | ||
// Go back to the previous history entry. The following | ||
@@ -56,0 +60,0 @@ // two lines are synonymous. |
@@ -14,2 +14,3 @@ ## Glossary | ||
* [Location](#location) | ||
* [LocationDescriptor](#locationdescriptor) | ||
* [LocationKey](#locationkey) | ||
@@ -67,6 +68,4 @@ * [LocationListener](#locationlistener) | ||
transitionTo(location: Location) => void; | ||
pushState(state: LocationState, path: Path) => void; | ||
push(path: Path) => void; | ||
replaceState(state: LocationState, path: Path) => void; | ||
replace(path: Path) => void; | ||
push(location: LocationDescriptor) => void; | ||
replace(location: LocationDescriptor) => void; | ||
go(n: number) => void; | ||
@@ -76,4 +75,4 @@ goBack() => void; | ||
createKey() => LocationKey; | ||
createPath(path: Path) => Path; | ||
createHref(path: Path) => Href; | ||
createPath(location: LocationDescriptor) => Path; | ||
createHref(location: LocationDescriptor) => Href; | ||
}; | ||
@@ -111,2 +110,19 @@ | ||
### LocationDescriptor | ||
type LocationDescriptorObject = { | ||
pathname: Pathname; | ||
search: Search; | ||
query: Query; | ||
state: LocationState; | ||
}; | ||
type LocationDescriptor = LocationDescriptorObject | Path; | ||
A *location descriptor* is the pushable analogue of a location. The `history` object uses `location`s to tell its listeners where they _are_, while history users use location descriptors to tell the `history` object where to _go_. | ||
The object signature is compatible with that of `location`, differing only in ignoring the internally-generated `action` and `key` fields. This allows you to build a location descriptor from an existing `location`, which can be used to change only specific fields on the `location`. | ||
For convenience, you can always use path strings instead of objects wherever a location descriptor is expected. | ||
### LocationKey | ||
@@ -113,0 +129,0 @@ |
@@ -15,2 +15,19 @@ ## Location | ||
### Location Descriptors | ||
[Location descriptors](Glossary.md#locationdescriptor) can be either objects or path strings. As objects, they are like `location` objects, except they ignore the internally-generated `action` and `key` fields. | ||
You can use location descriptors to call `history.push` and `history.replace`. Location descriptor objects can define just the portions of the next `location` that you want to set. They can also extend an existing `location` object to change only specific fields on that `location`. | ||
```js | ||
// Pushing a path string. | ||
history.push('/the/path') | ||
// Omitting location state when pushing a location descriptor. | ||
history.push({ pathname: '/the/path', search: '?the=search' }) | ||
// Extending an existing location object. | ||
history.push({ ...location, search: '?other=search' }) | ||
``` | ||
### Programmatic Creation | ||
@@ -17,0 +34,0 @@ |
@@ -8,27 +8,27 @@ ## Query Support | ||
// Use the built-in query parsing/serialization. | ||
let history = useQueries(createHistory)() | ||
const history = useQueries(createHistory)() | ||
// Use custom query parsing/serialization. | ||
let history = useQueries(createHistory)({ | ||
history.listen(function (location) { | ||
console.log(location.query) | ||
}) | ||
``` | ||
If you need custom query parsing and/or serialization, you can override either using the `parseQueryString` and `stringifyQuery` options, respectively. | ||
```js | ||
const history = useQueries(createHistory)({ | ||
parseQueryString: function (queryString) { | ||
return qs.parse(queryString) | ||
// TODO: return a parsed version of queryString | ||
}, | ||
stringifyQuery: function (query) { | ||
return qs.stringify(query, { arrayFormat: 'brackets' }) | ||
// TODO: return a query string created from query | ||
} | ||
}) | ||
history.listen(function (location) { | ||
console.log(location.query) | ||
}) | ||
``` | ||
Query-enhanced histories also accept URL queries as trailing arguments to `pushState`, `replaceState`, `createPath`, `createHref` and as second arguments to `push` and `replace`. | ||
Query-enhanced histories accept URL queries as the `query` key for `push`, `replace`, `createPath`, and `createHref`. | ||
```js | ||
history.createPath('/the/path', { the: 'query' }) | ||
history.pushState(null, '/the/path', { the: 'query' }) | ||
history.push('/the/path', { the: 'query' }) | ||
history.replace('/the/path', { the: 'query' }, { the: 'state' }) | ||
history.createPath({ pathname: '/the/path', query: { the: 'query' } }) | ||
history.push({ pathname: '/the/path', query: { the: 'query' } }) | ||
``` |
@@ -25,2 +25,6 @@ 'use strict'; | ||
var _parsePath = require('./parsePath'); | ||
var _parsePath2 = _interopRequireDefault(_parsePath); | ||
/** | ||
@@ -62,3 +66,5 @@ * Creates and returns a history object that uses HTML5's history API | ||
return history.createLocation(path, state, undefined, key); | ||
var location = _parsePath2['default'](path); | ||
return history.createLocation(_extends({}, location, { state: state }), undefined, key); | ||
} | ||
@@ -65,0 +71,0 @@ |
@@ -29,2 +29,6 @@ 'use strict'; | ||
var _parsePath = require('./parsePath'); | ||
var _parsePath2 = _interopRequireDefault(_parsePath); | ||
function isAbsolutePath(path) { | ||
@@ -88,3 +92,5 @@ return typeof path === 'string' && path.charAt(0) === '/'; | ||
return history.createLocation(path, state, undefined, key); | ||
var location = _parsePath2['default'](path); | ||
return history.createLocation(_extends({}, location, { state: state }), undefined, key); | ||
} | ||
@@ -176,12 +182,12 @@ | ||
function pushState(state, path) { | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined; | ||
function push(location) { | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined; | ||
history.pushState(state, path); | ||
history.push(location); | ||
} | ||
function replaceState(state, path) { | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined; | ||
function replace(location) { | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined; | ||
history.replaceState(state, path); | ||
history.replace(location); | ||
} | ||
@@ -215,11 +221,28 @@ | ||
// deprecated | ||
function pushState(state, path) { | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined; | ||
history.pushState(state, path); | ||
} | ||
// deprecated | ||
function replaceState(state, path) { | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined; | ||
history.replaceState(state, path); | ||
} | ||
return _extends({}, history, { | ||
listenBefore: listenBefore, | ||
listen: listen, | ||
pushState: pushState, | ||
replaceState: replaceState, | ||
push: push, | ||
replace: replace, | ||
go: go, | ||
createHref: createHref, | ||
registerTransitionHook: registerTransitionHook, | ||
unregisterTransitionHook: unregisterTransitionHook | ||
registerTransitionHook: registerTransitionHook, // deprecated - warning is in createHistory | ||
unregisterTransitionHook: unregisterTransitionHook, // deprecated - warning is in createHistory | ||
pushState: pushState, // deprecated - warning is in createHistory | ||
replaceState: replaceState // deprecated - warning is in createHistory | ||
}); | ||
@@ -226,0 +249,0 @@ } |
@@ -0,1 +1,2 @@ | ||
//import warning from 'warning' | ||
'use strict'; | ||
@@ -25,2 +26,6 @@ | ||
var _parsePath = require('./parsePath'); | ||
var _parsePath2 = _interopRequireDefault(_parsePath); | ||
var _deprecate = require('./deprecate'); | ||
@@ -146,11 +151,6 @@ | ||
if (nextLocation.action === _Actions.PUSH) { | ||
var _getCurrentLocation = getCurrentLocation(); | ||
var prevPath = createPath(location); | ||
var nextPath = createPath(nextLocation); | ||
var pathname = _getCurrentLocation.pathname; | ||
var search = _getCurrentLocation.search; | ||
var currentPath = pathname + search; | ||
var path = nextLocation.pathname + nextLocation.search; | ||
if (currentPath === path) nextLocation.action = _Actions.REPLACE; | ||
if (nextPath === prevPath) nextLocation.action = _Actions.REPLACE; | ||
} | ||
@@ -168,18 +168,10 @@ | ||
function pushState(state, path) { | ||
transitionTo(createLocation(path, state, _Actions.PUSH, createKey())); | ||
function push(location) { | ||
transitionTo(createLocation(location, _Actions.PUSH, createKey())); | ||
} | ||
function push(path) { | ||
pushState(null, path); | ||
function replace(location) { | ||
transitionTo(createLocation(location, _Actions.REPLACE, createKey())); | ||
} | ||
function replaceState(state, path) { | ||
transitionTo(createLocation(path, state, _Actions.REPLACE, createKey())); | ||
} | ||
function replace(path) { | ||
replaceState(null, path); | ||
} | ||
function goBack() { | ||
@@ -197,8 +189,8 @@ go(-1); | ||
function createPath(path) { | ||
if (path == null || typeof path === 'string') return path; | ||
function createPath(location) { | ||
if (location == null || typeof location === 'string') return location; | ||
var pathname = path.pathname; | ||
var search = path.search; | ||
var hash = path.hash; | ||
var pathname = location.pathname; | ||
var search = location.search; | ||
var hash = location.hash; | ||
@@ -214,10 +206,25 @@ var result = pathname; | ||
function createHref(path) { | ||
return createPath(path); | ||
function createHref(location) { | ||
return createPath(location); | ||
} | ||
function createLocation(path, state, action) { | ||
var key = arguments.length <= 3 || arguments[3] === undefined ? createKey() : arguments[3]; | ||
function createLocation(location, action) { | ||
var key = arguments.length <= 2 || arguments[2] === undefined ? createKey() : arguments[2]; | ||
return _createLocation3['default'](path, state, action, key); | ||
if (typeof action === 'object') { | ||
//warning( | ||
// false, | ||
// 'The state (2nd) argument to history.createLocation is deprecated; use a ' + | ||
// 'location descriptor instead' | ||
//) | ||
if (typeof location === 'string') location = _parsePath2['default'](location); | ||
location = _extends({}, location, { state: action }); | ||
action = key; | ||
key = arguments[3] || createKey(); | ||
} | ||
return _createLocation3['default'](location, action, key); | ||
} | ||
@@ -252,2 +259,16 @@ | ||
// deprecated | ||
function pushState(state, path) { | ||
if (typeof path === 'string') path = _parsePath2['default'](path); | ||
push(_extends({ state: state }, path)); | ||
} | ||
// deprecated | ||
function replaceState(state, path) { | ||
if (typeof path === 'string') path = _parsePath2['default'](path); | ||
replace(_extends({ state: state }, path)); | ||
} | ||
return { | ||
@@ -257,4 +278,2 @@ listenBefore: listenBefore, | ||
transitionTo: transitionTo, | ||
pushState: pushState, | ||
replaceState: replaceState, | ||
push: push, | ||
@@ -272,3 +291,5 @@ replace: replace, | ||
registerTransitionHook: _deprecate2['default'](registerTransitionHook, 'registerTransitionHook is deprecated; use listenBefore instead'), | ||
unregisterTransitionHook: _deprecate2['default'](unregisterTransitionHook, 'unregisterTransitionHook is deprecated; use the callback returned from listenBefore instead') | ||
unregisterTransitionHook: _deprecate2['default'](unregisterTransitionHook, 'unregisterTransitionHook is deprecated; use the callback returned from listenBefore instead'), | ||
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'), | ||
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead') | ||
}; | ||
@@ -275,0 +296,0 @@ } |
@@ -0,1 +1,2 @@ | ||
//import warning from 'warning' | ||
'use strict'; | ||
@@ -5,2 +6,4 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -15,13 +18,28 @@ | ||
function createLocation() { | ||
var path = arguments.length <= 0 || arguments[0] === undefined ? '/' : arguments[0]; | ||
var state = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; | ||
var action = arguments.length <= 2 || arguments[2] === undefined ? _Actions.POP : arguments[2]; | ||
var key = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; | ||
var location = arguments.length <= 0 || arguments[0] === undefined ? '/' : arguments[0]; | ||
var action = arguments.length <= 1 || arguments[1] === undefined ? _Actions.POP : arguments[1]; | ||
var key = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; | ||
if (typeof path === 'string') path = _parsePath2['default'](path); | ||
var _fourthArg = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; | ||
var pathname = path.pathname || '/'; | ||
var search = path.search || ''; | ||
var hash = path.hash || ''; | ||
if (typeof location === 'string') location = _parsePath2['default'](location); | ||
if (typeof action === 'object') { | ||
//warning( | ||
// false, | ||
// 'The state (2nd) argument to createLocation is deprecated; use a ' + | ||
// 'location descriptor instead' | ||
//) | ||
location = _extends({}, location, { state: action }); | ||
action = key || _Actions.POP; | ||
key = _fourthArg; | ||
} | ||
var pathname = location.pathname || '/'; | ||
var search = location.search || ''; | ||
var hash = location.hash || ''; | ||
var state = location.state || null; | ||
return { | ||
@@ -28,0 +46,0 @@ pathname: pathname, |
@@ -9,2 +9,6 @@ 'use strict'; | ||
var _warning = require('warning'); | ||
var _warning2 = _interopRequireDefault(_warning); | ||
var _invariant = require('invariant'); | ||
@@ -20,2 +24,6 @@ | ||
var _parsePath = require('./parsePath'); | ||
var _parsePath2 = _interopRequireDefault(_parsePath); | ||
function createStateStorage(entries) { | ||
@@ -100,3 +108,5 @@ return entries.filter(function (entry) { | ||
return history.createLocation(path, state, undefined, key); | ||
var location = _parsePath2['default'](path); | ||
return history.createLocation(_extends({}, location, { state: state }), undefined, key); | ||
} | ||
@@ -111,3 +121,6 @@ | ||
if (n) { | ||
!canGo(n) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Cannot go(%s) there is not enough history', n) : _invariant2['default'](false) : undefined; | ||
if (!canGo(n)) { | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'Cannot go(%s) there is not enough history', n) : undefined; | ||
return; | ||
} | ||
@@ -114,0 +127,0 @@ current += n; |
@@ -1,19 +0,15 @@ | ||
'use strict'; | ||
//import warning from 'warning' | ||
"use strict"; | ||
exports.__esModule = true; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _warning = require('warning'); | ||
var _warning2 = _interopRequireDefault(_warning); | ||
function deprecate(fn, message) { | ||
return function () { | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, '[history] ' + message) : undefined; | ||
return fn.apply(this, arguments); | ||
}; | ||
function deprecate(fn) { | ||
return fn; | ||
//return function () { | ||
// warning(false, '[history] ' + message) | ||
// return fn.apply(this, arguments) | ||
//} | ||
} | ||
exports['default'] = deprecate; | ||
module.exports = exports['default']; | ||
exports["default"] = deprecate; | ||
module.exports = exports["default"]; |
@@ -53,3 +53,3 @@ 'use strict'; | ||
/** | ||
* Returns true if the HTML5 history API is supported. Taken from modernizr. | ||
* Returns true if the HTML5 history API is supported. Taken from Modernizr. | ||
* | ||
@@ -66,2 +66,7 @@ * https://github.com/Modernizr/Modernizr/blob/master/LICENSE | ||
} | ||
// FIXME: Work around our browser history not working correctly on Chrome | ||
// iOS: https://github.com/rackt/react-router/issues/2565 | ||
if (ua.indexOf('CriOS') !== -1) { | ||
return false; | ||
} | ||
return window.history && 'pushState' in window.history; | ||
@@ -68,0 +73,0 @@ } |
@@ -7,2 +7,10 @@ 'use strict'; | ||
var _deprecate = require('./deprecate'); | ||
var _deprecate2 = _interopRequireDefault(_deprecate); | ||
var _createLocation2 = require('./createLocation'); | ||
var _createLocation3 = _interopRequireDefault(_createLocation2); | ||
var _createBrowserHistory = require('./createBrowserHistory'); | ||
@@ -26,8 +34,2 @@ | ||
var _createLocation2 = require('./createLocation'); | ||
var _createLocation3 = _interopRequireDefault(_createLocation2); | ||
exports.createLocation = _createLocation3['default']; | ||
var _useBasename2 = require('./useBasename'); | ||
@@ -69,2 +71,4 @@ | ||
exports.enableQueries = _enableQueries3['default']; | ||
exports.enableQueries = _enableQueries3['default']; | ||
var createLocation = _deprecate2['default'](_createLocation3['default'], 'Using createLocation without a history instance is deprecated; please use history.createLocation instead'); | ||
exports.createLocation = createLocation; |
@@ -25,2 +25,6 @@ 'use strict'; | ||
var _deprecate = require('./deprecate'); | ||
var _deprecate2 = _interopRequireDefault(_deprecate); | ||
function useBasename(createHistory) { | ||
@@ -58,8 +62,8 @@ return function () { | ||
function prependBasename(path) { | ||
if (!basename) return path; | ||
function prependBasename(location) { | ||
if (!basename) return location; | ||
if (typeof path === 'string') path = _parsePath2['default'](path); | ||
if (typeof location === 'string') location = _parsePath2['default'](location); | ||
var pname = path.pathname; | ||
var pname = location.pathname; | ||
var normalizedBasename = basename.slice(-1) === '/' ? basename : basename + '/'; | ||
@@ -69,3 +73,3 @@ var normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname; | ||
return _extends({}, path, { | ||
return _extends({}, location, { | ||
pathname: pathname | ||
@@ -89,28 +93,34 @@ }); | ||
// Override all write methods with basename-aware versions. | ||
function pushState(state, path) { | ||
history.pushState(state, prependBasename(path)); | ||
function push(location) { | ||
history.push(prependBasename(location)); | ||
} | ||
function push(path) { | ||
pushState(null, path); | ||
function replace(location) { | ||
history.replace(prependBasename(location)); | ||
} | ||
function replaceState(state, path) { | ||
history.replaceState(state, prependBasename(path)); | ||
function createPath(location) { | ||
return history.createPath(prependBasename(location)); | ||
} | ||
function replace(path) { | ||
replaceState(null, path); | ||
function createHref(location) { | ||
return history.createHref(prependBasename(location)); | ||
} | ||
function createPath(path) { | ||
return history.createPath(prependBasename(path)); | ||
function createLocation() { | ||
return addBasename(history.createLocation.apply(history, arguments)); | ||
} | ||
function createHref(path) { | ||
return history.createHref(prependBasename(path)); | ||
// deprecated | ||
function pushState(state, path) { | ||
if (typeof path === 'string') path = _parsePath2['default'](path); | ||
push(_extends({ state: state }, path)); | ||
} | ||
function createLocation() { | ||
return addBasename(history.createLocation.apply(history, arguments)); | ||
// deprecated | ||
function replaceState(state, path) { | ||
if (typeof path === 'string') path = _parsePath2['default'](path); | ||
replace(_extends({ state: state }, path)); | ||
} | ||
@@ -121,9 +131,10 @@ | ||
listen: listen, | ||
pushState: pushState, | ||
push: push, | ||
replaceState: replaceState, | ||
replace: replace, | ||
createPath: createPath, | ||
createHref: createHref, | ||
createLocation: createLocation | ||
createLocation: createLocation, | ||
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'), | ||
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead') | ||
}); | ||
@@ -130,0 +141,0 @@ }; |
@@ -11,6 +11,8 @@ 'use strict'; | ||
var _qs = require('qs'); | ||
var _warning = require('warning'); | ||
var _qs2 = _interopRequireDefault(_qs); | ||
var _warning2 = _interopRequireDefault(_warning); | ||
var _queryString = require('query-string'); | ||
var _runTransitionHook = require('./runTransitionHook'); | ||
@@ -24,8 +26,18 @@ | ||
var _deprecate = require('./deprecate'); | ||
var _deprecate2 = _interopRequireDefault(_deprecate); | ||
var SEARCH_BASE_KEY = '$searchBase'; | ||
function defaultStringifyQuery(query) { | ||
return _qs2['default'].stringify(query, { arrayFormat: 'brackets' }).replace(/%20/g, '+'); | ||
return _queryString.stringify(query).replace(/%20/g, '+'); | ||
} | ||
function defaultParseQueryString(queryString) { | ||
return _qs2['default'].parse(queryString.replace(/\+/g, '%20')); | ||
var defaultParseQueryString = _queryString.parse; | ||
function isNestedObject(object) { | ||
for (var p in object) { | ||
if (object.hasOwnProperty(p) && typeof object[p] === 'object' && !Array.isArray(object[p]) && object[p] !== null) return true; | ||
}return false; | ||
} | ||
@@ -52,18 +64,38 @@ | ||
function addQuery(location) { | ||
if (location.query == null) location.query = parseQueryString(location.search.substring(1)); | ||
if (location.query == null) { | ||
var search = location.search; | ||
location.query = parseQueryString(search.substring(1)); | ||
location[SEARCH_BASE_KEY] = { search: search, searchBase: '' }; | ||
} | ||
// TODO: Instead of all the book-keeping here, this should just strip the | ||
// stringified query from the search. | ||
return location; | ||
} | ||
function appendQuery(path, query) { | ||
function appendQuery(location, query) { | ||
var _extends2; | ||
var queryString = undefined; | ||
if (!query || (queryString = stringifyQuery(query)) === '') return path; | ||
if (!query || (queryString = stringifyQuery(query)) === '') return location; | ||
if (typeof path === 'string') path = _parsePath2['default'](path); | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](stringifyQuery !== defaultStringifyQuery || !isNestedObject(query), 'useQueries does not stringify nested query objects by default; ' + 'use a custom stringifyQuery function') : undefined; | ||
var search = path.search + (path.search ? '&' : '?') + queryString; | ||
if (typeof location === 'string') location = _parsePath2['default'](location); | ||
return _extends({}, path, { | ||
var searchBaseSpec = location[SEARCH_BASE_KEY]; | ||
var searchBase = undefined; | ||
if (searchBaseSpec && location.search === searchBaseSpec.search) { | ||
searchBase = searchBaseSpec.searchBase; | ||
} else { | ||
searchBase = location.search || ''; | ||
} | ||
var search = searchBase + (searchBase ? '&' : '?') + queryString; | ||
return _extends({}, location, (_extends2 = { | ||
search: search | ||
}); | ||
}, _extends2[SEARCH_BASE_KEY] = { search: search, searchBase: searchBase }, _extends2)); | ||
} | ||
@@ -85,16 +117,24 @@ | ||
// Override all write methods with query-aware versions. | ||
function pushState(state, path, query) { | ||
return history.pushState(state, appendQuery(path, query)); | ||
function push(location) { | ||
history.push(appendQuery(location, location.query)); | ||
} | ||
function replaceState(state, path, query) { | ||
return history.replaceState(state, appendQuery(path, query)); | ||
function replace(location) { | ||
history.replace(appendQuery(location, location.query)); | ||
} | ||
function createPath(path, query) { | ||
return history.createPath(appendQuery(path, query)); | ||
function createPath(location, query) { | ||
//warning( | ||
// !query, | ||
// 'the query argument to createPath is deprecated; use a location descriptor instead' | ||
//) | ||
return history.createPath(appendQuery(location, query || location.query)); | ||
} | ||
function createHref(path, query) { | ||
return history.createHref(appendQuery(path, query)); | ||
function createHref(location, query) { | ||
//warning( | ||
// !query, | ||
// 'the query argument to createHref is deprecated; use a location descriptor instead' | ||
//) | ||
return history.createHref(appendQuery(location, query || location.query)); | ||
} | ||
@@ -106,10 +146,27 @@ | ||
// deprecated | ||
function pushState(state, path, query) { | ||
if (typeof path === 'string') path = _parsePath2['default'](path); | ||
push(_extends({ state: state }, path, { query: query })); | ||
} | ||
// deprecated | ||
function replaceState(state, path, query) { | ||
if (typeof path === 'string') path = _parsePath2['default'](path); | ||
replace(_extends({ state: state }, path, { query: query })); | ||
} | ||
return _extends({}, history, { | ||
listenBefore: listenBefore, | ||
listen: listen, | ||
pushState: pushState, | ||
replaceState: replaceState, | ||
push: push, | ||
replace: replace, | ||
createPath: createPath, | ||
createHref: createHref, | ||
createLocation: createLocation | ||
createLocation: createLocation, | ||
pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'), | ||
replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead') | ||
}); | ||
@@ -116,0 +173,0 @@ }; |
{ | ||
"name": "history", | ||
"version": "1.13.1", | ||
"version": "1.17.0", | ||
"description": "A minimal, functional history implementation for JavaScript", | ||
"files": [ | ||
"*.md", | ||
"docs", | ||
"es6", | ||
"lib", | ||
"npm-scripts", | ||
"umd" | ||
], | ||
"main": "lib/index", | ||
@@ -14,3 +22,5 @@ "repository": { | ||
"scripts": { | ||
"build": "babel ./modules --stage 0 --loose all --plugins dev-expression -d lib --ignore '__tests__'", | ||
"build": "npm run build-cjs && npm run build-es6", | ||
"build-cjs": "rimraf lib && babel ./modules --stage 0 --loose all --plugins dev-expression -d lib --ignore '__tests__'", | ||
"build-es6": "rimraf es6 && babel ./modules --stage 0 --loose all --plugins dev-expression -d es6 --blacklist=es6.modules --ignore '__tests__'", | ||
"build-umd": "NODE_ENV=production webpack modules/index.js umd/History.js", | ||
@@ -30,3 +40,3 @@ "build-min": "NODE_ENV=production webpack -p modules/index.js umd/History.min.js", | ||
"invariant": "^2.0.0", | ||
"qs": "^4.0.0", | ||
"query-string": "^3.0.0", | ||
"warning": "^2.0.0" | ||
@@ -70,8 +80,8 @@ }, | ||
], | ||
"gitHead": "bed59dcd4c0b80bfb7a0017f0563bdb54a8e3225", | ||
"gitHead": "daf0bd52b8f3bc862c58faf4c7d5a40c86afed9e", | ||
"homepage": "https://github.com/rackt/history#readme", | ||
"_id": "history@1.13.1", | ||
"_shasum": "1d0664e667f031d5757ef73e81ef847beb3aedcd", | ||
"_from": "history@*", | ||
"_npmVersion": "3.3.6", | ||
"_id": "history@1.17.0", | ||
"_shasum": "c5483caa5a1d1fea00a1a7d8d19b874016711d29", | ||
"_from": "history@>=1.14.0 <2.0.0", | ||
"_npmVersion": "3.4.1", | ||
"_nodeVersion": "5.0.0", | ||
@@ -83,4 +93,4 @@ "_npmUser": { | ||
"dist": { | ||
"shasum": "1d0664e667f031d5757ef73e81ef847beb3aedcd", | ||
"tarball": "http://registry.npmjs.org/history/-/history-1.13.1.tgz" | ||
"shasum": "c5483caa5a1d1fea00a1a7d8d19b874016711d29", | ||
"tarball": "http://registry.npmjs.org/history/-/history-1.17.0.tgz" | ||
}, | ||
@@ -91,11 +101,7 @@ "maintainers": [ | ||
"email": "mjijackson@gmail.com" | ||
}, | ||
{ | ||
"name": "ryanflorence", | ||
"email": "rpflorence@gmail.com" | ||
} | ||
], | ||
"directories": {}, | ||
"_resolved": "https://registry.npmjs.org/history/-/history-1.13.1.tgz", | ||
"_resolved": "https://registry.npmjs.org/history/-/history-1.17.0.tgz", | ||
"readme": "ERROR: No README data found!" | ||
} |
@@ -55,3 +55,7 @@ # history [![Travis][build-badge]][build] [![npm package][npm-badge]][npm] | ||
history.pushState({ the: 'state' }, '/the/path?a=query') | ||
history.push({ | ||
pathname: '/the/path', | ||
search: '?a=query', | ||
state: { the: 'state' } | ||
}) | ||
@@ -58,0 +62,0 @@ // When you're finished, stop the listener. |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.History=t():e.History=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var a=n(18),o=r(a);t.createHistory=o["default"];var i=n(19),u=r(i);t.createHashHistory=u["default"];var s=n(20),c=r(s);t.createMemoryHistory=c["default"];var f=n(12),l=r(f);t.createLocation=l["default"];var d=n(23),p=r(d);t.useBasename=p["default"];var h=n(14),g=r(h);t.useBeforeUnload=g["default"];var v=n(15),y=r(v);t.useQueries=y["default"];var m=n(1),b=r(m);t.Actions=b["default"];var O=n(21),w=r(O);t.enableBeforeUnload=w["default"];var x=n(22),P=r(x);t.enableQueries=P["default"]},function(e,t){"use strict";t.__esModule=!0;var n="PUSH";t.PUSH=n;var r="REPLACE";t.REPLACE=r;var a="POP";t.POP=a,t["default"]={PUSH:n,REPLACE:r,POP:a}},function(e,t,n){"use strict";var r=function(){};e.exports=r},function(e,t){"use strict";t.__esModule=!0;var n=!("undefined"==typeof window||!window.document||!window.document.createElement);t.canUseDOM=n},function(e,t){"use strict";function n(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)}function r(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n)}function a(){return window.location.href.split("#")[1]||""}function o(e){window.location.replace(window.location.pathname+window.location.search+"#"+e)}function i(){return window.location.pathname+window.location.search+window.location.hash}function u(e){e&&window.history.go(e)}function s(e,t){t(window.confirm(e))}function c(){var e=navigator.userAgent;return-1===e.indexOf("Android 2.")&&-1===e.indexOf("Android 4.0")||-1===e.indexOf("Mobile Safari")||-1!==e.indexOf("Chrome")||-1!==e.indexOf("Windows Phone")?window.history&&"pushState"in window.history:!1}function f(){var e=navigator.userAgent;return-1===e.indexOf("Firefox")}t.__esModule=!0,t.addEventListener=n,t.removeEventListener=r,t.getHashPath=a,t.replaceHashPath=o,t.getWindowPath=i,t.go=u,t.getUserConfirmation=s,t.supportsHistory=c,t.supportsGoWithoutReloadUsingHash=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){return function(){return e.apply(this,arguments)}}t.__esModule=!0;var o=n(2);r(o);t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";var r=function(e,t,n,r,a,o,i,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,a,o,i,u],f=0;s=new Error("Invariant Violation: "+t.replace(/%s/g,function(){return c[f++]}))}throw s.framesToPop=1,s}};e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=u["default"](e),n="",r="",a=t.indexOf("#");-1!==a&&(r=t.substring(a),t=t.substring(0,a));var o=t.indexOf("?");return-1!==o&&(n=t.substring(o),t=t.substring(0,o)),""===t&&(t="/"),{pathname:t,search:n,hash:r}}t.__esModule=!0;var o=n(2),i=(r(o),n(13)),u=r(i);t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){var r=e(t,n);e.length<2&&n(r)}t.__esModule=!0;var o=n(2);r(o);t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){return s+e}function o(e,t){try{window.sessionStorage.setItem(a(e),JSON.stringify(t))}catch(n){if(n.name===f)return;if(n.name===c&&0===window.sessionStorage.length)return;throw n}}function i(e){var t=void 0;try{t=window.sessionStorage.getItem(a(e))}catch(n){if(n.name===f)return null}if(t)try{return JSON.parse(t)}catch(n){}return null}t.__esModule=!0,t.saveState=o,t.readState=i;var u=n(2),s=(r(u),"@@History/"),c="QuotaExceededError",f="SecurityError"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){function t(e){return s.canUseDOM?void 0:u["default"](!1),n.listen(e)}var n=l["default"](o({getUserConfirmation:c.getUserConfirmation},e,{go:c.go}));return o({},n,{listen:t})}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(6),u=r(i),s=n(3),c=n(4),f=n(11),l=r(f);t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){return Math.random().toString(36).substr(2,e)}function o(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.key===t.key&&c["default"](e.state,t.state)}function i(){function e(e){return C.push(e),function(){C=C.filter(function(t){return t!==e})}}function t(){return Q&&Q.action===l.POP?R.indexOf(Q.key):D?R.indexOf(D.key):-1}function n(e){var n=t();D=e,D.action===l.PUSH?R=[].concat(R.slice(0,n+1),[D.key]):D.action===l.REPLACE&&(R[n]=D.key),N.forEach(function(e){e(D)})}function r(e){if(N.push(e),D)e(D);else{var t=L();R=[t.key],n(t)}return function(){N=N.filter(function(t){return t!==e})}}function i(e,t){f.loopAsync(C.length,function(t,n,r){g["default"](C[t],e,function(e){null!=e?r(e):n()})},function(e){B&&"string"==typeof e?B(e,function(e){t(e!==!1)}):t(e!==!1)})}function s(e){D&&o(D,e)||(Q=e,i(e,function(t){if(Q===e)if(t){if(e.action===l.PUSH){var r=L(),a=r.pathname,o=r.search,i=a+o,u=e.pathname+e.search;i===u&&(e.action=l.REPLACE)}A(e)!==!1&&n(e)}else if(D&&e.action===l.POP){var s=R.indexOf(D.key),c=R.indexOf(e.key);-1!==s&&-1!==c&&T(s-c)}}))}function c(e,t){s(_(t,e,l.PUSH,w()))}function d(e){c(null,e)}function h(e,t){s(_(t,e,l.REPLACE,w()))}function v(e){h(null,e)}function b(){T(-1)}function O(){T(1)}function w(){return a(U)}function x(e){if(null==e||"string"==typeof e)return e;var t=e.pathname,n=e.search,r=e.hash,a=t;return n&&(a+=n),r&&(a+=r),a}function P(e){return x(e)}function _(e,t,n){var r=arguments.length<=3||void 0===arguments[3]?w():arguments[3];return p["default"](e,t,n,r)}function j(e){D?(H(D,e),n(D)):H(L(),e)}function H(e,t){e.state=u({},e.state,t),E(e.key,e.state)}function S(e){-1===C.indexOf(e)&&C.push(e)}function k(e){C=C.filter(function(t){return t!==e})}var M=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],L=M.getCurrentLocation,A=M.finishTransition,E=M.saveState,T=M.go,U=M.keyLength,B=M.getUserConfirmation;"number"!=typeof U&&(U=m);var C=[],R=[],N=[],D=void 0,Q=void 0;return{listenBefore:e,listen:r,transitionTo:s,pushState:c,replaceState:h,push:d,replace:v,go:T,goBack:b,goForward:O,createKey:w,createPath:x,createHref:P,createLocation:_,setState:y["default"](j,"setState is deprecated; use location.key to save state instead"),registerTransitionHook:y["default"](S,"registerTransitionHook is deprecated; use listenBefore instead"),unregisterTransitionHook:y["default"](k,"unregisterTransitionHook is deprecated; use the callback returned from listenBefore instead")}}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=n(24),c=r(s),f=n(17),l=n(1),d=n(12),p=r(d),h=n(8),g=r(h),v=n(5),y=r(v),m=6;t["default"]=i,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(){var e=arguments.length<=0||void 0===arguments[0]?"/":arguments[0],t=arguments.length<=1||void 0===arguments[1]?null:arguments[1],n=arguments.length<=2||void 0===arguments[2]?o.POP:arguments[2],r=arguments.length<=3||void 0===arguments[3]?null:arguments[3];"string"==typeof e&&(e=u["default"](e));var a=e.pathname||"/",i=e.search||"",s=e.hash||"";return{pathname:a,search:i,hash:s,state:t,action:n,key:r}}t.__esModule=!0;var o=n(1),i=n(7),u=r(i);t["default"]=a,e.exports=t["default"]},function(e,t){"use strict";function n(e){var t=e.match(/^https?:\/\/[^\/]*/);return null==t?e:e.substring(t[0].length)}t.__esModule=!0,t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){function t(t){var n=e();return"string"==typeof n?((t||window.event).returnValue=n,n):void 0}return c.addEventListener(window,"beforeunload",t),function(){c.removeEventListener(window,"beforeunload",t)}}function o(e){return function(t){function n(){for(var e=void 0,t=0,n=d.length;null==e&&n>t;++t)e=d[t].call();return e}function r(e){return d.push(e),1===d.length&&s.canUseDOM&&(f=a(n)),function(){d=d.filter(function(t){return t!==e}),0===d.length&&f&&(f(),f=null)}}function o(e){s.canUseDOM&&-1===d.indexOf(e)&&(d.push(e),1===d.length&&(f=a(n)))}function u(e){d.length>0&&(d=d.filter(function(t){return t!==e}),0===d.length&&f())}var c=e(t),f=void 0,d=[];return i({},c,{listenBeforeUnload:r,registerBeforeUnloadHook:l["default"](o,"registerBeforeUnloadHook is deprecated; use listenBeforeUnload instead"),unregisterBeforeUnloadHook:l["default"](u,"unregisterBeforeUnloadHook is deprecated; use the callback returned from listenBeforeUnload instead")})}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(2),s=(r(u),n(3)),c=n(4),f=n(5),l=r(f);t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e){return f["default"].stringify(e,{arrayFormat:"brackets"}).replace(/%20/g,"+")}function i(e){return f["default"].parse(e.replace(/\+/g,"%20"))}function u(e){return function(){function t(e){return null==e.query&&(e.query=m(e.search.substring(1))),e}function n(e,t){var n=void 0;if(!t||""===(n=y(t)))return e;"string"==typeof e&&(e=h["default"](e));var r=e.search+(e.search?"&":"?")+n;return s({},e,{search:r})}function r(e){return O.listenBefore(function(n,r){d["default"](e,t(n),r)})}function u(e){return O.listen(function(n){e(t(n))})}function c(e,t,r){return O.pushState(e,n(t,r))}function f(e,t,r){return O.replaceState(e,n(t,r))}function l(e,t){return O.createPath(n(e,t))}function p(e,t){return O.createHref(n(e,t))}function g(){return t(O.createLocation.apply(O,arguments))}var v=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],y=v.stringifyQuery,m=v.parseQueryString,b=a(v,["stringifyQuery","parseQueryString"]),O=e(b);return"function"!=typeof y&&(y=o),"function"!=typeof m&&(m=i),s({},O,{listenBefore:r,listen:u,pushState:c,replaceState:f,createPath:l,createHref:p,createLocation:g})}}t.__esModule=!0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=n(27),f=r(c),l=n(8),d=r(l),p=n(7),h=r(p);t["default"]=u,e.exports=t["default"]},function(e,t){var n={};n.hexTable=new Array(256);for(var r=0;256>r;++r)n.hexTable[r]="%"+((16>r?"0":"")+r.toString(16)).toUpperCase();t.arrayToObject=function(e,t){for(var n=t.plainObjects?Object.create(null):{},r=0,a=e.length;a>r;++r)"undefined"!=typeof e[r]&&(n[r]=e[r]);return n},t.merge=function(e,n,r){if(!n)return e;if("object"!=typeof n)return Array.isArray(e)?e.push(n):"object"==typeof e?e[n]=!0:e=[e,n],e;if("object"!=typeof e)return e=[e].concat(n);Array.isArray(e)&&!Array.isArray(n)&&(e=t.arrayToObject(e,r));for(var a=Object.keys(n),o=0,i=a.length;i>o;++o){var u=a[o],s=n[u];Object.prototype.hasOwnProperty.call(e,u)?e[u]=t.merge(e[u],s,r):e[u]=s}return e},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;"string"!=typeof e&&(e=""+e);for(var t="",r=0,a=e.length;a>r;++r){var o=e.charCodeAt(r);45===o||46===o||95===o||126===o||o>=48&&57>=o||o>=65&&90>=o||o>=97&&122>=o?t+=e[r]:128>o?t+=n.hexTable[o]:2048>o?t+=n.hexTable[192|o>>6]+n.hexTable[128|63&o]:55296>o||o>=57344?t+=n.hexTable[224|o>>12]+n.hexTable[128|o>>6&63]+n.hexTable[128|63&o]:(++r,o=65536+((1023&o)<<10|1023&e.charCodeAt(r)),t+=n.hexTable[240|o>>18]+n.hexTable[128|o>>12&63]+n.hexTable[128|o>>6&63]+n.hexTable[128|63&o])}return t},t.compact=function(e,n){if("object"!=typeof e||null===e)return e;n=n||[];var r=n.indexOf(e);if(-1!==r)return n[r];if(n.push(e),Array.isArray(e)){for(var a=[],o=0,i=e.length;i>o;++o)"undefined"!=typeof e[o]&&a.push(e[o]);return a}var u=Object.keys(e);for(o=0,i=u.length;i>o;++o){var s=u[o];e[s]=t.compact(e[s],n)}return e},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null===e||"undefined"==typeof e?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},function(e,t){"use strict";function n(e,t,n){function r(){i=!0,n.apply(this,arguments)}function a(){i||(e>o?t.call(this,o++,a,r):r.apply(this,arguments))}var o=0,i=!1;a()}t.__esModule=!0,t.loopAsync=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(){function e(e){e=e||window.history.state||{};var t=f.getWindowPath(),n=e,r=n.key,a=void 0;return r?a=l.readState(r):(a=null,r=m.createKey(),v&&window.history.replaceState(o({},e,{key:r}),null,t)),m.createLocation(t,a,void 0,r)}function t(t){function n(t){void 0!==t.state&&r(e(t.state))}var r=t.transitionTo;return f.addEventListener(window,"popstate",n),function(){f.removeEventListener(window,"popstate",n)}}function n(e){var t=e.basename,n=e.pathname,r=e.search,a=e.hash,o=e.state,i=e.action,u=e.key;if(i!==s.POP){l.saveState(u,o);var c=(t||"")+n+r+a,f={key:u};if(i===s.PUSH){if(y)return window.location.href=c,!1;window.history.pushState(f,null,c)}else{if(y)return window.location.replace(c),!1;window.history.replaceState(f,null,c)}}}function r(e){1===++b&&(O=t(m));var n=m.listenBefore(e);return function(){n(),0===--b&&O()}}function a(e){1===++b&&(O=t(m));var n=m.listen(e);return function(){n(),0===--b&&O()}}function i(e){1===++b&&(O=t(m)),m.registerTransitionHook(e)}function d(e){m.unregisterTransitionHook(e),0===--b&&O()}var h=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];c.canUseDOM?void 0:u["default"](!1);var g=h.forceRefresh,v=f.supportsHistory(),y=!v||g,m=p["default"](o({},h,{getCurrentLocation:e,finishTransition:n,saveState:l.saveState})),b=0,O=void 0;return o({},m,{listenBefore:r,listen:a,registerTransitionHook:i,unregisterTransitionHook:d})}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(6),u=r(i),s=n(1),c=n(3),f=n(4),l=n(9),d=n(10),p=r(d);t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){return"string"==typeof e&&"/"===e.charAt(0)}function o(){var e=v.getHashPath();return a(e)?!0:(v.replaceHashPath("/"+e),!1)}function i(e,t,n){return e+(-1===e.indexOf("?")?"?":"&")+(t+"="+n)}function u(e,t){return e.replace(new RegExp("[?&]?"+t+"=[a-zA-Z0-9]+"),"")}function s(e,t){var n=e.match(new RegExp("\\?.*?\\b"+t+"=(.+?)\\b"));return n&&n[1]}function c(){function e(){var e=v.getHashPath(),t=void 0,n=void 0;return _?(t=s(e,_),e=u(e,_),t?n=y.readState(t):(n=null,t=j.createKey(),v.replaceHashPath(i(e,_,t)))):t=n=null,j.createLocation(e,n,void 0,t)}function t(t){function n(){o()&&r(e())}var r=t.transitionTo;return o(),v.addEventListener(window,"hashchange",n),function(){v.removeEventListener(window,"hashchange",n)}}function n(e){var t=e.basename,n=e.pathname,r=e.search,a=e.state,o=e.action,u=e.key;if(o!==h.POP){var s=(t||"")+n+r;_?(s=i(s,_,u),y.saveState(u,a)):e.key=e.state=null;var c=v.getHashPath();o===h.PUSH?c!==s&&(window.location.hash=s):c!==s&&v.replaceHashPath(s)}}function r(e){1===++H&&(S=t(j));var n=j.listenBefore(e);return function(){n(),0===--H&&S()}}function a(e){1===++H&&(S=t(j));var n=j.listen(e);return function(){n(),0===--H&&S()}}function c(e,t){j.pushState(e,t)}function l(e,t){j.replaceState(e,t)}function d(e){j.go(e)}function m(e){return"#"+j.createHref(e)}function w(e){1===++H&&(S=t(j)),j.registerTransitionHook(e)}function x(e){j.unregisterTransitionHook(e),0===--H&&S()}var P=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];g.canUseDOM?void 0:p["default"](!1);var _=P.queryKey;(void 0===_||_)&&(_="string"==typeof _?_:O);var j=b["default"](f({},P,{getCurrentLocation:e,finishTransition:n,saveState:y.saveState})),H=0,S=void 0;v.supportsGoWithoutReloadUsingHash();return f({},j,{listenBefore:r,listen:a,pushState:c,replaceState:l,go:d,createHref:m,registerTransitionHook:w,unregisterTransitionHook:x})}t.__esModule=!0;var f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=n(2),d=(r(l),n(6)),p=r(d),h=n(1),g=n(3),v=n(4),y=n(9),m=n(10),b=r(m),O="_k";t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){return e.filter(function(e){return e.state}).reduce(function(e,t){return e[t.key]=t.state,e},{})}function o(){function e(e,t){v[e]=t}function t(e){return v[e]}function n(){var e=h[g],n=e.key,r=e.basename,a=e.pathname,o=e.search,i=(r||"")+a+(o||""),u=void 0;return n?u=t(n):(u=null,n=d.createKey(),e.key=n),d.createLocation(i,u,void 0,n)}function r(e){var t=g+e;return t>=0&&t<h.length}function o(e){if(e){r(e)?void 0:s["default"](!1),g+=e;var t=n();d.transitionTo(i({},t,{action:c.POP}))}}function u(t){switch(t.action){case c.PUSH:g+=1,g<h.length&&h.splice(g),h.push(t),e(t.key,t.state);break;case c.REPLACE:h[g]=t,e(t.key,t.state)}}var f=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];Array.isArray(f)?f={entries:f}:"string"==typeof f&&(f={entries:[f]});var d=l["default"](i({},f,{getCurrentLocation:n,finishTransition:u,saveState:e,go:o})),p=f,h=p.entries,g=p.current;"string"==typeof h?h=[h]:Array.isArray(h)||(h=["/"]),h=h.map(function(e){var t=d.createKey();return"string"==typeof e?{pathname:e,key:t}:"object"==typeof e&&e?i({},e,{key:t}):void s["default"](!1)}),null==g?g=h.length-1:g>=0&&g<h.length?void 0:s["default"](!1);var v=a(h);return d}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(6),s=r(u),c=n(1),f=n(11),l=r(f);t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var a=n(5),o=r(a),i=n(14),u=r(i);t["default"]=o["default"](u["default"],"enableBeforeUnload is deprecated, use useBeforeUnload instead"),e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var a=n(5),o=r(a),i=n(15),u=r(i);t["default"]=o["default"](u["default"],"enableQueries is deprecated, use useQueries instead"),e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e){return function(){function t(e){return b&&null==e.basename&&(0===e.pathname.indexOf(b)?(e.pathname=e.pathname.substring(b.length),e.basename=b,""===e.pathname&&(e.pathname="/")):e.basename=""),e}function n(e){if(!b)return e;"string"==typeof e&&(e=p["default"](e));var t=e.pathname,n="/"===b.slice(-1)?b:b+"/",r="/"===t.charAt(0)?t.slice(1):t,a=n+r;return i({},e,{pathname:a})}function r(e){return w.listenBefore(function(n,r){c["default"](e,t(n),r)})}function o(e){return w.listen(function(n){e(t(n))})}function s(e,t){w.pushState(e,n(t))}function f(e){s(null,e)}function d(e,t){w.replaceState(e,n(t))}function h(e){d(null,e)}function g(e){return w.createPath(n(e))}function v(e){return w.createHref(n(e))}function y(){return t(w.createLocation.apply(w,arguments))}var m=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],b=m.basename,O=a(m,["basename"]),w=e(O);if(null==b&&u.canUseDOM){var x=document.getElementsByTagName("base")[0];x&&(b=l["default"](x.href))}return i({},w,{listenBefore:r,listen:o,pushState:s,push:f,replaceState:d,replace:h,createPath:g,createHref:v,createLocation:y})}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(3),s=n(8),c=r(s),f=n(13),l=r(f),d=n(7),p=r(d);t["default"]=o,e.exports=t["default"]},function(e,t,n){function r(e){return null===e||void 0===e}function a(e){return e&&"object"==typeof e&&"number"==typeof e.length?"function"!=typeof e.copy||"function"!=typeof e.slice?!1:e.length>0&&"number"!=typeof e[0]?!1:!0:!1}function o(e,t,n){var o,f;if(r(e)||r(t))return!1;if(e.prototype!==t.prototype)return!1;if(s(e))return s(t)?(e=i.call(e),t=i.call(t),c(e,t,n)):!1;if(a(e)){if(!a(t))return!1;if(e.length!==t.length)return!1;for(o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}try{var l=u(e),d=u(t)}catch(p){return!1}if(l.length!=d.length)return!1;for(l.sort(),d.sort(),o=l.length-1;o>=0;o--)if(l[o]!=d[o])return!1;for(o=l.length-1;o>=0;o--)if(f=l[o],!c(e[f],t[f],n))return!1;return typeof e==typeof t}var i=Array.prototype.slice,u=n(26),s=n(25),c=e.exports=function(e,t,n){return n||(n={}),e===t?!0:e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=typeof e&&"object"!=typeof t?n.strict?e===t:e==t:o(e,t,n)}},function(e,t){function n(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function r(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}var a="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();t=e.exports=a?n:r,t.supported=n,t.unsupported=r},function(e,t){function n(e){var t=[];for(var n in e)t.push(n);return t}t=e.exports="function"==typeof Object.keys?Object.keys:n,t.shim=n},function(e,t,n){var r=n(29),a=n(28);e.exports={stringify:r,parse:a}},function(e,t,n){var r=n(16),a={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1};a.parseValues=function(e,t){for(var n={},a=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),o=0,i=a.length;i>o;++o){var u=a[o],s=-1===u.indexOf("]=")?u.indexOf("="):u.indexOf("]=")+1;if(-1===s)n[r.decode(u)]="",t.strictNullHandling&&(n[r.decode(u)]=null);else{var c=r.decode(u.slice(0,s)),f=r.decode(u.slice(s+1));Object.prototype.hasOwnProperty.call(n,c)?n[c]=[].concat(n[c]).concat(f):n[c]=f}}return n},a.parseObject=function(e,t,n){if(!e.length)return t;var r,o=e.shift();if("[]"===o)r=[],r=r.concat(a.parseObject(e,t,n));else{r=n.plainObjects?Object.create(null):{};var i="["===o[0]&&"]"===o[o.length-1]?o.slice(1,o.length-1):o,u=parseInt(i,10),s=""+u;!isNaN(u)&&o!==i&&s===i&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(r=[],r[u]=a.parseObject(e,t,n)):r[i]=a.parseObject(e,t,n)}return r},a.parseKeys=function(e,t,n){if(e){n.allowDots&&(e=e.replace(/\.([^\.\[]+)/g,"[$1]"));var r=/^([^\[\]]*)/,o=/(\[[^\[\]]*\])/g,i=r.exec(e),u=[];if(i[1]){if(!n.plainObjects&&Object.prototype.hasOwnProperty(i[1])&&!n.allowPrototypes)return;u.push(i[1])}for(var s=0;null!==(i=o.exec(e))&&s<n.depth;)++s,(n.plainObjects||!Object.prototype.hasOwnProperty(i[1].replace(/\[|\]/g,""))||n.allowPrototypes)&&u.push(i[1]);return i&&u.push("["+e.slice(i.index)+"]"),a.parseObject(u,t,n)}},e.exports=function(e,t){if(t=t||{},t.delimiter="string"==typeof t.delimiter||r.isRegExp(t.delimiter)?t.delimiter:a.delimiter,t.depth="number"==typeof t.depth?t.depth:a.depth,t.arrayLimit="number"==typeof t.arrayLimit?t.arrayLimit:a.arrayLimit,t.parseArrays=t.parseArrays!==!1,t.allowDots=t.allowDots!==!1,t.plainObjects="boolean"==typeof t.plainObjects?t.plainObjects:a.plainObjects,t.allowPrototypes="boolean"==typeof t.allowPrototypes?t.allowPrototypes:a.allowPrototypes,t.parameterLimit="number"==typeof t.parameterLimit?t.parameterLimit:a.parameterLimit,t.strictNullHandling="boolean"==typeof t.strictNullHandling?t.strictNullHandling:a.strictNullHandling,""===e||null===e||"undefined"==typeof e)return t.plainObjects?Object.create(null):{};for(var n="string"==typeof e?a.parseValues(e,t):e,o=t.plainObjects?Object.create(null):{},i=Object.keys(n),u=0,s=i.length;s>u;++u){var c=i[u],f=a.parseKeys(c,n[c],t);o=r.merge(o,f,t)}return r.compact(o)}},function(e,t,n){var r=n(16),a={delimiter:"&",arrayPrefixGenerators:{brackets:function(e,t){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e,t){return e}},strictNullHandling:!1};a.stringify=function(e,t,n,o,i){if("function"==typeof i)e=i(t,e);else if(r.isBuffer(e))e=e.toString();else if(e instanceof Date)e=e.toISOString();else if(null===e){if(o)return r.encode(t);e=""}if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return[r.encode(t)+"="+r.encode(e)];var u=[];if("undefined"==typeof e)return u;for(var s=Array.isArray(i)?i:Object.keys(e),c=0,f=s.length;f>c;++c){var l=s[c];u=Array.isArray(e)?u.concat(a.stringify(e[l],n(t,l),n,o,i)):u.concat(a.stringify(e[l],t+"["+l+"]",n,o,i))}return u},e.exports=function(e,t){t=t||{};var n,r,o="undefined"==typeof t.delimiter?a.delimiter:t.delimiter,i="boolean"==typeof t.strictNullHandling?t.strictNullHandling:a.strictNullHandling;"function"==typeof t.filter?(r=t.filter,e=r("",e)):Array.isArray(t.filter)&&(n=r=t.filter);var u=[];if("object"!=typeof e||null===e)return"";var s;s=t.arrayFormat in a.arrayPrefixGenerators?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":"indices";var c=a.arrayPrefixGenerators[s];n||(n=Object.keys(e));for(var f=0,l=n.length;l>f;++f){var d=n[f];u=u.concat(a.stringify(e[d],d,c,i,r))}return u.join(o)}}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.History=t():e.History=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var a=n(1),o=r(a),u=n(12),i=r(u),s=n(17),f=r(s);t.createHistory=f["default"];var c=n(18),l=r(c);t.createHashHistory=l["default"];var d=n(19),p=r(d);t.createMemoryHistory=p["default"];var h=n(22),g=r(h);t.useBasename=g["default"];var v=n(14),y=r(v);t.useBeforeUnload=y["default"];var m=n(15),w=r(m);t.useQueries=w["default"];var O=n(4),b=r(O);t.Actions=b["default"];var _=n(20),P=r(_);t.enableBeforeUnload=P["default"];var S=n(21),x=r(S);t.enableQueries=x["default"];var H=o["default"](i["default"],"Using createLocation without a history instance is deprecated; please use history.createLocation instead");t.createLocation=H},function(e,t){"use strict";function n(e){return e}t.__esModule=!0,t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=i["default"](e),n="",r="",a=t.indexOf("#");-1!==a&&(r=t.substring(a),t=t.substring(0,a));var o=t.indexOf("?");return-1!==o&&(n=t.substring(o),t=t.substring(0,o)),""===t&&(t="/"),{pathname:t,search:n,hash:r}}t.__esModule=!0;var o=n(3),u=(r(o),n(13)),i=r(u);t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";var r=function(){};e.exports=r},function(e,t){"use strict";t.__esModule=!0;var n="PUSH";t.PUSH=n;var r="REPLACE";t.REPLACE=r;var a="POP";t.POP=a,t["default"]={PUSH:n,REPLACE:r,POP:a}},function(e,t){"use strict";t.__esModule=!0;var n=!("undefined"==typeof window||!window.document||!window.document.createElement);t.canUseDOM=n},function(e,t){"use strict";function n(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)}function r(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n)}function a(){return window.location.href.split("#")[1]||""}function o(e){window.location.replace(window.location.pathname+window.location.search+"#"+e)}function u(){return window.location.pathname+window.location.search+window.location.hash}function i(e){e&&window.history.go(e)}function s(e,t){t(window.confirm(e))}function f(){var e=navigator.userAgent;return-1===e.indexOf("Android 2.")&&-1===e.indexOf("Android 4.0")||-1===e.indexOf("Mobile Safari")||-1!==e.indexOf("Chrome")||-1!==e.indexOf("Windows Phone")?-1!==e.indexOf("CriOS")?!1:window.history&&"pushState"in window.history:!1}function c(){var e=navigator.userAgent;return-1===e.indexOf("Firefox")}t.__esModule=!0,t.addEventListener=n,t.removeEventListener=r,t.getHashPath=a,t.replaceHashPath=o,t.getWindowPath=u,t.go=i,t.getUserConfirmation=s,t.supportsHistory=f,t.supportsGoWithoutReloadUsingHash=c},function(e,t,n){"use strict";var r=function(e,t,n,r,a,o,u,i){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,r,a,o,u,i],c=0;s=new Error("Invariant Violation: "+t.replace(/%s/g,function(){return f[c++]}))}throw s.framesToPop=1,s}};e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){var r=e(t,n);e.length<2&&n(r)}t.__esModule=!0;var o=n(3);r(o);t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){return s+e}function o(e,t){try{window.sessionStorage.setItem(a(e),JSON.stringify(t))}catch(n){if(n.name===c)return;if(n.name===f&&0===window.sessionStorage.length)return;throw n}}function u(e){var t=void 0;try{t=window.sessionStorage.getItem(a(e))}catch(n){if(n.name===c)return null}if(t)try{return JSON.parse(t)}catch(n){}return null}t.__esModule=!0,t.saveState=o,t.readState=u;var i=n(3),s=(r(i),"@@History/"),f="QuotaExceededError",c="SecurityError"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){function t(e){return s.canUseDOM?void 0:i["default"](!1),n.listen(e)}var n=l["default"](o({getUserConfirmation:f.getUserConfirmation},e,{go:f.go}));return o({},n,{listen:t})}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(7),i=r(u),s=n(5),f=n(6),c=n(11),l=r(c);t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){return Math.random().toString(36).substr(2,e)}function o(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.key===t.key&&f["default"](e.state,t.state)}function u(){function e(e){return R.push(e),function(){R=R.filter(function(t){return t!==e})}}function t(){return I&&I.action===l.POP?q.indexOf(I.key):Q?q.indexOf(Q.key):-1}function n(e){var n=t();Q=e,Q.action===l.PUSH?q=[].concat(q.slice(0,n+1),[Q.key]):Q.action===l.REPLACE&&(q[n]=Q.key),D.forEach(function(e){e(Q)})}function r(e){if(D.push(e),Q)e(Q);else{var t=U();q=[t.key],n(t)}return function(){D=D.filter(function(t){return t!==e})}}function u(e,t){c.loopAsync(R.length,function(t,n,r){g["default"](R[t],e,function(e){null!=e?r(e):n()})},function(e){C&&"string"==typeof e?C(e,function(e){t(e!==!1)}):t(e!==!1)})}function s(e){Q&&o(Q,e)||(I=e,u(e,function(t){if(I===e)if(t){if(e.action===l.PUSH){var r=b(Q),a=b(e);a===r&&(e.action=l.REPLACE)}L(e)!==!1&&n(e)}else if(Q&&e.action===l.POP){var o=q.indexOf(Q.key),u=q.indexOf(e.key);-1!==o&&-1!==u&&B(o-u)}}))}function f(e){s(P(e,l.PUSH,m()))}function d(e){s(P(e,l.REPLACE,m()))}function h(){B(-1)}function v(){B(1)}function m(){return a(T)}function b(e){if(null==e||"string"==typeof e)return e;var t=e.pathname,n=e.search,r=e.hash,a=t;return n&&(a+=n),r&&(a+=r),a}function _(e){return b(e)}function P(e,t){var n=arguments.length<=2||void 0===arguments[2]?m():arguments[2];return"object"==typeof t&&("string"==typeof e&&(e=y["default"](e)),e=i({},e,{state:t}),t=n,n=arguments[3]||m()),p["default"](e,t,n)}function S(e){Q?(x(Q,e),n(Q)):x(U(),e)}function x(e,t){e.state=i({},e.state,t),A(e.key,e.state)}function H(e){-1===R.indexOf(e)&&R.push(e)}function k(e){R=R.filter(function(t){return t!==e})}function M(e,t){"string"==typeof t&&(t=y["default"](t)),f(i({state:e},t))}function j(e,t){"string"==typeof t&&(t=y["default"](t)),d(i({state:e},t))}var E=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],U=E.getCurrentLocation,L=E.finishTransition,A=E.saveState,B=E.go,T=E.keyLength,C=E.getUserConfirmation;"number"!=typeof T&&(T=O);var R=[],q=[],D=[],Q=void 0,I=void 0;return{listenBefore:e,listen:r,transitionTo:s,push:f,replace:d,go:B,goBack:h,goForward:v,createKey:m,createPath:b,createHref:_,createLocation:P,setState:w["default"](S,"setState is deprecated; use location.key to save state instead"),registerTransitionHook:w["default"](H,"registerTransitionHook is deprecated; use listenBefore instead"),unregisterTransitionHook:w["default"](k,"unregisterTransitionHook is deprecated; use the callback returned from listenBefore instead"),pushState:w["default"](M,"pushState is deprecated; use push instead"),replaceState:w["default"](j,"replaceState is deprecated; use replace instead")}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=n(23),f=r(s),c=n(16),l=n(4),d=n(12),p=r(d),h=n(8),g=r(h),v=n(2),y=r(v),m=n(1),w=r(m),O=6;t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(){var e=arguments.length<=0||void 0===arguments[0]?"/":arguments[0],t=arguments.length<=1||void 0===arguments[1]?u.POP:arguments[1],n=arguments.length<=2||void 0===arguments[2]?null:arguments[2],r=arguments.length<=3||void 0===arguments[3]?null:arguments[3];"string"==typeof e&&(e=s["default"](e)),"object"==typeof t&&(e=o({},e,{state:t}),t=n||u.POP,n=r);var a=e.pathname||"/",i=e.search||"",f=e.hash||"",c=e.state||null;return{pathname:a,search:i,hash:f,state:c,action:t,key:n}}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(4),i=n(2),s=r(i);t["default"]=a,e.exports=t["default"]},function(e,t){"use strict";function n(e){var t=e.match(/^https?:\/\/[^\/]*/);return null==t?e:e.substring(t[0].length)}t.__esModule=!0,t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){function t(t){var n=e();return"string"==typeof n?((t||window.event).returnValue=n,n):void 0}return f.addEventListener(window,"beforeunload",t),function(){f.removeEventListener(window,"beforeunload",t)}}function o(e){return function(t){function n(){for(var e=void 0,t=0,n=d.length;null==e&&n>t;++t)e=d[t].call();return e}function r(e){return d.push(e),1===d.length&&s.canUseDOM&&(c=a(n)),function(){d=d.filter(function(t){return t!==e}),0===d.length&&c&&(c(),c=null)}}function o(e){s.canUseDOM&&-1===d.indexOf(e)&&(d.push(e),1===d.length&&(c=a(n)))}function i(e){d.length>0&&(d=d.filter(function(t){return t!==e}),0===d.length&&c())}var f=e(t),c=void 0,d=[];return u({},f,{listenBeforeUnload:r,registerBeforeUnloadHook:l["default"](o,"registerBeforeUnloadHook is deprecated; use listenBeforeUnload instead"),unregisterBeforeUnloadHook:l["default"](i,"unregisterBeforeUnloadHook is deprecated; use the callback returned from listenBeforeUnload instead")})}}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(3),s=(r(i),n(5)),f=n(6),c=n(1),l=r(c);t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e){return f.stringify(e).replace(/%20/g,"+")}function u(e){return function(){function t(e){if(null==e.query){var t=e.search;e.query=_(t.substring(1)),e[v]={search:t,searchBase:""}}return e}function n(e,t){var n,r=void 0;if(!t||""===(r=b(t)))return e;"string"==typeof e&&(e=p["default"](e));var a=e[v],o=void 0;o=a&&e.search===a.search?a.searchBase:e.search||"";var u=o+(o?"&":"?")+r;return i({},e,(n={search:u},n[v]={search:u,searchBase:o},n))}function r(e){return S.listenBefore(function(n,r){l["default"](e,t(n),r)})}function u(e){return S.listen(function(n){e(t(n))})}function s(e){S.push(n(e,e.query))}function f(e){S.replace(n(e,e.query))}function c(e,t){return S.createPath(n(e,t||e.query))}function d(e,t){return S.createHref(n(e,t||e.query))}function h(){return t(S.createLocation.apply(S,arguments))}function m(e,t,n){"string"==typeof t&&(t=p["default"](t)),s(i({state:e},t,{query:n}))}function w(e,t,n){"string"==typeof t&&(t=p["default"](t)),f(i({state:e},t,{query:n}))}var O=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],b=O.stringifyQuery,_=O.parseQueryString,P=a(O,["stringifyQuery","parseQueryString"]),S=e(P);return"function"!=typeof b&&(b=o),"function"!=typeof _&&(_=y),i({},S,{listenBefore:r,listen:u,push:s,replace:f,createPath:c,createHref:d,createLocation:h,pushState:g["default"](m,"pushState is deprecated; use push instead"),replaceState:g["default"](w,"replaceState is deprecated; use replace instead")})}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=n(3),f=(r(s),n(26)),c=n(8),l=r(c),d=n(2),p=r(d),h=n(1),g=r(h),v="$searchBase",y=f.parse;t["default"]=u,e.exports=t["default"]},function(e,t){"use strict";function n(e,t,n){function r(){u=!0,n.apply(this,arguments)}function a(){u||(e>o?t.call(this,o++,a,r):r.apply(this,arguments))}var o=0,u=!1;a()}t.__esModule=!0,t.loopAsync=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(){function e(e){e=e||window.history.state||{};var t=c.getWindowPath(),n=e,r=n.key,a=void 0;r?a=l.readState(r):(a=null,r=w.createKey(),y&&window.history.replaceState(o({},e,{key:r}),null,t));var u=g["default"](t);return w.createLocation(o({},u,{state:a}),void 0,r)}function t(t){function n(t){void 0!==t.state&&r(e(t.state))}var r=t.transitionTo;return c.addEventListener(window,"popstate",n),function(){c.removeEventListener(window,"popstate",n)}}function n(e){var t=e.basename,n=e.pathname,r=e.search,a=e.hash,o=e.state,u=e.action,i=e.key;if(u!==s.POP){l.saveState(i,o);var f=(t||"")+n+r+a,c={key:i};if(u===s.PUSH){if(m)return window.location.href=f,!1;window.history.pushState(c,null,f)}else{if(m)return window.location.replace(f),!1;window.history.replaceState(c,null,f)}}}function r(e){1===++O&&(b=t(w));var n=w.listenBefore(e);return function(){n(),0===--O&&b()}}function a(e){1===++O&&(b=t(w));var n=w.listen(e);return function(){n(),0===--O&&b()}}function u(e){1===++O&&(b=t(w)),w.registerTransitionHook(e)}function d(e){w.unregisterTransitionHook(e),0===--O&&b()}var h=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];f.canUseDOM?void 0:i["default"](!1);var v=h.forceRefresh,y=c.supportsHistory(),m=!y||v,w=p["default"](o({},h,{getCurrentLocation:e,finishTransition:n,saveState:l.saveState})),O=0,b=void 0;return o({},w,{listenBefore:r,listen:a,registerTransitionHook:u,unregisterTransitionHook:d})}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(7),i=r(u),s=n(4),f=n(5),c=n(6),l=n(9),d=n(10),p=r(d),h=n(2),g=r(h);t["default"]=a,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){return"string"==typeof e&&"/"===e.charAt(0)}function o(){var e=v.getHashPath();return a(e)?!0:(v.replaceHashPath("/"+e),!1)}function u(e,t,n){return e+(-1===e.indexOf("?")?"?":"&")+(t+"="+n)}function i(e,t){return e.replace(new RegExp("[?&]?"+t+"=[a-zA-Z0-9]+"),"")}function s(e,t){var n=e.match(new RegExp("\\?.*?\\b"+t+"=(.+?)\\b"));return n&&n[1]}function f(){function e(){var e=v.getHashPath(),t=void 0,n=void 0;k?(t=s(e,k),e=i(e,k),t?n=y.readState(t):(n=null,t=M.createKey(),v.replaceHashPath(u(e,k,t)))):t=n=null;var r=b["default"](e);return M.createLocation(c({},r,{state:n}),void 0,t)}function t(t){function n(){o()&&r(e())}var r=t.transitionTo;return o(),v.addEventListener(window,"hashchange",n),function(){v.removeEventListener(window,"hashchange",n)}}function n(e){var t=e.basename,n=e.pathname,r=e.search,a=e.state,o=e.action,i=e.key;if(o!==h.POP){var s=(t||"")+n+r;k?(s=u(s,k,i),y.saveState(i,a)):e.key=e.state=null;var f=v.getHashPath();o===h.PUSH?f!==s&&(window.location.hash=s):f!==s&&v.replaceHashPath(s)}}function r(e){1===++j&&(E=t(M));var n=M.listenBefore(e);return function(){n(),0===--j&&E()}}function a(e){1===++j&&(E=t(M));var n=M.listen(e);return function(){n(),0===--j&&E()}}function f(e){M.push(e)}function l(e){M.replace(e)}function d(e){M.go(e)}function m(e){return"#"+M.createHref(e)}function O(e){1===++j&&(E=t(M)),M.registerTransitionHook(e)}function P(e){M.unregisterTransitionHook(e),0===--j&&E()}function S(e,t){M.pushState(e,t)}function x(e,t){M.replaceState(e,t)}var H=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];g.canUseDOM?void 0:p["default"](!1);var k=H.queryKey;(void 0===k||k)&&(k="string"==typeof k?k:_);var M=w["default"](c({},H,{getCurrentLocation:e,finishTransition:n,saveState:y.saveState})),j=0,E=void 0;v.supportsGoWithoutReloadUsingHash();return c({},M,{listenBefore:r,listen:a,push:f,replace:l,go:d,createHref:m,registerTransitionHook:O,unregisterTransitionHook:P,pushState:S,replaceState:x})}t.__esModule=!0;var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=n(3),d=(r(l),n(7)),p=r(d),h=n(4),g=n(5),v=n(6),y=n(9),m=n(10),w=r(m),O=n(2),b=r(O),_="_k";t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e){return e.filter(function(e){return e.state}).reduce(function(e,t){return e[t.key]=t.state,e},{})}function o(){function e(e,t){y[e]=t}function t(e){return y[e]}function n(){var e=g[v],n=e.key,r=e.basename,a=e.pathname,o=e.search,i=(r||"")+a+(o||""),s=void 0;n?s=t(n):(s=null,n=l.createKey(),e.key=n);var f=h["default"](i);return l.createLocation(u({},f,{state:s}),void 0,n)}function r(e){var t=v+e;return t>=0&&t<g.length}function o(e){if(e){if(!r(e))return;v+=e;var t=n();l.transitionTo(u({},t,{action:c.POP}))}}function i(t){switch(t.action){case c.PUSH:v+=1,v<g.length&&g.splice(v),g.push(t),e(t.key,t.state);break;case c.REPLACE:g[v]=t,e(t.key,t.state)}}var s=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];Array.isArray(s)?s={entries:s}:"string"==typeof s&&(s={entries:[s]});var l=d["default"](u({},s,{getCurrentLocation:n,finishTransition:i,saveState:e,go:o})),p=s,g=p.entries,v=p.current;"string"==typeof g?g=[g]:Array.isArray(g)||(g=["/"]),g=g.map(function(e){var t=l.createKey();return"string"==typeof e?{pathname:e,key:t}:"object"==typeof e&&e?u({},e,{key:t}):void f["default"](!1)}),null==v?v=g.length-1:v>=0&&v<g.length?void 0:f["default"](!1);var y=a(g);return l}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(3),s=(r(i),n(7)),f=r(s),c=n(4),l=n(11),d=r(l),p=n(2),h=r(p);t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var a=n(1),o=r(a),u=n(14),i=r(u);t["default"]=o["default"](i["default"],"enableBeforeUnload is deprecated, use useBeforeUnload instead"),e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var a=n(1),o=r(a),u=n(15),i=r(u);t["default"]=o["default"](i["default"],"enableQueries is deprecated, use useQueries instead"),e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e){return function(){function t(e){return O&&null==e.basename&&(0===e.pathname.indexOf(O)?(e.pathname=e.pathname.substring(O.length),e.basename=O,""===e.pathname&&(e.pathname="/")):e.basename=""),e}function n(e){if(!O)return e;"string"==typeof e&&(e=p["default"](e));var t=e.pathname,n="/"===O.slice(-1)?O:O+"/",r="/"===t.charAt(0)?t.slice(1):t,a=n+r;return u({},e,{pathname:a})}function r(e){return _.listenBefore(function(n,r){f["default"](e,t(n),r)})}function o(e){return _.listen(function(n){e(t(n))})}function s(e){_.push(n(e))}function c(e){_.replace(n(e))}function d(e){return _.createPath(n(e))}function h(e){return _.createHref(n(e))}function v(){return t(_.createLocation.apply(_,arguments))}function y(e,t){"string"==typeof t&&(t=p["default"](t)),s(u({state:e},t))}function m(e,t){"string"==typeof t&&(t=p["default"](t)),c(u({state:e},t))}var w=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],O=w.basename,b=a(w,["basename"]),_=e(b);if(null==O&&i.canUseDOM){var P=document.getElementsByTagName("base")[0];P&&(O=l["default"](P.href))}return u({},_,{listenBefore:r,listen:o,push:s,replace:c,createPath:d,createHref:h,createLocation:v,pushState:g["default"](y,"pushState is deprecated; use push instead"),replaceState:g["default"](m,"replaceState is deprecated; use replace instead")})}}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(5),s=n(8),f=r(s),c=n(13),l=r(c),d=n(2),p=r(d),h=n(1),g=r(h);t["default"]=o,e.exports=t["default"]},function(e,t,n){function r(e){return null===e||void 0===e}function a(e){return e&&"object"==typeof e&&"number"==typeof e.length?"function"!=typeof e.copy||"function"!=typeof e.slice?!1:e.length>0&&"number"!=typeof e[0]?!1:!0:!1}function o(e,t,n){var o,c;if(r(e)||r(t))return!1;if(e.prototype!==t.prototype)return!1;if(s(e))return s(t)?(e=u.call(e),t=u.call(t),f(e,t,n)):!1;if(a(e)){if(!a(t))return!1;if(e.length!==t.length)return!1;for(o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}try{var l=i(e),d=i(t)}catch(p){return!1}if(l.length!=d.length)return!1;for(l.sort(),d.sort(),o=l.length-1;o>=0;o--)if(l[o]!=d[o])return!1;for(o=l.length-1;o>=0;o--)if(c=l[o],!f(e[c],t[c],n))return!1;return typeof e==typeof t}var u=Array.prototype.slice,i=n(25),s=n(24),f=e.exports=function(e,t,n){return n||(n={}),e===t?!0:e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=typeof e&&"object"!=typeof t?n.strict?e===t:e==t:o(e,t,n)}},function(e,t){function n(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function r(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}var a="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();t=e.exports=a?n:r,t.supported=n,t.unsupported=r},function(e,t){function n(e){var t=[];for(var n in e)t.push(n);return t}t=e.exports="function"==typeof Object.keys?Object.keys:n,t.shim=n},function(e,t,n){"use strict";var r=n(27);t.extract=function(e){return e.split("?")[1]||""},t.parse=function(e){return"string"!=typeof e?{}:(e=e.trim().replace(/^(\?|#|&)/,""),e?e.split("&").reduce(function(e,t){var n=t.replace(/\+/g," ").split("="),r=n.shift(),a=n.length>0?n.join("="):void 0;return r=decodeURIComponent(r),a=void 0===a?null:decodeURIComponent(a),e.hasOwnProperty(r)?Array.isArray(e[r])?e[r].push(a):e[r]=[e[r],a]:e[r]=a,e},{}):{})},t.stringify=function(e){return e?Object.keys(e).sort().map(function(t){var n=e[t];return void 0===n?"":null===n?t:Array.isArray(n)?n.sort().map(function(e){return r(t)+"="+r(e)}).join("&"):r(t)+"="+r(n)}).filter(function(e){return e.length>0}).join("&"):""}},function(e,t){"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16)})}}])}); |
{ | ||
"name": "redux-simple-router", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "Ruthlessly simple bindings to keep react-router and redux in sync", | ||
@@ -9,3 +9,4 @@ "main": "lib/index", | ||
"LICENSE", | ||
"lib" | ||
"lib", | ||
"src" | ||
], | ||
@@ -46,8 +47,8 @@ "repository": { | ||
"babel-loader": "^6.2.0", | ||
"babel-plugin-transform-object-assign": "^6.0.14", | ||
"babel-preset-es2015": "^6.1.2", | ||
"babel-preset-stage-2": "^6.3.13", | ||
"eslint": "^1.10.3", | ||
"eslint-config-rackt": "^1.1.1", | ||
"expect": "^1.13.0", | ||
"history": "^1.13.1", | ||
"history": "^1.14.0", | ||
"isparta": "^4.0.0", | ||
@@ -69,6 +70,3 @@ "isparta-loader": "^2.0.0", | ||
"webpack": "^1.12.9" | ||
}, | ||
"dependencies": { | ||
"deep-equal": "^1.0.1" | ||
} | ||
} |
# redux-simple-router | ||
[![npm version](https://img.shields.io/npm/v/redux-simple-router.svg?style=flat-square)](https://www.npmjs.com/package/redux-simple-router) [![npm downloads](https://img.shields.io/npm/dm/redux-simple-router.svg?style=flat-square)](https://www.npmjs.com/package/redux-simple-router) | ||
[![npm version](https://img.shields.io/npm/v/redux-simple-router.svg?style=flat-square)](https://www.npmjs.com/package/redux-simple-router) [![npm downloads](https://img.shields.io/npm/dm/redux-simple-router.svg?style=flat-square)](https://www.npmjs.com/package/redux-simple-router) [![build status](https://img.shields.io/travis/rackt/redux-simple-router/master.svg?style=flat-square)](https://travis-ci.org/rackt/redux-simple-router) | ||
@@ -108,2 +108,3 @@ **Let react-router do all the work** :sparkles: | ||
* [freeqaz/redux-simple-router-example](https://github.com/freeqaz/redux-simple-router-example) - example implementation | ||
* [choonkending/react-webpack-node](https://github.com/choonkending/react-webpack-node) - boilerplate for universal redux and react-router | ||
@@ -110,0 +111,0 @@ _Have an example to add? Send us a PR!_ |
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
0
141
300893
107
4861
43
- Removeddeep-equal@^1.0.1
- Removedcall-bind@1.0.7(transitive)
- Removeddeep-equal@1.1.2(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedfunctions-have-names@1.2.3(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-arguments@1.1.1(transitive)
- Removedis-date-object@1.0.5(transitive)
- Removedis-regex@1.1.4(transitive)
- Removedobject-is@1.1.6(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedregexp.prototype.flags@1.5.2(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedset-function-name@2.0.2(transitive)