diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index 362e2791..a3f3b07f 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -21,6 +21,33 @@ def show ) end + def create + movie = Movie.new( + title: params['title'], + overview: params['overview'], + release_date: params['release_date'], + image_url: params['image_url'], + external_id: params['external_id'] + ) + + if movie.save + render status: :ok, json: { + id: movie.id, + title: movie.title, + overview: movie.overview, + release_date: movie.release_date, + image_url: movie.image_url, + external_id: movie.external_id + } + else + render status: :bad_request, json: { errors: movie.errors.messages } + end + end + + + + + private def require_movie diff --git a/app/models/movie.rb b/app/models/movie.rb index 0016080b..b5c023fe 100644 --- a/app/models/movie.rb +++ b/app/models/movie.rb @@ -7,10 +7,11 @@ def available_inventory end def image_url + pattern = /^((?!http).)*$/ orig_value = read_attribute :image_url if !orig_value MovieWrapper::DEFAULT_IMG_URL - elsif external_id + elsif external_id && pattern.match?(orig_value) MovieWrapper.construct_image_url(orig_value) else orig_value diff --git a/config/routes.rb b/config/routes.rb index f4c99688..76715f9a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,7 @@ resources :customers, only: [:index] - resources :movies, only: [:index, :show], param: :title + resources :movies, only: [:index, :show, :create], param: :title post "/rentals/:title/check-out", to: "rentals#check_out", as: "check_out" post "/rentals/:title/return", to: "rentals#check_in", as: "check_in" diff --git a/node_modules/.bin/loose-envify b/node_modules/.bin/loose-envify new file mode 120000 index 00000000..ed9009c5 --- /dev/null +++ b/node_modules/.bin/loose-envify @@ -0,0 +1 @@ +../loose-envify/cli.js \ No newline at end of file diff --git a/node_modules/history/CHANGES.md b/node_modules/history/CHANGES.md new file mode 100644 index 00000000..8e63ba0d --- /dev/null +++ b/node_modules/history/CHANGES.md @@ -0,0 +1,395 @@ +## [v4.6.3] +> Jun 20, 2017 + +- Add main/module entries to package.json (thanks @pshrmn) + +[v4.6.3]: https://github.com/ReactTraining/history/compare/v4.6.2...v4.6.3 + +## [v4.6.2] +> Jun 14, 2017 + +- Rely on the user/browser to encode pathname portion of the URL +- Add more complete basename matching support (case insensitive matching, basename must be a complete match, see [#459]) + +[v4.6.2]: https://github.com/ReactTraining/history/compare/v4.6.1...v4.6.2 +[#459]: https://github.com/ReactTraining/history/pull/459 + +## [v4.6.1] +> Mar 15, 2017 + +- Only encode/decode pathname portion of the URL (see [#445]) + +[v4.6.1]: https://github.com/ReactTraining/history/compare/v4.6.0...v4.6.1 +[#445]: https://github.com/ReactTraining/history/pull/445 + +## [v4.6.0] +> Mar 7, 2017 + +- Encode/decode URLs +- Added `location.key` to the initial location in memory history +- Added ES modules build in `es` package directory +- Improve `basename` slash handling (source of a common user error, see [#404] and [#432]) + +[v4.6.0]: https://github.com/ReactTraining/history/compare/v4.5.1...v4.6.0 +[#404]: https://github.com/ReactTraining/history/issues/404 +[#432]: https://github.com/ReactTraining/history/pull/432 + +## [v4.5.1] +> Jan 9, 2017 + +- Fix a bug that allowed a history listener to still be called if it was + unregistered in another listener + +[v4.5.1]: https://github.com/ReactTraining/history/compare/v4.5.0...v4.5.1 + +## [v4.5.0] +> Dec 14, 2016 + +- Added `history.createHref(location)` for creating hrefs suitable for use in `` + +[v4.5.0]: https://github.com/ReactTraining/history/compare/v4.4.1...v4.5.0 + +## [v4.4.1] +> Nov 24, 2016 + +- Fix the back button on Chrome iOS + +[v4.4.1]: https://github.com/ReactTraining/history/compare/v4.4.0...v4.4.1 + +## [v4.4.0] +> Nov 1, 2016 + +- Use `value-equal` instead of own `deepEqual` function for checking state equality + +[v4.4.0]: https://github.com/ReactTraining/history/compare/v4.3.0...v4.4.0 + +## [v4.3.0] +> Sep 29, 2016 + +- Allow relative pathnames in `history.push` and `history.replace` ([#135]) + +[v4.3.0]: https://github.com/ReactTraining/history/compare/v4.2.1...v4.3.0 +[#135]: https://github.com/ReactTraining/history/issues/135 + +## [v4.2.1] +> Sep 29, 2016 + +- Fixed `createLocation` defaults when using objects instead of strings + +[v4.2.1]: https://github.com/ReactTraining/history/compare/v4.2.0...v4.2.1 + +## [v4.2.0] +> Sep 15, 2016 + +- Add `createLocation` to top-level exports +- Better warnings + +[v4.2.0]: https://github.com/ReactTraining/history/compare/v4.1.0...v4.2.0 + +## [v4.1.0] +> Sep 15, 2016 + +- Automatically use a leading `/` when doing `history.push('')` +- Automatically clean up bad location descriptors + +[v4.1.0]: https://github.com/ReactTraining/history/compare/v4.0.0...v4.1.0 + +## [v4.0.0] +> Sep 10, 2016 + +- Added back two-arg form of `push` and `replace` + +[v4.0.0]: https://github.com/ReactTraining/history/compare/v4.0.0-2...v4.0.0 + +## [v4.0.0-2] +> Sep 9, 2016 + +- Added `history.length`, `history.location`, and `history.action` properties +- Added `history.index` and `history.entries` properties in memory history +- Added `location.pathname`, `location.search`, and `location.hash` instead of + `location.path` since this is work most people will always have to do +- Added `parsePath` and `createPath` helpers to top-level exports +- Removed `history.getCurrentLocation()` + +[v4.0.0-2]: https://github.com/ReactTraining/history/compare/v4.0.0-1...v4.0.0-2 + +## [v4.0.0-1] +> Sep 6, 2016 + +- Fix blocking POP transitions in browsers where listen() has not yet been called +- Use block(false) to prevent transitions +- Better warnings for PUSH with the same path using hash history + +[v4.0.0-1]: https://github.com/ReactTraining/history/compare/v4.0.0-0...v4.0.0-1 + +## [v4.0.0-0] +> Sep 3, 2016 + +- Easier top-level `import`s. Use `import createHistory from "history/createBrowserHistory"` instead of `history/lib/createBrowserHistory`. +- Removed the "middleware" API (i.e. all "use" functions). +- Moved path and query parsing out of core. Location objects are now `{ path, state, key }`. Any other parsing can be done outside core. +- Removed the `Actions` module. `location.action` is now just a string. No need to `import` our constants. +- Switched to using `window.history.state` in `createBrowserHistory` instead of `sessionStorage`. +- Removed `location.state` entirely from `createHashHistory` locations. +- Removed support for basename in `createMemoryHistory`. +- Refactored the test suite. Tests are much more flexible and easier to zero in on one that is failing. + +[v4.0.0-0]: https://github.com/ReactTraining/history/compare/v3.2.1...v4.0.0-0 + +## [v3.2.0] +> Sep 1, 2016 + +- Exposed `canGo` in memory history + +[v3.2.0]: https://github.com/ReactTraining/history/compare/v3.1.0...v3.2.0 + +## [v3.1.0] +> Sep 1, 2016 + +- Added `hashType` option to hash history for supporting different + hash URL schemes including "hashbang" and no leading slash +- **Bugfix:** Fix URL restoration on canceled popstate transitions +- Better React Native support + +[v3.1.0]: https://github.com/ReactTraining/history/compare/v3.0.0...v3.1.0 + +## [v3.0.0] +> May 30, 2016 + +- `location.query` has no prototype +- Warn about protocol-relative URLs ([#243]) +- **Bugfix:** Ignore errors when saving hash history state if + `window.sessionStorage` is undefined ([#295]) +- **Bugfix:** Fix replacing hash path in IE served via file protocol ([#126]) + +[v3.0.0]: https://github.com/ReactTraining/history/compare/v3.0.0-2...v3.0.0 +[#243]: https://github.com/ReactTraining/history/issues/243 +[#295]: https://github.com/ReactTraining/history/issues/295 +[#126]: https://github.com/ReactTraining/history/issues/126 + +## [v3.0.0-2] +> Apr 19, 2016 + +- Lower-cased UMD build file name + +[v3.0.0-2]: https://github.com/ReactTraining/history/compare/v3.0.0-1...v3.0.0-2 + +## [v3.0.0-1] +> Apr 19, 2016 + +- Added `locationsAreEqual` to top-level exports +- **Breakage:** Removed support for `` as `basename` ([#94]) +- Removed dependency on `deep-equal` + +[v3.0.0-1]: https://github.com/ReactTraining/history/compare/v3.0.0-0...v3.0.0-1 +[#94]: https://github.com/ReactTraining/history/issues/94 + +## [3.0.0-0] +> Mar 19, 2016 + +- Added `history.getCurrentLocation()` method +- **Breakage:** `history.listen` no longer calls the callback synchronously once. + Use `history.getCurrentLocation` instead +- **Breakage:** `location.key` on the initial POP is `null`. Users who relied on + this key may immediately use `replace` to get it back +- **Breakage:** `location.state` is `undefined` (instead of `null`) if the location + has no state. This helps us know when we need to access session storage and when + we can safely ignore it +- **Bugfix:** Hash history now uses a custom query string key/value pair only if + the location has state. This obsoletes using `{ queryKey: false }` to prevent + the query string from being used ([#163]) +- **Bugfix:** Do not access `window.sessionStorage` unless the location has state. + This should minimize the # of times we access session storage and allow users to + opt-out of using it entirely by not using location state + +[3.0.0-0]: https://github.com/ReactTraining/history/compare/v2.0.0...v3.0.0-0 +[#163]: https://github.com/ReactTraining/history/issues/163 + +## [v2.0.0] +> Feb 4, 2016 + +- **Bugfix:** Fix search base logic with an empty query ([#221]) +- **Bugfix:** Fail gracefully when Safari 5 security settings prevent access to window.sessionStorage ([#223]) + +[v2.0.0]: https://github.com/ReactTraining/history/compare/v2.0.0-rc3...v2.0.0 +[#221]: https://github.com/ReactTraining/history/issues/221 +[#223]: https://github.com/ReactTraining/history/pull/223 + +## [v2.0.0-rc3] +> Feb 3, 2016 + +- **Bugfix:** Don't convert same-path `PUSH` to `REPLACE` when `location.state` changes ([#179]) +- **Bugfix:** Re-enable browser history on Chrome iOS ([#208]) +- **Bugfix:** Properly support location descriptors in `history.createLocation` ([#200]) + +[v2.0.0-rc3]: https://github.com/ReactTraining/history/compare/v2.0.0-rc2...v2.0.0-rc3 +[#179]: https://github.com/ReactTraining/history/pull/179 +[#208]: https://github.com/ReactTraining/history/pull/208 +[#200]: https://github.com/ReactTraining/history/pull/200 + +## [v2.0.0-rc2] +> Jan 9, 2016 + +- Add back deprecation warnings + +[v2.0.0-rc2]: https://github.com/ReactTraining/history/compare/v2.0.0-rc1...v2.0.0-rc2 + +## [v2.0.0-rc1] +> Jan 2, 2016 + +- **Bugfix:** Don't create empty entries in session storage ([#177]) + +[v2.0.0-rc1]: https://github.com/ReactTraining/history/compare/v1.17.0...v2.0.0-rc1 +[#177]: https://github.com/ReactTraining/history/pull/177 + +## [v1.17.0] +> Dec 19, 2015 + +- **Bugfix:** Don't throw in memory history when out of history entries ([#170]) +- **Bugfix:** Fix the deprecation warnings on `createPath` and `createHref` ([#189]) + +[v1.17.0]: https://github.com/ReactTraining/history/compare/v1.16.0...v1.17.0 +[#170]: https://github.com/ReactTraining/history/pull/170 +[#189]: https://github.com/ReactTraining/history/pull/189 + +## [v1.16.0] +> Dec 10, 2015 + +- **Bugfix:** Silence all warnings that were introduced since 1.13 (see [reactjs/react-router#2682]) +- Deprecate the `createLocation` method in the top-level exports +- Deprecate the `state` arg to `history.createLocation` + +[v1.16.0]: https://github.com/ReactTraining/history/compare/v1.15.0...v1.16.0 +[reactjs/react-router#2682]: https://github.com/reactjs/react-router/issues/2682 + +## [v1.15.0] +> Dec 7, 2015 + +- Accept location descriptors in `createPath` and `createHref` ([#173]) +- Deprecate the `query` arg to `createPath` and `createHref` in favor of using location descriptor objects ([#173]) + +[v1.15.0]: https://github.com/ReactTraining/history/compare/v1.14.0...v1.15.0 +[#173]: https://github.com/ReactTraining/history/pull/173 + +## [v1.14.0] +> Dec 6, 2015 + +- Accept objects in `history.push` and `history.replace` ([#141]) +- 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/ReactTraining/history/compare/v1.13.1...v1.14.0 +[#121]: https://github.com/ReactTraining/history/issues/121 +[#141]: https://github.com/ReactTraining/history/pull/141 +[#146]: https://github.com/ReactTraining/history/pull/146 +[#152]: https://github.com/ReactTraining/history/pull/152 +[#167]: https://github.com/ReactTraining/history/pull/167 +[#168]: https://github.com/ReactTraining/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 ([#43]) +- Strip the protocol and domain from `` ([#139]) + +[v1.13.1]: https://github.com/ReactTraining/history/compare/v1.13.0...v1.13.1 +[#43]: https://github.com/ReactTraining/history/pull/43 +[#139]: https://github.com/ReactTraining/history/pull/139 + +## [v1.13.0] +> Oct 28, 2015 + +- `useBasename` transparently handles trailing slashes ([#108]) +- `useBasename` automatically uses the value of `` when no + `basename` option is provided ([#94]) + +[v1.13.0]: https://github.com/ReactTraining/history/compare/v1.12.6...v1.13.0 +[#108]: https://github.com/ReactTraining/history/pull/108 +[#94]: https://github.com/ReactTraining/history/issues/94 + +## [v1.12.6] +> Oct 25, 2015 + +- Add `forceRefresh` option to `createBrowserHistory` that forces + full page refreshes even when the browser supports pushState ([#95]) + +[v1.12.6]: https://github.com/ReactTraining/history/compare/v1.12.5...v1.12.6 +[#95]: https://github.com/ReactTraining/history/issues/95 + +## [v1.12.5] +> Oct 11, 2015 + +- Un-deprecate top-level createLocation method +- Add ability to use `{ pathname, search, hash }` object anywhere + a path can be used +- Fix `useQueries` handling of hashes ([#93]) + +[v1.12.5]: https://github.com/ReactTraining/history/compare/v1.12.4...v1.12.5 +[#93]: https://github.com/ReactTraining/history/issues/93 + +## [v1.12.4] +> Oct 9, 2015 + +- Fix npm postinstall hook on Windows ([#62]) + +[v1.12.4]: https://github.com/ReactTraining/history/compare/v1.12.3...v1.12.4 +[#62]: https://github.com/ReactTraining/history/issues/62 + +## [v1.12.3] +> Oct 7, 2015 + +- 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]) + +[v1.12.3]: https://github.com/ReactTraining/history/compare/v1.12.2...v1.12.3 +[#71]: https://github.com/ReactTraining/history/issues/71 +[#42]: https://github.com/ReactTraining/history/issues/42 + +## [v1.12.2] +> Oct 6, 2015 + +- Fix hash support (see [comments in #51][#51-comments]) + +[v1.12.2]: https://github.com/ReactTraining/history/compare/v1.12.1...v1.12.2 +[#51-comments]: https://github.com/ReactTraining/history/pull/51#issuecomment-143189672 + +## [v1.12.1] +> Oct 5, 2015 + +- Give `location` objects a `key` by default +- Deprecate `history.setState` + +[v1.12.1]: https://github.com/ReactTraining/history/compare/v1.12.0...v1.12.1 + +## [v1.12.0] +> Oct 4, 2015 + +- Add `history.createLocation` instance method. This allows history enhancers such as `useQueries` to modify `location` objects when creating them directly +- Deprecate `createLocation` method on top-level exports + +[v1.12.0]: https://github.com/ReactTraining/history/compare/v1.11.1...v1.12.0 + +## [v1.11.1] +> Sep 26, 2015 + +- Fix `location.basename` when location matches exactly ([#68]) +- Allow transitions to be interrupted by another + +[v1.11.1]: https://github.com/ReactTraining/history/compare/v1.11.0...v1.11.1 +[#68]: https://github.com/ReactTraining/history/issues/68 + +## [v1.11.0] +> Sep 24, 2015 + +- Add `useBasename` history enhancer +- Add `history.listenBefore` +- Add `history.listenBeforeUnload` to `useBeforeUnload` history enhancer +- Deprecate (un)registerTransitionHook +- Deprecate (un)registerBeforeUnloadHook +- Fix installing directly from git repo + +[v1.11.0]: https://github.com/ReactTraining/history/compare/v1.10.2...v1.11.0 diff --git a/node_modules/history/DOMUtils.js b/node_modules/history/DOMUtils.js new file mode 100644 index 00000000..61b206ea --- /dev/null +++ b/node_modules/history/DOMUtils.js @@ -0,0 +1,55 @@ +'use strict'; + +exports.__esModule = true; +var canUseDOM = exports.canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); + +var addEventListener = exports.addEventListener = function addEventListener(node, event, listener) { + return node.addEventListener ? node.addEventListener(event, listener, false) : node.attachEvent('on' + event, listener); +}; + +var removeEventListener = exports.removeEventListener = function removeEventListener(node, event, listener) { + return node.removeEventListener ? node.removeEventListener(event, listener, false) : node.detachEvent('on' + event, listener); +}; + +var getConfirmation = exports.getConfirmation = function getConfirmation(message, callback) { + return callback(window.confirm(message)); +}; // eslint-disable-line no-alert + +/** + * Returns true if the HTML5 history API is supported. Taken from Modernizr. + * + * https://github.com/Modernizr/Modernizr/blob/master/LICENSE + * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js + * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586 + */ +var supportsHistory = exports.supportsHistory = function supportsHistory() { + var ua = window.navigator.userAgent; + + if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false; + + return window.history && 'pushState' in window.history; +}; + +/** + * Returns true if browser fires popstate on hash change. + * IE10 and IE11 do not. + */ +var supportsPopStateOnHashChange = exports.supportsPopStateOnHashChange = function supportsPopStateOnHashChange() { + return window.navigator.userAgent.indexOf('Trident') === -1; +}; + +/** + * Returns false if using go(n) with hash history causes a full page reload. + */ +var supportsGoWithoutReloadUsingHash = exports.supportsGoWithoutReloadUsingHash = function supportsGoWithoutReloadUsingHash() { + return window.navigator.userAgent.indexOf('Firefox') === -1; +}; + +/** + * Returns true if a given popstate event is an extraneous WebKit event. + * Accounts for the fact that Chrome on iOS fires real popstate events + * containing undefined state when pressing the back button. + */ +var isExtraneousPopstateEvent = exports.isExtraneousPopstateEvent = function isExtraneousPopstateEvent(event) { + return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1; +}; \ No newline at end of file diff --git a/node_modules/history/LICENSE.md b/node_modules/history/LICENSE.md new file mode 100644 index 00000000..312045b3 --- /dev/null +++ b/node_modules/history/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2016 Michael Jackson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/history/LocationUtils.js b/node_modules/history/LocationUtils.js new file mode 100644 index 00000000..9e07f01d --- /dev/null +++ b/node_modules/history/LocationUtils.js @@ -0,0 +1,78 @@ +'use strict'; + +exports.__esModule = true; +exports.locationsAreEqual = exports.createLocation = undefined; + +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; }; + +var _resolvePathname = require('resolve-pathname'); + +var _resolvePathname2 = _interopRequireDefault(_resolvePathname); + +var _valueEqual = require('value-equal'); + +var _valueEqual2 = _interopRequireDefault(_valueEqual); + +var _PathUtils = require('./PathUtils'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var createLocation = exports.createLocation = function createLocation(path, state, key, currentLocation) { + var location = void 0; + if (typeof path === 'string') { + // Two-arg form: push(path, state) + location = (0, _PathUtils.parsePath)(path); + location.state = state; + } else { + // One-arg form: push(location) + location = _extends({}, path); + + if (location.pathname === undefined) location.pathname = ''; + + if (location.search) { + if (location.search.charAt(0) !== '?') location.search = '?' + location.search; + } else { + location.search = ''; + } + + if (location.hash) { + if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash; + } else { + location.hash = ''; + } + + if (state !== undefined && location.state === undefined) location.state = state; + } + + try { + location.pathname = decodeURI(location.pathname); + } catch (e) { + if (e instanceof URIError) { + throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); + } else { + throw e; + } + } + + if (key) location.key = key; + + if (currentLocation) { + // Resolve incomplete/relative pathname relative to current location. + if (!location.pathname) { + location.pathname = currentLocation.pathname; + } else if (location.pathname.charAt(0) !== '/') { + location.pathname = (0, _resolvePathname2.default)(location.pathname, currentLocation.pathname); + } + } else { + // When there is no prior location and pathname is empty, set it to / + if (!location.pathname) { + location.pathname = '/'; + } + } + + return location; +}; + +var locationsAreEqual = exports.locationsAreEqual = function locationsAreEqual(a, b) { + return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && (0, _valueEqual2.default)(a.state, b.state); +}; \ No newline at end of file diff --git a/node_modules/history/PathUtils.js b/node_modules/history/PathUtils.js new file mode 100644 index 00000000..0fdcdd5c --- /dev/null +++ b/node_modules/history/PathUtils.js @@ -0,0 +1,61 @@ +'use strict'; + +exports.__esModule = true; +var addLeadingSlash = exports.addLeadingSlash = function addLeadingSlash(path) { + return path.charAt(0) === '/' ? path : '/' + path; +}; + +var stripLeadingSlash = exports.stripLeadingSlash = function stripLeadingSlash(path) { + return path.charAt(0) === '/' ? path.substr(1) : path; +}; + +var hasBasename = exports.hasBasename = function hasBasename(path, prefix) { + return new RegExp('^' + prefix + '(\\/|\\?|#|$)', 'i').test(path); +}; + +var stripBasename = exports.stripBasename = function stripBasename(path, prefix) { + return hasBasename(path, prefix) ? path.substr(prefix.length) : path; +}; + +var stripTrailingSlash = exports.stripTrailingSlash = function stripTrailingSlash(path) { + return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path; +}; + +var parsePath = exports.parsePath = function parsePath(path) { + var pathname = path || '/'; + var search = ''; + var hash = ''; + + var hashIndex = pathname.indexOf('#'); + if (hashIndex !== -1) { + hash = pathname.substr(hashIndex); + pathname = pathname.substr(0, hashIndex); + } + + var searchIndex = pathname.indexOf('?'); + if (searchIndex !== -1) { + search = pathname.substr(searchIndex); + pathname = pathname.substr(0, searchIndex); + } + + return { + pathname: pathname, + search: search === '?' ? '' : search, + hash: hash === '#' ? '' : hash + }; +}; + +var createPath = exports.createPath = function createPath(location) { + var pathname = location.pathname, + search = location.search, + hash = location.hash; + + + var path = pathname || '/'; + + if (search && search !== '?') path += search.charAt(0) === '?' ? search : '?' + search; + + if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : '#' + hash; + + return path; +}; \ No newline at end of file diff --git a/node_modules/history/README.md b/node_modules/history/README.md new file mode 100644 index 00000000..aed93f56 --- /dev/null +++ b/node_modules/history/README.md @@ -0,0 +1,267 @@ +# history [![Travis][build-badge]][build] [![npm package][npm-badge]][npm] + +[build-badge]: https://img.shields.io/travis/ReactTraining/history/master.svg?style=flat-square +[build]: https://travis-ci.org/ReactTraining/history + +[npm-badge]: https://img.shields.io/npm/v/history.svg?style=flat-square +[npm]: https://www.npmjs.org/package/history + +[`history`](https://www.npmjs.com/package/history) is a JavaScript library that lets you easily manage session history anywhere JavaScript runs. `history` abstracts away the differences in various environments and provides a minimal API that lets you manage the history stack, navigate, confirm navigation, and persist state between sessions. + +## Installation + +Using [npm](https://www.npmjs.com/): + + $ npm install --save history + +Then with a module bundler like [webpack](https://webpack.github.io/), use as you would anything else: + +```js +// using ES6 modules +import createHistory from 'history/createBrowserHistory' + +// using CommonJS modules +var createHistory = require('history').createBrowserHistory +``` + +The UMD build is also available on [unpkg](https://unpkg.com): + +```html + +``` + +You can find the library on `window.History`. + +## Usage + +`history` provides 3 different methods for creating a `history` object, depending on your environment. + +- `createBrowserHistory` is for use in modern web browsers that support the [HTML5 history API](http://diveintohtml5.info/history.html) (see [cross-browser compatibility](http://caniuse.com/#feat=history)) +- `createMemoryHistory` is used as a reference implementation and may also be used in non-DOM environments, like [React Native](https://facebook.github.io/react-native/) or tests +- `createHashHistory` is for use in legacy web browsers + +Depending on the method you want to use to keep track of history, you'll `import` (or `require`) one of these methods directly from the package root (i.e. `history/createBrowserHistory`). The remainder of this document uses the term `createHistory` to refer to any of these implementations. + +Basic usage looks like this: + +```js +import createHistory from 'history/createBrowserHistory' + +const history = createHistory() + +// Get the current location. +const location = history.location + +// Listen for changes to the current location. +const unlisten = history.listen((location, action) => { + // location is an object like window.location + console.log(action, location.pathname, location.state) +}) + +// Use push, replace, and go to navigate around. +history.push('/home', { some: 'state' }) + +// To stop listening, call the function returned from listen(). +unlisten() +``` + +The options that each `create` method takes, along with its default values, are: + +```js +createBrowserHistory({ + basename: '', // The base URL of the app (see below) + forceRefresh: false, // Set true to force full page refreshes + keyLength: 6, // The length of location.key + // A function to use to confirm navigation with the user (see below) + getUserConfirmation: (message, callback) => callback(window.confirm(message)) +}) + +createMemoryHistory({ + initialEntries: [ '/' ], // The initial URLs in the history stack + initialIndex: 0, // The starting index in the history stack + keyLength: 6, // The length of location.key + // A function to use to confirm navigation with the user. Required + // if you return string prompts from transition hooks (see below) + getUserConfirmation: null +}) + +createHashHistory({ + basename: '', // The base URL of the app (see below) + hashType: 'slash', // The hash type to use (see below) + // A function to use to confirm navigation with the user (see below) + getUserConfirmation: (message, callback) => callback(window.confirm(message)) +}) +``` + +### Properties + +Each `history` object has the following properties: + +- `history.length` - The number of entries in the history stack +- `history.location` - The current location (see below) +- `history.action` - The current navigation action (see below) + +Additionally, `createMemoryHistory` provides `history.index` and `history.entries` properties that let you inspect the history stack. + +### Listening + +You can listen for changes to the current location using `history.listen`: + +```js +history.listen((location, action) => { + console.log(`The current URL is ${location.pathname}${location.search}${location.hash}`) + console.log(`The last navigation action was ${action}`) +}) +``` + +The `location` object implements a subset of [the `window.location` interface](https://developer.mozilla.org/en-US/docs/Web/API/Location), including: + +- `location.pathname` - The path of the URL +- `location.search` - The URL query string +- `location.hash` - The URL hash fragment + +Locations may also have the following properties: + +- `location.state` - Some extra state for this location that does not reside in the URL (supported in `createBrowserHistory` and `createMemoryHistory`) +- `location.key` - A unique string representing this location (supported in `createBrowserHistory` and `createMemoryHistory`) + +The `action` is one of `PUSH`, `REPLACE`, or `POP` depending on how the user got to the current URL. + +### Navigation + +`history` objects may be used programmatically change the current location using the following methods: + +- `history.push(path, [state])` +- `history.replace(path, [state])` +- `history.go(n)` +- `history.goBack()` +- `history.goForward()` +- `history.canGo(n)` (only in `createMemoryHistory`) + +When using `push` or `replace` you can either specify both the URL path and state as separate arguments or include everything in a single location-like object as the first argument. + +1. A URL path *or* +2. A location-like object with `{ pathname, search, hash, state }` + +```js +// Push a new entry onto the history stack. +history.push('/home') + +// Push a new entry onto the history stack with a query string +// and some state. Location state does not appear in the URL. +history.push('/home?the=query', { some: 'state' }) + +// If you prefer, use a single location-like object to specify both +// the URL and state. This is equivalent to the example above. +history.push({ + pathname: '/home', + search: '?the=query', + state: { some: 'state' } +}) + +// Go back to the previous history entry. The following +// two lines are synonymous. +history.go(-1) +history.goBack() +``` + +**Note:** Location state is only supported in `createBrowserHistory` and `createMemoryHistory`. + +### Blocking Transitions + +`history` lets you register a prompt message that will be shown to the user before location listeners are notified. This allows you to make sure the user wants to leave the current page before they navigate away. + +```js +// Register a simple prompt message that will be shown the +// user before they navigate away from the current page. +const unblock = history.block('Are you sure you want to leave this page?') + +// Or use a function that returns the message when it's needed. +history.block((location, action) => { + // The location and action arguments indicate the location + // we're transitioning to and how we're getting there. + + // A common use case is to prevent the user from leaving the + // page if there's a form they haven't submitted yet. + if (input.value !== '') + return 'Are you sure you want to leave this page?' +}) + +// To stop blocking transitions, call the function returned from block(). +unblock() +``` + +**Note:** You'll need to provide a `getUserConfirmation` function to use this feature with `createMemoryHistory` (see below). + +### Customizing the Confirm Dialog + +By default, [`window.confirm`](https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm) is used to show prompt messages to the user. If you need to override this behavior (or if you're using `createMemoryHistory`, which doesn't assume a DOM environment), provide a `getUserConfirmation` function when you create your history object. + +```js +const history = createHistory({ + getUserConfirmation(message, callback) { + // Show some custom dialog to the user and call + // callback(true) to continue the transiton, or + // callback(false) to abort it. + } +}) +``` + +### Using a Base URL + +If all the URLs in your app are relative to some other "base" URL, use the `basename` option. This option transparently adds the given string to the front of all URLs you use. + +```js +const history = createHistory({ + basename: '/the/base' +}) + +history.listen(location => { + console.log(location.pathname) // /home +}) + +history.push('/home') // URL is now /the/base/home +``` + +**Note:** `basename` is not suppported in `createMemoryHistory`. + +### Forcing Full Page Refreshes in createBrowserHistory + +By default `createBrowserHistory` uses HTML5 `pushState` and `replaceState` to prevent reloading the entire page from the server while navigating around. If instead you would like to reload as the URL changes, use the `forceRefresh` option. + +```js +const history = createBrowserHistory({ + forceRefresh: true +}) +``` + +### Modifying the Hash Type in createHashHistory + +By default `createHashHistory` uses a leading slash in hash-based URLs. You can use the `hashType` option to use a different hash formatting. + + +```js +const history = createHashHistory({ + hashType: 'slash' // the default +}) + +history.push('/home') // window.location.hash is #/home + +const history = createHashHistory({ + hashType: 'noslash' // Omit the leading slash +}) + +history.push('/home') // window.location.hash is #home + +const history = createHashHistory({ + hashType: 'hashbang' // Google's legacy AJAX URL format +}) + +history.push('/home') // window.location.hash is #!/home +``` + +## Thanks + +A big thank-you to [Dan Shaw](https://www.npmjs.com/~dshaw) for letting us use the `history` npm package name! Thanks Dan! + +Also, thanks to [BrowserStack](https://www.browserstack.com/) for providing the infrastructure that allows us to run our build in real browsers. diff --git a/node_modules/history/createBrowserHistory.js b/node_modules/history/createBrowserHistory.js new file mode 100644 index 00000000..74da51d5 --- /dev/null +++ b/node_modules/history/createBrowserHistory.js @@ -0,0 +1,307 @@ +'use strict'; + +exports.__esModule = true; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +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; }; + +var _warning = require('warning'); + +var _warning2 = _interopRequireDefault(_warning); + +var _invariant = require('invariant'); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _LocationUtils = require('./LocationUtils'); + +var _PathUtils = require('./PathUtils'); + +var _createTransitionManager = require('./createTransitionManager'); + +var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); + +var _DOMUtils = require('./DOMUtils'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var PopStateEvent = 'popstate'; +var HashChangeEvent = 'hashchange'; + +var getHistoryState = function getHistoryState() { + try { + return window.history.state || {}; + } catch (e) { + // IE 11 sometimes throws when accessing window.history.state + // See https://github.com/ReactTraining/history/pull/289 + return {}; + } +}; + +/** + * Creates a history object that uses the HTML5 history API including + * pushState, replaceState, and the popstate event. + */ +var createBrowserHistory = function createBrowserHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + (0, _invariant2.default)(_DOMUtils.canUseDOM, 'Browser history needs a DOM'); + + var globalHistory = window.history; + var canUseHistory = (0, _DOMUtils.supportsHistory)(); + var needsHashChangeListener = !(0, _DOMUtils.supportsPopStateOnHashChange)(); + + var _props$forceRefresh = props.forceRefresh, + forceRefresh = _props$forceRefresh === undefined ? false : _props$forceRefresh, + _props$getUserConfirm = props.getUserConfirmation, + getUserConfirmation = _props$getUserConfirm === undefined ? _DOMUtils.getConfirmation : _props$getUserConfirm, + _props$keyLength = props.keyLength, + keyLength = _props$keyLength === undefined ? 6 : _props$keyLength; + + var basename = props.basename ? (0, _PathUtils.stripTrailingSlash)((0, _PathUtils.addLeadingSlash)(props.basename)) : ''; + + var getDOMLocation = function getDOMLocation(historyState) { + var _ref = historyState || {}, + key = _ref.key, + state = _ref.state; + + var _window$location = window.location, + pathname = _window$location.pathname, + search = _window$location.search, + hash = _window$location.hash; + + + var path = pathname + search + hash; + + (0, _warning2.default)(!basename || (0, _PathUtils.hasBasename)(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".'); + + if (basename) path = (0, _PathUtils.stripBasename)(path, basename); + + return (0, _LocationUtils.createLocation)(path, state, key); + }; + + var createKey = function createKey() { + return Math.random().toString(36).substr(2, keyLength); + }; + + var transitionManager = (0, _createTransitionManager2.default)(); + + var setState = function setState(nextState) { + _extends(history, nextState); + + history.length = globalHistory.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var handlePopState = function handlePopState(event) { + // Ignore extraneous popstate events in WebKit. + if ((0, _DOMUtils.isExtraneousPopstateEvent)(event)) return; + + handlePop(getDOMLocation(event.state)); + }; + + var handleHashChange = function handleHashChange() { + handlePop(getDOMLocation(getHistoryState())); + }; + + var forceNextPop = false; + + var handlePop = function handlePop(location) { + if (forceNextPop) { + forceNextPop = false; + setState(); + } else { + var action = 'POP'; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ action: action, location: location }); + } else { + revertPop(location); + } + }); + } + }; + + var revertPop = function revertPop(fromLocation) { + var toLocation = history.location; + + // TODO: We could probably make this more reliable by + // keeping a list of keys we've seen in sessionStorage. + // Instead, we just default to 0 for keys we don't know. + + var toIndex = allKeys.indexOf(toLocation.key); + + if (toIndex === -1) toIndex = 0; + + var fromIndex = allKeys.indexOf(fromLocation.key); + + if (fromIndex === -1) fromIndex = 0; + + var delta = toIndex - fromIndex; + + if (delta) { + forceNextPop = true; + go(delta); + } + }; + + var initialLocation = getDOMLocation(getHistoryState()); + var allKeys = [initialLocation.key]; + + // Public interface + + var createHref = function createHref(location) { + return basename + (0, _PathUtils.createPath)(location); + }; + + var push = function push(path, state) { + (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'PUSH'; + var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var href = createHref(location); + var key = location.key, + state = location.state; + + + if (canUseHistory) { + globalHistory.pushState({ key: key, state: state }, null, href); + + if (forceRefresh) { + window.location.href = href; + } else { + var prevIndex = allKeys.indexOf(history.location.key); + var nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1); + + nextKeys.push(location.key); + allKeys = nextKeys; + + setState({ action: action, location: location }); + } + } else { + (0, _warning2.default)(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history'); + + window.location.href = href; + } + }); + }; + + var replace = function replace(path, state) { + (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'REPLACE'; + var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var href = createHref(location); + var key = location.key, + state = location.state; + + + if (canUseHistory) { + globalHistory.replaceState({ key: key, state: state }, null, href); + + if (forceRefresh) { + window.location.replace(href); + } else { + var prevIndex = allKeys.indexOf(history.location.key); + + if (prevIndex !== -1) allKeys[prevIndex] = location.key; + + setState({ action: action, location: location }); + } + } else { + (0, _warning2.default)(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history'); + + window.location.replace(href); + } + }); + }; + + var go = function go(n) { + globalHistory.go(n); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var listenerCount = 0; + + var checkDOMListeners = function checkDOMListeners(delta) { + listenerCount += delta; + + if (listenerCount === 1) { + (0, _DOMUtils.addEventListener)(window, PopStateEvent, handlePopState); + + if (needsHashChangeListener) (0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleHashChange); + } else if (listenerCount === 0) { + (0, _DOMUtils.removeEventListener)(window, PopStateEvent, handlePopState); + + if (needsHashChangeListener) (0, _DOMUtils.removeEventListener)(window, HashChangeEvent, handleHashChange); + } + }; + + var isBlocked = false; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + var unblock = transitionManager.setPrompt(prompt); + + if (!isBlocked) { + checkDOMListeners(1); + isBlocked = true; + } + + return function () { + if (isBlocked) { + isBlocked = false; + checkDOMListeners(-1); + } + + return unblock(); + }; + }; + + var listen = function listen(listener) { + var unlisten = transitionManager.appendListener(listener); + checkDOMListeners(1); + + return function () { + checkDOMListeners(-1); + unlisten(); + }; + }; + + var history = { + length: globalHistory.length, + action: 'POP', + location: initialLocation, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + block: block, + listen: listen + }; + + return history; +}; + +exports.default = createBrowserHistory; \ No newline at end of file diff --git a/node_modules/history/createHashHistory.js b/node_modules/history/createHashHistory.js new file mode 100644 index 00000000..47004a7e --- /dev/null +++ b/node_modules/history/createHashHistory.js @@ -0,0 +1,324 @@ +'use strict'; + +exports.__esModule = true; + +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; }; + +var _warning = require('warning'); + +var _warning2 = _interopRequireDefault(_warning); + +var _invariant = require('invariant'); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _LocationUtils = require('./LocationUtils'); + +var _PathUtils = require('./PathUtils'); + +var _createTransitionManager = require('./createTransitionManager'); + +var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); + +var _DOMUtils = require('./DOMUtils'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var HashChangeEvent = 'hashchange'; + +var HashPathCoders = { + hashbang: { + encodePath: function encodePath(path) { + return path.charAt(0) === '!' ? path : '!/' + (0, _PathUtils.stripLeadingSlash)(path); + }, + decodePath: function decodePath(path) { + return path.charAt(0) === '!' ? path.substr(1) : path; + } + }, + noslash: { + encodePath: _PathUtils.stripLeadingSlash, + decodePath: _PathUtils.addLeadingSlash + }, + slash: { + encodePath: _PathUtils.addLeadingSlash, + decodePath: _PathUtils.addLeadingSlash + } +}; + +var getHashPath = function getHashPath() { + // We can't use window.location.hash here because it's not + // consistent across browsers - Firefox will pre-decode it! + var href = window.location.href; + var hashIndex = href.indexOf('#'); + return hashIndex === -1 ? '' : href.substring(hashIndex + 1); +}; + +var pushHashPath = function pushHashPath(path) { + return window.location.hash = path; +}; + +var replaceHashPath = function replaceHashPath(path) { + var hashIndex = window.location.href.indexOf('#'); + + window.location.replace(window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path); +}; + +var createHashHistory = function createHashHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + (0, _invariant2.default)(_DOMUtils.canUseDOM, 'Hash history needs a DOM'); + + var globalHistory = window.history; + var canGoWithoutReload = (0, _DOMUtils.supportsGoWithoutReloadUsingHash)(); + + var _props$getUserConfirm = props.getUserConfirmation, + getUserConfirmation = _props$getUserConfirm === undefined ? _DOMUtils.getConfirmation : _props$getUserConfirm, + _props$hashType = props.hashType, + hashType = _props$hashType === undefined ? 'slash' : _props$hashType; + + var basename = props.basename ? (0, _PathUtils.stripTrailingSlash)((0, _PathUtils.addLeadingSlash)(props.basename)) : ''; + + var _HashPathCoders$hashT = HashPathCoders[hashType], + encodePath = _HashPathCoders$hashT.encodePath, + decodePath = _HashPathCoders$hashT.decodePath; + + + var getDOMLocation = function getDOMLocation() { + var path = decodePath(getHashPath()); + + (0, _warning2.default)(!basename || (0, _PathUtils.hasBasename)(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".'); + + if (basename) path = (0, _PathUtils.stripBasename)(path, basename); + + return (0, _LocationUtils.createLocation)(path); + }; + + var transitionManager = (0, _createTransitionManager2.default)(); + + var setState = function setState(nextState) { + _extends(history, nextState); + + history.length = globalHistory.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var forceNextPop = false; + var ignorePath = null; + + var handleHashChange = function handleHashChange() { + var path = getHashPath(); + var encodedPath = encodePath(path); + + if (path !== encodedPath) { + // Ensure we always have a properly-encoded hash. + replaceHashPath(encodedPath); + } else { + var location = getDOMLocation(); + var prevLocation = history.location; + + if (!forceNextPop && (0, _LocationUtils.locationsAreEqual)(prevLocation, location)) return; // A hashchange doesn't always == location change. + + if (ignorePath === (0, _PathUtils.createPath)(location)) return; // Ignore this change; we already setState in push/replace. + + ignorePath = null; + + handlePop(location); + } + }; + + var handlePop = function handlePop(location) { + if (forceNextPop) { + forceNextPop = false; + setState(); + } else { + var action = 'POP'; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ action: action, location: location }); + } else { + revertPop(location); + } + }); + } + }; + + var revertPop = function revertPop(fromLocation) { + var toLocation = history.location; + + // TODO: We could probably make this more reliable by + // keeping a list of paths we've seen in sessionStorage. + // Instead, we just default to 0 for paths we don't know. + + var toIndex = allPaths.lastIndexOf((0, _PathUtils.createPath)(toLocation)); + + if (toIndex === -1) toIndex = 0; + + var fromIndex = allPaths.lastIndexOf((0, _PathUtils.createPath)(fromLocation)); + + if (fromIndex === -1) fromIndex = 0; + + var delta = toIndex - fromIndex; + + if (delta) { + forceNextPop = true; + go(delta); + } + }; + + // Ensure the hash is encoded properly before doing anything else. + var path = getHashPath(); + var encodedPath = encodePath(path); + + if (path !== encodedPath) replaceHashPath(encodedPath); + + var initialLocation = getDOMLocation(); + var allPaths = [(0, _PathUtils.createPath)(initialLocation)]; + + // Public interface + + var createHref = function createHref(location) { + return '#' + encodePath(basename + (0, _PathUtils.createPath)(location)); + }; + + var push = function push(path, state) { + (0, _warning2.default)(state === undefined, 'Hash history cannot push state; it is ignored'); + + var action = 'PUSH'; + var location = (0, _LocationUtils.createLocation)(path, undefined, undefined, history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var path = (0, _PathUtils.createPath)(location); + var encodedPath = encodePath(basename + path); + var hashChanged = getHashPath() !== encodedPath; + + if (hashChanged) { + // We cannot tell if a hashchange was caused by a PUSH, so we'd + // rather setState here and ignore the hashchange. The caveat here + // is that other hash histories in the page will consider it a POP. + ignorePath = path; + pushHashPath(encodedPath); + + var prevIndex = allPaths.lastIndexOf((0, _PathUtils.createPath)(history.location)); + var nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1); + + nextPaths.push(path); + allPaths = nextPaths; + + setState({ action: action, location: location }); + } else { + (0, _warning2.default)(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack'); + + setState(); + } + }); + }; + + var replace = function replace(path, state) { + (0, _warning2.default)(state === undefined, 'Hash history cannot replace state; it is ignored'); + + var action = 'REPLACE'; + var location = (0, _LocationUtils.createLocation)(path, undefined, undefined, history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var path = (0, _PathUtils.createPath)(location); + var encodedPath = encodePath(basename + path); + var hashChanged = getHashPath() !== encodedPath; + + if (hashChanged) { + // We cannot tell if a hashchange was caused by a REPLACE, so we'd + // rather setState here and ignore the hashchange. The caveat here + // is that other hash histories in the page will consider it a POP. + ignorePath = path; + replaceHashPath(encodedPath); + } + + var prevIndex = allPaths.indexOf((0, _PathUtils.createPath)(history.location)); + + if (prevIndex !== -1) allPaths[prevIndex] = path; + + setState({ action: action, location: location }); + }); + }; + + var go = function go(n) { + (0, _warning2.default)(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser'); + + globalHistory.go(n); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var listenerCount = 0; + + var checkDOMListeners = function checkDOMListeners(delta) { + listenerCount += delta; + + if (listenerCount === 1) { + (0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleHashChange); + } else if (listenerCount === 0) { + (0, _DOMUtils.removeEventListener)(window, HashChangeEvent, handleHashChange); + } + }; + + var isBlocked = false; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + var unblock = transitionManager.setPrompt(prompt); + + if (!isBlocked) { + checkDOMListeners(1); + isBlocked = true; + } + + return function () { + if (isBlocked) { + isBlocked = false; + checkDOMListeners(-1); + } + + return unblock(); + }; + }; + + var listen = function listen(listener) { + var unlisten = transitionManager.appendListener(listener); + checkDOMListeners(1); + + return function () { + checkDOMListeners(-1); + unlisten(); + }; + }; + + var history = { + length: globalHistory.length, + action: 'POP', + location: initialLocation, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + block: block, + listen: listen + }; + + return history; +}; + +exports.default = createHashHistory; \ No newline at end of file diff --git a/node_modules/history/createMemoryHistory.js b/node_modules/history/createMemoryHistory.js new file mode 100644 index 00000000..2691953b --- /dev/null +++ b/node_modules/history/createMemoryHistory.js @@ -0,0 +1,170 @@ +'use strict'; + +exports.__esModule = true; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +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; }; + +var _warning = require('warning'); + +var _warning2 = _interopRequireDefault(_warning); + +var _PathUtils = require('./PathUtils'); + +var _LocationUtils = require('./LocationUtils'); + +var _createTransitionManager = require('./createTransitionManager'); + +var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var clamp = function clamp(n, lowerBound, upperBound) { + return Math.min(Math.max(n, lowerBound), upperBound); +}; + +/** + * Creates a history object that stores locations in memory. + */ +var createMemoryHistory = function createMemoryHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var getUserConfirmation = props.getUserConfirmation, + _props$initialEntries = props.initialEntries, + initialEntries = _props$initialEntries === undefined ? ['/'] : _props$initialEntries, + _props$initialIndex = props.initialIndex, + initialIndex = _props$initialIndex === undefined ? 0 : _props$initialIndex, + _props$keyLength = props.keyLength, + keyLength = _props$keyLength === undefined ? 6 : _props$keyLength; + + + var transitionManager = (0, _createTransitionManager2.default)(); + + var setState = function setState(nextState) { + _extends(history, nextState); + + history.length = history.entries.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var createKey = function createKey() { + return Math.random().toString(36).substr(2, keyLength); + }; + + var index = clamp(initialIndex, 0, initialEntries.length - 1); + var entries = initialEntries.map(function (entry) { + return typeof entry === 'string' ? (0, _LocationUtils.createLocation)(entry, undefined, createKey()) : (0, _LocationUtils.createLocation)(entry, undefined, entry.key || createKey()); + }); + + // Public interface + + var createHref = _PathUtils.createPath; + + var push = function push(path, state) { + (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'PUSH'; + var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var prevIndex = history.index; + var nextIndex = prevIndex + 1; + + var nextEntries = history.entries.slice(0); + if (nextEntries.length > nextIndex) { + nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location); + } else { + nextEntries.push(location); + } + + setState({ + action: action, + location: location, + index: nextIndex, + entries: nextEntries + }); + }); + }; + + var replace = function replace(path, state) { + (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'REPLACE'; + var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + history.entries[history.index] = location; + + setState({ action: action, location: location }); + }); + }; + + var go = function go(n) { + var nextIndex = clamp(history.index + n, 0, history.entries.length - 1); + + var action = 'POP'; + var location = history.entries[nextIndex]; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ + action: action, + location: location, + index: nextIndex + }); + } else { + // Mimic the behavior of DOM histories by + // causing a render after a cancelled POP. + setState(); + } + }); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var canGo = function canGo(n) { + var nextIndex = history.index + n; + return nextIndex >= 0 && nextIndex < history.entries.length; + }; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + return transitionManager.setPrompt(prompt); + }; + + var listen = function listen(listener) { + return transitionManager.appendListener(listener); + }; + + var history = { + length: entries.length, + action: 'POP', + location: entries[index], + index: index, + entries: entries, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + canGo: canGo, + block: block, + listen: listen + }; + + return history; +}; + +exports.default = createMemoryHistory; \ No newline at end of file diff --git a/node_modules/history/createTransitionManager.js b/node_modules/history/createTransitionManager.js new file mode 100644 index 00000000..dfeca8a8 --- /dev/null +++ b/node_modules/history/createTransitionManager.js @@ -0,0 +1,85 @@ +'use strict'; + +exports.__esModule = true; + +var _warning = require('warning'); + +var _warning2 = _interopRequireDefault(_warning); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var createTransitionManager = function createTransitionManager() { + var prompt = null; + + var setPrompt = function setPrompt(nextPrompt) { + (0, _warning2.default)(prompt == null, 'A history supports only one prompt at a time'); + + prompt = nextPrompt; + + return function () { + if (prompt === nextPrompt) prompt = null; + }; + }; + + var confirmTransitionTo = function confirmTransitionTo(location, action, getUserConfirmation, callback) { + // TODO: If another transition starts while we're still confirming + // the previous one, we may end up in a weird state. Figure out the + // best way to handle this. + if (prompt != null) { + var result = typeof prompt === 'function' ? prompt(location, action) : prompt; + + if (typeof result === 'string') { + if (typeof getUserConfirmation === 'function') { + getUserConfirmation(result, callback); + } else { + (0, _warning2.default)(false, 'A history needs a getUserConfirmation function in order to use a prompt message'); + + callback(true); + } + } else { + // Return false from a transition hook to cancel the transition. + callback(result !== false); + } + } else { + callback(true); + } + }; + + var listeners = []; + + var appendListener = function appendListener(fn) { + var isActive = true; + + var listener = function listener() { + if (isActive) fn.apply(undefined, arguments); + }; + + listeners.push(listener); + + return function () { + isActive = false; + listeners = listeners.filter(function (item) { + return item !== listener; + }); + }; + }; + + var notifyListeners = function notifyListeners() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + listeners.forEach(function (listener) { + return listener.apply(undefined, args); + }); + }; + + return { + setPrompt: setPrompt, + confirmTransitionTo: confirmTransitionTo, + appendListener: appendListener, + notifyListeners: notifyListeners + }; +}; + +exports.default = createTransitionManager; \ No newline at end of file diff --git a/node_modules/history/es/DOMUtils.js b/node_modules/history/es/DOMUtils.js new file mode 100644 index 00000000..890b2bbc --- /dev/null +++ b/node_modules/history/es/DOMUtils.js @@ -0,0 +1,52 @@ +export var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); + +export var addEventListener = function addEventListener(node, event, listener) { + return node.addEventListener ? node.addEventListener(event, listener, false) : node.attachEvent('on' + event, listener); +}; + +export var removeEventListener = function removeEventListener(node, event, listener) { + return node.removeEventListener ? node.removeEventListener(event, listener, false) : node.detachEvent('on' + event, listener); +}; + +export var getConfirmation = function getConfirmation(message, callback) { + return callback(window.confirm(message)); +}; // eslint-disable-line no-alert + +/** + * Returns true if the HTML5 history API is supported. Taken from Modernizr. + * + * https://github.com/Modernizr/Modernizr/blob/master/LICENSE + * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js + * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586 + */ +export var supportsHistory = function supportsHistory() { + var ua = window.navigator.userAgent; + + if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false; + + return window.history && 'pushState' in window.history; +}; + +/** + * Returns true if browser fires popstate on hash change. + * IE10 and IE11 do not. + */ +export var supportsPopStateOnHashChange = function supportsPopStateOnHashChange() { + return window.navigator.userAgent.indexOf('Trident') === -1; +}; + +/** + * Returns false if using go(n) with hash history causes a full page reload. + */ +export var supportsGoWithoutReloadUsingHash = function supportsGoWithoutReloadUsingHash() { + return window.navigator.userAgent.indexOf('Firefox') === -1; +}; + +/** + * Returns true if a given popstate event is an extraneous WebKit event. + * Accounts for the fact that Chrome on iOS fires real popstate events + * containing undefined state when pressing the back button. + */ +export var isExtraneousPopstateEvent = function isExtraneousPopstateEvent(event) { + return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1; +}; \ No newline at end of file diff --git a/node_modules/history/es/LocationUtils.js b/node_modules/history/es/LocationUtils.js new file mode 100644 index 00000000..cbe096c3 --- /dev/null +++ b/node_modules/history/es/LocationUtils.js @@ -0,0 +1,65 @@ +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; }; + +import resolvePathname from 'resolve-pathname'; +import valueEqual from 'value-equal'; +import { parsePath } from './PathUtils'; + +export var createLocation = function createLocation(path, state, key, currentLocation) { + var location = void 0; + if (typeof path === 'string') { + // Two-arg form: push(path, state) + location = parsePath(path); + location.state = state; + } else { + // One-arg form: push(location) + location = _extends({}, path); + + if (location.pathname === undefined) location.pathname = ''; + + if (location.search) { + if (location.search.charAt(0) !== '?') location.search = '?' + location.search; + } else { + location.search = ''; + } + + if (location.hash) { + if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash; + } else { + location.hash = ''; + } + + if (state !== undefined && location.state === undefined) location.state = state; + } + + try { + location.pathname = decodeURI(location.pathname); + } catch (e) { + if (e instanceof URIError) { + throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); + } else { + throw e; + } + } + + if (key) location.key = key; + + if (currentLocation) { + // Resolve incomplete/relative pathname relative to current location. + if (!location.pathname) { + location.pathname = currentLocation.pathname; + } else if (location.pathname.charAt(0) !== '/') { + location.pathname = resolvePathname(location.pathname, currentLocation.pathname); + } + } else { + // When there is no prior location and pathname is empty, set it to / + if (!location.pathname) { + location.pathname = '/'; + } + } + + return location; +}; + +export var locationsAreEqual = function locationsAreEqual(a, b) { + return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && valueEqual(a.state, b.state); +}; \ No newline at end of file diff --git a/node_modules/history/es/PathUtils.js b/node_modules/history/es/PathUtils.js new file mode 100644 index 00000000..f3e36417 --- /dev/null +++ b/node_modules/history/es/PathUtils.js @@ -0,0 +1,58 @@ +export var addLeadingSlash = function addLeadingSlash(path) { + return path.charAt(0) === '/' ? path : '/' + path; +}; + +export var stripLeadingSlash = function stripLeadingSlash(path) { + return path.charAt(0) === '/' ? path.substr(1) : path; +}; + +export var hasBasename = function hasBasename(path, prefix) { + return new RegExp('^' + prefix + '(\\/|\\?|#|$)', 'i').test(path); +}; + +export var stripBasename = function stripBasename(path, prefix) { + return hasBasename(path, prefix) ? path.substr(prefix.length) : path; +}; + +export var stripTrailingSlash = function stripTrailingSlash(path) { + return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path; +}; + +export var parsePath = function parsePath(path) { + var pathname = path || '/'; + var search = ''; + var hash = ''; + + var hashIndex = pathname.indexOf('#'); + if (hashIndex !== -1) { + hash = pathname.substr(hashIndex); + pathname = pathname.substr(0, hashIndex); + } + + var searchIndex = pathname.indexOf('?'); + if (searchIndex !== -1) { + search = pathname.substr(searchIndex); + pathname = pathname.substr(0, searchIndex); + } + + return { + pathname: pathname, + search: search === '?' ? '' : search, + hash: hash === '#' ? '' : hash + }; +}; + +export var createPath = function createPath(location) { + var pathname = location.pathname, + search = location.search, + hash = location.hash; + + + var path = pathname || '/'; + + if (search && search !== '?') path += search.charAt(0) === '?' ? search : '?' + search; + + if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : '#' + hash; + + return path; +}; \ No newline at end of file diff --git a/node_modules/history/es/createBrowserHistory.js b/node_modules/history/es/createBrowserHistory.js new file mode 100644 index 00000000..407cacdb --- /dev/null +++ b/node_modules/history/es/createBrowserHistory.js @@ -0,0 +1,290 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +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; }; + +import warning from 'warning'; +import invariant from 'invariant'; +import { createLocation } from './LocationUtils'; +import { addLeadingSlash, stripTrailingSlash, hasBasename, stripBasename, createPath } from './PathUtils'; +import createTransitionManager from './createTransitionManager'; +import { canUseDOM, addEventListener, removeEventListener, getConfirmation, supportsHistory, supportsPopStateOnHashChange, isExtraneousPopstateEvent } from './DOMUtils'; + +var PopStateEvent = 'popstate'; +var HashChangeEvent = 'hashchange'; + +var getHistoryState = function getHistoryState() { + try { + return window.history.state || {}; + } catch (e) { + // IE 11 sometimes throws when accessing window.history.state + // See https://github.com/ReactTraining/history/pull/289 + return {}; + } +}; + +/** + * Creates a history object that uses the HTML5 history API including + * pushState, replaceState, and the popstate event. + */ +var createBrowserHistory = function createBrowserHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + invariant(canUseDOM, 'Browser history needs a DOM'); + + var globalHistory = window.history; + var canUseHistory = supportsHistory(); + var needsHashChangeListener = !supportsPopStateOnHashChange(); + + var _props$forceRefresh = props.forceRefresh, + forceRefresh = _props$forceRefresh === undefined ? false : _props$forceRefresh, + _props$getUserConfirm = props.getUserConfirmation, + getUserConfirmation = _props$getUserConfirm === undefined ? getConfirmation : _props$getUserConfirm, + _props$keyLength = props.keyLength, + keyLength = _props$keyLength === undefined ? 6 : _props$keyLength; + + var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; + + var getDOMLocation = function getDOMLocation(historyState) { + var _ref = historyState || {}, + key = _ref.key, + state = _ref.state; + + var _window$location = window.location, + pathname = _window$location.pathname, + search = _window$location.search, + hash = _window$location.hash; + + + var path = pathname + search + hash; + + warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".'); + + if (basename) path = stripBasename(path, basename); + + return createLocation(path, state, key); + }; + + var createKey = function createKey() { + return Math.random().toString(36).substr(2, keyLength); + }; + + var transitionManager = createTransitionManager(); + + var setState = function setState(nextState) { + _extends(history, nextState); + + history.length = globalHistory.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var handlePopState = function handlePopState(event) { + // Ignore extraneous popstate events in WebKit. + if (isExtraneousPopstateEvent(event)) return; + + handlePop(getDOMLocation(event.state)); + }; + + var handleHashChange = function handleHashChange() { + handlePop(getDOMLocation(getHistoryState())); + }; + + var forceNextPop = false; + + var handlePop = function handlePop(location) { + if (forceNextPop) { + forceNextPop = false; + setState(); + } else { + var action = 'POP'; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ action: action, location: location }); + } else { + revertPop(location); + } + }); + } + }; + + var revertPop = function revertPop(fromLocation) { + var toLocation = history.location; + + // TODO: We could probably make this more reliable by + // keeping a list of keys we've seen in sessionStorage. + // Instead, we just default to 0 for keys we don't know. + + var toIndex = allKeys.indexOf(toLocation.key); + + if (toIndex === -1) toIndex = 0; + + var fromIndex = allKeys.indexOf(fromLocation.key); + + if (fromIndex === -1) fromIndex = 0; + + var delta = toIndex - fromIndex; + + if (delta) { + forceNextPop = true; + go(delta); + } + }; + + var initialLocation = getDOMLocation(getHistoryState()); + var allKeys = [initialLocation.key]; + + // Public interface + + var createHref = function createHref(location) { + return basename + createPath(location); + }; + + var push = function push(path, state) { + warning(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'PUSH'; + var location = createLocation(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var href = createHref(location); + var key = location.key, + state = location.state; + + + if (canUseHistory) { + globalHistory.pushState({ key: key, state: state }, null, href); + + if (forceRefresh) { + window.location.href = href; + } else { + var prevIndex = allKeys.indexOf(history.location.key); + var nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1); + + nextKeys.push(location.key); + allKeys = nextKeys; + + setState({ action: action, location: location }); + } + } else { + warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history'); + + window.location.href = href; + } + }); + }; + + var replace = function replace(path, state) { + warning(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'REPLACE'; + var location = createLocation(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var href = createHref(location); + var key = location.key, + state = location.state; + + + if (canUseHistory) { + globalHistory.replaceState({ key: key, state: state }, null, href); + + if (forceRefresh) { + window.location.replace(href); + } else { + var prevIndex = allKeys.indexOf(history.location.key); + + if (prevIndex !== -1) allKeys[prevIndex] = location.key; + + setState({ action: action, location: location }); + } + } else { + warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history'); + + window.location.replace(href); + } + }); + }; + + var go = function go(n) { + globalHistory.go(n); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var listenerCount = 0; + + var checkDOMListeners = function checkDOMListeners(delta) { + listenerCount += delta; + + if (listenerCount === 1) { + addEventListener(window, PopStateEvent, handlePopState); + + if (needsHashChangeListener) addEventListener(window, HashChangeEvent, handleHashChange); + } else if (listenerCount === 0) { + removeEventListener(window, PopStateEvent, handlePopState); + + if (needsHashChangeListener) removeEventListener(window, HashChangeEvent, handleHashChange); + } + }; + + var isBlocked = false; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + var unblock = transitionManager.setPrompt(prompt); + + if (!isBlocked) { + checkDOMListeners(1); + isBlocked = true; + } + + return function () { + if (isBlocked) { + isBlocked = false; + checkDOMListeners(-1); + } + + return unblock(); + }; + }; + + var listen = function listen(listener) { + var unlisten = transitionManager.appendListener(listener); + checkDOMListeners(1); + + return function () { + checkDOMListeners(-1); + unlisten(); + }; + }; + + var history = { + length: globalHistory.length, + action: 'POP', + location: initialLocation, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + block: block, + listen: listen + }; + + return history; +}; + +export default createBrowserHistory; \ No newline at end of file diff --git a/node_modules/history/es/createHashHistory.js b/node_modules/history/es/createHashHistory.js new file mode 100644 index 00000000..c0f55614 --- /dev/null +++ b/node_modules/history/es/createHashHistory.js @@ -0,0 +1,307 @@ +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; }; + +import warning from 'warning'; +import invariant from 'invariant'; +import { createLocation, locationsAreEqual } from './LocationUtils'; +import { addLeadingSlash, stripLeadingSlash, stripTrailingSlash, hasBasename, stripBasename, createPath } from './PathUtils'; +import createTransitionManager from './createTransitionManager'; +import { canUseDOM, addEventListener, removeEventListener, getConfirmation, supportsGoWithoutReloadUsingHash } from './DOMUtils'; + +var HashChangeEvent = 'hashchange'; + +var HashPathCoders = { + hashbang: { + encodePath: function encodePath(path) { + return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path); + }, + decodePath: function decodePath(path) { + return path.charAt(0) === '!' ? path.substr(1) : path; + } + }, + noslash: { + encodePath: stripLeadingSlash, + decodePath: addLeadingSlash + }, + slash: { + encodePath: addLeadingSlash, + decodePath: addLeadingSlash + } +}; + +var getHashPath = function getHashPath() { + // We can't use window.location.hash here because it's not + // consistent across browsers - Firefox will pre-decode it! + var href = window.location.href; + var hashIndex = href.indexOf('#'); + return hashIndex === -1 ? '' : href.substring(hashIndex + 1); +}; + +var pushHashPath = function pushHashPath(path) { + return window.location.hash = path; +}; + +var replaceHashPath = function replaceHashPath(path) { + var hashIndex = window.location.href.indexOf('#'); + + window.location.replace(window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path); +}; + +var createHashHistory = function createHashHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + invariant(canUseDOM, 'Hash history needs a DOM'); + + var globalHistory = window.history; + var canGoWithoutReload = supportsGoWithoutReloadUsingHash(); + + var _props$getUserConfirm = props.getUserConfirmation, + getUserConfirmation = _props$getUserConfirm === undefined ? getConfirmation : _props$getUserConfirm, + _props$hashType = props.hashType, + hashType = _props$hashType === undefined ? 'slash' : _props$hashType; + + var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; + + var _HashPathCoders$hashT = HashPathCoders[hashType], + encodePath = _HashPathCoders$hashT.encodePath, + decodePath = _HashPathCoders$hashT.decodePath; + + + var getDOMLocation = function getDOMLocation() { + var path = decodePath(getHashPath()); + + warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".'); + + if (basename) path = stripBasename(path, basename); + + return createLocation(path); + }; + + var transitionManager = createTransitionManager(); + + var setState = function setState(nextState) { + _extends(history, nextState); + + history.length = globalHistory.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var forceNextPop = false; + var ignorePath = null; + + var handleHashChange = function handleHashChange() { + var path = getHashPath(); + var encodedPath = encodePath(path); + + if (path !== encodedPath) { + // Ensure we always have a properly-encoded hash. + replaceHashPath(encodedPath); + } else { + var location = getDOMLocation(); + var prevLocation = history.location; + + if (!forceNextPop && locationsAreEqual(prevLocation, location)) return; // A hashchange doesn't always == location change. + + if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace. + + ignorePath = null; + + handlePop(location); + } + }; + + var handlePop = function handlePop(location) { + if (forceNextPop) { + forceNextPop = false; + setState(); + } else { + var action = 'POP'; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ action: action, location: location }); + } else { + revertPop(location); + } + }); + } + }; + + var revertPop = function revertPop(fromLocation) { + var toLocation = history.location; + + // TODO: We could probably make this more reliable by + // keeping a list of paths we've seen in sessionStorage. + // Instead, we just default to 0 for paths we don't know. + + var toIndex = allPaths.lastIndexOf(createPath(toLocation)); + + if (toIndex === -1) toIndex = 0; + + var fromIndex = allPaths.lastIndexOf(createPath(fromLocation)); + + if (fromIndex === -1) fromIndex = 0; + + var delta = toIndex - fromIndex; + + if (delta) { + forceNextPop = true; + go(delta); + } + }; + + // Ensure the hash is encoded properly before doing anything else. + var path = getHashPath(); + var encodedPath = encodePath(path); + + if (path !== encodedPath) replaceHashPath(encodedPath); + + var initialLocation = getDOMLocation(); + var allPaths = [createPath(initialLocation)]; + + // Public interface + + var createHref = function createHref(location) { + return '#' + encodePath(basename + createPath(location)); + }; + + var push = function push(path, state) { + warning(state === undefined, 'Hash history cannot push state; it is ignored'); + + var action = 'PUSH'; + var location = createLocation(path, undefined, undefined, history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var path = createPath(location); + var encodedPath = encodePath(basename + path); + var hashChanged = getHashPath() !== encodedPath; + + if (hashChanged) { + // We cannot tell if a hashchange was caused by a PUSH, so we'd + // rather setState here and ignore the hashchange. The caveat here + // is that other hash histories in the page will consider it a POP. + ignorePath = path; + pushHashPath(encodedPath); + + var prevIndex = allPaths.lastIndexOf(createPath(history.location)); + var nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1); + + nextPaths.push(path); + allPaths = nextPaths; + + setState({ action: action, location: location }); + } else { + warning(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack'); + + setState(); + } + }); + }; + + var replace = function replace(path, state) { + warning(state === undefined, 'Hash history cannot replace state; it is ignored'); + + var action = 'REPLACE'; + var location = createLocation(path, undefined, undefined, history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var path = createPath(location); + var encodedPath = encodePath(basename + path); + var hashChanged = getHashPath() !== encodedPath; + + if (hashChanged) { + // We cannot tell if a hashchange was caused by a REPLACE, so we'd + // rather setState here and ignore the hashchange. The caveat here + // is that other hash histories in the page will consider it a POP. + ignorePath = path; + replaceHashPath(encodedPath); + } + + var prevIndex = allPaths.indexOf(createPath(history.location)); + + if (prevIndex !== -1) allPaths[prevIndex] = path; + + setState({ action: action, location: location }); + }); + }; + + var go = function go(n) { + warning(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser'); + + globalHistory.go(n); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var listenerCount = 0; + + var checkDOMListeners = function checkDOMListeners(delta) { + listenerCount += delta; + + if (listenerCount === 1) { + addEventListener(window, HashChangeEvent, handleHashChange); + } else if (listenerCount === 0) { + removeEventListener(window, HashChangeEvent, handleHashChange); + } + }; + + var isBlocked = false; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + var unblock = transitionManager.setPrompt(prompt); + + if (!isBlocked) { + checkDOMListeners(1); + isBlocked = true; + } + + return function () { + if (isBlocked) { + isBlocked = false; + checkDOMListeners(-1); + } + + return unblock(); + }; + }; + + var listen = function listen(listener) { + var unlisten = transitionManager.appendListener(listener); + checkDOMListeners(1); + + return function () { + checkDOMListeners(-1); + unlisten(); + }; + }; + + var history = { + length: globalHistory.length, + action: 'POP', + location: initialLocation, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + block: block, + listen: listen + }; + + return history; +}; + +export default createHashHistory; \ No newline at end of file diff --git a/node_modules/history/es/createMemoryHistory.js b/node_modules/history/es/createMemoryHistory.js new file mode 100644 index 00000000..01f1ca7b --- /dev/null +++ b/node_modules/history/es/createMemoryHistory.js @@ -0,0 +1,157 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +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; }; + +import warning from 'warning'; +import { createPath } from './PathUtils'; +import { createLocation } from './LocationUtils'; +import createTransitionManager from './createTransitionManager'; + +var clamp = function clamp(n, lowerBound, upperBound) { + return Math.min(Math.max(n, lowerBound), upperBound); +}; + +/** + * Creates a history object that stores locations in memory. + */ +var createMemoryHistory = function createMemoryHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var getUserConfirmation = props.getUserConfirmation, + _props$initialEntries = props.initialEntries, + initialEntries = _props$initialEntries === undefined ? ['/'] : _props$initialEntries, + _props$initialIndex = props.initialIndex, + initialIndex = _props$initialIndex === undefined ? 0 : _props$initialIndex, + _props$keyLength = props.keyLength, + keyLength = _props$keyLength === undefined ? 6 : _props$keyLength; + + + var transitionManager = createTransitionManager(); + + var setState = function setState(nextState) { + _extends(history, nextState); + + history.length = history.entries.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var createKey = function createKey() { + return Math.random().toString(36).substr(2, keyLength); + }; + + var index = clamp(initialIndex, 0, initialEntries.length - 1); + var entries = initialEntries.map(function (entry) { + return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey()); + }); + + // Public interface + + var createHref = createPath; + + var push = function push(path, state) { + warning(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'PUSH'; + var location = createLocation(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var prevIndex = history.index; + var nextIndex = prevIndex + 1; + + var nextEntries = history.entries.slice(0); + if (nextEntries.length > nextIndex) { + nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location); + } else { + nextEntries.push(location); + } + + setState({ + action: action, + location: location, + index: nextIndex, + entries: nextEntries + }); + }); + }; + + var replace = function replace(path, state) { + warning(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'REPLACE'; + var location = createLocation(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + history.entries[history.index] = location; + + setState({ action: action, location: location }); + }); + }; + + var go = function go(n) { + var nextIndex = clamp(history.index + n, 0, history.entries.length - 1); + + var action = 'POP'; + var location = history.entries[nextIndex]; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ + action: action, + location: location, + index: nextIndex + }); + } else { + // Mimic the behavior of DOM histories by + // causing a render after a cancelled POP. + setState(); + } + }); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var canGo = function canGo(n) { + var nextIndex = history.index + n; + return nextIndex >= 0 && nextIndex < history.entries.length; + }; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + return transitionManager.setPrompt(prompt); + }; + + var listen = function listen(listener) { + return transitionManager.appendListener(listener); + }; + + var history = { + length: entries.length, + action: 'POP', + location: entries[index], + index: index, + entries: entries, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + canGo: canGo, + block: block, + listen: listen + }; + + return history; +}; + +export default createMemoryHistory; \ No newline at end of file diff --git a/node_modules/history/es/createTransitionManager.js b/node_modules/history/es/createTransitionManager.js new file mode 100644 index 00000000..43af9f73 --- /dev/null +++ b/node_modules/history/es/createTransitionManager.js @@ -0,0 +1,77 @@ +import warning from 'warning'; + +var createTransitionManager = function createTransitionManager() { + var prompt = null; + + var setPrompt = function setPrompt(nextPrompt) { + warning(prompt == null, 'A history supports only one prompt at a time'); + + prompt = nextPrompt; + + return function () { + if (prompt === nextPrompt) prompt = null; + }; + }; + + var confirmTransitionTo = function confirmTransitionTo(location, action, getUserConfirmation, callback) { + // TODO: If another transition starts while we're still confirming + // the previous one, we may end up in a weird state. Figure out the + // best way to handle this. + if (prompt != null) { + var result = typeof prompt === 'function' ? prompt(location, action) : prompt; + + if (typeof result === 'string') { + if (typeof getUserConfirmation === 'function') { + getUserConfirmation(result, callback); + } else { + warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message'); + + callback(true); + } + } else { + // Return false from a transition hook to cancel the transition. + callback(result !== false); + } + } else { + callback(true); + } + }; + + var listeners = []; + + var appendListener = function appendListener(fn) { + var isActive = true; + + var listener = function listener() { + if (isActive) fn.apply(undefined, arguments); + }; + + listeners.push(listener); + + return function () { + isActive = false; + listeners = listeners.filter(function (item) { + return item !== listener; + }); + }; + }; + + var notifyListeners = function notifyListeners() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + listeners.forEach(function (listener) { + return listener.apply(undefined, args); + }); + }; + + return { + setPrompt: setPrompt, + confirmTransitionTo: confirmTransitionTo, + appendListener: appendListener, + notifyListeners: notifyListeners + }; +}; + +export default createTransitionManager; \ No newline at end of file diff --git a/node_modules/history/es/index.js b/node_modules/history/es/index.js new file mode 100644 index 00000000..9833d833 --- /dev/null +++ b/node_modules/history/es/index.js @@ -0,0 +1,9 @@ +import _createBrowserHistory from './createBrowserHistory'; +export { _createBrowserHistory as createBrowserHistory }; +import _createHashHistory from './createHashHistory'; +export { _createHashHistory as createHashHistory }; +import _createMemoryHistory from './createMemoryHistory'; +export { _createMemoryHistory as createMemoryHistory }; + +export { createLocation, locationsAreEqual } from './LocationUtils'; +export { parsePath, createPath } from './PathUtils'; \ No newline at end of file diff --git a/node_modules/history/index.js b/node_modules/history/index.js new file mode 100644 index 00000000..488e697a --- /dev/null +++ b/node_modules/history/index.js @@ -0,0 +1,52 @@ +'use strict'; + +exports.__esModule = true; +exports.createPath = exports.parsePath = exports.locationsAreEqual = exports.createLocation = exports.createMemoryHistory = exports.createHashHistory = exports.createBrowserHistory = undefined; + +var _LocationUtils = require('./LocationUtils'); + +Object.defineProperty(exports, 'createLocation', { + enumerable: true, + get: function get() { + return _LocationUtils.createLocation; + } +}); +Object.defineProperty(exports, 'locationsAreEqual', { + enumerable: true, + get: function get() { + return _LocationUtils.locationsAreEqual; + } +}); + +var _PathUtils = require('./PathUtils'); + +Object.defineProperty(exports, 'parsePath', { + enumerable: true, + get: function get() { + return _PathUtils.parsePath; + } +}); +Object.defineProperty(exports, 'createPath', { + enumerable: true, + get: function get() { + return _PathUtils.createPath; + } +}); + +var _createBrowserHistory2 = require('./createBrowserHistory'); + +var _createBrowserHistory3 = _interopRequireDefault(_createBrowserHistory2); + +var _createHashHistory2 = require('./createHashHistory'); + +var _createHashHistory3 = _interopRequireDefault(_createHashHistory2); + +var _createMemoryHistory2 = require('./createMemoryHistory'); + +var _createMemoryHistory3 = _interopRequireDefault(_createMemoryHistory2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.createBrowserHistory = _createBrowserHistory3.default; +exports.createHashHistory = _createHashHistory3.default; +exports.createMemoryHistory = _createMemoryHistory3.default; \ No newline at end of file diff --git a/node_modules/history/node_modules/warning/CHANGELOG.md b/node_modules/history/node_modules/warning/CHANGELOG.md new file mode 100644 index 00000000..bedee340 --- /dev/null +++ b/node_modules/history/node_modules/warning/CHANGELOG.md @@ -0,0 +1,9 @@ +v2.0.0 - July 11, 2015 +--------------------- + +- [1a33d40fa1](https://github.com/r3dm/warning/commit/1a33d40fa1) add browserify.js + +v1.0.2 - May 30, 2015 +-------------------------------------- + +- [2ac6962](https://github.com/r3dm/warning/commit/2ac6962263) fix return args in replace diff --git a/node_modules/history/node_modules/warning/LICENSE.md b/node_modules/history/node_modules/warning/LICENSE.md new file mode 100644 index 00000000..b355fd42 --- /dev/null +++ b/node_modules/history/node_modules/warning/LICENSE.md @@ -0,0 +1,31 @@ +BSD License + +For React software + +Copyright (c) 2013-2015, Facebook, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Facebook nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/history/node_modules/warning/README.md b/node_modules/history/node_modules/warning/README.md new file mode 100644 index 00000000..6e4ab35c --- /dev/null +++ b/node_modules/history/node_modules/warning/README.md @@ -0,0 +1,52 @@ +# Warning [![npm version](https://badge.fury.io/js/warning.svg)](https://badge.fury.io/js/warning) +A mirror of Facebook's Warning + + +## Usage +``` +npm install warning +``` + +``` +// some script +var warning = require('warning'); + +var ShouldBeTrue = false; + +warning( + ShouldBeTrue, + 'This thing should be true but you set to false. No soup for you!' +); +// 'This thing should be true but you set to false. No soup for you!' +``` + +Similar to Facebook's invariant but only logs a warning if the condition is not met. +This can be used to log issues in development environments in critical +paths. Removing the logging code for production environments will keep the +same logic and follow the same code paths. + +## Browserify + +When using [browserify](http://browserify.org/), the `browser.js` file will be imported instead of `invariant.js` and browserify will be told to transform the file with [envify](https://github.com/hughsk/envify). The only difference between `browser.js` and `invariant.js` is the `process.env.NODE_ENV` variable isn't cached. This, in combination with envify and (optionally) [uglifyjs](https://github.com/mishoo/UglifyJS), will result in a noop in production environments. Otherwise behavior is as expected. + +## Use in Production + +It is recommended to add [babel-plugin-dev-expression](https://github.com/4Catalyzer/babel-plugin-dev-expression) with this module to remove warning messages in production. +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Don't Forget To Be Awesome diff --git a/node_modules/history/node_modules/warning/browser.js b/node_modules/history/node_modules/warning/browser.js new file mode 100644 index 00000000..2409d276 --- /dev/null +++ b/node_modules/history/node_modules/warning/browser.js @@ -0,0 +1,60 @@ +/** + * Copyright 2014-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +/** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + +var warning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + warning = function(condition, format, args) { + var len = arguments.length; + args = new Array(len > 2 ? len - 2 : 0); + for (var key = 2; key < len; key++) { + args[key - 2] = arguments[key]; + } + if (format === undefined) { + throw new Error( + '`warning(condition, format, ...args)` requires a warning ' + + 'message argument' + ); + } + + if (format.length < 10 || (/^[s\W]*$/).test(format)) { + throw new Error( + 'The warning format should be able to uniquely identify this ' + + 'warning. Please, use a more descriptive format than: ' + format + ); + } + + if (!condition) { + var argIndex = 0; + var message = 'Warning: ' + + format.replace(/%s/g, function() { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch(x) {} + } + }; +} + +module.exports = warning; diff --git a/node_modules/history/node_modules/warning/package.json b/node_modules/history/node_modules/warning/package.json new file mode 100644 index 00000000..08ce9543 --- /dev/null +++ b/node_modules/history/node_modules/warning/package.json @@ -0,0 +1,71 @@ +{ + "_from": "warning@^3.0.0", + "_id": "warning@3.0.0", + "_inBundle": false, + "_integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=", + "_location": "/history/warning", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "warning@^3.0.0", + "name": "warning", + "escapedName": "warning", + "rawSpec": "^3.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0" + }, + "_requiredBy": [ + "/history" + ], + "_resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz", + "_shasum": "32e5377cb572de4ab04753bdf8821c01ed605b7c", + "_spec": "warning@^3.0.0", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/history", + "author": { + "name": "Berkeley Martinez", + "email": "berkeley@r3dm.com", + "url": "http://www.freecodecamp.com" + }, + "browser": "browser.js", + "browserify": { + "transform": [ + "loose-envify" + ] + }, + "bugs": { + "url": "https://github.com/BerkeleyTrue/warning/issues" + }, + "bundleDependencies": false, + "dependencies": { + "loose-envify": "^1.0.0" + }, + "deprecated": false, + "description": "A mirror of Facebook's Warning", + "devDependencies": { + "browserify": "^11.0.1", + "tap": "^1.4.0" + }, + "files": [ + "browser.js", + "warning.js" + ], + "homepage": "https://github.com/BerkeleyTrue/warning", + "keywords": [ + "warning", + "facebook", + "react", + "invariant" + ], + "license": "BSD-3-Clause", + "main": "warning.js", + "name": "warning", + "repository": { + "type": "git", + "url": "git+https://github.com/BerkeleyTrue/warning.git" + }, + "scripts": { + "test": "NODE_ENV=production tap test/*.js && NODE_ENV=development tap test/*.js" + }, + "version": "3.0.0" +} diff --git a/node_modules/history/node_modules/warning/warning.js b/node_modules/history/node_modules/warning/warning.js new file mode 100644 index 00000000..322025cc --- /dev/null +++ b/node_modules/history/node_modules/warning/warning.js @@ -0,0 +1,62 @@ +/** + * Copyright 2014-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +'use strict'; + +/** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + +var __DEV__ = process.env.NODE_ENV !== 'production'; + +var warning = function() {}; + +if (__DEV__) { + warning = function(condition, format, args) { + var len = arguments.length; + args = new Array(len > 2 ? len - 2 : 0); + for (var key = 2; key < len; key++) { + args[key - 2] = arguments[key]; + } + if (format === undefined) { + throw new Error( + '`warning(condition, format, ...args)` requires a warning ' + + 'message argument' + ); + } + + if (format.length < 10 || (/^[s\W]*$/).test(format)) { + throw new Error( + 'The warning format should be able to uniquely identify this ' + + 'warning. Please, use a more descriptive format than: ' + format + ); + } + + if (!condition) { + var argIndex = 0; + var message = 'Warning: ' + + format.replace(/%s/g, function() { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch(x) {} + } + }; +} + +module.exports = warning; diff --git a/node_modules/history/package.json b/node_modules/history/package.json new file mode 100644 index 00000000..16978268 --- /dev/null +++ b/node_modules/history/package.json @@ -0,0 +1,113 @@ +{ + "_from": "history@^4.7.2", + "_id": "history@4.7.2", + "_inBundle": false, + "_integrity": "sha512-1zkBRWW6XweO0NBcjiphtVJVsIQ+SXF29z9DVkceeaSLVMFXHool+fdCZD4spDCfZJCILPILc3bm7Bc+HRi0nA==", + "_location": "/history", + "_phantomChildren": { + "loose-envify": "1.4.0" + }, + "_requested": { + "type": "range", + "registry": true, + "raw": "history@^4.7.2", + "name": "history", + "escapedName": "history", + "rawSpec": "^4.7.2", + "saveSpec": null, + "fetchSpec": "^4.7.2" + }, + "_requiredBy": [ + "/react-router", + "/react-router-dom" + ], + "_resolved": "https://registry.npmjs.org/history/-/history-4.7.2.tgz", + "_shasum": "22b5c7f31633c5b8021c7f4a8a954ac139ee8d5b", + "_spec": "history@^4.7.2", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/react-router-dom", + "author": { + "name": "Michael Jackson" + }, + "browserify": { + "transform": [ + "loose-envify" + ] + }, + "bugs": { + "url": "https://github.com/ReactTraining/history/issues" + }, + "bundleDependencies": false, + "dependencies": { + "invariant": "^2.2.1", + "loose-envify": "^1.2.0", + "resolve-pathname": "^2.2.0", + "value-equal": "^0.4.0", + "warning": "^3.0.0" + }, + "deprecated": false, + "description": "Manage session history with JavaScript", + "devDependencies": { + "babel-cli": "^6.18.0", + "babel-core": "^6.23.1", + "babel-eslint": "^7.0.0", + "babel-loader": "^6.2.10", + "babel-plugin-dev-expression": "^0.2.1", + "babel-plugin-transform-object-assign": "^6.8.0", + "babel-preset-es2015": "^6.9.0", + "babel-preset-stage-1": "^6.5.0", + "eslint": "^3.3.0", + "eslint-plugin-import": "^2.0.0", + "expect": "^1.20.1", + "gzip-size": "^3.0.0", + "in-publish": "^2.0.0", + "karma": "^1.2.0", + "karma-browserstack-launcher": "^1.0.1", + "karma-chrome-launcher": "^2.0.0", + "karma-firefox-launcher": "^1.0.0", + "karma-mocha": "^1.0.1", + "karma-mocha-reporter": "^2.0.4", + "karma-sourcemap-loader": "^0.3.7", + "karma-webpack": "^2.0.1", + "mocha": "^3.0.2", + "pretty-bytes": "^4.0.2", + "readline-sync": "^1.4.4", + "webpack": "^1.13.1", + "webpack-dev-server": "^1.14.1" + }, + "files": [ + "DOMUtils.js", + "ExecutionEnvironment.js", + "LocationUtils.js", + "PathUtils.js", + "createBrowserHistory.js", + "createHashHistory.js", + "createMemoryHistory.js", + "createTransitionManager.js", + "es", + "index.js", + "umd" + ], + "homepage": "https://github.com/ReactTraining/history#readme", + "keywords": [ + "history", + "location" + ], + "license": "MIT", + "main": "index.js", + "module": "es/index.js", + "name": "history", + "repository": { + "type": "git", + "url": "git+https://github.com/ReactTraining/history.git" + }, + "scripts": { + "build": "node ./tools/build.js", + "clean": "git clean -fdX .", + "lint": "eslint modules", + "prepublish": "node ./tools/build.js", + "release": "node ./tools/release.js", + "start": "webpack-dev-server -d --content-base ./ --history-api-fallback --inline modules/index.js", + "test": "karma start --single-run" + }, + "version": "4.7.2" +} diff --git a/node_modules/history/umd/history.js b/node_modules/history/umd/history.js new file mode 100644 index 00000000..ef73eb65 --- /dev/null +++ b/node_modules/history/umd/history.js @@ -0,0 +1,1478 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["History"] = factory(); + else + root["History"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.createPath = exports.parsePath = exports.locationsAreEqual = exports.createLocation = exports.createMemoryHistory = exports.createHashHistory = exports.createBrowserHistory = undefined; + + var _LocationUtils = __webpack_require__(1); + + Object.defineProperty(exports, 'createLocation', { + enumerable: true, + get: function get() { + return _LocationUtils.createLocation; + } + }); + Object.defineProperty(exports, 'locationsAreEqual', { + enumerable: true, + get: function get() { + return _LocationUtils.locationsAreEqual; + } + }); + + var _PathUtils = __webpack_require__(4); + + Object.defineProperty(exports, 'parsePath', { + enumerable: true, + get: function get() { + return _PathUtils.parsePath; + } + }); + Object.defineProperty(exports, 'createPath', { + enumerable: true, + get: function get() { + return _PathUtils.createPath; + } + }); + + var _createBrowserHistory2 = __webpack_require__(5); + + var _createBrowserHistory3 = _interopRequireDefault(_createBrowserHistory2); + + var _createHashHistory2 = __webpack_require__(10); + + var _createHashHistory3 = _interopRequireDefault(_createHashHistory2); + + var _createMemoryHistory2 = __webpack_require__(11); + + var _createMemoryHistory3 = _interopRequireDefault(_createMemoryHistory2); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.createBrowserHistory = _createBrowserHistory3.default; + exports.createHashHistory = _createHashHistory3.default; + exports.createMemoryHistory = _createMemoryHistory3.default; + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.locationsAreEqual = exports.createLocation = undefined; + + 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; }; + + var _resolvePathname = __webpack_require__(2); + + var _resolvePathname2 = _interopRequireDefault(_resolvePathname); + + var _valueEqual = __webpack_require__(3); + + var _valueEqual2 = _interopRequireDefault(_valueEqual); + + var _PathUtils = __webpack_require__(4); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var createLocation = exports.createLocation = function createLocation(path, state, key, currentLocation) { + var location = void 0; + if (typeof path === 'string') { + // Two-arg form: push(path, state) + location = (0, _PathUtils.parsePath)(path); + location.state = state; + } else { + // One-arg form: push(location) + location = _extends({}, path); + + if (location.pathname === undefined) location.pathname = ''; + + if (location.search) { + if (location.search.charAt(0) !== '?') location.search = '?' + location.search; + } else { + location.search = ''; + } + + if (location.hash) { + if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash; + } else { + location.hash = ''; + } + + if (state !== undefined && location.state === undefined) location.state = state; + } + + try { + location.pathname = decodeURI(location.pathname); + } catch (e) { + if (e instanceof URIError) { + throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); + } else { + throw e; + } + } + + if (key) location.key = key; + + if (currentLocation) { + // Resolve incomplete/relative pathname relative to current location. + if (!location.pathname) { + location.pathname = currentLocation.pathname; + } else if (location.pathname.charAt(0) !== '/') { + location.pathname = (0, _resolvePathname2.default)(location.pathname, currentLocation.pathname); + } + } else { + // When there is no prior location and pathname is empty, set it to / + if (!location.pathname) { + location.pathname = '/'; + } + } + + return location; + }; + + var locationsAreEqual = exports.locationsAreEqual = function locationsAreEqual(a, b) { + return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && (0, _valueEqual2.default)(a.state, b.state); + }; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + function isAbsolute(pathname) { + return pathname.charAt(0) === '/'; + } + + // About 1.5x faster than the two-arg version of Array#splice() + function spliceOne(list, index) { + for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) { + list[i] = list[k]; + } + + list.pop(); + } + + // This implementation is based heavily on node's url.parse + function resolvePathname(to) { + var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + var toParts = to && to.split('/') || []; + var fromParts = from && from.split('/') || []; + + var isToAbs = to && isAbsolute(to); + var isFromAbs = from && isAbsolute(from); + var mustEndAbs = isToAbs || isFromAbs; + + if (to && isAbsolute(to)) { + // to is absolute + fromParts = toParts; + } else if (toParts.length) { + // to is relative, drop the filename + fromParts.pop(); + fromParts = fromParts.concat(toParts); + } + + if (!fromParts.length) return '/'; + + var hasTrailingSlash = void 0; + if (fromParts.length) { + var last = fromParts[fromParts.length - 1]; + hasTrailingSlash = last === '.' || last === '..' || last === ''; + } else { + hasTrailingSlash = false; + } + + var up = 0; + for (var i = fromParts.length; i >= 0; i--) { + var part = fromParts[i]; + + if (part === '.') { + spliceOne(fromParts, i); + } else if (part === '..') { + spliceOne(fromParts, i); + up++; + } else if (up) { + spliceOne(fromParts, i); + up--; + } + } + + if (!mustEndAbs) for (; up--; up) { + fromParts.unshift('..'); + }if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift(''); + + var result = fromParts.join('/'); + + if (hasTrailingSlash && result.substr(-1) !== '/') result += '/'; + + return result; + } + + exports.default = resolvePathname; + module.exports = exports['default']; + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + function valueEqual(a, b) { + if (a === b) return true; + + if (a == null || b == null) return false; + + if (Array.isArray(a)) { + return Array.isArray(b) && a.length === b.length && a.every(function (item, index) { + return valueEqual(item, b[index]); + }); + } + + var aType = typeof a === 'undefined' ? 'undefined' : _typeof(a); + var bType = typeof b === 'undefined' ? 'undefined' : _typeof(b); + + if (aType !== bType) return false; + + if (aType === 'object') { + var aValue = a.valueOf(); + var bValue = b.valueOf(); + + if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); + + var aKeys = Object.keys(a); + var bKeys = Object.keys(b); + + if (aKeys.length !== bKeys.length) return false; + + return aKeys.every(function (key) { + return valueEqual(a[key], b[key]); + }); + } + + return false; + } + + exports.default = valueEqual; + module.exports = exports['default']; + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + var addLeadingSlash = exports.addLeadingSlash = function addLeadingSlash(path) { + return path.charAt(0) === '/' ? path : '/' + path; + }; + + var stripLeadingSlash = exports.stripLeadingSlash = function stripLeadingSlash(path) { + return path.charAt(0) === '/' ? path.substr(1) : path; + }; + + var hasBasename = exports.hasBasename = function hasBasename(path, prefix) { + return new RegExp('^' + prefix + '(\\/|\\?|#|$)', 'i').test(path); + }; + + var stripBasename = exports.stripBasename = function stripBasename(path, prefix) { + return hasBasename(path, prefix) ? path.substr(prefix.length) : path; + }; + + var stripTrailingSlash = exports.stripTrailingSlash = function stripTrailingSlash(path) { + return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path; + }; + + var parsePath = exports.parsePath = function parsePath(path) { + var pathname = path || '/'; + var search = ''; + var hash = ''; + + var hashIndex = pathname.indexOf('#'); + if (hashIndex !== -1) { + hash = pathname.substr(hashIndex); + pathname = pathname.substr(0, hashIndex); + } + + var searchIndex = pathname.indexOf('?'); + if (searchIndex !== -1) { + search = pathname.substr(searchIndex); + pathname = pathname.substr(0, searchIndex); + } + + return { + pathname: pathname, + search: search === '?' ? '' : search, + hash: hash === '#' ? '' : hash + }; + }; + + var createPath = exports.createPath = function createPath(location) { + var pathname = location.pathname, + search = location.search, + hash = location.hash; + + + var path = pathname || '/'; + + if (search && search !== '?') path += search.charAt(0) === '?' ? search : '?' + search; + + if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : '#' + hash; + + return path; + }; + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + 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; }; + + var _warning = __webpack_require__(6); + + var _warning2 = _interopRequireDefault(_warning); + + var _invariant = __webpack_require__(7); + + var _invariant2 = _interopRequireDefault(_invariant); + + var _LocationUtils = __webpack_require__(1); + + var _PathUtils = __webpack_require__(4); + + var _createTransitionManager = __webpack_require__(8); + + var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); + + var _DOMUtils = __webpack_require__(9); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var PopStateEvent = 'popstate'; + var HashChangeEvent = 'hashchange'; + + var getHistoryState = function getHistoryState() { + try { + return window.history.state || {}; + } catch (e) { + // IE 11 sometimes throws when accessing window.history.state + // See https://github.com/ReactTraining/history/pull/289 + return {}; + } + }; + + /** + * Creates a history object that uses the HTML5 history API including + * pushState, replaceState, and the popstate event. + */ + var createBrowserHistory = function createBrowserHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + !_DOMUtils.canUseDOM ? false ? (0, _invariant2.default)(false, 'Browser history needs a DOM') : (0, _invariant2.default)(false) : void 0; + + var globalHistory = window.history; + var canUseHistory = (0, _DOMUtils.supportsHistory)(); + var needsHashChangeListener = !(0, _DOMUtils.supportsPopStateOnHashChange)(); + + var _props$forceRefresh = props.forceRefresh, + forceRefresh = _props$forceRefresh === undefined ? false : _props$forceRefresh, + _props$getUserConfirm = props.getUserConfirmation, + getUserConfirmation = _props$getUserConfirm === undefined ? _DOMUtils.getConfirmation : _props$getUserConfirm, + _props$keyLength = props.keyLength, + keyLength = _props$keyLength === undefined ? 6 : _props$keyLength; + + var basename = props.basename ? (0, _PathUtils.stripTrailingSlash)((0, _PathUtils.addLeadingSlash)(props.basename)) : ''; + + var getDOMLocation = function getDOMLocation(historyState) { + var _ref = historyState || {}, + key = _ref.key, + state = _ref.state; + + var _window$location = window.location, + pathname = _window$location.pathname, + search = _window$location.search, + hash = _window$location.hash; + + + var path = pathname + search + hash; + + false ? (0, _warning2.default)(!basename || (0, _PathUtils.hasBasename)(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : void 0; + + if (basename) path = (0, _PathUtils.stripBasename)(path, basename); + + return (0, _LocationUtils.createLocation)(path, state, key); + }; + + var createKey = function createKey() { + return Math.random().toString(36).substr(2, keyLength); + }; + + var transitionManager = (0, _createTransitionManager2.default)(); + + var setState = function setState(nextState) { + _extends(history, nextState); + + history.length = globalHistory.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var handlePopState = function handlePopState(event) { + // Ignore extraneous popstate events in WebKit. + if ((0, _DOMUtils.isExtraneousPopstateEvent)(event)) return; + + handlePop(getDOMLocation(event.state)); + }; + + var handleHashChange = function handleHashChange() { + handlePop(getDOMLocation(getHistoryState())); + }; + + var forceNextPop = false; + + var handlePop = function handlePop(location) { + if (forceNextPop) { + forceNextPop = false; + setState(); + } else { + var action = 'POP'; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ action: action, location: location }); + } else { + revertPop(location); + } + }); + } + }; + + var revertPop = function revertPop(fromLocation) { + var toLocation = history.location; + + // TODO: We could probably make this more reliable by + // keeping a list of keys we've seen in sessionStorage. + // Instead, we just default to 0 for keys we don't know. + + var toIndex = allKeys.indexOf(toLocation.key); + + if (toIndex === -1) toIndex = 0; + + var fromIndex = allKeys.indexOf(fromLocation.key); + + if (fromIndex === -1) fromIndex = 0; + + var delta = toIndex - fromIndex; + + if (delta) { + forceNextPop = true; + go(delta); + } + }; + + var initialLocation = getDOMLocation(getHistoryState()); + var allKeys = [initialLocation.key]; + + // Public interface + + var createHref = function createHref(location) { + return basename + (0, _PathUtils.createPath)(location); + }; + + var push = function push(path, state) { + false ? (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0; + + var action = 'PUSH'; + var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var href = createHref(location); + var key = location.key, + state = location.state; + + + if (canUseHistory) { + globalHistory.pushState({ key: key, state: state }, null, href); + + if (forceRefresh) { + window.location.href = href; + } else { + var prevIndex = allKeys.indexOf(history.location.key); + var nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1); + + nextKeys.push(location.key); + allKeys = nextKeys; + + setState({ action: action, location: location }); + } + } else { + false ? (0, _warning2.default)(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : void 0; + + window.location.href = href; + } + }); + }; + + var replace = function replace(path, state) { + false ? (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0; + + var action = 'REPLACE'; + var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var href = createHref(location); + var key = location.key, + state = location.state; + + + if (canUseHistory) { + globalHistory.replaceState({ key: key, state: state }, null, href); + + if (forceRefresh) { + window.location.replace(href); + } else { + var prevIndex = allKeys.indexOf(history.location.key); + + if (prevIndex !== -1) allKeys[prevIndex] = location.key; + + setState({ action: action, location: location }); + } + } else { + false ? (0, _warning2.default)(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : void 0; + + window.location.replace(href); + } + }); + }; + + var go = function go(n) { + globalHistory.go(n); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var listenerCount = 0; + + var checkDOMListeners = function checkDOMListeners(delta) { + listenerCount += delta; + + if (listenerCount === 1) { + (0, _DOMUtils.addEventListener)(window, PopStateEvent, handlePopState); + + if (needsHashChangeListener) (0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleHashChange); + } else if (listenerCount === 0) { + (0, _DOMUtils.removeEventListener)(window, PopStateEvent, handlePopState); + + if (needsHashChangeListener) (0, _DOMUtils.removeEventListener)(window, HashChangeEvent, handleHashChange); + } + }; + + var isBlocked = false; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + var unblock = transitionManager.setPrompt(prompt); + + if (!isBlocked) { + checkDOMListeners(1); + isBlocked = true; + } + + return function () { + if (isBlocked) { + isBlocked = false; + checkDOMListeners(-1); + } + + return unblock(); + }; + }; + + var listen = function listen(listener) { + var unlisten = transitionManager.appendListener(listener); + checkDOMListeners(1); + + return function () { + checkDOMListeners(-1); + unlisten(); + }; + }; + + var history = { + length: globalHistory.length, + action: 'POP', + location: initialLocation, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + block: block, + listen: listen + }; + + return history; + }; + + exports.default = createBrowserHistory; + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Copyright 2014-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + + 'use strict'; + + /** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + + var warning = function() {}; + + if (false) { + warning = function(condition, format, args) { + var len = arguments.length; + args = new Array(len > 2 ? len - 2 : 0); + for (var key = 2; key < len; key++) { + args[key - 2] = arguments[key]; + } + if (format === undefined) { + throw new Error( + '`warning(condition, format, ...args)` requires a warning ' + + 'message argument' + ); + } + + if (format.length < 10 || (/^[s\W]*$/).test(format)) { + throw new Error( + 'The warning format should be able to uniquely identify this ' + + 'warning. Please, use a more descriptive format than: ' + format + ); + } + + if (!condition) { + var argIndex = 0; + var message = 'Warning: ' + + format.replace(/%s/g, function() { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch(x) {} + } + }; + } + + module.exports = warning; + + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + + 'use strict'; + + /** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + + var invariant = function(condition, format, a, b, c, d, e, f) { + if (false) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + } + + if (!condition) { + var error; + if (format === undefined) { + error = new Error( + 'Minified exception occurred; use the non-minified dev environment ' + + 'for the full error message and additional helpful warnings.' + ); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error( + format.replace(/%s/g, function() { return args[argIndex++]; }) + ); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } + }; + + module.exports = invariant; + + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _warning = __webpack_require__(6); + + var _warning2 = _interopRequireDefault(_warning); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var createTransitionManager = function createTransitionManager() { + var prompt = null; + + var setPrompt = function setPrompt(nextPrompt) { + false ? (0, _warning2.default)(prompt == null, 'A history supports only one prompt at a time') : void 0; + + prompt = nextPrompt; + + return function () { + if (prompt === nextPrompt) prompt = null; + }; + }; + + var confirmTransitionTo = function confirmTransitionTo(location, action, getUserConfirmation, callback) { + // TODO: If another transition starts while we're still confirming + // the previous one, we may end up in a weird state. Figure out the + // best way to handle this. + if (prompt != null) { + var result = typeof prompt === 'function' ? prompt(location, action) : prompt; + + if (typeof result === 'string') { + if (typeof getUserConfirmation === 'function') { + getUserConfirmation(result, callback); + } else { + false ? (0, _warning2.default)(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : void 0; + + callback(true); + } + } else { + // Return false from a transition hook to cancel the transition. + callback(result !== false); + } + } else { + callback(true); + } + }; + + var listeners = []; + + var appendListener = function appendListener(fn) { + var isActive = true; + + var listener = function listener() { + if (isActive) fn.apply(undefined, arguments); + }; + + listeners.push(listener); + + return function () { + isActive = false; + listeners = listeners.filter(function (item) { + return item !== listener; + }); + }; + }; + + var notifyListeners = function notifyListeners() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + listeners.forEach(function (listener) { + return listener.apply(undefined, args); + }); + }; + + return { + setPrompt: setPrompt, + confirmTransitionTo: confirmTransitionTo, + appendListener: appendListener, + notifyListeners: notifyListeners + }; + }; + + exports.default = createTransitionManager; + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + var canUseDOM = exports.canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); + + var addEventListener = exports.addEventListener = function addEventListener(node, event, listener) { + return node.addEventListener ? node.addEventListener(event, listener, false) : node.attachEvent('on' + event, listener); + }; + + var removeEventListener = exports.removeEventListener = function removeEventListener(node, event, listener) { + return node.removeEventListener ? node.removeEventListener(event, listener, false) : node.detachEvent('on' + event, listener); + }; + + var getConfirmation = exports.getConfirmation = function getConfirmation(message, callback) { + return callback(window.confirm(message)); + }; // eslint-disable-line no-alert + + /** + * Returns true if the HTML5 history API is supported. Taken from Modernizr. + * + * https://github.com/Modernizr/Modernizr/blob/master/LICENSE + * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js + * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586 + */ + var supportsHistory = exports.supportsHistory = function supportsHistory() { + var ua = window.navigator.userAgent; + + if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false; + + return window.history && 'pushState' in window.history; + }; + + /** + * Returns true if browser fires popstate on hash change. + * IE10 and IE11 do not. + */ + var supportsPopStateOnHashChange = exports.supportsPopStateOnHashChange = function supportsPopStateOnHashChange() { + return window.navigator.userAgent.indexOf('Trident') === -1; + }; + + /** + * Returns false if using go(n) with hash history causes a full page reload. + */ + var supportsGoWithoutReloadUsingHash = exports.supportsGoWithoutReloadUsingHash = function supportsGoWithoutReloadUsingHash() { + return window.navigator.userAgent.indexOf('Firefox') === -1; + }; + + /** + * Returns true if a given popstate event is an extraneous WebKit event. + * Accounts for the fact that Chrome on iOS fires real popstate events + * containing undefined state when pressing the back button. + */ + var isExtraneousPopstateEvent = exports.isExtraneousPopstateEvent = function isExtraneousPopstateEvent(event) { + return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1; + }; + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + 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; }; + + var _warning = __webpack_require__(6); + + var _warning2 = _interopRequireDefault(_warning); + + var _invariant = __webpack_require__(7); + + var _invariant2 = _interopRequireDefault(_invariant); + + var _LocationUtils = __webpack_require__(1); + + var _PathUtils = __webpack_require__(4); + + var _createTransitionManager = __webpack_require__(8); + + var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); + + var _DOMUtils = __webpack_require__(9); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var HashChangeEvent = 'hashchange'; + + var HashPathCoders = { + hashbang: { + encodePath: function encodePath(path) { + return path.charAt(0) === '!' ? path : '!/' + (0, _PathUtils.stripLeadingSlash)(path); + }, + decodePath: function decodePath(path) { + return path.charAt(0) === '!' ? path.substr(1) : path; + } + }, + noslash: { + encodePath: _PathUtils.stripLeadingSlash, + decodePath: _PathUtils.addLeadingSlash + }, + slash: { + encodePath: _PathUtils.addLeadingSlash, + decodePath: _PathUtils.addLeadingSlash + } + }; + + var getHashPath = function getHashPath() { + // We can't use window.location.hash here because it's not + // consistent across browsers - Firefox will pre-decode it! + var href = window.location.href; + var hashIndex = href.indexOf('#'); + return hashIndex === -1 ? '' : href.substring(hashIndex + 1); + }; + + var pushHashPath = function pushHashPath(path) { + return window.location.hash = path; + }; + + var replaceHashPath = function replaceHashPath(path) { + var hashIndex = window.location.href.indexOf('#'); + + window.location.replace(window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path); + }; + + var createHashHistory = function createHashHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + !_DOMUtils.canUseDOM ? false ? (0, _invariant2.default)(false, 'Hash history needs a DOM') : (0, _invariant2.default)(false) : void 0; + + var globalHistory = window.history; + var canGoWithoutReload = (0, _DOMUtils.supportsGoWithoutReloadUsingHash)(); + + var _props$getUserConfirm = props.getUserConfirmation, + getUserConfirmation = _props$getUserConfirm === undefined ? _DOMUtils.getConfirmation : _props$getUserConfirm, + _props$hashType = props.hashType, + hashType = _props$hashType === undefined ? 'slash' : _props$hashType; + + var basename = props.basename ? (0, _PathUtils.stripTrailingSlash)((0, _PathUtils.addLeadingSlash)(props.basename)) : ''; + + var _HashPathCoders$hashT = HashPathCoders[hashType], + encodePath = _HashPathCoders$hashT.encodePath, + decodePath = _HashPathCoders$hashT.decodePath; + + + var getDOMLocation = function getDOMLocation() { + var path = decodePath(getHashPath()); + + false ? (0, _warning2.default)(!basename || (0, _PathUtils.hasBasename)(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : void 0; + + if (basename) path = (0, _PathUtils.stripBasename)(path, basename); + + return (0, _LocationUtils.createLocation)(path); + }; + + var transitionManager = (0, _createTransitionManager2.default)(); + + var setState = function setState(nextState) { + _extends(history, nextState); + + history.length = globalHistory.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var forceNextPop = false; + var ignorePath = null; + + var handleHashChange = function handleHashChange() { + var path = getHashPath(); + var encodedPath = encodePath(path); + + if (path !== encodedPath) { + // Ensure we always have a properly-encoded hash. + replaceHashPath(encodedPath); + } else { + var location = getDOMLocation(); + var prevLocation = history.location; + + if (!forceNextPop && (0, _LocationUtils.locationsAreEqual)(prevLocation, location)) return; // A hashchange doesn't always == location change. + + if (ignorePath === (0, _PathUtils.createPath)(location)) return; // Ignore this change; we already setState in push/replace. + + ignorePath = null; + + handlePop(location); + } + }; + + var handlePop = function handlePop(location) { + if (forceNextPop) { + forceNextPop = false; + setState(); + } else { + var action = 'POP'; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ action: action, location: location }); + } else { + revertPop(location); + } + }); + } + }; + + var revertPop = function revertPop(fromLocation) { + var toLocation = history.location; + + // TODO: We could probably make this more reliable by + // keeping a list of paths we've seen in sessionStorage. + // Instead, we just default to 0 for paths we don't know. + + var toIndex = allPaths.lastIndexOf((0, _PathUtils.createPath)(toLocation)); + + if (toIndex === -1) toIndex = 0; + + var fromIndex = allPaths.lastIndexOf((0, _PathUtils.createPath)(fromLocation)); + + if (fromIndex === -1) fromIndex = 0; + + var delta = toIndex - fromIndex; + + if (delta) { + forceNextPop = true; + go(delta); + } + }; + + // Ensure the hash is encoded properly before doing anything else. + var path = getHashPath(); + var encodedPath = encodePath(path); + + if (path !== encodedPath) replaceHashPath(encodedPath); + + var initialLocation = getDOMLocation(); + var allPaths = [(0, _PathUtils.createPath)(initialLocation)]; + + // Public interface + + var createHref = function createHref(location) { + return '#' + encodePath(basename + (0, _PathUtils.createPath)(location)); + }; + + var push = function push(path, state) { + false ? (0, _warning2.default)(state === undefined, 'Hash history cannot push state; it is ignored') : void 0; + + var action = 'PUSH'; + var location = (0, _LocationUtils.createLocation)(path, undefined, undefined, history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var path = (0, _PathUtils.createPath)(location); + var encodedPath = encodePath(basename + path); + var hashChanged = getHashPath() !== encodedPath; + + if (hashChanged) { + // We cannot tell if a hashchange was caused by a PUSH, so we'd + // rather setState here and ignore the hashchange. The caveat here + // is that other hash histories in the page will consider it a POP. + ignorePath = path; + pushHashPath(encodedPath); + + var prevIndex = allPaths.lastIndexOf((0, _PathUtils.createPath)(history.location)); + var nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1); + + nextPaths.push(path); + allPaths = nextPaths; + + setState({ action: action, location: location }); + } else { + false ? (0, _warning2.default)(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack') : void 0; + + setState(); + } + }); + }; + + var replace = function replace(path, state) { + false ? (0, _warning2.default)(state === undefined, 'Hash history cannot replace state; it is ignored') : void 0; + + var action = 'REPLACE'; + var location = (0, _LocationUtils.createLocation)(path, undefined, undefined, history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var path = (0, _PathUtils.createPath)(location); + var encodedPath = encodePath(basename + path); + var hashChanged = getHashPath() !== encodedPath; + + if (hashChanged) { + // We cannot tell if a hashchange was caused by a REPLACE, so we'd + // rather setState here and ignore the hashchange. The caveat here + // is that other hash histories in the page will consider it a POP. + ignorePath = path; + replaceHashPath(encodedPath); + } + + var prevIndex = allPaths.indexOf((0, _PathUtils.createPath)(history.location)); + + if (prevIndex !== -1) allPaths[prevIndex] = path; + + setState({ action: action, location: location }); + }); + }; + + var go = function go(n) { + false ? (0, _warning2.default)(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : void 0; + + globalHistory.go(n); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var listenerCount = 0; + + var checkDOMListeners = function checkDOMListeners(delta) { + listenerCount += delta; + + if (listenerCount === 1) { + (0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleHashChange); + } else if (listenerCount === 0) { + (0, _DOMUtils.removeEventListener)(window, HashChangeEvent, handleHashChange); + } + }; + + var isBlocked = false; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + var unblock = transitionManager.setPrompt(prompt); + + if (!isBlocked) { + checkDOMListeners(1); + isBlocked = true; + } + + return function () { + if (isBlocked) { + isBlocked = false; + checkDOMListeners(-1); + } + + return unblock(); + }; + }; + + var listen = function listen(listener) { + var unlisten = transitionManager.appendListener(listener); + checkDOMListeners(1); + + return function () { + checkDOMListeners(-1); + unlisten(); + }; + }; + + var history = { + length: globalHistory.length, + action: 'POP', + location: initialLocation, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + block: block, + listen: listen + }; + + return history; + }; + + exports.default = createHashHistory; + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + 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; }; + + var _warning = __webpack_require__(6); + + var _warning2 = _interopRequireDefault(_warning); + + var _PathUtils = __webpack_require__(4); + + var _LocationUtils = __webpack_require__(1); + + var _createTransitionManager = __webpack_require__(8); + + var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var clamp = function clamp(n, lowerBound, upperBound) { + return Math.min(Math.max(n, lowerBound), upperBound); + }; + + /** + * Creates a history object that stores locations in memory. + */ + var createMemoryHistory = function createMemoryHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var getUserConfirmation = props.getUserConfirmation, + _props$initialEntries = props.initialEntries, + initialEntries = _props$initialEntries === undefined ? ['/'] : _props$initialEntries, + _props$initialIndex = props.initialIndex, + initialIndex = _props$initialIndex === undefined ? 0 : _props$initialIndex, + _props$keyLength = props.keyLength, + keyLength = _props$keyLength === undefined ? 6 : _props$keyLength; + + + var transitionManager = (0, _createTransitionManager2.default)(); + + var setState = function setState(nextState) { + _extends(history, nextState); + + history.length = history.entries.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var createKey = function createKey() { + return Math.random().toString(36).substr(2, keyLength); + }; + + var index = clamp(initialIndex, 0, initialEntries.length - 1); + var entries = initialEntries.map(function (entry) { + return typeof entry === 'string' ? (0, _LocationUtils.createLocation)(entry, undefined, createKey()) : (0, _LocationUtils.createLocation)(entry, undefined, entry.key || createKey()); + }); + + // Public interface + + var createHref = _PathUtils.createPath; + + var push = function push(path, state) { + false ? (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0; + + var action = 'PUSH'; + var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var prevIndex = history.index; + var nextIndex = prevIndex + 1; + + var nextEntries = history.entries.slice(0); + if (nextEntries.length > nextIndex) { + nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location); + } else { + nextEntries.push(location); + } + + setState({ + action: action, + location: location, + index: nextIndex, + entries: nextEntries + }); + }); + }; + + var replace = function replace(path, state) { + false ? (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0; + + var action = 'REPLACE'; + var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + history.entries[history.index] = location; + + setState({ action: action, location: location }); + }); + }; + + var go = function go(n) { + var nextIndex = clamp(history.index + n, 0, history.entries.length - 1); + + var action = 'POP'; + var location = history.entries[nextIndex]; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ + action: action, + location: location, + index: nextIndex + }); + } else { + // Mimic the behavior of DOM histories by + // causing a render after a cancelled POP. + setState(); + } + }); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var canGo = function canGo(n) { + var nextIndex = history.index + n; + return nextIndex >= 0 && nextIndex < history.entries.length; + }; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + return transitionManager.setPrompt(prompt); + }; + + var listen = function listen(listener) { + return transitionManager.appendListener(listener); + }; + + var history = { + length: entries.length, + action: 'POP', + location: entries[index], + index: index, + entries: entries, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + canGo: canGo, + block: block, + listen: listen + }; + + return history; + }; + + exports.default = createMemoryHistory; + +/***/ } +/******/ ]) +}); +; \ No newline at end of file diff --git a/node_modules/history/umd/history.min.js b/node_modules/history/umd/history.min.js new file mode 100644 index 00000000..817e9823 --- /dev/null +++ b/node_modules/history/umd/history.min.js @@ -0,0 +1 @@ +!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.History=n():t.History=n()}(this,function(){return function(t){function n(o){if(e[o])return e[o].exports;var r=e[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0,n.createPath=n.parsePath=n.locationsAreEqual=n.createLocation=n.createMemoryHistory=n.createHashHistory=n.createBrowserHistory=void 0;var r=e(2);Object.defineProperty(n,"createLocation",{enumerable:!0,get:function(){return r.createLocation}}),Object.defineProperty(n,"locationsAreEqual",{enumerable:!0,get:function(){return r.locationsAreEqual}});var i=e(1);Object.defineProperty(n,"parsePath",{enumerable:!0,get:function(){return i.parsePath}}),Object.defineProperty(n,"createPath",{enumerable:!0,get:function(){return i.createPath}});var a=e(7),c=o(a),u=e(8),s=o(u),f=e(9),l=o(f);n.createBrowserHistory=c.default,n.createHashHistory=s.default,n.createMemoryHistory=l.default},function(t,n){"use strict";n.__esModule=!0;var e=(n.addLeadingSlash=function(t){return"/"===t.charAt(0)?t:"/"+t},n.stripLeadingSlash=function(t){return"/"===t.charAt(0)?t.substr(1):t},n.hasBasename=function(t,n){return new RegExp("^"+n+"(\\/|\\?|#|$)","i").test(t)});n.stripBasename=function(t,n){return e(t,n)?t.substr(n.length):t},n.stripTrailingSlash=function(t){return"/"===t.charAt(t.length-1)?t.slice(0,-1):t},n.parsePath=function(t){var n=t||"/",e="",o="",r=n.indexOf("#");r!==-1&&(o=n.substr(r),n=n.substr(0,r));var i=n.indexOf("?");return i!==-1&&(e=n.substr(i),n=n.substr(0,i)),{pathname:n,search:"?"===e?"":e,hash:"#"===o?"":o}},n.createPath=function(t){var n=t.pathname,e=t.search,o=t.hash,r=n||"/";return e&&"?"!==e&&(r+="?"===e.charAt(0)?e:"?"+e),o&&"#"!==o&&(r+="#"===o.charAt(0)?o:"#"+o),r}},function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0,n.locationsAreEqual=n.createLocation=void 0;var r=Object.assign||function(t){for(var n=1;n0&&void 0!==arguments[0]?arguments[0]:{};d.canUseDOM?void 0:(0,c.default)(!1);var n=window.history,e=(0,d.supportsHistory)(),o=!(0,d.supportsPopStateOnHashChange)(),i=t.forceRefresh,a=void 0!==i&&i,f=t.getUserConfirmation,y=void 0===f?d.getConfirmation:f,g=t.keyLength,m=void 0===g?6:g,w=t.basename?(0,s.stripTrailingSlash)((0,s.addLeadingSlash)(t.basename)):"",b=function(t){var n=t||{},e=n.key,o=n.state,r=window.location,i=r.pathname,a=r.search,c=r.hash,f=i+a+c;return w&&(f=(0,s.stripBasename)(f,w)),(0,u.createLocation)(f,o,e)},P=function(){return Math.random().toString(36).substr(2,m)},O=(0,l.default)(),L=function(t){r(G,t),G.length=n.length,O.notifyListeners(G.location,G.action)},x=function(t){(0,d.isExtraneousPopstateEvent)(t)||_(b(t.state))},S=function(){_(b(v()))},E=!1,_=function(t){if(E)E=!1,L();else{var n="POP";O.confirmTransitionTo(t,n,y,function(e){e?L({action:n,location:t}):A(t)})}},A=function(t){var n=G.location,e=M.indexOf(n.key);e===-1&&(e=0);var o=M.indexOf(t.key);o===-1&&(o=0);var r=e-o;r&&(E=!0,U(r))},k=b(v()),M=[k.key],T=function(t){return w+(0,s.createPath)(t)},H=function(t,o){var r="PUSH",i=(0,u.createLocation)(t,o,P(),G.location);O.confirmTransitionTo(i,r,y,function(t){if(t){var o=T(i),c=i.key,u=i.state;if(e)if(n.pushState({key:c,state:u},null,o),a)window.location.href=o;else{var s=M.indexOf(G.location.key),f=M.slice(0,s===-1?0:s+1);f.push(i.key),M=f,L({action:r,location:i})}else window.location.href=o}})},j=function(t,o){var r="REPLACE",i=(0,u.createLocation)(t,o,P(),G.location);O.confirmTransitionTo(i,r,y,function(t){if(t){var o=T(i),c=i.key,u=i.state;if(e)if(n.replaceState({key:c,state:u},null,o),a)window.location.replace(o);else{var s=M.indexOf(G.location.key);s!==-1&&(M[s]=i.key),L({action:r,location:i})}else window.location.replace(o)}})},U=function(t){n.go(t)},C=function(){return U(-1)},R=function(){return U(1)},B=0,I=function(t){B+=t,1===B?((0,d.addEventListener)(window,h,x),o&&(0,d.addEventListener)(window,p,S)):0===B&&((0,d.removeEventListener)(window,h,x),o&&(0,d.removeEventListener)(window,p,S))},q=!1,F=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=O.setPrompt(t);return q||(I(1),q=!0),function(){return q&&(q=!1,I(-1)),n()}},D=function(t){var n=O.appendListener(t);return I(1),function(){I(-1),n()}},G={length:n.length,action:"POP",location:k,createHref:T,push:H,replace:j,go:U,goBack:C,goForward:R,block:F,listen:D};return G};n.default=y},function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0;var r=Object.assign||function(t){for(var n=1;n=0?n:0)+"#"+t)},m=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d.canUseDOM?void 0:(0,c.default)(!1);var n=window.history,e=((0,d.supportsGoWithoutReloadUsingHash)(),t.getUserConfirmation),o=void 0===e?d.getConfirmation:e,i=t.hashType,a=void 0===i?"slash":i,f=t.basename?(0,s.stripTrailingSlash)((0,s.addLeadingSlash)(t.basename)):"",m=p[a],w=m.encodePath,b=m.decodePath,P=function(){var t=b(v());return f&&(t=(0,s.stripBasename)(t,f)),(0,u.createLocation)(t)},O=(0,l.default)(),L=function(t){r(V,t),V.length=n.length,O.notifyListeners(V.location,V.action)},x=!1,S=null,E=function(){var t=v(),n=w(t);if(t!==n)g(n);else{var e=P(),o=V.location;if(!x&&(0,u.locationsAreEqual)(o,e))return;if(S===(0,s.createPath)(e))return;S=null,_(e)}},_=function(t){if(x)x=!1,L();else{var n="POP";O.confirmTransitionTo(t,n,o,function(e){e?L({action:n,location:t}):A(t)})}},A=function(t){var n=V.location,e=H.lastIndexOf((0,s.createPath)(n));e===-1&&(e=0);var o=H.lastIndexOf((0,s.createPath)(t));o===-1&&(o=0);var r=e-o;r&&(x=!0,R(r))},k=v(),M=w(k);k!==M&&g(M);var T=P(),H=[(0,s.createPath)(T)],j=function(t){return"#"+w(f+(0,s.createPath)(t))},U=function(t,n){var e="PUSH",r=(0,u.createLocation)(t,void 0,void 0,V.location);O.confirmTransitionTo(r,e,o,function(t){if(t){var n=(0,s.createPath)(r),o=w(f+n),i=v()!==o;if(i){S=n,y(o);var a=H.lastIndexOf((0,s.createPath)(V.location)),c=H.slice(0,a===-1?0:a+1);c.push(n),H=c,L({action:e,location:r})}else L()}})},C=function(t,n){var e="REPLACE",r=(0,u.createLocation)(t,void 0,void 0,V.location);O.confirmTransitionTo(r,e,o,function(t){if(t){var n=(0,s.createPath)(r),o=w(f+n),i=v()!==o;i&&(S=n,g(o));var a=H.indexOf((0,s.createPath)(V.location));a!==-1&&(H[a]=n),L({action:e,location:r})}})},R=function(t){n.go(t)},B=function(){return R(-1)},I=function(){return R(1)},q=0,F=function(t){q+=t,1===q?(0,d.addEventListener)(window,h,E):0===q&&(0,d.removeEventListener)(window,h,E)},D=!1,G=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=O.setPrompt(t);return D||(F(1),D=!0),function(){return D&&(D=!1,F(-1)),n()}},W=function(t){var n=O.appendListener(t);return F(1),function(){F(-1),n()}},V={length:n.length,action:"POP",location:T,createHref:j,push:U,replace:C,go:R,goBack:B,goForward:I,block:G,listen:W};return V};n.default=m},function(t,n,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}n.__esModule=!0;var r=("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Object.assign||function(t){for(var n=1;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.getUserConfirmation,e=t.initialEntries,o=void 0===e?["/"]:e,i=t.initialIndex,u=void 0===i?0:i,l=t.keyLength,d=void 0===l?6:l,h=(0,s.default)(),p=function(t){r(_,t),_.length=_.entries.length,h.notifyListeners(_.location,_.action)},v=function(){return Math.random().toString(36).substr(2,d)},y=f(u,0,o.length-1),g=o.map(function(t){return"string"==typeof t?(0,c.createLocation)(t,void 0,v()):(0,c.createLocation)(t,void 0,t.key||v())}),m=a.createPath,w=function(t,e){var o="PUSH",r=(0,c.createLocation)(t,e,v(),_.location);h.confirmTransitionTo(r,o,n,function(t){if(t){var n=_.index,e=n+1,i=_.entries.slice(0);i.length>e?i.splice(e,i.length-e,r):i.push(r),p({action:o,location:r,index:e,entries:i})}})},b=function(t,e){var o="REPLACE",r=(0,c.createLocation)(t,e,v(),_.location);h.confirmTransitionTo(r,o,n,function(t){t&&(_.entries[_.index]=r,p({action:o,location:r}))})},P=function(t){var e=f(_.index+t,0,_.entries.length-1),o="POP",r=_.entries[e];h.confirmTransitionTo(r,o,n,function(t){t?p({action:o,location:r,index:e}):p()})},O=function(){return P(-1)},L=function(){return P(1)},x=function(t){var n=_.index+t;return n>=0&&n<_.entries.length},S=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return h.setPrompt(t)},E=function(t){return h.appendListener(t)},_={length:g.length,action:"POP",location:g[y],index:y,entries:g,createHref:m,push:w,replace:b,go:P,goBack:O,goForward:L,canGo:x,block:S,listen:E};return _};n.default=l},function(t,n){"use strict";function e(t){return"/"===t.charAt(0)}function o(t,n){for(var e=n,o=e+1,r=t.length;o1&&void 0!==arguments[1]?arguments[1]:"",r=t&&t.split("/")||[],i=n&&n.split("/")||[],a=t&&e(t),c=n&&e(n),u=a||c;if(t&&e(t)?i=r:r.length&&(i.pop(),i=i.concat(r)),!i.length)return"/";var s=void 0;if(i.length){var f=i[i.length-1];s="."===f||".."===f||""===f}else s=!1;for(var l=0,d=i.length;d>=0;d--){var h=i[d];"."===h?o(i,d):".."===h?(o(i,d),l++):l&&(o(i,d),l--)}if(!u)for(;l--;l)i.unshift("..");!u||""===i[0]||i[0]&&e(i[0])||i.unshift("");var p=i.join("/");return s&&"/"!==p.substr(-1)&&(p+="/"),p}n.__esModule=!0,n.default=r,t.exports=n.default},function(t,n){"use strict";function e(t,n){if(t===n)return!0;if(null==t||null==n)return!1;if(Array.isArray(t))return Array.isArray(n)&&t.length===n.length&&t.every(function(t,o){return e(t,n[o])});var r="undefined"==typeof t?"undefined":o(t),i="undefined"==typeof n?"undefined":o(n);if(r!==i)return!1;if("object"===r){var a=t.valueOf(),c=n.valueOf();if(a!==t||c!==n)return e(a,c);var u=Object.keys(t),s=Object.keys(n);return u.length===s.length&&u.every(function(o){return e(t[o],n[o])})}return!1}n.__esModule=!0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};n.default=e,t.exports=n.default}])}); \ No newline at end of file diff --git a/node_modules/hoist-non-react-statics/LICENSE.md b/node_modules/hoist-non-react-statics/LICENSE.md new file mode 100644 index 00000000..2464f59e --- /dev/null +++ b/node_modules/hoist-non-react-statics/LICENSE.md @@ -0,0 +1,29 @@ +Software License Agreement (BSD License) +======================================== + +Copyright (c) 2015, Yahoo! Inc. All rights reserved. +---------------------------------------------------- + +Redistribution and use of this software in source and binary forms, with or +without modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Yahoo! Inc. nor the names of YUI's contributors may be + used to endorse or promote products derived from this software without + specific prior written permission of Yahoo! Inc. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/hoist-non-react-statics/README.md b/node_modules/hoist-non-react-statics/README.md new file mode 100644 index 00000000..dd1fd61f --- /dev/null +++ b/node_modules/hoist-non-react-statics/README.md @@ -0,0 +1,52 @@ +# hoist-non-react-statics + +[![NPM version](https://badge.fury.io/js/hoist-non-react-statics.svg)](http://badge.fury.io/js/hoist-non-react-statics) +[![Build Status](https://img.shields.io/travis/mridgway/hoist-non-react-statics.svg)](https://travis-ci.org/mridgway/hoist-non-react-statics) +[![Coverage Status](https://img.shields.io/coveralls/mridgway/hoist-non-react-statics.svg)](https://coveralls.io/r/mridgway/hoist-non-react-statics?branch=master) +[![Dependency Status](https://img.shields.io/david/mridgway/hoist-non-react-statics.svg)](https://david-dm.org/mridgway/hoist-non-react-statics) +[![devDependency Status](https://img.shields.io/david/dev/mridgway/hoist-non-react-statics.svg)](https://david-dm.org/mridgway/hoist-non-react-statics#info=devDependencies) + +Copies non-react specific statics from a child component to a parent component. +Similar to `Object.assign`, but with React static keywords blacklisted from +being overridden. + +```bash +$ npm install --save hoist-non-react-statics +``` + +## Usage + +```js +import hoistNonReactStatics from 'hoist-non-react-statics'; + +hoistNonReactStatics(targetComponent, sourceComponent); +``` + +If you have specific statics that you don't want to be hoisted, you can also pass a third parameter to exclude them: + +```js +hoistNonReactStatics(targetComponent, sourceComponent, { myStatic: true, myOtherStatic: true }); +``` + +## What does this module do? + +See this [explanation](https://facebook.github.io/react/docs/higher-order-components.html#static-methods-must-be-copied-over) from the React docs. + +## Compatible React Versions + +| Compatible React Version | hoist-non-react-statics Version | +|--------------------------|-------------------------------| +| 16.3+ | >= 2.5.0 | +| 0.13-16.2 | >= 1.0.0 | + +## Browser Support + +This package uses `Object.defineProperty` which has a broken implementation in IE8. In order to use this package in IE8, you will need a polyfill that fixes this method. + +## License +This software is free to use under the Yahoo Inc. BSD license. +See the [LICENSE file][] for license text and copyright information. + +[LICENSE file]: https://github.com/mridgway/hoist-non-react-statics/blob/master/LICENSE.md + +Third-party open source code used are listed in our [package.json file]( https://github.com/mridgway/hoist-non-react-statics/blob/master/package.json). diff --git a/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js b/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js new file mode 100644 index 00000000..cb13d2ac --- /dev/null +++ b/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js @@ -0,0 +1,68 @@ +'use strict'; + +/** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ +var REACT_STATICS = { + childContextTypes: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true +}; + +var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true +}; + +var defineProperty = Object.defineProperty; +var getOwnPropertyNames = Object.getOwnPropertyNames; +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var getPrototypeOf = Object.getPrototypeOf; +var objectPrototype = getPrototypeOf && getPrototypeOf(Object); + +function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components + + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + try { // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + + return targetComponent; + } + + return targetComponent; +} + +module.exports = hoistNonReactStatics; diff --git a/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.js b/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.js new file mode 100644 index 00000000..9cb75ccd --- /dev/null +++ b/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.js @@ -0,0 +1,74 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.hoistNonReactStatics = factory()); +}(this, (function () { 'use strict'; + +/** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ +var REACT_STATICS = { + childContextTypes: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true +}; + +var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true +}; + +var defineProperty = Object.defineProperty; +var getOwnPropertyNames = Object.getOwnPropertyNames; +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var getPrototypeOf = Object.getPrototypeOf; +var objectPrototype = getPrototypeOf && getPrototypeOf(Object); + +function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components + + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + try { // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + + return targetComponent; + } + + return targetComponent; +} + +return hoistNonReactStatics; + +}))); diff --git a/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.min.js b/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.min.js new file mode 100644 index 00000000..2cd853fb --- /dev/null +++ b/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.hoistNonReactStatics=t()}(this,function(){"use strict";var f={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},s={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},y=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,l=Object.getOwnPropertyDescriptor,g=Object.getPrototypeOf,m=g&&g(Object);return function e(t,r,o){if("string"!=typeof r){if(m){var n=g(r);n&&n!==m&&e(t,n,o)}var i=u(r);d&&(i=i.concat(d(r)));for(var p=0;p( + TargetComponent: React.ComponentType, + SourceComponent: React.ComponentType, + customStatic?: any): React.ComponentType; + +export default hoistNonReactStatics diff --git a/node_modules/hoist-non-react-statics/package.json b/node_modules/hoist-non-react-statics/package.json new file mode 100644 index 00000000..6b56f5ca --- /dev/null +++ b/node_modules/hoist-non-react-statics/package.json @@ -0,0 +1,85 @@ +{ + "_from": "hoist-non-react-statics@^2.5.0", + "_id": "hoist-non-react-statics@2.5.5", + "_inBundle": false, + "_integrity": "sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw==", + "_location": "/hoist-non-react-statics", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "hoist-non-react-statics@^2.5.0", + "name": "hoist-non-react-statics", + "escapedName": "hoist-non-react-statics", + "rawSpec": "^2.5.0", + "saveSpec": null, + "fetchSpec": "^2.5.0" + }, + "_requiredBy": [ + "/react-router" + ], + "_resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz", + "_shasum": "c5903cf409c0dfd908f388e619d86b9c1174cb47", + "_spec": "hoist-non-react-statics@^2.5.0", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/react-router", + "author": { + "name": "Michael Ridgway", + "email": "mcridgway@gmail.com" + }, + "bugs": { + "url": "https://github.com/mridgway/hoist-non-react-statics/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Copies non-react specific statics from a child component to a parent component", + "devDependencies": { + "babel": "^6.23.0", + "babel-cli": "^6.24.1", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-react-jsx-source": "^6.22.0", + "babel-preset-env": "^1.6.1", + "babel-preset-react": "^6.24.1", + "babel-register": "^6.24.1", + "chai": "^4.0.1", + "coveralls": "^2.11.1", + "create-react-class": "^15.5.3", + "eslint": "^4.13.1", + "istanbul": "^0.4.5", + "mocha": "^3.4.2", + "pre-commit": "^1.0.7", + "react": "^15.0.0", + "rimraf": "^2.6.2", + "rollup": "^0.52.3", + "rollup-plugin-uglify": "^2.0.1" + }, + "files": [ + "src", + "dist", + "index.d.ts" + ], + "homepage": "https://github.com/mridgway/hoist-non-react-statics#readme", + "keywords": [ + "react" + ], + "license": "BSD-3-Clause", + "main": "dist/hoist-non-react-statics.cjs.js", + "name": "hoist-non-react-statics", + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, + "repository": { + "type": "git", + "url": "git://github.com/mridgway/hoist-non-react-statics.git" + }, + "scripts": { + "build": "rollup -c", + "cover": "node node_modules/istanbul/lib/cli.js cover --dir artifacts -- ./node_modules/mocha/bin/_mocha tests/unit/ --recursive --compilers js:babel/register --reporter spec", + "lint": "eslint src", + "prebuild": "rimraf dist", + "prepublish": "npm test", + "pretest": "npm run build", + "test": "mocha tests/unit/ --recursive --compilers js:babel-register --reporter spec" + }, + "types": "index.d.ts", + "version": "2.5.5" +} diff --git a/node_modules/hoist-non-react-statics/src/index.js b/node_modules/hoist-non-react-statics/src/index.js new file mode 100644 index 00000000..6c99c4aa --- /dev/null +++ b/node_modules/hoist-non-react-statics/src/index.js @@ -0,0 +1,64 @@ +/** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ +var REACT_STATICS = { + childContextTypes: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true +}; + +var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true +}; + +var defineProperty = Object.defineProperty; +var getOwnPropertyNames = Object.getOwnPropertyNames; +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var getPrototypeOf = Object.getPrototypeOf; +var objectPrototype = getPrototypeOf && getPrototypeOf(Object); + +export default function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components + + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + try { // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + + return targetComponent; + } + + return targetComponent; +}; diff --git a/node_modules/invariant/CHANGELOG.md b/node_modules/invariant/CHANGELOG.md new file mode 100644 index 00000000..bc52f1c5 --- /dev/null +++ b/node_modules/invariant/CHANGELOG.md @@ -0,0 +1,69 @@ +2.2.4 / 2018-03-13 +================== + + * Use flow strict mode (i.e. `@flow strict`). + +2.2.3 / 2018-02-19 +================== + + * Change license from BSD+Patents to MIT. + +2.2.2 / 2016-11-15 +================== + + * Add LICENSE file. + * Misc housekeeping. + +2.2.1 / 2016-03-09 +================== + + * Use `NODE_ENV` variable instead of `__DEV__` to cache `process.env.NODE_ENV`. + +2.2.0 / 2015-11-17 +================== + + * Use `error.name` instead of `Invariant Violation`. + +2.1.3 / 2015-11-17 +================== + + * Remove `@provideModule` pragma. + +2.1.2 / 2015-10-27 +================== + + * Fix license. + +2.1.1 / 2015-09-20 +================== + + * Use correct SPDX license. + * Test "browser.js" using browserify. + * Switch from "envify" to "loose-envify". + +2.1.0 / 2015-06-03 +================== + + * Add "envify" as a dependency. + * Fixed license field in "package.json". + +2.0.0 / 2015-02-21 +================== + + * Switch to using the "browser" field. There are now browser and server versions that respect the "format" in production. + +1.0.2 / 2014-09-24 +================== + + * Added tests, npmignore and gitignore. + * Clarifications in README. + +1.0.1 / 2014-09-24 +================== + + * Actually include 'invariant.js'. + +1.0.0 / 2014-09-24 +================== + + * Initial release. diff --git a/node_modules/invariant/LICENSE b/node_modules/invariant/LICENSE new file mode 100644 index 00000000..188fb2b0 --- /dev/null +++ b/node_modules/invariant/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013-present, Facebook, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/invariant/README.md b/node_modules/invariant/README.md new file mode 100644 index 00000000..4f18354a --- /dev/null +++ b/node_modules/invariant/README.md @@ -0,0 +1,37 @@ +# invariant + +[![Build Status](https://travis-ci.org/zertosh/invariant.svg?branch=master)](https://travis-ci.org/zertosh/invariant) + +A mirror of Facebook's `invariant` (e.g. [React](https://github.com/facebook/react/blob/v0.13.3/src/vendor/core/invariant.js), [flux](https://github.com/facebook/flux/blob/2.0.2/src/invariant.js)). + +A way to provide descriptive errors in development but generic errors in production. + +## Install + +With [npm](http://npmjs.org) do: + +```sh +npm install invariant +``` + +## `invariant(condition, message)` + +```js +var invariant = require('invariant'); + +invariant(someTruthyVal, 'This will not throw'); +// No errors + +invariant(someFalseyVal, 'This will throw an error with this message'); +// Error: Invariant Violation: This will throw an error with this message +``` + +**Note:** When `process.env.NODE_ENV` is not `production`, the message is required. If omitted, `invariant` will throw regardless of the truthiness of the condition. When `process.env.NODE_ENV` is `production`, the message is optional – so they can be minified away. + +### Browser + +When used with [browserify](https://github.com/substack/node-browserify), it'll use `browser.js` (instead of `invariant.js`) and the [envify](https://github.com/hughsk/envify) transform will inline the value of `process.env.NODE_ENV`. + +### Node + +The node version is optimized around the performance implications of accessing `process.env`. The value of `process.env.NODE_ENV` is cached, and repeatedly used instead of reading `process.env`. See [Server rendering is slower with npm react #812](https://github.com/facebook/react/issues/812) diff --git a/node_modules/invariant/browser.js b/node_modules/invariant/browser.js new file mode 100644 index 00000000..b3941bc6 --- /dev/null +++ b/node_modules/invariant/browser.js @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +/** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + +var invariant = function(condition, format, a, b, c, d, e, f) { + if (process.env.NODE_ENV !== 'production') { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + } + + if (!condition) { + var error; + if (format === undefined) { + error = new Error( + 'Minified exception occurred; use the non-minified dev environment ' + + 'for the full error message and additional helpful warnings.' + ); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error( + format.replace(/%s/g, function() { return args[argIndex++]; }) + ); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } +}; + +module.exports = invariant; diff --git a/node_modules/invariant/invariant.js b/node_modules/invariant/invariant.js new file mode 100644 index 00000000..b543e9ff --- /dev/null +++ b/node_modules/invariant/invariant.js @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +/** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + +var NODE_ENV = process.env.NODE_ENV; + +var invariant = function(condition, format, a, b, c, d, e, f) { + if (NODE_ENV !== 'production') { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + } + + if (!condition) { + var error; + if (format === undefined) { + error = new Error( + 'Minified exception occurred; use the non-minified dev environment ' + + 'for the full error message and additional helpful warnings.' + ); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error( + format.replace(/%s/g, function() { return args[argIndex++]; }) + ); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } +}; + +module.exports = invariant; diff --git a/node_modules/invariant/invariant.js.flow b/node_modules/invariant/invariant.js.flow new file mode 100644 index 00000000..462ab73b --- /dev/null +++ b/node_modules/invariant/invariant.js.flow @@ -0,0 +1,7 @@ +/* @flow strict */ + +declare module.exports: ( + condition: any, + format?: string, + ...args: Array +) => void; diff --git a/node_modules/invariant/package.json b/node_modules/invariant/package.json new file mode 100644 index 00000000..9c13742f --- /dev/null +++ b/node_modules/invariant/package.json @@ -0,0 +1,72 @@ +{ + "_from": "invariant@^2.2.4", + "_id": "invariant@2.2.4", + "_inBundle": false, + "_integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "_location": "/invariant", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "invariant@^2.2.4", + "name": "invariant", + "escapedName": "invariant", + "rawSpec": "^2.2.4", + "saveSpec": null, + "fetchSpec": "^2.2.4" + }, + "_requiredBy": [ + "/history", + "/react-router", + "/react-router-dom" + ], + "_resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "_shasum": "610f3c92c9359ce1db616e538008d23ff35158e6", + "_spec": "invariant@^2.2.4", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/react-router-dom", + "author": { + "name": "Andres Suarez", + "email": "zertosh@gmail.com" + }, + "browser": "browser.js", + "browserify": { + "transform": [ + "loose-envify" + ] + }, + "bugs": { + "url": "https://github.com/zertosh/invariant/issues" + }, + "bundleDependencies": false, + "dependencies": { + "loose-envify": "^1.0.0" + }, + "deprecated": false, + "description": "invariant", + "devDependencies": { + "browserify": "^11.0.1", + "flow-bin": "^0.67.1", + "tap": "^1.4.0" + }, + "files": [ + "browser.js", + "invariant.js", + "invariant.js.flow" + ], + "homepage": "https://github.com/zertosh/invariant#readme", + "keywords": [ + "test", + "invariant" + ], + "license": "MIT", + "main": "invariant.js", + "name": "invariant", + "repository": { + "type": "git", + "url": "git+https://github.com/zertosh/invariant.git" + }, + "scripts": { + "test": "NODE_ENV=production tap test/*.js && NODE_ENV=development tap test/*.js" + }, + "version": "2.2.4" +} diff --git a/node_modules/isarray/README.md b/node_modules/isarray/README.md new file mode 100644 index 00000000..052a62b8 --- /dev/null +++ b/node_modules/isarray/README.md @@ -0,0 +1,54 @@ + +# isarray + +`Array#isArray` for older browsers. + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](http://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/browserify). + +With [component](http://component.io) do + +```bash +$ component install juliangruber/isarray +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/isarray/build/build.js b/node_modules/isarray/build/build.js new file mode 100644 index 00000000..ec58596a --- /dev/null +++ b/node_modules/isarray/build/build.js @@ -0,0 +1,209 @@ + +/** + * Require the given path. + * + * @param {String} path + * @return {Object} exports + * @api public + */ + +function require(path, parent, orig) { + var resolved = require.resolve(path); + + // lookup failed + if (null == resolved) { + orig = orig || path; + parent = parent || 'root'; + var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); + err.path = orig; + err.parent = parent; + err.require = true; + throw err; + } + + var module = require.modules[resolved]; + + // perform real require() + // by invoking the module's + // registered function + if (!module.exports) { + module.exports = {}; + module.client = module.component = true; + module.call(this, module.exports, require.relative(resolved), module); + } + + return module.exports; +} + +/** + * Registered modules. + */ + +require.modules = {}; + +/** + * Registered aliases. + */ + +require.aliases = {}; + +/** + * Resolve `path`. + * + * Lookup: + * + * - PATH/index.js + * - PATH.js + * - PATH + * + * @param {String} path + * @return {String} path or null + * @api private + */ + +require.resolve = function(path) { + if (path.charAt(0) === '/') path = path.slice(1); + var index = path + '/index.js'; + + var paths = [ + path, + path + '.js', + path + '.json', + path + '/index.js', + path + '/index.json' + ]; + + for (var i = 0; i < paths.length; i++) { + var path = paths[i]; + if (require.modules.hasOwnProperty(path)) return path; + } + + if (require.aliases.hasOwnProperty(index)) { + return require.aliases[index]; + } +}; + +/** + * Normalize `path` relative to the current path. + * + * @param {String} curr + * @param {String} path + * @return {String} + * @api private + */ + +require.normalize = function(curr, path) { + var segs = []; + + if ('.' != path.charAt(0)) return path; + + curr = curr.split('/'); + path = path.split('/'); + + for (var i = 0; i < path.length; ++i) { + if ('..' == path[i]) { + curr.pop(); + } else if ('.' != path[i] && '' != path[i]) { + segs.push(path[i]); + } + } + + return curr.concat(segs).join('/'); +}; + +/** + * Register module at `path` with callback `definition`. + * + * @param {String} path + * @param {Function} definition + * @api private + */ + +require.register = function(path, definition) { + require.modules[path] = definition; +}; + +/** + * Alias a module definition. + * + * @param {String} from + * @param {String} to + * @api private + */ + +require.alias = function(from, to) { + if (!require.modules.hasOwnProperty(from)) { + throw new Error('Failed to alias "' + from + '", it does not exist'); + } + require.aliases[to] = from; +}; + +/** + * Return a require function relative to the `parent` path. + * + * @param {String} parent + * @return {Function} + * @api private + */ + +require.relative = function(parent) { + var p = require.normalize(parent, '..'); + + /** + * lastIndexOf helper. + */ + + function lastIndexOf(arr, obj) { + var i = arr.length; + while (i--) { + if (arr[i] === obj) return i; + } + return -1; + } + + /** + * The relative require() itself. + */ + + function localRequire(path) { + var resolved = localRequire.resolve(path); + return require(resolved, parent, path); + } + + /** + * Resolve relative to the parent. + */ + + localRequire.resolve = function(path) { + var c = path.charAt(0); + if ('/' == c) return path.slice(1); + if ('.' == c) return require.normalize(p, path); + + // resolve deps by returning + // the dep in the nearest "deps" + // directory + var segs = parent.split('/'); + var i = lastIndexOf(segs, 'deps') + 1; + if (!i) i = 0; + path = segs.slice(0, i + 1).join('/') + '/deps/' + path; + return path; + }; + + /** + * Check if module is defined at `path`. + */ + + localRequire.exists = function(path) { + return require.modules.hasOwnProperty(localRequire.resolve(path)); + }; + + return localRequire; +}; +require.register("isarray/index.js", function(exports, require, module){ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; + +}); +require.alias("isarray/index.js", "isarray/index.js"); + diff --git a/node_modules/isarray/component.json b/node_modules/isarray/component.json new file mode 100644 index 00000000..9e31b683 --- /dev/null +++ b/node_modules/isarray/component.json @@ -0,0 +1,19 @@ +{ + "name" : "isarray", + "description" : "Array#isArray for older browsers", + "version" : "0.0.1", + "repository" : "juliangruber/isarray", + "homepage": "https://github.com/juliangruber/isarray", + "main" : "index.js", + "scripts" : [ + "index.js" + ], + "dependencies" : {}, + "keywords": ["browser","isarray","array"], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT" +} diff --git a/node_modules/isarray/index.js b/node_modules/isarray/index.js new file mode 100644 index 00000000..5f5ad45d --- /dev/null +++ b/node_modules/isarray/index.js @@ -0,0 +1,3 @@ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; diff --git a/node_modules/isarray/package.json b/node_modules/isarray/package.json new file mode 100644 index 00000000..9ffa7c76 --- /dev/null +++ b/node_modules/isarray/package.json @@ -0,0 +1,57 @@ +{ + "_from": "isarray@0.0.1", + "_id": "isarray@0.0.1", + "_inBundle": false, + "_integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "_location": "/isarray", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "isarray@0.0.1", + "name": "isarray", + "escapedName": "isarray", + "rawSpec": "0.0.1", + "saveSpec": null, + "fetchSpec": "0.0.1" + }, + "_requiredBy": [ + "/path-to-regexp" + ], + "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "_spec": "isarray@0.0.1", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/path-to-regexp", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/isarray/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Array#isArray for older browsers", + "devDependencies": { + "tap": "*" + }, + "homepage": "https://github.com/juliangruber/isarray", + "keywords": [ + "browser", + "isarray", + "array" + ], + "license": "MIT", + "main": "index.js", + "name": "isarray", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "0.0.1" +} diff --git a/node_modules/js-tokens/CHANGELOG.md b/node_modules/js-tokens/CHANGELOG.md new file mode 100644 index 00000000..755e6f6e --- /dev/null +++ b/node_modules/js-tokens/CHANGELOG.md @@ -0,0 +1,151 @@ +### Version 4.0.0 (2018-01-28) ### + +- Added: Support for ES2018. The only change needed was recognizing the `s` + regex flag. +- Changed: _All_ tokens returned by the `matchToToken` function now have a + `closed` property. It is set to `undefined` for the tokens where “closed” + doesn’t make sense. This means that all tokens objects have the same shape, + which might improve performance. + +These are the breaking changes: + +- `'/a/s'.match(jsTokens)` no longer returns `['/', 'a', '/', 's']`, but + `['/a/s']`. (There are of course other variations of this.) +- Code that rely on some token objects not having the `closed` property could + now behave differently. + + +### Version 3.0.2 (2017-06-28) ### + +- No code changes. Just updates to the readme. + + +### Version 3.0.1 (2017-01-30) ### + +- Fixed: ES2015 unicode escapes with more than 6 hex digits are now matched + correctly. + + +### Version 3.0.0 (2017-01-11) ### + +This release contains one breaking change, that should [improve performance in +V8][v8-perf]: + +> So how can you, as a JavaScript developer, ensure that your RegExps are fast? +> If you are not interested in hooking into RegExp internals, make sure that +> neither the RegExp instance, nor its prototype is modified in order to get the +> best performance: +> +> ```js +> var re = /./g; +> re.exec(''); // Fast path. +> re.new_property = 'slow'; +> ``` + +This module used to export a single regex, with `.matchToToken` bolted +on, just like in the above example. This release changes the exports of +the module to avoid this issue. + +Before: + +```js +import jsTokens from "js-tokens" +// or: +var jsTokens = require("js-tokens") +var matchToToken = jsTokens.matchToToken +``` + +After: + +```js +import jsTokens, {matchToToken} from "js-tokens" +// or: +var jsTokens = require("js-tokens").default +var matchToToken = require("js-tokens").matchToToken +``` + +[v8-perf]: http://v8project.blogspot.se/2017/01/speeding-up-v8-regular-expressions.html + + +### Version 2.0.0 (2016-06-19) ### + +- Added: Support for ES2016. In other words, support for the `**` exponentiation + operator. + +These are the breaking changes: + +- `'**'.match(jsTokens)` no longer returns `['*', '*']`, but `['**']`. +- `'**='.match(jsTokens)` no longer returns `['*', '*=']`, but `['**=']`. + + +### Version 1.0.3 (2016-03-27) ### + +- Improved: Made the regex ever so slightly smaller. +- Updated: The readme. + + +### Version 1.0.2 (2015-10-18) ### + +- Improved: Limited npm package contents for a smaller download. Thanks to + @zertosh! + + +### Version 1.0.1 (2015-06-20) ### + +- Fixed: Declared an undeclared variable. + + +### Version 1.0.0 (2015-02-26) ### + +- Changed: Merged the 'operator' and 'punctuation' types into 'punctuator'. That + type is now equivalent to the Punctuator token in the ECMAScript + specification. (Backwards-incompatible change.) +- Fixed: A `-` followed by a number is now correctly matched as a punctuator + followed by a number. It used to be matched as just a number, but there is no + such thing as negative number literals. (Possibly backwards-incompatible + change.) + + +### Version 0.4.1 (2015-02-21) ### + +- Added: Support for the regex `u` flag. + + +### Version 0.4.0 (2015-02-21) ### + +- Improved: `jsTokens.matchToToken` performance. +- Added: Support for octal and binary number literals. +- Added: Support for template strings. + + +### Version 0.3.1 (2015-01-06) ### + +- Fixed: Support for unicode spaces. They used to be allowed in names (which is + very confusing), and some unicode newlines were wrongly allowed in strings and + regexes. + + +### Version 0.3.0 (2014-12-19) ### + +- Changed: The `jsTokens.names` array has been replaced with the + `jsTokens.matchToToken` function. The capturing groups of `jsTokens` are no + longer part of the public API; instead use said function. See this [gist] for + an example. (Backwards-incompatible change.) +- Changed: The empty string is now considered an “invalid” token, instead an + “empty” token (its own group). (Backwards-incompatible change.) +- Removed: component support. (Backwards-incompatible change.) + +[gist]: https://gist.github.com/lydell/be49dbf80c382c473004 + + +### Version 0.2.0 (2014-06-19) ### + +- Changed: Match ES6 function arrows (`=>`) as an operator, instead of its own + category (“functionArrow”), for simplicity. (Backwards-incompatible change.) +- Added: ES6 splats (`...`) are now matched as an operator (instead of three + punctuations). (Backwards-incompatible change.) + + +### Version 0.1.0 (2014-03-08) ### + +- Initial release. diff --git a/node_modules/js-tokens/LICENSE b/node_modules/js-tokens/LICENSE new file mode 100644 index 00000000..54aef52f --- /dev/null +++ b/node_modules/js-tokens/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014, 2015, 2016, 2017, 2018 Simon Lydell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/js-tokens/README.md b/node_modules/js-tokens/README.md new file mode 100644 index 00000000..00cdf163 --- /dev/null +++ b/node_modules/js-tokens/README.md @@ -0,0 +1,240 @@ +Overview [![Build Status](https://travis-ci.org/lydell/js-tokens.svg?branch=master)](https://travis-ci.org/lydell/js-tokens) +======== + +A regex that tokenizes JavaScript. + +```js +var jsTokens = require("js-tokens").default + +var jsString = "var foo=opts.foo;\n..." + +jsString.match(jsTokens) +// ["var", " ", "foo", "=", "opts", ".", "foo", ";", "\n", ...] +``` + + +Installation +============ + +`npm install js-tokens` + +```js +import jsTokens from "js-tokens" +// or: +var jsTokens = require("js-tokens").default +``` + + +Usage +===== + +### `jsTokens` ### + +A regex with the `g` flag that matches JavaScript tokens. + +The regex _always_ matches, even invalid JavaScript and the empty string. + +The next match is always directly after the previous. + +### `var token = matchToToken(match)` ### + +```js +import {matchToToken} from "js-tokens" +// or: +var matchToToken = require("js-tokens").matchToToken +``` + +Takes a `match` returned by `jsTokens.exec(string)`, and returns a `{type: +String, value: String}` object. The following types are available: + +- string +- comment +- regex +- number +- name +- punctuator +- whitespace +- invalid + +Multi-line comments and strings also have a `closed` property indicating if the +token was closed or not (see below). + +Comments and strings both come in several flavors. To distinguish them, check if +the token starts with `//`, `/*`, `'`, `"` or `` ` ``. + +Names are ECMAScript IdentifierNames, that is, including both identifiers and +keywords. You may use [is-keyword-js] to tell them apart. + +Whitespace includes both line terminators and other whitespace. + +[is-keyword-js]: https://github.com/crissdev/is-keyword-js + + +ECMAScript support +================== + +The intention is to always support the latest ECMAScript version whose feature +set has been finalized. + +If adding support for a newer version requires changes, a new version with a +major verion bump will be released. + +Currently, ECMAScript 2018 is supported. + + +Invalid code handling +===================== + +Unterminated strings are still matched as strings. JavaScript strings cannot +contain (unescaped) newlines, so unterminated strings simply end at the end of +the line. Unterminated template strings can contain unescaped newlines, though, +so they go on to the end of input. + +Unterminated multi-line comments are also still matched as comments. They +simply go on to the end of the input. + +Unterminated regex literals are likely matched as division and whatever is +inside the regex. + +Invalid ASCII characters have their own capturing group. + +Invalid non-ASCII characters are treated as names, to simplify the matching of +names (except unicode spaces which are treated as whitespace). Note: See also +the [ES2018](#es2018) section. + +Regex literals may contain invalid regex syntax. They are still matched as +regex literals. They may also contain repeated regex flags, to keep the regex +simple. + +Strings may contain invalid escape sequences. + + +Limitations +=========== + +Tokenizing JavaScript using regexes—in fact, _one single regex_—won’t be +perfect. But that’s not the point either. + +You may compare jsTokens with [esprima] by using `esprima-compare.js`. +See `npm run esprima-compare`! + +[esprima]: http://esprima.org/ + +### Template string interpolation ### + +Template strings are matched as single tokens, from the starting `` ` `` to the +ending `` ` ``, including interpolations (whose tokens are not matched +individually). + +Matching template string interpolations requires recursive balancing of `{` and +`}`—something that JavaScript regexes cannot do. Only one level of nesting is +supported. + +### Division and regex literals collision ### + +Consider this example: + +```js +var g = 9.82 +var number = bar / 2/g + +var regex = / 2/g +``` + +A human can easily understand that in the `number` line we’re dealing with +division, and in the `regex` line we’re dealing with a regex literal. How come? +Because humans can look at the whole code to put the `/` characters in context. +A JavaScript regex cannot. It only sees forwards. (Well, ES2018 regexes can also +look backwards. See the [ES2018](#es2018) section). + +When the `jsTokens` regex scans throught the above, it will see the following +at the end of both the `number` and `regex` rows: + +```js +/ 2/g +``` + +It is then impossible to know if that is a regex literal, or part of an +expression dealing with division. + +Here is a similar case: + +```js +foo /= 2/g +foo(/= 2/g) +``` + +The first line divides the `foo` variable with `2/g`. The second line calls the +`foo` function with the regex literal `/= 2/g`. Again, since `jsTokens` only +sees forwards, it cannot tell the two cases apart. + +There are some cases where we _can_ tell division and regex literals apart, +though. + +First off, we have the simple cases where there’s only one slash in the line: + +```js +var foo = 2/g +foo /= 2 +``` + +Regex literals cannot contain newlines, so the above cases are correctly +identified as division. Things are only problematic when there are more than +one non-comment slash in a single line. + +Secondly, not every character is a valid regex flag. + +```js +var number = bar / 2/e +``` + +The above example is also correctly identified as division, because `e` is not a +valid regex flag. I initially wanted to future-proof by allowing `[a-zA-Z]*` +(any letter) as flags, but it is not worth it since it increases the amount of +ambigous cases. So only the standard `g`, `m`, `i`, `y` and `u` flags are +allowed. This means that the above example will be identified as division as +long as you don’t rename the `e` variable to some permutation of `gmiyus` 1 to 6 +characters long. + +Lastly, we can look _forward_ for information. + +- If the token following what looks like a regex literal is not valid after a + regex literal, but is valid in a division expression, then the regex literal + is treated as division instead. For example, a flagless regex cannot be + followed by a string, number or name, but all of those three can be the + denominator of a division. +- Generally, if what looks like a regex literal is followed by an operator, the + regex literal is treated as division instead. This is because regexes are + seldomly used with operators (such as `+`, `*`, `&&` and `==`), but division + could likely be part of such an expression. + +Please consult the regex source and the test cases for precise information on +when regex or division is matched (should you need to know). In short, you +could sum it up as: + +If the end of a statement looks like a regex literal (even if it isn’t), it +will be treated as one. Otherwise it should work as expected (if you write sane +code). + +### ES2018 ### + +ES2018 added some nice regex improvements to the language. + +- [Unicode property escapes] should allow telling names and invalid non-ASCII + characters apart without blowing up the regex size. +- [Lookbehind assertions] should allow matching telling division and regex + literals apart in more cases. +- [Named capture groups] might simplify some things. + +These things would be nice to do, but are not critical. They probably have to +wait until the oldest maintained Node.js LTS release supports those features. + +[Unicode property escapes]: http://2ality.com/2017/07/regexp-unicode-property-escapes.html +[Lookbehind assertions]: http://2ality.com/2017/05/regexp-lookbehind-assertions.html +[Named capture groups]: http://2ality.com/2017/05/regexp-named-capture-groups.html + + +License +======= + +[MIT](LICENSE). diff --git a/node_modules/js-tokens/index.js b/node_modules/js-tokens/index.js new file mode 100644 index 00000000..b23a4a0e --- /dev/null +++ b/node_modules/js-tokens/index.js @@ -0,0 +1,23 @@ +// Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell +// License: MIT. (See LICENSE.) + +Object.defineProperty(exports, "__esModule", { + value: true +}) + +// This regex comes from regex.coffee, and is inserted here by generate-index.js +// (run `npm run build`). +exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g + +exports.matchToToken = function(match) { + var token = {type: "invalid", value: match[0], closed: undefined} + if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4]) + else if (match[ 5]) token.type = "comment" + else if (match[ 6]) token.type = "comment", token.closed = !!match[7] + else if (match[ 8]) token.type = "regex" + else if (match[ 9]) token.type = "number" + else if (match[10]) token.type = "name" + else if (match[11]) token.type = "punctuator" + else if (match[12]) token.type = "whitespace" + return token +} diff --git a/node_modules/js-tokens/package.json b/node_modules/js-tokens/package.json new file mode 100644 index 00000000..a05a739f --- /dev/null +++ b/node_modules/js-tokens/package.json @@ -0,0 +1,64 @@ +{ + "_from": "js-tokens@^3.0.0 || ^4.0.0", + "_id": "js-tokens@4.0.0", + "_inBundle": false, + "_integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "_location": "/js-tokens", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "js-tokens@^3.0.0 || ^4.0.0", + "name": "js-tokens", + "escapedName": "js-tokens", + "rawSpec": "^3.0.0 || ^4.0.0", + "saveSpec": null, + "fetchSpec": "^3.0.0 || ^4.0.0" + }, + "_requiredBy": [ + "/loose-envify" + ], + "_resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "_shasum": "19203fb59991df98e3a287050d4647cdeaf32499", + "_spec": "js-tokens@^3.0.0 || ^4.0.0", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/loose-envify", + "author": { + "name": "Simon Lydell" + }, + "bugs": { + "url": "https://github.com/lydell/js-tokens/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "A regex that tokenizes JavaScript.", + "devDependencies": { + "coffeescript": "2.1.1", + "esprima": "4.0.0", + "everything.js": "1.0.3", + "mocha": "5.0.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/lydell/js-tokens#readme", + "keywords": [ + "JavaScript", + "js", + "token", + "tokenize", + "regex" + ], + "license": "MIT", + "name": "js-tokens", + "repository": { + "type": "git", + "url": "git+https://github.com/lydell/js-tokens.git" + }, + "scripts": { + "build": "node generate-index.js", + "dev": "npm run build && npm test", + "esprima-compare": "node esprima-compare ./index.js everything.js/es5.js", + "test": "mocha --ui tdd" + }, + "version": "4.0.0" +} diff --git a/node_modules/loose-envify/LICENSE b/node_modules/loose-envify/LICENSE new file mode 100644 index 00000000..fbafb487 --- /dev/null +++ b/node_modules/loose-envify/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Andres Suarez + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/loose-envify/README.md b/node_modules/loose-envify/README.md new file mode 100644 index 00000000..7f4e07b0 --- /dev/null +++ b/node_modules/loose-envify/README.md @@ -0,0 +1,45 @@ +# loose-envify + +[![Build Status](https://travis-ci.org/zertosh/loose-envify.svg?branch=master)](https://travis-ci.org/zertosh/loose-envify) + +Fast (and loose) selective `process.env` replacer using [js-tokens](https://github.com/lydell/js-tokens) instead of an AST. Works just like [envify](https://github.com/hughsk/envify) but much faster. + +## Gotchas + +* Doesn't handle broken syntax. +* Doesn't look inside embedded expressions in template strings. + - **this won't work:** + ```js + console.log(`the current env is ${process.env.NODE_ENV}`); + ``` +* Doesn't replace oddly-spaced or oddly-commented expressions. + - **this won't work:** + ```js + console.log(process./*won't*/env./*work*/NODE_ENV); + ``` + +## Usage/Options + +loose-envify has the exact same interface as [envify](https://github.com/hughsk/envify), including the CLI. + +## Benchmark + +``` +envify: + + $ for i in {1..5}; do node bench/bench.js 'envify'; done + 708ms + 727ms + 791ms + 719ms + 720ms + +loose-envify: + + $ for i in {1..5}; do node bench/bench.js '../'; done + 51ms + 52ms + 52ms + 52ms + 52ms +``` diff --git a/node_modules/loose-envify/cli.js b/node_modules/loose-envify/cli.js new file mode 100755 index 00000000..c0b63cb1 --- /dev/null +++ b/node_modules/loose-envify/cli.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node +'use strict'; + +var looseEnvify = require('./'); +var fs = require('fs'); + +if (process.argv[2]) { + fs.createReadStream(process.argv[2], {encoding: 'utf8'}) + .pipe(looseEnvify(process.argv[2])) + .pipe(process.stdout); +} else { + process.stdin.resume() + process.stdin + .pipe(looseEnvify(__filename)) + .pipe(process.stdout); +} diff --git a/node_modules/loose-envify/custom.js b/node_modules/loose-envify/custom.js new file mode 100644 index 00000000..6389bfac --- /dev/null +++ b/node_modules/loose-envify/custom.js @@ -0,0 +1,4 @@ +// envify compatibility +'use strict'; + +module.exports = require('./loose-envify'); diff --git a/node_modules/loose-envify/index.js b/node_modules/loose-envify/index.js new file mode 100644 index 00000000..8cd8305d --- /dev/null +++ b/node_modules/loose-envify/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./loose-envify')(process.env); diff --git a/node_modules/loose-envify/loose-envify.js b/node_modules/loose-envify/loose-envify.js new file mode 100644 index 00000000..b5a5be22 --- /dev/null +++ b/node_modules/loose-envify/loose-envify.js @@ -0,0 +1,36 @@ +'use strict'; + +var stream = require('stream'); +var util = require('util'); +var replace = require('./replace'); + +var jsonExtRe = /\.json$/; + +module.exports = function(rootEnv) { + rootEnv = rootEnv || process.env; + return function (file, trOpts) { + if (jsonExtRe.test(file)) { + return stream.PassThrough(); + } + var envs = trOpts ? [rootEnv, trOpts] : [rootEnv]; + return new LooseEnvify(envs); + }; +}; + +function LooseEnvify(envs) { + stream.Transform.call(this); + this._data = ''; + this._envs = envs; +} +util.inherits(LooseEnvify, stream.Transform); + +LooseEnvify.prototype._transform = function(buf, enc, cb) { + this._data += buf; + cb(); +}; + +LooseEnvify.prototype._flush = function(cb) { + var replaced = replace(this._data, this._envs); + this.push(replaced); + cb(); +}; diff --git a/node_modules/loose-envify/package.json b/node_modules/loose-envify/package.json new file mode 100644 index 00000000..eafb187e --- /dev/null +++ b/node_modules/loose-envify/package.json @@ -0,0 +1,73 @@ +{ + "_from": "loose-envify@^1.3.1", + "_id": "loose-envify@1.4.0", + "_inBundle": false, + "_integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "_location": "/loose-envify", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "loose-envify@^1.3.1", + "name": "loose-envify", + "escapedName": "loose-envify", + "rawSpec": "^1.3.1", + "saveSpec": null, + "fetchSpec": "^1.3.1" + }, + "_requiredBy": [ + "/history", + "/history/warning", + "/invariant", + "/prop-types", + "/react-router", + "/react-router-dom", + "/warning" + ], + "_resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "_shasum": "71ee51fa7be4caec1a63839f7e682d8132d30caf", + "_spec": "loose-envify@^1.3.1", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/react-router-dom", + "author": { + "name": "Andres Suarez", + "email": "zertosh@gmail.com" + }, + "bin": { + "loose-envify": "cli.js" + }, + "bugs": { + "url": "https://github.com/zertosh/loose-envify/issues" + }, + "bundleDependencies": false, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "deprecated": false, + "description": "Fast (and loose) selective `process.env` replacer using js-tokens instead of an AST", + "devDependencies": { + "browserify": "^13.1.1", + "envify": "^3.4.0", + "tap": "^8.0.0" + }, + "homepage": "https://github.com/zertosh/loose-envify", + "keywords": [ + "environment", + "variables", + "browserify", + "browserify-transform", + "transform", + "source", + "configuration" + ], + "license": "MIT", + "main": "index.js", + "name": "loose-envify", + "repository": { + "type": "git", + "url": "git://github.com/zertosh/loose-envify.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "version": "1.4.0" +} diff --git a/node_modules/loose-envify/replace.js b/node_modules/loose-envify/replace.js new file mode 100644 index 00000000..ec15e81c --- /dev/null +++ b/node_modules/loose-envify/replace.js @@ -0,0 +1,65 @@ +'use strict'; + +var jsTokens = require('js-tokens').default; + +var processEnvRe = /\bprocess\.env\.[_$a-zA-Z][$\w]+\b/; +var spaceOrCommentRe = /^(?:\s|\/[/*])/; + +function replace(src, envs) { + if (!processEnvRe.test(src)) { + return src; + } + + var out = []; + var purge = envs.some(function(env) { + return env._ && env._.indexOf('purge') !== -1; + }); + + jsTokens.lastIndex = 0 + var parts = src.match(jsTokens); + + for (var i = 0; i < parts.length; i++) { + if (parts[i ] === 'process' && + parts[i + 1] === '.' && + parts[i + 2] === 'env' && + parts[i + 3] === '.') { + var prevCodeToken = getAdjacentCodeToken(-1, parts, i); + var nextCodeToken = getAdjacentCodeToken(1, parts, i + 4); + var replacement = getReplacementString(envs, parts[i + 4], purge); + if (prevCodeToken !== '.' && + nextCodeToken !== '.' && + nextCodeToken !== '=' && + typeof replacement === 'string') { + out.push(replacement); + i += 4; + continue; + } + } + out.push(parts[i]); + } + + return out.join(''); +} + +function getAdjacentCodeToken(dir, parts, i) { + while (true) { + var part = parts[i += dir]; + if (!spaceOrCommentRe.test(part)) { + return part; + } + } +} + +function getReplacementString(envs, name, purge) { + for (var j = 0; j < envs.length; j++) { + var env = envs[j]; + if (typeof env[name] !== 'undefined') { + return JSON.stringify(env[name]); + } + } + if (purge) { + return 'undefined'; + } +} + +module.exports = replace; diff --git a/node_modules/object-assign/index.js b/node_modules/object-assign/index.js new file mode 100644 index 00000000..0930cf88 --- /dev/null +++ b/node_modules/object-assign/index.js @@ -0,0 +1,90 @@ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; diff --git a/node_modules/object-assign/license b/node_modules/object-assign/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/object-assign/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/object-assign/package.json b/node_modules/object-assign/package.json new file mode 100644 index 00000000..cc3c9e7e --- /dev/null +++ b/node_modules/object-assign/package.json @@ -0,0 +1,74 @@ +{ + "_from": "object-assign@^4.1.1", + "_id": "object-assign@4.1.1", + "_inBundle": false, + "_integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "_location": "/object-assign", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "object-assign@^4.1.1", + "name": "object-assign", + "escapedName": "object-assign", + "rawSpec": "^4.1.1", + "saveSpec": null, + "fetchSpec": "^4.1.1" + }, + "_requiredBy": [ + "/prop-types" + ], + "_resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "_shasum": "2109adc7965887cfc05cbbd442cac8bfbb360863", + "_spec": "object-assign@^4.1.1", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/prop-types", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/object-assign/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "ES2015 `Object.assign()` ponyfill", + "devDependencies": { + "ava": "^0.16.0", + "lodash": "^4.16.4", + "matcha": "^0.7.0", + "xo": "^0.16.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/object-assign#readme", + "keywords": [ + "object", + "assign", + "extend", + "properties", + "es2015", + "ecmascript", + "harmony", + "ponyfill", + "prollyfill", + "polyfill", + "shim", + "browser" + ], + "license": "MIT", + "name": "object-assign", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/object-assign.git" + }, + "scripts": { + "bench": "matcha bench.js", + "test": "xo && ava" + }, + "version": "4.1.1" +} diff --git a/node_modules/object-assign/readme.md b/node_modules/object-assign/readme.md new file mode 100644 index 00000000..1be09d35 --- /dev/null +++ b/node_modules/object-assign/readme.md @@ -0,0 +1,61 @@ +# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) + +> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) + + +## Use the built-in + +Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), +support `Object.assign()` :tada:. If you target only those environments, then by all +means, use `Object.assign()` instead of this package. + + +## Install + +``` +$ npm install --save object-assign +``` + + +## Usage + +```js +const objectAssign = require('object-assign'); + +objectAssign({foo: 0}, {bar: 1}); +//=> {foo: 0, bar: 1} + +// multiple sources +objectAssign({foo: 0}, {bar: 1}, {baz: 2}); +//=> {foo: 0, bar: 1, baz: 2} + +// overwrites equal keys +objectAssign({foo: 0}, {foo: 1}, {foo: 2}); +//=> {foo: 2} + +// ignores null and undefined sources +objectAssign({foo: 0}, null, {bar: 1}, undefined); +//=> {foo: 0, bar: 1} +``` + + +## API + +### objectAssign(target, [source, ...]) + +Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. + + +## Resources + +- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) + + +## Related + +- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-to-regexp/History.md b/node_modules/path-to-regexp/History.md new file mode 100644 index 00000000..6672e788 --- /dev/null +++ b/node_modules/path-to-regexp/History.md @@ -0,0 +1,153 @@ +1.6.0 / 2016-10-03 +================== + + * Populate `RegExp.keys` when using the `tokensToRegExp` method (making it consistent with the main export) + * Allow a `delimiter` option to be passed in with `parse` + * Updated TypeScript definition with `Keys` and `Options` updated + +1.5.3 / 2016-06-15 +================== + + * Add `\\` to the ignore character group to avoid backtracking on mismatched parens + +1.5.2 / 2016-06-15 +================== + + * Escape `\\` in string segments of regexp + +1.5.1 / 2016-06-08 +================== + + * Add `index.d.ts` to NPM package + +1.5.0 / 2016-05-20 +================== + + * Handle partial token segments (better) + * Allow compile to handle asterisk token segments + +1.4.0 / 2016-05-18 +================== + + * Handle RegExp unions in path matching groups + +1.3.0 / 2016-05-08 +================== + + * Clarify README language and named parameter token support + * Support advanced Closure Compiler with type annotations + * Add pretty paths options to compiled function output + * Add TypeScript definition to project + * Improved prefix handling with non-complete segment parameters (E.g. `/:foo?-bar`) + +1.2.1 / 2015-08-17 +================== + + * Encode values before validation with path compilation function + * More examples of using compilation in README + +1.2.0 / 2015-05-20 +================== + + * Add support for matching an asterisk (`*`) as an unnamed match everything group (`(.*)`) + +1.1.1 / 2015-05-11 +================== + + * Expose methods for working with path tokens + +1.1.0 / 2015-05-09 +================== + + * Expose the parser implementation to consumers + * Implement a compiler function to generate valid strings + * Huge refactor of tests to be more DRY and cover new parse and compile functions + * Use chai in tests + * Add .editorconfig + +1.0.3 / 2015-01-17 +================== + + * Optimised function runtime + * Added `files` to `package.json` + +1.0.2 / 2014-12-17 +================== + + * Use `Array.isArray` shim + * Remove ES5 incompatible code + * Fixed repository path + * Added new readme badges + +1.0.1 / 2014-08-27 +================== + + * Ensure installation works correctly on 0.8 + +1.0.0 / 2014-08-17 +================== + + * No more API changes + +0.2.5 / 2014-08-07 +================== + + * Allow keys parameter to be omitted + +0.2.4 / 2014-08-02 +================== + + * Code coverage badge + * Updated readme + * Attach keys to the generated regexp + +0.2.3 / 2014-07-09 +================== + + * Add MIT license + +0.2.2 / 2014-07-06 +================== + + * A passed in trailing slash in non-strict mode will become optional + * In non-end mode, the optional trailing slash will only match at the end + +0.2.1 / 2014-06-11 +================== + + * Fixed a major capturing group regexp regression + +0.2.0 / 2014-06-09 +================== + + * Improved support for arrays + * Improved support for regexps + * Better support for non-ending strict mode matches with a trailing slash + * Travis CI support + * Block using regexp special characters in the path + * Removed support for the asterisk to match all + * New support for parameter suffixes - `*`, `+` and `?` + * Updated readme + * Provide delimiter information with keys array + +0.1.2 / 2014-03-10 +================== + + * Move testing dependencies to `devDependencies` + +0.1.1 / 2014-03-10 +================== + + * Match entire substring with `options.end` + * Properly handle ending and non-ending matches + +0.1.0 / 2014-03-06 +================== + + * Add `options.end` + +0.0.2 / 2013-02-10 +================== + + * Update to match current express + * Add .license property to component.json diff --git a/node_modules/path-to-regexp/LICENSE b/node_modules/path-to-regexp/LICENSE new file mode 100644 index 00000000..983fbe8a --- /dev/null +++ b/node_modules/path-to-regexp/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/path-to-regexp/Readme.md b/node_modules/path-to-regexp/Readme.md new file mode 100644 index 00000000..379ecf4b --- /dev/null +++ b/node_modules/path-to-regexp/Readme.md @@ -0,0 +1,257 @@ +# Path-to-RegExp + +> Turn an Express-style path string such as `/user/:name` into a regular expression. + +[![NPM version][npm-image]][npm-url] +[![Build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] +[![Dependency Status][david-image]][david-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +## Installation + +``` +npm install path-to-regexp --save +``` + +## Usage + +```javascript +var pathToRegexp = require('path-to-regexp') + +// pathToRegexp(path, keys, options) +// pathToRegexp.parse(path) +// pathToRegexp.compile(path) +``` + +- **path** An Express-style string, an array of strings, or a regular expression. +- **keys** An array to be populated with the keys found in the path. +- **options** + - **sensitive** When `true` the route will be case sensitive. (default: `false`) + - **strict** When `false` the trailing slash is optional. (default: `false`) + - **end** When `false` the path will match at the beginning. (default: `true`) + - **delimiter** Set the default delimiter for repeat parameters. (default: `'/'`) + +```javascript +var keys = [] +var re = pathToRegexp('/foo/:bar', keys) +// re = /^\/foo\/([^\/]+?)\/?$/i +// keys = [{ name: 'bar', prefix: '/', delimiter: '/', optional: false, repeat: false, pattern: '[^\\/]+?' }] +``` + +**Please note:** The `RegExp` returned by `path-to-regexp` is intended for use with pathnames or hostnames. It can not handle the query strings or fragments of a URL. + +### Parameters + +The path string can be used to define parameters and populate the keys. + +#### Named Parameters + +Named parameters are defined by prefixing a colon to the parameter name (`:foo`). By default, the parameter will match until the following path segment. + +```js +var re = pathToRegexp('/:foo/:bar', keys) +// keys = [{ name: 'foo', prefix: '/', ... }, { name: 'bar', prefix: '/', ... }] + +re.exec('/test/route') +//=> ['/test/route', 'test', 'route'] +``` + +**Please note:** Named parameters must be made up of "word characters" (`[A-Za-z0-9_]`). + +```js +var re = pathToRegexp('/(apple-)?icon-:res(\\d+).png', keys) +// keys = [{ name: 0, prefix: '/', ... }, { name: 'res', prefix: '', ... }] + +re.exec('/icon-76.png') +//=> ['/icon-76.png', undefined, '76'] +``` + +#### Modified Parameters + +##### Optional + +Parameters can be suffixed with a question mark (`?`) to make the parameter optional. This will also make the prefix optional. + +```js +var re = pathToRegexp('/:foo/:bar?', keys) +// keys = [{ name: 'foo', ... }, { name: 'bar', delimiter: '/', optional: true, repeat: false }] + +re.exec('/test') +//=> ['/test', 'test', undefined] + +re.exec('/test/route') +//=> ['/test', 'test', 'route'] +``` + +##### Zero or more + +Parameters can be suffixed with an asterisk (`*`) to denote a zero or more parameter matches. The prefix is taken into account for each match. + +```js +var re = pathToRegexp('/:foo*', keys) +// keys = [{ name: 'foo', delimiter: '/', optional: true, repeat: true }] + +re.exec('/') +//=> ['/', undefined] + +re.exec('/bar/baz') +//=> ['/bar/baz', 'bar/baz'] +``` + +##### One or more + +Parameters can be suffixed with a plus sign (`+`) to denote a one or more parameter matches. The prefix is taken into account for each match. + +```js +var re = pathToRegexp('/:foo+', keys) +// keys = [{ name: 'foo', delimiter: '/', optional: false, repeat: true }] + +re.exec('/') +//=> null + +re.exec('/bar/baz') +//=> ['/bar/baz', 'bar/baz'] +``` + +#### Custom Match Parameters + +All parameters can be provided a custom regexp, which overrides the default (`[^\/]+`). + +```js +var re = pathToRegexp('/:foo(\\d+)', keys) +// keys = [{ name: 'foo', ... }] + +re.exec('/123') +//=> ['/123', '123'] + +re.exec('/abc') +//=> null +``` + +**Please note:** Backslashes need to be escaped with another backslash in strings. + +#### Unnamed Parameters + +It is possible to write an unnamed parameter that only consists of a matching group. It works the same as a named parameter, except it will be numerically indexed. + +```js +var re = pathToRegexp('/:foo/(.*)', keys) +// keys = [{ name: 'foo', ... }, { name: 0, ... }] + +re.exec('/test/route') +//=> ['/test/route', 'test', 'route'] +``` + +#### Asterisk + +An asterisk can be used for matching everything. It is equivalent to an unnamed matching group of `(.*)`. + +```js +var re = pathToRegexp('/foo/*', keys) +// keys = [{ name: '0', ... }] + +re.exec('/foo/bar/baz') +//=> ['/foo/bar/baz', 'bar/baz'] +``` + +### Parse + +The parse function is exposed via `pathToRegexp.parse`. This will return an array of strings and keys. + +```js +var tokens = pathToRegexp.parse('/route/:foo/(.*)') + +console.log(tokens[0]) +//=> "/route" + +console.log(tokens[1]) +//=> { name: 'foo', prefix: '/', delimiter: '/', optional: false, repeat: false, pattern: '[^\\/]+?' } + +console.log(tokens[2]) +//=> { name: 0, prefix: '/', delimiter: '/', optional: false, repeat: false, pattern: '.*' } +``` + +**Note:** This method only works with Express-style strings. + +### Compile ("Reverse" Path-To-RegExp) + +Path-To-RegExp exposes a compile function for transforming an Express-style path into a valid path. + +```js +var toPath = pathToRegexp.compile('/user/:id') + +toPath({ id: 123 }) //=> "/user/123" +toPath({ id: 'café' }) //=> "/user/caf%C3%A9" +toPath({ id: '/' }) //=> "/user/%2F" + +toPath({ id: ':' }) //=> "/user/%3A" +toPath({ id: ':' }, { pretty: true }) //=> "/user/:" + +var toPathRepeated = pathToRegexp.compile('/:segment+') + +toPathRepeated({ segment: 'foo' }) //=> "/foo" +toPathRepeated({ segment: ['a', 'b', 'c'] }) //=> "/a/b/c" + +var toPathRegexp = pathToRegexp.compile('/user/:id(\\d+)') + +toPathRegexp({ id: 123 }) //=> "/user/123" +toPathRegexp({ id: '123' }) //=> "/user/123" +toPathRegexp({ id: 'abc' }) //=> Throws `TypeError`. +``` + +**Note:** The generated function will throw on invalid input. It will do all necessary checks to ensure the generated path is valid. This method only works with strings. + +### Working with Tokens + +Path-To-RegExp exposes the two functions used internally that accept an array of tokens. + +* `pathToRegexp.tokensToRegExp(tokens, options)` Transform an array of tokens into a matching regular expression. +* `pathToRegexp.tokensToFunction(tokens)` Transform an array of tokens into a path generator function. + +#### Token Information + +* `name` The name of the token (`string` for named or `number` for index) +* `prefix` The prefix character for the segment (`/` or `.`) +* `delimiter` The delimiter for the segment (same as prefix or `/`) +* `optional` Indicates the token is optional (`boolean`) +* `repeat` Indicates the token is repeated (`boolean`) +* `partial` Indicates this token is a partial path segment (`boolean`) +* `pattern` The RegExp used to match this token (`string`) +* `asterisk` Indicates the token is an `*` match (`boolean`) + +## Compatibility with Express <= 4.x + +Path-To-RegExp breaks compatibility with Express <= `4.x`: + +* No longer a direct conversion to a RegExp with sugar on top - it's a path matcher with named and unnamed matching groups + * It's unlikely you previously abused this feature, it's rare and you could always use a RegExp instead +* All matching RegExp special characters can be used in a matching group. E.g. `/:user(.*)` + * Other RegExp features are not support - no nested matching groups, non-capturing groups or look aheads +* Parameters have suffixes that augment meaning - `*`, `+` and `?`. E.g. `/:user*` + +## TypeScript + +Includes a [`.d.ts`](index.d.ts) file for TypeScript users. + +## Live Demo + +You can see a live demo of this library in use at [express-route-tester](http://forbeslindesay.github.com/express-route-tester/). + +## License + +MIT + +[npm-image]: https://img.shields.io/npm/v/path-to-regexp.svg?style=flat +[npm-url]: https://npmjs.org/package/path-to-regexp +[travis-image]: https://img.shields.io/travis/pillarjs/path-to-regexp.svg?style=flat +[travis-url]: https://travis-ci.org/pillarjs/path-to-regexp +[coveralls-image]: https://img.shields.io/coveralls/pillarjs/path-to-regexp.svg?style=flat +[coveralls-url]: https://coveralls.io/r/pillarjs/path-to-regexp?branch=master +[david-image]: http://img.shields.io/david/pillarjs/path-to-regexp.svg?style=flat +[david-url]: https://david-dm.org/pillarjs/path-to-regexp +[license-image]: http://img.shields.io/npm/l/path-to-regexp.svg?style=flat +[license-url]: LICENSE.md +[downloads-image]: http://img.shields.io/npm/dm/path-to-regexp.svg?style=flat +[downloads-url]: https://npmjs.org/package/path-to-regexp diff --git a/node_modules/path-to-regexp/index.d.ts b/node_modules/path-to-regexp/index.d.ts new file mode 100644 index 00000000..705da2d0 --- /dev/null +++ b/node_modules/path-to-regexp/index.d.ts @@ -0,0 +1,77 @@ +declare function pathToRegexp (path: pathToRegexp.Path, options?: pathToRegexp.RegExpOptions & pathToRegexp.ParseOptions): pathToRegexp.PathRegExp; +declare function pathToRegexp (path: pathToRegexp.Path, keys?: pathToRegexp.Key[], options?: pathToRegexp.RegExpOptions & pathToRegexp.ParseOptions): pathToRegexp.PathRegExp; + +declare namespace pathToRegexp { + export interface PathRegExp extends RegExp { + // An array to be populated with the keys found in the path. + keys: Key[]; + } + + export interface RegExpOptions { + /** + * When `true` the route will be case sensitive. (default: `false`) + */ + sensitive?: boolean; + /** + * When `false` the trailing slash is optional. (default: `false`) + */ + strict?: boolean; + /** + * When `false` the path will match at the beginning. (default: `true`) + */ + end?: boolean; + /** + * Sets the final character for non-ending optimistic matches. (default: `/`) + */ + delimiter?: string; + } + + export interface ParseOptions { + /** + * Set the default delimiter for repeat parameters. (default: `'/'`) + */ + delimiter?: string; + } + + /** + * Parse an Express-style path into an array of tokens. + */ + export function parse (path: string, options?: ParseOptions): Token[]; + + /** + * Transforming an Express-style path into a valid path. + */ + export function compile (path: string, options?: ParseOptions): PathFunction; + + /** + * Transform an array of tokens into a path generator function. + */ + export function tokensToFunction (tokens: Token[]): PathFunction; + + /** + * Transform an array of tokens into a matching regular expression. + */ + export function tokensToRegExp (tokens: Token[], options?: RegExpOptions): PathRegExp; + export function tokensToRegExp (tokens: Token[], keys?: Key[], options?: RegExpOptions): PathRegExp; + + export interface Key { + name: string | number; + prefix: string; + delimiter: string; + optional: boolean; + repeat: boolean; + pattern: string; + partial: boolean; + asterisk: boolean; + } + + interface PathFunctionOptions { + pretty?: boolean; + } + + export type Token = string | Key; + export type Path = string | RegExp | Array; + export type PathFunction = (data?: Object, options?: PathFunctionOptions) => string; +} + +export = pathToRegexp; diff --git a/node_modules/path-to-regexp/index.js b/node_modules/path-to-regexp/index.js new file mode 100644 index 00000000..63e34163 --- /dev/null +++ b/node_modules/path-to-regexp/index.js @@ -0,0 +1,426 @@ +var isarray = require('isarray') + +/** + * Expose `pathToRegexp`. + */ +module.exports = pathToRegexp +module.exports.parse = parse +module.exports.compile = compile +module.exports.tokensToFunction = tokensToFunction +module.exports.tokensToRegExp = tokensToRegExp + +/** + * The main path matching regexp utility. + * + * @type {RegExp} + */ +var PATH_REGEXP = new RegExp([ + // Match escaped characters that would otherwise appear in future matches. + // This allows the user to escape special characters that won't transform. + '(\\\\.)', + // Match Express-style parameters and un-named parameters with a prefix + // and optional suffixes. Matches appear as: + // + // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined] + // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] + // "/*" => ["/", undefined, undefined, undefined, undefined, "*"] + '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))' +].join('|'), 'g') + +/** + * Parse a string for the raw tokens. + * + * @param {string} str + * @param {Object=} options + * @return {!Array} + */ +function parse (str, options) { + var tokens = [] + var key = 0 + var index = 0 + var path = '' + var defaultDelimiter = options && options.delimiter || '/' + var res + + while ((res = PATH_REGEXP.exec(str)) != null) { + var m = res[0] + var escaped = res[1] + var offset = res.index + path += str.slice(index, offset) + index = offset + m.length + + // Ignore already escaped sequences. + if (escaped) { + path += escaped[1] + continue + } + + var next = str[index] + var prefix = res[2] + var name = res[3] + var capture = res[4] + var group = res[5] + var modifier = res[6] + var asterisk = res[7] + + // Push the current path onto the tokens. + if (path) { + tokens.push(path) + path = '' + } + + var partial = prefix != null && next != null && next !== prefix + var repeat = modifier === '+' || modifier === '*' + var optional = modifier === '?' || modifier === '*' + var delimiter = res[2] || defaultDelimiter + var pattern = capture || group + + tokens.push({ + name: name || key++, + prefix: prefix || '', + delimiter: delimiter, + optional: optional, + repeat: repeat, + partial: partial, + asterisk: !!asterisk, + pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?') + }) + } + + // Match any characters still remaining. + if (index < str.length) { + path += str.substr(index) + } + + // If the path exists, push it onto the end. + if (path) { + tokens.push(path) + } + + return tokens +} + +/** + * Compile a string to a template function for the path. + * + * @param {string} str + * @param {Object=} options + * @return {!function(Object=, Object=)} + */ +function compile (str, options) { + return tokensToFunction(parse(str, options)) +} + +/** + * Prettier encoding of URI path segments. + * + * @param {string} + * @return {string} + */ +function encodeURIComponentPretty (str) { + return encodeURI(str).replace(/[\/?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) +} + +/** + * Encode the asterisk parameter. Similar to `pretty`, but allows slashes. + * + * @param {string} + * @return {string} + */ +function encodeAsterisk (str) { + return encodeURI(str).replace(/[?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) +} + +/** + * Expose a method for transforming tokens into the path function. + */ +function tokensToFunction (tokens) { + // Compile all the tokens into regexps. + var matches = new Array(tokens.length) + + // Compile all the patterns before compilation. + for (var i = 0; i < tokens.length; i++) { + if (typeof tokens[i] === 'object') { + matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$') + } + } + + return function (obj, opts) { + var path = '' + var data = obj || {} + var options = opts || {} + var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent + + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i] + + if (typeof token === 'string') { + path += token + + continue + } + + var value = data[token.name] + var segment + + if (value == null) { + if (token.optional) { + // Prepend partial segment prefixes. + if (token.partial) { + path += token.prefix + } + + continue + } else { + throw new TypeError('Expected "' + token.name + '" to be defined') + } + } + + if (isarray(value)) { + if (!token.repeat) { + throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`') + } + + if (value.length === 0) { + if (token.optional) { + continue + } else { + throw new TypeError('Expected "' + token.name + '" to not be empty') + } + } + + for (var j = 0; j < value.length; j++) { + segment = encode(value[j]) + + if (!matches[i].test(segment)) { + throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`') + } + + path += (j === 0 ? token.prefix : token.delimiter) + segment + } + + continue + } + + segment = token.asterisk ? encodeAsterisk(value) : encode(value) + + if (!matches[i].test(segment)) { + throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"') + } + + path += token.prefix + segment + } + + return path + } +} + +/** + * Escape a regular expression string. + * + * @param {string} str + * @return {string} + */ +function escapeString (str) { + return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1') +} + +/** + * Escape the capturing group by escaping special characters and meaning. + * + * @param {string} group + * @return {string} + */ +function escapeGroup (group) { + return group.replace(/([=!:$\/()])/g, '\\$1') +} + +/** + * Attach the keys as a property of the regexp. + * + * @param {!RegExp} re + * @param {Array} keys + * @return {!RegExp} + */ +function attachKeys (re, keys) { + re.keys = keys + return re +} + +/** + * Get the flags for a regexp from the options. + * + * @param {Object} options + * @return {string} + */ +function flags (options) { + return options.sensitive ? '' : 'i' +} + +/** + * Pull out keys from a regexp. + * + * @param {!RegExp} path + * @param {!Array} keys + * @return {!RegExp} + */ +function regexpToRegexp (path, keys) { + // Use a negative lookahead to match only capturing groups. + var groups = path.source.match(/\((?!\?)/g) + + if (groups) { + for (var i = 0; i < groups.length; i++) { + keys.push({ + name: i, + prefix: null, + delimiter: null, + optional: false, + repeat: false, + partial: false, + asterisk: false, + pattern: null + }) + } + } + + return attachKeys(path, keys) +} + +/** + * Transform an array into a regexp. + * + * @param {!Array} path + * @param {Array} keys + * @param {!Object} options + * @return {!RegExp} + */ +function arrayToRegexp (path, keys, options) { + var parts = [] + + for (var i = 0; i < path.length; i++) { + parts.push(pathToRegexp(path[i], keys, options).source) + } + + var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)) + + return attachKeys(regexp, keys) +} + +/** + * Create a path regexp from string input. + * + * @param {string} path + * @param {!Array} keys + * @param {!Object} options + * @return {!RegExp} + */ +function stringToRegexp (path, keys, options) { + return tokensToRegExp(parse(path, options), keys, options) +} + +/** + * Expose a function for taking tokens and returning a RegExp. + * + * @param {!Array} tokens + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ +function tokensToRegExp (tokens, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */ (keys || options) + keys = [] + } + + options = options || {} + + var strict = options.strict + var end = options.end !== false + var route = '' + + // Iterate over the tokens and create our regexp string. + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i] + + if (typeof token === 'string') { + route += escapeString(token) + } else { + var prefix = escapeString(token.prefix) + var capture = '(?:' + token.pattern + ')' + + keys.push(token) + + if (token.repeat) { + capture += '(?:' + prefix + capture + ')*' + } + + if (token.optional) { + if (!token.partial) { + capture = '(?:' + prefix + '(' + capture + '))?' + } else { + capture = prefix + '(' + capture + ')?' + } + } else { + capture = prefix + '(' + capture + ')' + } + + route += capture + } + } + + var delimiter = escapeString(options.delimiter || '/') + var endsWithDelimiter = route.slice(-delimiter.length) === delimiter + + // In non-strict mode we allow a slash at the end of match. If the path to + // match already ends with a slash, we remove it for consistency. The slash + // is valid at the end of a path match, not in the middle. This is important + // in non-ending mode, where "/test/" shouldn't match "/test//route". + if (!strict) { + route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?' + } + + if (end) { + route += '$' + } else { + // In non-ending mode, we need the capturing groups to match as much as + // possible by using a positive lookahead to the end or next path segment. + route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)' + } + + return attachKeys(new RegExp('^' + route, flags(options)), keys) +} + +/** + * Normalize the given path string, returning a regular expression. + * + * An empty array can be passed in for the keys, which will hold the + * placeholder key descriptions. For example, using `/user/:id`, `keys` will + * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. + * + * @param {(string|RegExp|Array)} path + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ +function pathToRegexp (path, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */ (keys || options) + keys = [] + } + + options = options || {} + + if (path instanceof RegExp) { + return regexpToRegexp(path, /** @type {!Array} */ (keys)) + } + + if (isarray(path)) { + return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options) + } + + return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options) +} diff --git a/node_modules/path-to-regexp/package.json b/node_modules/path-to-regexp/package.json new file mode 100644 index 00000000..f926dfd2 --- /dev/null +++ b/node_modules/path-to-regexp/package.json @@ -0,0 +1,76 @@ +{ + "_from": "path-to-regexp@^1.7.0", + "_id": "path-to-regexp@1.7.0", + "_inBundle": false, + "_integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "_location": "/path-to-regexp", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "path-to-regexp@^1.7.0", + "name": "path-to-regexp", + "escapedName": "path-to-regexp", + "rawSpec": "^1.7.0", + "saveSpec": null, + "fetchSpec": "^1.7.0" + }, + "_requiredBy": [ + "/react-router" + ], + "_resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "_shasum": "59fde0f435badacba103a84e9d3bc64e96b9937d", + "_spec": "path-to-regexp@^1.7.0", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/react-router", + "bugs": { + "url": "https://github.com/pillarjs/path-to-regexp/issues" + }, + "bundleDependencies": false, + "component": { + "scripts": { + "path-to-regexp": "index.js" + } + }, + "dependencies": { + "isarray": "0.0.1" + }, + "deprecated": false, + "description": "Express style path to RegExp utility", + "devDependencies": { + "chai": "^2.3.0", + "istanbul": "~0.3.0", + "mocha": "~2.2.4", + "standard": "~3.7.3", + "ts-node": "^0.5.5", + "typescript": "^1.8.7", + "typings": "^1.0.4" + }, + "files": [ + "index.js", + "index.d.ts", + "LICENSE" + ], + "homepage": "https://github.com/pillarjs/path-to-regexp#readme", + "keywords": [ + "express", + "regexp", + "route", + "routing" + ], + "license": "MIT", + "main": "index.js", + "name": "path-to-regexp", + "repository": { + "type": "git", + "url": "git+https://github.com/pillarjs/path-to-regexp.git" + }, + "scripts": { + "lint": "standard", + "prepublish": "typings install", + "test": "npm run lint && npm run test-cov", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require ts-node/register -R spec test.ts", + "test-spec": "mocha --require ts-node/register -R spec --bail test.ts" + }, + "typings": "index.d.ts", + "version": "1.7.0" +} diff --git a/node_modules/prop-types/CHANGELOG.md b/node_modules/prop-types/CHANGELOG.md new file mode 100644 index 00000000..98b917c9 --- /dev/null +++ b/node_modules/prop-types/CHANGELOG.md @@ -0,0 +1,76 @@ +## 15.6.2 +* Remove the `fbjs` dependency by inlining some helpers from it ([#194](https://github.com/reactjs/prop-types/pull/194))) + +## 15.6.1 +* Fix an issue where outdated BSD license headers were still present in the published bundle [#162](https://github.com/facebook/prop-types/issues/162) + +## 15.6.0 + +* Switch from BSD + Patents to MIT license +* Add PropTypes.exact, like PropTypes.shape but warns on extra object keys. ([@thejameskyle](https://github.com/thejameskyle) and [@aweary](https://github.com/aweary) in [#41](https://github.com/reactjs/prop-types/pull/41) and [#87](https://github.com/reactjs/prop-types/pull/87)) + +## 15.5.10 + +* Fix a false positive warning when using a production UMD build of a third-party library with a DEV version of React. ([@gaearon](https://github.com/gaearon) in [#50](https://github.com/reactjs/prop-types/pull/50)) + +## 15.5.9 + +* Add `loose-envify` Browserify transform for users who don't envify globally. ([@mridgway](https://github.com/mridgway) in [#45](https://github.com/reactjs/prop-types/pull/45)) + +## 15.5.8 + +* Limit the manual PropTypes call warning count because it has false positives with React versions earlier than 15.2.0 in the 15.x branch and 0.14.9 in the 0.14.x branch. ([@gaearon](https://github.com/gaearon) in [#26](https://github.com/reactjs/prop-types/pull/26)) + +## 15.5.7 + +* **Critical Bugfix:** Fix an accidental breaking change that caused errors in production when used through `React.PropTypes`. ([@gaearon](https://github.com/gaearon) in [#20](https://github.com/reactjs/prop-types/pull/20)) +* Improve the size of production UMD build. ([@aweary](https://github.com/aweary) in [38ba18](https://github.com/reactjs/prop-types/commit/38ba18a4a8f705f4b2b33c88204573ddd604f2d6) and [7882a7](https://github.com/reactjs/prop-types/commit/7882a7285293db5f284bcf559b869fd2cd4c44d4)) + +## 15.5.6 + +**Note: this release has a critical issue and was deprecated. Please update to 15.5.7 or higher.** + +* Fix a markdown issue in README. ([@bvaughn](https://github.com/bvaughn) in [174f77](https://github.com/reactjs/prop-types/commit/174f77a50484fa628593e84b871fb40eed78b69a)) + +## 15.5.5 + +**Note: this release has a critical issue and was deprecated. Please update to 15.5.7 or higher.** + +* Add missing documentation and license files. ([@bvaughn](https://github.com/bvaughn) in [0a53d3](https://github.com/reactjs/prop-types/commit/0a53d3a34283ae1e2d3aa396632b6dc2a2061e6a)) + +## 15.5.4 + +**Note: this release has a critical issue and was deprecated. Please update to 15.5.7 or higher.** + +* Reduce the size of the UMD Build. ([@acdlite](https://github.com/acdlite) in [31e9344](https://github.com/reactjs/prop-types/commit/31e9344ca3233159928da66295da17dad82db1a8)) +* Remove bad package url. ([@ljharb](https://github.com/ljharb) in [158198f](https://github.com/reactjs/prop-types/commit/158198fd6c468a3f6f742e0e355e622b3914048a)) +* Remove the accidentally included typechecking code from the production build. + +## 15.5.3 + +**Note: this release has a critical issue and was deprecated. Please update to 15.5.7 or higher.** + +* Remove the accidentally included React package code from the UMD bundle. ([@acdlite](https://github.com/acdlite) in [df318bb](https://github.com/reactjs/prop-types/commit/df318bba8a89bc5aadbb0292822cf4ed71d27ace)) + +## 15.5.2 + +**Note: this release has a critical issue and was deprecated. Please update to 15.5.7 or higher.** + +* Remove dependency on React for CommonJS entry point. ([@acdlite](https://github.com/acdlite) in [cae72bb](https://github.com/reactjs/prop-types/commit/cae72bb281a3766c765e3624f6088c3713567e6d)) + + +## 15.5.1 + +**Note: this release has a critical issue and was deprecated. Please update to 15.5.7 or higher.** + +* Remove accidental uncompiled ES6 syntax in the published package. ([@acdlite](https://github.com/acdlite) in [e191963](https://github.com/facebook/react/commit/e1919638b39dd65eedd250a8bb649773ca61b6f1)) + +## 15.5.0 + +**Note: this release has a critical issue and was deprecated. Please update to 15.5.7 or higher.** + +* Initial release. + +## Before 15.5.0 + +PropTypes was previously included in React, but is now a separate package. For earlier history of PropTypes [see the React change log.](https://github.com/facebook/react/blob/master/CHANGELOG.md) diff --git a/node_modules/prop-types/LICENSE b/node_modules/prop-types/LICENSE new file mode 100644 index 00000000..188fb2b0 --- /dev/null +++ b/node_modules/prop-types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013-present, Facebook, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/prop-types/README.md b/node_modules/prop-types/README.md new file mode 100644 index 00000000..a7bfc80f --- /dev/null +++ b/node_modules/prop-types/README.md @@ -0,0 +1,285 @@ +# prop-types + +Runtime type checking for React props and similar objects. + +You can use prop-types to document the intended types of properties passed to +components. React (and potentially other libraries—see the checkPropTypes() +reference below) will check props passed to your components against those +definitions, and warn in development if they don’t match. + +## Installation + +```shell +npm install --save prop-types +``` + +## Importing + +```js +import PropTypes from 'prop-types'; // ES6 +var PropTypes = require('prop-types'); // ES5 with npm +``` + +### CDN + +If you prefer to exclude `prop-types` from your application and use it +globally via `window.PropTypes`, the `prop-types` package provides +single-file distributions, which are hosted on the following CDNs: + +* [**unpkg**](https://unpkg.com/prop-types/) +```html + + + + + +``` + +* [**cdnjs**](https://cdnjs.com/libraries/prop-types) +```html + + + + + +``` + +To load a specific version of `prop-types` replace `15.6.0` with the version number. + +## Usage + +PropTypes was originally exposed as part of the React core module, and is +commonly used with React components. +Here is an example of using PropTypes with a React component, which also +documents the different validators provided: + +```js +import React from 'react'; +import PropTypes from 'prop-types'; + +class MyComponent extends React.Component { + render() { + // ... do things with the props + } +} + +MyComponent.propTypes = { + // You can declare that a prop is a specific JS primitive. By default, these + // are all optional. + optionalArray: PropTypes.array, + optionalBool: PropTypes.bool, + optionalFunc: PropTypes.func, + optionalNumber: PropTypes.number, + optionalObject: PropTypes.object, + optionalString: PropTypes.string, + optionalSymbol: PropTypes.symbol, + + // Anything that can be rendered: numbers, strings, elements or an array + // (or fragment) containing these types. + optionalNode: PropTypes.node, + + // A React element. + optionalElement: PropTypes.element, + + // You can also declare that a prop is an instance of a class. This uses + // JS's instanceof operator. + optionalMessage: PropTypes.instanceOf(Message), + + // You can ensure that your prop is limited to specific values by treating + // it as an enum. + optionalEnum: PropTypes.oneOf(['News', 'Photos']), + + // An object that could be one of many types + optionalUnion: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, + PropTypes.instanceOf(Message) + ]), + + // An array of a certain type + optionalArrayOf: PropTypes.arrayOf(PropTypes.number), + + // An object with property values of a certain type + optionalObjectOf: PropTypes.objectOf(PropTypes.number), + + // You can chain any of the above with `isRequired` to make sure a warning + // is shown if the prop isn't provided. + + // An object taking on a particular shape + optionalObjectWithShape: PropTypes.shape({ + optionalProperty: PropTypes.string, + requiredProperty: PropTypes.number.isRequired + }), + + // An object with warnings on extra properties + optionalObjectWithStrictShape: PropTypes.exact({ + optionalProperty: PropTypes.string, + requiredProperty: PropTypes.number.isRequired + }), + + requiredFunc: PropTypes.func.isRequired, + + // A value of any data type + requiredAny: PropTypes.any.isRequired, + + // You can also specify a custom validator. It should return an Error + // object if the validation fails. Don't `console.warn` or throw, as this + // won't work inside `oneOfType`. + customProp: function(props, propName, componentName) { + if (!/matchme/.test(props[propName])) { + return new Error( + 'Invalid prop `' + propName + '` supplied to' + + ' `' + componentName + '`. Validation failed.' + ); + } + }, + + // You can also supply a custom validator to `arrayOf` and `objectOf`. + // It should return an Error object if the validation fails. The validator + // will be called for each key in the array or object. The first two + // arguments of the validator are the array or object itself, and the + // current item's key. + customArrayProp: PropTypes.arrayOf(function(propValue, key, componentName, location, propFullName) { + if (!/matchme/.test(propValue[key])) { + return new Error( + 'Invalid prop `' + propFullName + '` supplied to' + + ' `' + componentName + '`. Validation failed.' + ); + } + }) +}; +``` + +Refer to the [React documentation](https://facebook.github.io/react/docs/typechecking-with-proptypes.html) for more information. + +## Migrating from React.PropTypes + +Check out [Migrating from React.PropTypes](https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.proptypes) for details on how to migrate to `prop-types` from `React.PropTypes`. + +Note that this blog posts **mentions a codemod script that performs the conversion automatically**. + +There are also important notes below. + +## How to Depend on This Package? + +For apps, we recommend putting it in `dependencies` with a caret range. +For example: + +```js + "dependencies": { + "prop-types": "^15.5.7" + } +``` + +For libraries, we *also* recommend leaving it in `dependencies`: + +```js + "dependencies": { + "prop-types": "^15.5.7" + }, + "peerDependencies": { + "react": "^15.5.0" + } +``` + +**Note:** there are known issues in versions before 15.5.7 so we recommend using it as the minimal version. + +Make sure that the version range uses a caret (`^`) and thus is broad enough for npm to efficiently deduplicate packages. + +For UMD bundles of your components, make sure you **don’t** include `PropTypes` in the build. Usually this is done by marking it as an external (the specifics depend on your bundler), just like you do with React. + +## Compatibility + +### React 0.14 + +This package is compatible with **React 0.14.9**. Compared to 0.14.8 (which was released a year ago), there are no other changes in 0.14.9, so it should be a painless upgrade. + +```shell +# ATTENTION: Only run this if you still use React 0.14! +npm install --save react@^0.14.9 react-dom@^0.14.9 +``` + +### React 15+ + +This package is compatible with **React 15.3.0** and higher. + +``` +npm install --save react@^15.3.0 react-dom@^15.3.0 +``` + +### What happens on other React versions? + +It outputs warnings with the message below even though the developer doesn’t do anything wrong. Unfortunately there is no solution for this other than updating React to either 15.3.0 or higher, or 0.14.9 if you’re using React 0.14. + +## Difference from `React.PropTypes`: Don’t Call Validator Functions + +First of all, **which version of React are you using**? You might be seeing this message because a component library has updated to use `prop-types` package, but your version of React is incompatible with it. See the [above section](#compatibility) for more details. + +Are you using either React 0.14.9 or a version higher than React 15.3.0? Read on. + +When you migrate components to use the standalone `prop-types`, **all validator functions will start throwing an error if you call them directly**. This makes sure that nobody relies on them in production code, and it is safe to strip their implementations to optimize the bundle size. + +Code like this is still fine: + +```js +MyComponent.propTypes = { + myProp: PropTypes.bool +}; +``` + +However, code like this will not work with the `prop-types` package: + +```js +// Will not work with `prop-types` package! +var errorOrNull = PropTypes.bool(42, 'myProp', 'MyComponent', 'prop'); +``` + +It will throw an error: + +``` +Calling PropTypes validators directly is not supported by the `prop-types` package. +Use PropTypes.checkPropTypes() to call them. +``` + +(If you see **a warning** rather than an error with this message, please check the [above section about compatibility](#compatibility).) + +This is new behavior, and you will only encounter it when you migrate from `React.PropTypes` to the `prop-types` package. For the vast majority of components, this doesn’t matter, and if you didn’t see [this warning](https://facebook.github.io/react/warnings/dont-call-proptypes.html) in your components, your code is safe to migrate. This is not a breaking change in React because you are only opting into this change for a component by explicitly changing your imports to use `prop-types`. If you temporarily need the old behavior, you can keep using `React.PropTypes` until React 16. + +**If you absolutely need to trigger the validation manually**, call `PropTypes.checkPropTypes()`. Unlike the validators themselves, this function is safe to call in production, as it will be replaced by an empty function: + +```js +// Works with standalone PropTypes +PropTypes.checkPropTypes(MyComponent.propTypes, props, 'prop', 'MyComponent'); +``` +See below for more info. + +**You might also see this error** if you’re calling a `PropTypes` validator from your own custom `PropTypes` validator. In this case, the fix is to make sure that you are passing *all* of the arguments to the inner function. There is a more in-depth explanation of how to fix it [on this page](https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes). Alternatively, you can temporarily keep using `React.PropTypes` until React 16, as it would still only warn in this case. + +If you use a bundler like Browserify or Webpack, don’t forget to [follow these instructions](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) to correctly bundle your application in development or production mode. Otherwise you’ll ship unnecessary code to your users. + +## PropTypes.checkPropTypes + +React will automatically check the propTypes you set on the component, but if +you are using PropTypes without React then you may want to manually call +`PropTypes.checkPropTypes`, like so: + +```js +const myPropTypes = { + name: PropTypes.string, + age: PropTypes.number, + // ... define your prop validations +}; + +const props = { + name: 'hello', // is valid + age: 'world', // not valid +}; + +// Let's say your component is called 'MyComponent' + +// Works with standalone PropTypes +PropTypes.checkPropTypes(myPropTypes, props, 'prop', 'MyComponent'); +// This will warn as follows: +// Warning: Failed prop type: Invalid prop `age` of type `string` supplied to +// `MyComponent`, expected `number`. +``` diff --git a/node_modules/prop-types/checkPropTypes.js b/node_modules/prop-types/checkPropTypes.js new file mode 100644 index 00000000..05403dcb --- /dev/null +++ b/node_modules/prop-types/checkPropTypes.js @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var printWarning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); + var loggedTypeFailures = {}; + + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; +} + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ +function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if (process.env.NODE_ENV !== 'production') { + for (var typeSpecName in typeSpecs) { + if (typeSpecs.hasOwnProperty(typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + var err = Error( + (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + ); + err.name = 'Invariant Violation'; + throw err; + } + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + if (error && !(error instanceof Error)) { + printWarning( + (componentName || 'React class') + ': type specification of ' + + location + ' `' + typeSpecName + '` is invalid; the type checker ' + + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + + 'You may have forgotten to pass an argument to the type checker ' + + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + + 'shape all require an argument).' + ) + + } + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var stack = getStack ? getStack() : ''; + + printWarning( + 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') + ); + } + } + } + } +} + +module.exports = checkPropTypes; diff --git a/node_modules/prop-types/factory.js b/node_modules/prop-types/factory.js new file mode 100644 index 00000000..abdf8e6d --- /dev/null +++ b/node_modules/prop-types/factory.js @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +// React 15.5 references this module, and assumes PropTypes are still callable in production. +// Therefore we re-export development-only version with all the PropTypes checks here. +// However if one is migrating to the `prop-types` npm library, they will go through the +// `index.js` entry point, and it will branch depending on the environment. +var factory = require('./factoryWithTypeCheckers'); +module.exports = function(isValidElement) { + // It is still allowed in 15.5. + var throwOnDirectAccess = false; + return factory(isValidElement, throwOnDirectAccess); +}; diff --git a/node_modules/prop-types/factoryWithThrowingShims.js b/node_modules/prop-types/factoryWithThrowingShims.js new file mode 100644 index 00000000..79b60f24 --- /dev/null +++ b/node_modules/prop-types/factoryWithThrowingShims.js @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); + +function emptyFunction() {} + +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + + any: shim, + arrayOf: getShim, + element: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim + }; + + ReactPropTypes.checkPropTypes = emptyFunction; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; diff --git a/node_modules/prop-types/factoryWithTypeCheckers.js b/node_modules/prop-types/factoryWithTypeCheckers.js new file mode 100644 index 00000000..c41e3bb4 --- /dev/null +++ b/node_modules/prop-types/factoryWithTypeCheckers.js @@ -0,0 +1,555 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var assign = require('object-assign'); + +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); +var checkPropTypes = require('./checkPropTypes'); + +var printWarning = function() {}; + +if (process.env.NODE_ENV !== 'production') { + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; +} + +function emptyFunctionThatReturnsNull() { + return null; +} + +module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } + + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message) { + this.message = message; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + if (process.env.NODE_ENV !== 'production') { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + printWarning( + 'You are manually calling a React.PropTypes validation ' + + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunctionThatReturnsNull); + } + + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (propValue.hasOwnProperty(key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { + return null; + } + } + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (!checker) { + continue; + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from + // props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; diff --git a/node_modules/prop-types/index.js b/node_modules/prop-types/index.js new file mode 100644 index 00000000..11bfceab --- /dev/null +++ b/node_modules/prop-types/index.js @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if (process.env.NODE_ENV !== 'production') { + var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && + Symbol.for && + Symbol.for('react.element')) || + 0xeac7; + + var isValidElement = function(object) { + return typeof object === 'object' && + object !== null && + object.$$typeof === REACT_ELEMENT_TYPE; + }; + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess); +} else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = require('./factoryWithThrowingShims')(); +} diff --git a/node_modules/prop-types/lib/ReactPropTypesSecret.js b/node_modules/prop-types/lib/ReactPropTypesSecret.js new file mode 100644 index 00000000..f54525e7 --- /dev/null +++ b/node_modules/prop-types/lib/ReactPropTypesSecret.js @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; diff --git a/node_modules/prop-types/package.json b/node_modules/prop-types/package.json new file mode 100644 index 00000000..d1a49126 --- /dev/null +++ b/node_modules/prop-types/package.json @@ -0,0 +1,83 @@ +{ + "_from": "prop-types@^15.6.1", + "_id": "prop-types@15.6.2", + "_inBundle": false, + "_integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==", + "_location": "/prop-types", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "prop-types@^15.6.1", + "name": "prop-types", + "escapedName": "prop-types", + "rawSpec": "^15.6.1", + "saveSpec": null, + "fetchSpec": "^15.6.1" + }, + "_requiredBy": [ + "/react-router", + "/react-router-dom" + ], + "_resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz", + "_shasum": "05d5ca77b4453e985d60fc7ff8c859094a497102", + "_spec": "prop-types@^15.6.1", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/react-router-dom", + "browserify": { + "transform": [ + "loose-envify" + ] + }, + "bugs": { + "url": "https://github.com/facebook/prop-types/issues" + }, + "bundleDependencies": false, + "dependencies": { + "loose-envify": "^1.3.1", + "object-assign": "^4.1.1" + }, + "deprecated": false, + "description": "Runtime type checking for React props and similar objects.", + "devDependencies": { + "babel-jest": "^19.0.0", + "babel-preset-react": "^6.24.1", + "browserify": "^14.3.0", + "bundle-collapser": "^1.2.1", + "envify": "^4.0.0", + "jest": "^19.0.2", + "react": "^15.5.1", + "uglifyify": "^3.0.4", + "uglifyjs": "^2.4.10" + }, + "files": [ + "LICENSE", + "README.md", + "checkPropTypes.js", + "factory.js", + "factoryWithThrowingShims.js", + "factoryWithTypeCheckers.js", + "index.js", + "prop-types.js", + "prop-types.min.js", + "lib" + ], + "homepage": "https://facebook.github.io/react/", + "keywords": [ + "react" + ], + "license": "MIT", + "main": "index.js", + "name": "prop-types", + "repository": { + "type": "git", + "url": "git+https://github.com/facebook/prop-types.git" + }, + "scripts": { + "build": "yarn umd && yarn umd-min", + "prepublish": "yarn build", + "test": "jest", + "umd": "NODE_ENV=development browserify index.js -t envify --standalone PropTypes -o prop-types.js", + "umd-min": "NODE_ENV=production browserify index.js -t envify -t uglifyify --standalone PropTypes -p bundle-collapser/plugin -o | uglifyjs --compress unused,dead_code -o prop-types.min.js" + }, + "version": "15.6.2" +} diff --git a/node_modules/prop-types/prop-types.js b/node_modules/prop-types/prop-types.js new file mode 100644 index 00000000..c779692b --- /dev/null +++ b/node_modules/prop-types/prop-types.js @@ -0,0 +1,849 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PropTypes = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o that uses HTML5 history. + */ +var BrowserRouter = function (_React$Component) { + _inherits(BrowserRouter, _React$Component); + + function BrowserRouter() { + var _temp, _this, _ret; + + _classCallCheck(this, BrowserRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = (0, _history.createBrowserHistory)(_this.props), _temp), _possibleConstructorReturn(_this, _ret); + } + + BrowserRouter.prototype.componentWillMount = function componentWillMount() { + (0, _warning2.default)(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { BrowserRouter as Router }`."); + }; + + BrowserRouter.prototype.render = function render() { + return _react2.default.createElement(_Router2.default, { history: this.history, children: this.props.children }); + }; + + return BrowserRouter; +}(_react2.default.Component); + +BrowserRouter.propTypes = { + basename: _propTypes2.default.string, + forceRefresh: _propTypes2.default.bool, + getUserConfirmation: _propTypes2.default.func, + keyLength: _propTypes2.default.number, + children: _propTypes2.default.node +}; +exports.default = BrowserRouter; \ No newline at end of file diff --git a/node_modules/react-router-dom/HashRouter.js b/node_modules/react-router-dom/HashRouter.js new file mode 100644 index 00000000..27795ffd --- /dev/null +++ b/node_modules/react-router-dom/HashRouter.js @@ -0,0 +1,66 @@ +"use strict"; + +exports.__esModule = true; + +var _warning = require("warning"); + +var _warning2 = _interopRequireDefault(_warning); + +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _history = require("history"); + +var _Router = require("./Router"); + +var _Router2 = _interopRequireDefault(_Router); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +/** + * The public API for a that uses window.location.hash. + */ +var HashRouter = function (_React$Component) { + _inherits(HashRouter, _React$Component); + + function HashRouter() { + var _temp, _this, _ret; + + _classCallCheck(this, HashRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = (0, _history.createHashHistory)(_this.props), _temp), _possibleConstructorReturn(_this, _ret); + } + + HashRouter.prototype.componentWillMount = function componentWillMount() { + (0, _warning2.default)(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { HashRouter as Router }`."); + }; + + HashRouter.prototype.render = function render() { + return _react2.default.createElement(_Router2.default, { history: this.history, children: this.props.children }); + }; + + return HashRouter; +}(_react2.default.Component); + +HashRouter.propTypes = { + basename: _propTypes2.default.string, + getUserConfirmation: _propTypes2.default.func, + hashType: _propTypes2.default.oneOf(["hashbang", "noslash", "slash"]), + children: _propTypes2.default.node +}; +exports.default = HashRouter; \ No newline at end of file diff --git a/node_modules/react-router-dom/Link.js b/node_modules/react-router-dom/Link.js new file mode 100644 index 00000000..263143fe --- /dev/null +++ b/node_modules/react-router-dom/Link.js @@ -0,0 +1,117 @@ +"use strict"; + +exports.__esModule = true; + +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; }; + +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _invariant = require("invariant"); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _history = require("history"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var isModifiedEvent = function isModifiedEvent(event) { + return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); +}; + +/** + * The public API for rendering a history-aware
. + */ + +var Link = function (_React$Component) { + _inherits(Link, _React$Component); + + function Link() { + var _temp, _this, _ret; + + _classCallCheck(this, Link); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function (event) { + if (_this.props.onClick) _this.props.onClick(event); + + if (!event.defaultPrevented && // onClick prevented default + event.button === 0 && // ignore everything but left clicks + !_this.props.target && // let browser handle "target=_blank" etc. + !isModifiedEvent(event) // ignore clicks with modifier keys + ) { + event.preventDefault(); + + var history = _this.context.router.history; + var _this$props = _this.props, + replace = _this$props.replace, + to = _this$props.to; + + + if (replace) { + history.replace(to); + } else { + history.push(to); + } + } + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + Link.prototype.render = function render() { + var _props = this.props, + replace = _props.replace, + to = _props.to, + innerRef = _props.innerRef, + props = _objectWithoutProperties(_props, ["replace", "to", "innerRef"]); // eslint-disable-line no-unused-vars + + (0, _invariant2.default)(this.context.router, "You should not use outside a "); + + (0, _invariant2.default)(to !== undefined, 'You must specify the "to" property'); + + var history = this.context.router.history; + + var location = typeof to === "string" ? (0, _history.createLocation)(to, null, null, history.location) : to; + + var href = history.createHref(location); + return _react2.default.createElement("a", _extends({}, props, { onClick: this.handleClick, href: href, ref: innerRef })); + }; + + return Link; +}(_react2.default.Component); + +Link.propTypes = { + onClick: _propTypes2.default.func, + target: _propTypes2.default.string, + replace: _propTypes2.default.bool, + to: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]).isRequired, + innerRef: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]) +}; +Link.defaultProps = { + replace: false +}; +Link.contextTypes = { + router: _propTypes2.default.shape({ + history: _propTypes2.default.shape({ + push: _propTypes2.default.func.isRequired, + replace: _propTypes2.default.func.isRequired, + createHref: _propTypes2.default.func.isRequired + }).isRequired + }).isRequired +}; +exports.default = Link; \ No newline at end of file diff --git a/node_modules/react-router-dom/MemoryRouter.js b/node_modules/react-router-dom/MemoryRouter.js new file mode 100644 index 00000000..2e4fb69b --- /dev/null +++ b/node_modules/react-router-dom/MemoryRouter.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.__esModule = true; + +var _MemoryRouter = require("react-router/MemoryRouter"); + +var _MemoryRouter2 = _interopRequireDefault(_MemoryRouter); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _MemoryRouter2.default; // Written in this round about way for babel-transform-imports \ No newline at end of file diff --git a/node_modules/react-router-dom/NavLink.js b/node_modules/react-router-dom/NavLink.js new file mode 100644 index 00000000..b440e9b8 --- /dev/null +++ b/node_modules/react-router-dom/NavLink.js @@ -0,0 +1,91 @@ +"use strict"; + +exports.__esModule = true; + +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; }; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _Route = require("./Route"); + +var _Route2 = _interopRequireDefault(_Route); + +var _Link = require("./Link"); + +var _Link2 = _interopRequireDefault(_Link); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +/** + * A wrapper that knows if it's "active" or not. + */ +var NavLink = function NavLink(_ref) { + var to = _ref.to, + exact = _ref.exact, + strict = _ref.strict, + location = _ref.location, + activeClassName = _ref.activeClassName, + className = _ref.className, + activeStyle = _ref.activeStyle, + style = _ref.style, + getIsActive = _ref.isActive, + ariaCurrent = _ref["aria-current"], + rest = _objectWithoutProperties(_ref, ["to", "exact", "strict", "location", "activeClassName", "className", "activeStyle", "style", "isActive", "aria-current"]); + + var path = (typeof to === "undefined" ? "undefined" : _typeof(to)) === "object" ? to.pathname : to; + + // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202 + var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1"); + + return _react2.default.createElement(_Route2.default, { + path: escapedPath, + exact: exact, + strict: strict, + location: location, + children: function children(_ref2) { + var location = _ref2.location, + match = _ref2.match; + + var isActive = !!(getIsActive ? getIsActive(match, location) : match); + + return _react2.default.createElement(_Link2.default, _extends({ + to: to, + className: isActive ? [className, activeClassName].filter(function (i) { + return i; + }).join(" ") : className, + style: isActive ? _extends({}, style, activeStyle) : style, + "aria-current": isActive && ariaCurrent || null + }, rest)); + } + }); +}; + +NavLink.propTypes = { + to: _Link2.default.propTypes.to, + exact: _propTypes2.default.bool, + strict: _propTypes2.default.bool, + location: _propTypes2.default.object, + activeClassName: _propTypes2.default.string, + className: _propTypes2.default.string, + activeStyle: _propTypes2.default.object, + style: _propTypes2.default.object, + isActive: _propTypes2.default.func, + "aria-current": _propTypes2.default.oneOf(["page", "step", "location", "date", "time", "true"]) +}; + +NavLink.defaultProps = { + activeClassName: "active", + "aria-current": "page" +}; + +exports.default = NavLink; \ No newline at end of file diff --git a/node_modules/react-router-dom/Prompt.js b/node_modules/react-router-dom/Prompt.js new file mode 100644 index 00000000..28482e77 --- /dev/null +++ b/node_modules/react-router-dom/Prompt.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.__esModule = true; + +var _Prompt = require("react-router/Prompt"); + +var _Prompt2 = _interopRequireDefault(_Prompt); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _Prompt2.default; // Written in this round about way for babel-transform-imports \ No newline at end of file diff --git a/node_modules/react-router-dom/README.md b/node_modules/react-router-dom/README.md new file mode 100644 index 00000000..c79afb81 --- /dev/null +++ b/node_modules/react-router-dom/README.md @@ -0,0 +1,37 @@ +# react-router-dom + +DOM bindings for [React Router](https://reacttraining.com/react-router). + +## Installation + +Using [npm](https://www.npmjs.com/): + + $ npm install --save react-router-dom + +Then with a module bundler like [webpack](https://webpack.github.io/), use as you would anything else: + +```js +// using ES6 modules +import { BrowserRouter, Route, Link } from 'react-router-dom' + +// using CommonJS modules +const BrowserRouter = require('react-router-dom').BrowserRouter +const Route = require('react-router-dom').Route +const Link = require('react-router-dom').Link +``` + +The UMD build is also available on [unpkg](https://unpkg.com): + +```html + +``` + +You can find the library on `window.ReactRouterDOM`. + +## Issues + +If you find a bug, please file an issue on [our issue tracker on GitHub](https://github.com/ReactTraining/react-router/issues). + +## Credits + +React Router is built and maintained by [React Training](https://reacttraining.com). diff --git a/node_modules/react-router-dom/Redirect.js b/node_modules/react-router-dom/Redirect.js new file mode 100644 index 00000000..29fcf36e --- /dev/null +++ b/node_modules/react-router-dom/Redirect.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.__esModule = true; + +var _Redirect = require("react-router/Redirect"); + +var _Redirect2 = _interopRequireDefault(_Redirect); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _Redirect2.default; // Written in this round about way for babel-transform-imports \ No newline at end of file diff --git a/node_modules/react-router-dom/Route.js b/node_modules/react-router-dom/Route.js new file mode 100644 index 00000000..6b0080a1 --- /dev/null +++ b/node_modules/react-router-dom/Route.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.__esModule = true; + +var _Route = require("react-router/Route"); + +var _Route2 = _interopRequireDefault(_Route); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _Route2.default; // Written in this round about way for babel-transform-imports \ No newline at end of file diff --git a/node_modules/react-router-dom/Router.js b/node_modules/react-router-dom/Router.js new file mode 100644 index 00000000..1a224f09 --- /dev/null +++ b/node_modules/react-router-dom/Router.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.__esModule = true; + +var _Router = require("react-router/Router"); + +var _Router2 = _interopRequireDefault(_Router); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _Router2.default; // Written in this round about way for babel-transform-imports \ No newline at end of file diff --git a/node_modules/react-router-dom/StaticRouter.js b/node_modules/react-router-dom/StaticRouter.js new file mode 100644 index 00000000..a52d5561 --- /dev/null +++ b/node_modules/react-router-dom/StaticRouter.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.__esModule = true; + +var _StaticRouter = require("react-router/StaticRouter"); + +var _StaticRouter2 = _interopRequireDefault(_StaticRouter); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _StaticRouter2.default; // Written in this round about way for babel-transform-imports \ No newline at end of file diff --git a/node_modules/react-router-dom/Switch.js b/node_modules/react-router-dom/Switch.js new file mode 100644 index 00000000..f7e5a782 --- /dev/null +++ b/node_modules/react-router-dom/Switch.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.__esModule = true; + +var _Switch = require("react-router/Switch"); + +var _Switch2 = _interopRequireDefault(_Switch); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _Switch2.default; // Written in this round about way for babel-transform-imports \ No newline at end of file diff --git a/node_modules/react-router-dom/es/BrowserRouter.js b/node_modules/react-router-dom/es/BrowserRouter.js new file mode 100644 index 00000000..c156cd0c --- /dev/null +++ b/node_modules/react-router-dom/es/BrowserRouter.js @@ -0,0 +1,52 @@ +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +import warning from "warning"; +import React from "react"; +import PropTypes from "prop-types"; +import { createBrowserHistory as createHistory } from "history"; +import Router from "./Router"; + +/** + * The public API for a that uses HTML5 history. + */ + +var BrowserRouter = function (_React$Component) { + _inherits(BrowserRouter, _React$Component); + + function BrowserRouter() { + var _temp, _this, _ret; + + _classCallCheck(this, BrowserRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = createHistory(_this.props), _temp), _possibleConstructorReturn(_this, _ret); + } + + BrowserRouter.prototype.componentWillMount = function componentWillMount() { + warning(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { BrowserRouter as Router }`."); + }; + + BrowserRouter.prototype.render = function render() { + return React.createElement(Router, { history: this.history, children: this.props.children }); + }; + + return BrowserRouter; +}(React.Component); + +BrowserRouter.propTypes = { + basename: PropTypes.string, + forceRefresh: PropTypes.bool, + getUserConfirmation: PropTypes.func, + keyLength: PropTypes.number, + children: PropTypes.node +}; + + +export default BrowserRouter; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/HashRouter.js b/node_modules/react-router-dom/es/HashRouter.js new file mode 100644 index 00000000..fcfbcd03 --- /dev/null +++ b/node_modules/react-router-dom/es/HashRouter.js @@ -0,0 +1,51 @@ +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +import warning from "warning"; +import React from "react"; +import PropTypes from "prop-types"; +import { createHashHistory as createHistory } from "history"; +import Router from "./Router"; + +/** + * The public API for a that uses window.location.hash. + */ + +var HashRouter = function (_React$Component) { + _inherits(HashRouter, _React$Component); + + function HashRouter() { + var _temp, _this, _ret; + + _classCallCheck(this, HashRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = createHistory(_this.props), _temp), _possibleConstructorReturn(_this, _ret); + } + + HashRouter.prototype.componentWillMount = function componentWillMount() { + warning(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { HashRouter as Router }`."); + }; + + HashRouter.prototype.render = function render() { + return React.createElement(Router, { history: this.history, children: this.props.children }); + }; + + return HashRouter; +}(React.Component); + +HashRouter.propTypes = { + basename: PropTypes.string, + getUserConfirmation: PropTypes.func, + hashType: PropTypes.oneOf(["hashbang", "noslash", "slash"]), + children: PropTypes.node +}; + + +export default HashRouter; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/Link.js b/node_modules/react-router-dom/es/Link.js new file mode 100644 index 00000000..a215e57d --- /dev/null +++ b/node_modules/react-router-dom/es/Link.js @@ -0,0 +1,104 @@ +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 _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +import React from "react"; +import PropTypes from "prop-types"; +import invariant from "invariant"; +import { createLocation } from "history"; + +var isModifiedEvent = function isModifiedEvent(event) { + return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); +}; + +/** + * The public API for rendering a history-aware . + */ + +var Link = function (_React$Component) { + _inherits(Link, _React$Component); + + function Link() { + var _temp, _this, _ret; + + _classCallCheck(this, Link); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function (event) { + if (_this.props.onClick) _this.props.onClick(event); + + if (!event.defaultPrevented && // onClick prevented default + event.button === 0 && // ignore everything but left clicks + !_this.props.target && // let browser handle "target=_blank" etc. + !isModifiedEvent(event) // ignore clicks with modifier keys + ) { + event.preventDefault(); + + var history = _this.context.router.history; + var _this$props = _this.props, + replace = _this$props.replace, + to = _this$props.to; + + + if (replace) { + history.replace(to); + } else { + history.push(to); + } + } + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + Link.prototype.render = function render() { + var _props = this.props, + replace = _props.replace, + to = _props.to, + innerRef = _props.innerRef, + props = _objectWithoutProperties(_props, ["replace", "to", "innerRef"]); // eslint-disable-line no-unused-vars + + invariant(this.context.router, "You should not use outside a "); + + invariant(to !== undefined, 'You must specify the "to" property'); + + var history = this.context.router.history; + + var location = typeof to === "string" ? createLocation(to, null, null, history.location) : to; + + var href = history.createHref(location); + return React.createElement("a", _extends({}, props, { onClick: this.handleClick, href: href, ref: innerRef })); + }; + + return Link; +}(React.Component); + +Link.propTypes = { + onClick: PropTypes.func, + target: PropTypes.string, + replace: PropTypes.bool, + to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired, + innerRef: PropTypes.oneOfType([PropTypes.string, PropTypes.func]) +}; +Link.defaultProps = { + replace: false +}; +Link.contextTypes = { + router: PropTypes.shape({ + history: PropTypes.shape({ + push: PropTypes.func.isRequired, + replace: PropTypes.func.isRequired, + createHref: PropTypes.func.isRequired + }).isRequired + }).isRequired +}; + + +export default Link; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/MemoryRouter.js b/node_modules/react-router-dom/es/MemoryRouter.js new file mode 100644 index 00000000..50f9aa2b --- /dev/null +++ b/node_modules/react-router-dom/es/MemoryRouter.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import MemoryRouter from "react-router/es/MemoryRouter"; + +export default MemoryRouter; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/NavLink.js b/node_modules/react-router-dom/es/NavLink.js new file mode 100644 index 00000000..367caf2b --- /dev/null +++ b/node_modules/react-router-dom/es/NavLink.js @@ -0,0 +1,74 @@ +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; }; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +import React from "react"; +import PropTypes from "prop-types"; +import Route from "./Route"; +import Link from "./Link"; + +/** + * A wrapper that knows if it's "active" or not. + */ +var NavLink = function NavLink(_ref) { + var to = _ref.to, + exact = _ref.exact, + strict = _ref.strict, + location = _ref.location, + activeClassName = _ref.activeClassName, + className = _ref.className, + activeStyle = _ref.activeStyle, + style = _ref.style, + getIsActive = _ref.isActive, + ariaCurrent = _ref["aria-current"], + rest = _objectWithoutProperties(_ref, ["to", "exact", "strict", "location", "activeClassName", "className", "activeStyle", "style", "isActive", "aria-current"]); + + var path = (typeof to === "undefined" ? "undefined" : _typeof(to)) === "object" ? to.pathname : to; + + // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202 + var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1"); + + return React.createElement(Route, { + path: escapedPath, + exact: exact, + strict: strict, + location: location, + children: function children(_ref2) { + var location = _ref2.location, + match = _ref2.match; + + var isActive = !!(getIsActive ? getIsActive(match, location) : match); + + return React.createElement(Link, _extends({ + to: to, + className: isActive ? [className, activeClassName].filter(function (i) { + return i; + }).join(" ") : className, + style: isActive ? _extends({}, style, activeStyle) : style, + "aria-current": isActive && ariaCurrent || null + }, rest)); + } + }); +}; + +NavLink.propTypes = { + to: Link.propTypes.to, + exact: PropTypes.bool, + strict: PropTypes.bool, + location: PropTypes.object, + activeClassName: PropTypes.string, + className: PropTypes.string, + activeStyle: PropTypes.object, + style: PropTypes.object, + isActive: PropTypes.func, + "aria-current": PropTypes.oneOf(["page", "step", "location", "date", "time", "true"]) +}; + +NavLink.defaultProps = { + activeClassName: "active", + "aria-current": "page" +}; + +export default NavLink; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/Prompt.js b/node_modules/react-router-dom/es/Prompt.js new file mode 100644 index 00000000..f4d8a518 --- /dev/null +++ b/node_modules/react-router-dom/es/Prompt.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import Prompt from "react-router/es/Prompt"; + +export default Prompt; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/Redirect.js b/node_modules/react-router-dom/es/Redirect.js new file mode 100644 index 00000000..0e1e4d49 --- /dev/null +++ b/node_modules/react-router-dom/es/Redirect.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import Redirect from "react-router/es/Redirect"; + +export default Redirect; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/Route.js b/node_modules/react-router-dom/es/Route.js new file mode 100644 index 00000000..454a2ecd --- /dev/null +++ b/node_modules/react-router-dom/es/Route.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import Route from "react-router/es/Route"; + +export default Route; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/Router.js b/node_modules/react-router-dom/es/Router.js new file mode 100644 index 00000000..78c8b3cf --- /dev/null +++ b/node_modules/react-router-dom/es/Router.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import Router from "react-router/es/Router"; + +export default Router; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/RouterContext.js b/node_modules/react-router-dom/es/RouterContext.js new file mode 100644 index 00000000..2165fb02 --- /dev/null +++ b/node_modules/react-router-dom/es/RouterContext.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import RouterContext from "react-router/es/RouterContext"; + +export default RouterContext; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/StaticRouter.js b/node_modules/react-router-dom/es/StaticRouter.js new file mode 100644 index 00000000..9cadf981 --- /dev/null +++ b/node_modules/react-router-dom/es/StaticRouter.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import StaticRouter from "react-router/es/StaticRouter"; + +export default StaticRouter; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/Switch.js b/node_modules/react-router-dom/es/Switch.js new file mode 100644 index 00000000..83f1fd91 --- /dev/null +++ b/node_modules/react-router-dom/es/Switch.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import Switch from "react-router/es/Switch"; + +export default Switch; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/generatePath.js b/node_modules/react-router-dom/es/generatePath.js new file mode 100644 index 00000000..71bce4e1 --- /dev/null +++ b/node_modules/react-router-dom/es/generatePath.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import generatePath from "react-router/es/generatePath"; + +export default generatePath; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/index.js b/node_modules/react-router-dom/es/index.js new file mode 100644 index 00000000..b90f4488 --- /dev/null +++ b/node_modules/react-router-dom/es/index.js @@ -0,0 +1,28 @@ +import _BrowserRouter from "./BrowserRouter"; +export { _BrowserRouter as BrowserRouter }; +import _HashRouter from "./HashRouter"; +export { _HashRouter as HashRouter }; +import _Link from "./Link"; +export { _Link as Link }; +import _MemoryRouter from "./MemoryRouter"; +export { _MemoryRouter as MemoryRouter }; +import _NavLink from "./NavLink"; +export { _NavLink as NavLink }; +import _Prompt from "./Prompt"; +export { _Prompt as Prompt }; +import _Redirect from "./Redirect"; +export { _Redirect as Redirect }; +import _Route from "./Route"; +export { _Route as Route }; +import _Router from "./Router"; +export { _Router as Router }; +import _StaticRouter from "./StaticRouter"; +export { _StaticRouter as StaticRouter }; +import _Switch from "./Switch"; +export { _Switch as Switch }; +import _generatePath from "./generatePath"; +export { _generatePath as generatePath }; +import _matchPath from "./matchPath"; +export { _matchPath as matchPath }; +import _withRouter from "./withRouter"; +export { _withRouter as withRouter }; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/matchPath.js b/node_modules/react-router-dom/es/matchPath.js new file mode 100644 index 00000000..d7eb53ce --- /dev/null +++ b/node_modules/react-router-dom/es/matchPath.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import matchPath from "react-router/es/matchPath"; + +export default matchPath; \ No newline at end of file diff --git a/node_modules/react-router-dom/es/withRouter.js b/node_modules/react-router-dom/es/withRouter.js new file mode 100644 index 00000000..7cb62ff3 --- /dev/null +++ b/node_modules/react-router-dom/es/withRouter.js @@ -0,0 +1,4 @@ +// Written in this round about way for babel-transform-imports +import withRouter from "react-router/es/withRouter"; + +export default withRouter; \ No newline at end of file diff --git a/node_modules/react-router-dom/generatePath.js b/node_modules/react-router-dom/generatePath.js new file mode 100644 index 00000000..b75ac8f6 --- /dev/null +++ b/node_modules/react-router-dom/generatePath.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.__esModule = true; + +var _generatePath = require("react-router/generatePath"); + +var _generatePath2 = _interopRequireDefault(_generatePath); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _generatePath2.default; // Written in this round about way for babel-transform-imports \ No newline at end of file diff --git a/node_modules/react-router-dom/index.js b/node_modules/react-router-dom/index.js new file mode 100644 index 00000000..e17deaa0 --- /dev/null +++ b/node_modules/react-router-dom/index.js @@ -0,0 +1,77 @@ +"use strict"; + +exports.__esModule = true; +exports.withRouter = exports.matchPath = exports.generatePath = exports.Switch = exports.StaticRouter = exports.Router = exports.Route = exports.Redirect = exports.Prompt = exports.NavLink = exports.MemoryRouter = exports.Link = exports.HashRouter = exports.BrowserRouter = undefined; + +var _BrowserRouter2 = require("./BrowserRouter"); + +var _BrowserRouter3 = _interopRequireDefault(_BrowserRouter2); + +var _HashRouter2 = require("./HashRouter"); + +var _HashRouter3 = _interopRequireDefault(_HashRouter2); + +var _Link2 = require("./Link"); + +var _Link3 = _interopRequireDefault(_Link2); + +var _MemoryRouter2 = require("./MemoryRouter"); + +var _MemoryRouter3 = _interopRequireDefault(_MemoryRouter2); + +var _NavLink2 = require("./NavLink"); + +var _NavLink3 = _interopRequireDefault(_NavLink2); + +var _Prompt2 = require("./Prompt"); + +var _Prompt3 = _interopRequireDefault(_Prompt2); + +var _Redirect2 = require("./Redirect"); + +var _Redirect3 = _interopRequireDefault(_Redirect2); + +var _Route2 = require("./Route"); + +var _Route3 = _interopRequireDefault(_Route2); + +var _Router2 = require("./Router"); + +var _Router3 = _interopRequireDefault(_Router2); + +var _StaticRouter2 = require("./StaticRouter"); + +var _StaticRouter3 = _interopRequireDefault(_StaticRouter2); + +var _Switch2 = require("./Switch"); + +var _Switch3 = _interopRequireDefault(_Switch2); + +var _generatePath2 = require("./generatePath"); + +var _generatePath3 = _interopRequireDefault(_generatePath2); + +var _matchPath2 = require("./matchPath"); + +var _matchPath3 = _interopRequireDefault(_matchPath2); + +var _withRouter2 = require("./withRouter"); + +var _withRouter3 = _interopRequireDefault(_withRouter2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.BrowserRouter = _BrowserRouter3.default; +exports.HashRouter = _HashRouter3.default; +exports.Link = _Link3.default; +exports.MemoryRouter = _MemoryRouter3.default; +exports.NavLink = _NavLink3.default; +exports.Prompt = _Prompt3.default; +exports.Redirect = _Redirect3.default; +exports.Route = _Route3.default; +exports.Router = _Router3.default; +exports.StaticRouter = _StaticRouter3.default; +exports.Switch = _Switch3.default; +exports.generatePath = _generatePath3.default; +exports.matchPath = _matchPath3.default; +exports.withRouter = _withRouter3.default; \ No newline at end of file diff --git a/node_modules/react-router-dom/matchPath.js b/node_modules/react-router-dom/matchPath.js new file mode 100644 index 00000000..7aaa1c4f --- /dev/null +++ b/node_modules/react-router-dom/matchPath.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.__esModule = true; + +var _matchPath = require("react-router/matchPath"); + +var _matchPath2 = _interopRequireDefault(_matchPath); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _matchPath2.default; // Written in this round about way for babel-transform-imports \ No newline at end of file diff --git a/node_modules/react-router-dom/package.json b/node_modules/react-router-dom/package.json new file mode 100644 index 00000000..dd586053 --- /dev/null +++ b/node_modules/react-router-dom/package.json @@ -0,0 +1,131 @@ +{ + "_from": "react-router-dom", + "_id": "react-router-dom@4.3.1", + "_inBundle": false, + "_integrity": "sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==", + "_location": "/react-router-dom", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "react-router-dom", + "name": "react-router-dom", + "escapedName": "react-router-dom", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-4.3.1.tgz", + "_shasum": "4c2619fc24c4fa87c9fd18f4fb4a43fe63fbd5c6", + "_spec": "react-router-dom", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API", + "authors": [ + "Michael Jackson", + "Ryan Florence" + ], + "browserify": { + "transform": [ + "loose-envify" + ] + }, + "bugs": { + "url": "https://github.com/ReactTraining/react-router/issues" + }, + "bundleDependencies": false, + "dependencies": { + "history": "^4.7.2", + "invariant": "^2.2.4", + "loose-envify": "^1.3.1", + "prop-types": "^15.6.1", + "react-router": "^4.3.1", + "warning": "^4.0.1" + }, + "deprecated": false, + "description": "DOM bindings for React Router", + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-eslint": "^8.2.3", + "babel-jest": "^23.0.1", + "babel-plugin-dev-expression": "^0.2.1", + "babel-plugin-external-helpers": "^6.22.0", + "babel-plugin-transform-imports": "^1.5.0", + "babel-plugin-transform-react-remove-prop-types": "^0.4.13", + "babel-preset-es2015": "^6.14.0", + "babel-preset-react": "^6.5.0", + "babel-preset-stage-1": "^6.5.0", + "eslint": "^4.19.1", + "eslint-plugin-import": "^2.12.0", + "eslint-plugin-react": "^7.9.1", + "gzip-size": "^4.1.0", + "jest": "^23.1.0", + "pretty-bytes": "^5.0.0", + "raf": "^3.4.0", + "react": "^16.4.0", + "react-addons-test-utils": "^15.6.2", + "react-dom": "^16.4.0", + "rollup": "^0.60.0", + "rollup-plugin-babel": "^3.0.4", + "rollup-plugin-commonjs": "^9.1.3", + "rollup-plugin-node-resolve": "^3.3.0", + "rollup-plugin-replace": "^2.0.0", + "rollup-plugin-uglify": "^3.0.0" + }, + "files": [ + "BrowserRouter.js", + "HashRouter.js", + "Link.js", + "MemoryRouter.js", + "NavLink.js", + "Prompt.js", + "Redirect.js", + "Route.js", + "Router.js", + "StaticRouter.js", + "Switch.js", + "es", + "index.js", + "generatePath.js", + "matchPath.js", + "withRouter.js", + "umd" + ], + "homepage": "https://github.com/ReactTraining/react-router#readme", + "jest": { + "setupFiles": [ + "raf/polyfill" + ] + }, + "keywords": [ + "react", + "router", + "route", + "routing", + "history", + "link" + ], + "license": "MIT", + "main": "index.js", + "module": "es/index.js", + "name": "react-router-dom", + "peerDependencies": { + "react": ">=15" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ReactTraining/react-router.git" + }, + "scripts": { + "build": "node ./tools/build.js", + "clean": "git clean -fdX .", + "lint": "eslint modules", + "prepublishOnly": "node ./tools/build.js", + "test": "jest", + "watch": "babel ./modules -d . --ignore __tests__ --watch" + }, + "sideEffects": false, + "version": "4.3.1" +} diff --git a/node_modules/react-router-dom/umd/react-router-dom.js b/node_modules/react-router-dom/umd/react-router-dom.js new file mode 100644 index 00000000..a68928a3 --- /dev/null +++ b/node_modules/react-router-dom/umd/react-router-dom.js @@ -0,0 +1,3788 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) : + typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) : + (factory((global.ReactRouterDOM = {}),global.React)); +}(this, (function (exports,React) { 'use strict'; + + React = React && React.hasOwnProperty('default') ? React['default'] : React; + + /** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @providesModule warning + */ + + var warning = function () {}; + + { + var printWarning = function printWarning(format, args) { + var len = arguments.length; + args = new Array(len > 2 ? len - 2 : 0); + for (var key = 2; key < len; key++) { + args[key - 2] = arguments[key]; + } + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + warning = function (condition, format, args) { + var len = arguments.length; + args = new Array(len > 2 ? len - 2 : 0); + for (var key = 2; key < len; key++) { + args[key - 2] = arguments[key]; + } + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + if (!condition) { + printWarning.apply(null, [format].concat(args)); + } + }; + } + + var warning_1 = warning; + + var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + function makeEmptyFunction(arg) { + return function () { + return arg; + }; + } + + /** + * This function accepts and discards inputs; it has no side effects. This is + * primarily useful idiomatically for overridable function endpoints which + * always need to be callable, since JS lacks a null-call idiom ala Cocoa. + */ + var emptyFunction = function emptyFunction() {}; + + emptyFunction.thatReturns = makeEmptyFunction; + emptyFunction.thatReturnsFalse = makeEmptyFunction(false); + emptyFunction.thatReturnsTrue = makeEmptyFunction(true); + emptyFunction.thatReturnsNull = makeEmptyFunction(null); + emptyFunction.thatReturnsThis = function () { + return this; + }; + emptyFunction.thatReturnsArgument = function (arg) { + return arg; + }; + + var emptyFunction_1 = emptyFunction; + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + /** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + + var validateFormat = function validateFormat(format) {}; + + { + validateFormat = function validateFormat(format) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + }; + } + + function invariant(condition, format, a, b, c, d, e, f) { + validateFormat(format); + + if (!condition) { + var error; + if (format === undefined) { + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error(format.replace(/%s/g, function () { + return args[argIndex++]; + })); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } + } + + var invariant_1 = invariant; + + /** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + + var warning$1 = emptyFunction_1; + + { + var printWarning$1 = function printWarning(format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + warning$1 = function warning(condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + + if (format.indexOf('Failed Composite propType: ') === 0) { + return; // Ignore CompositeComponent proptype check. + } + + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + printWarning$1.apply(undefined, [format].concat(args)); + } + }; + } + + var warning_1$1 = warning$1; + + /* + object-assign + (c) Sindre Sorhus + @license MIT + */ + /* eslint-disable no-unused-vars */ + + var getOwnPropertySymbols = Object.getOwnPropertySymbols; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var propIsEnumerable = Object.prototype.propertyIsEnumerable; + + function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); + } + + function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } + } + + var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; + }; + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + + var ReactPropTypesSecret_1 = ReactPropTypesSecret; + + { + var invariant$1 = invariant_1; + var warning$2 = warning_1$1; + var ReactPropTypesSecret$1 = ReactPropTypesSecret_1; + var loggedTypeFailures = {}; + } + + /** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ + function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + { + for (var typeSpecName in typeSpecs) { + if (typeSpecs.hasOwnProperty(typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + invariant$1(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1); + } catch (ex) { + error = ex; + } + warning$2(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var stack = getStack ? getStack() : ''; + + warning$2(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); + } + } + } + } + } + + var checkPropTypes_1 = checkPropTypes; + + var factoryWithTypeCheckers = function (isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } + + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message) { + this.message = message; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret_1) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + invariant_1(false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types'); + } else if (typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if (!manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3) { + warning_1$1(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunction_1.thatReturnsNull); + } + + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + warning_1$1(false, 'Invalid argument supplied to oneOf, expected an instance of array.'); + return emptyFunction_1.thatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (propValue.hasOwnProperty(key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + warning_1$1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.'); + return emptyFunction_1.thatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + warning_1$1(false, 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received %s at index %s.', getPostfixForTypeWarning(checker), i); + return emptyFunction_1.thatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) { + return null; + } + } + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (!checker) { + continue; + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from + // props. + var allKeys = objectAssign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (!checker) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes_1; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; + }; + + var propTypes = createCommonjsModule(function (module) { + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + { + var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element') || 0xeac7; + + var isValidElement = function (object) { + return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + }; + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess); + } + }); + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + var invariant$2 = function (condition, format, a, b, c, d, e, f) { + { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + } + + if (!condition) { + var error; + if (format === undefined) { + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error(format.replace(/%s/g, function () { + return args[argIndex++]; + })); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } + }; + + var invariant_1$1 = invariant$2; + + function isAbsolute(pathname) { + return pathname.charAt(0) === '/'; + } + + // About 1.5x faster than the two-arg version of Array#splice() + function spliceOne(list, index) { + for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) { + list[i] = list[k]; + } + + list.pop(); + } + + // This implementation is based heavily on node's url.parse + function resolvePathname(to) { + var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + var toParts = to && to.split('/') || []; + var fromParts = from && from.split('/') || []; + + var isToAbs = to && isAbsolute(to); + var isFromAbs = from && isAbsolute(from); + var mustEndAbs = isToAbs || isFromAbs; + + if (to && isAbsolute(to)) { + // to is absolute + fromParts = toParts; + } else if (toParts.length) { + // to is relative, drop the filename + fromParts.pop(); + fromParts = fromParts.concat(toParts); + } + + if (!fromParts.length) return '/'; + + var hasTrailingSlash = void 0; + if (fromParts.length) { + var last = fromParts[fromParts.length - 1]; + hasTrailingSlash = last === '.' || last === '..' || last === ''; + } else { + hasTrailingSlash = false; + } + + var up = 0; + for (var i = fromParts.length; i >= 0; i--) { + var part = fromParts[i]; + + if (part === '.') { + spliceOne(fromParts, i); + } else if (part === '..') { + spliceOne(fromParts, i); + up++; + } else if (up) { + spliceOne(fromParts, i); + up--; + } + } + + if (!mustEndAbs) for (; up--; up) { + fromParts.unshift('..'); + }if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift(''); + + var result = fromParts.join('/'); + + if (hasTrailingSlash && result.substr(-1) !== '/') result += '/'; + + return result; + } + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + + function valueEqual(a, b) { + if (a === b) return true; + + if (a == null || b == null) return false; + + if (Array.isArray(a)) { + return Array.isArray(b) && a.length === b.length && a.every(function (item, index) { + return valueEqual(item, b[index]); + }); + } + + var aType = typeof a === 'undefined' ? 'undefined' : _typeof(a); + var bType = typeof b === 'undefined' ? 'undefined' : _typeof(b); + + if (aType !== bType) return false; + + if (aType === 'object') { + var aValue = a.valueOf(); + var bValue = b.valueOf(); + + if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); + + var aKeys = Object.keys(a); + var bKeys = Object.keys(b); + + if (aKeys.length !== bKeys.length) return false; + + return aKeys.every(function (key) { + return valueEqual(a[key], b[key]); + }); + } + + return false; + } + + var addLeadingSlash = function addLeadingSlash(path) { + return path.charAt(0) === '/' ? path : '/' + path; + }; + + var stripLeadingSlash = function stripLeadingSlash(path) { + return path.charAt(0) === '/' ? path.substr(1) : path; + }; + + var hasBasename = function hasBasename(path, prefix) { + return new RegExp('^' + prefix + '(\\/|\\?|#|$)', 'i').test(path); + }; + + var stripBasename = function stripBasename(path, prefix) { + return hasBasename(path, prefix) ? path.substr(prefix.length) : path; + }; + + var stripTrailingSlash = function stripTrailingSlash(path) { + return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path; + }; + + var parsePath = function parsePath(path) { + var pathname = path || '/'; + var search = ''; + var hash = ''; + + var hashIndex = pathname.indexOf('#'); + if (hashIndex !== -1) { + hash = pathname.substr(hashIndex); + pathname = pathname.substr(0, hashIndex); + } + + var searchIndex = pathname.indexOf('?'); + if (searchIndex !== -1) { + search = pathname.substr(searchIndex); + pathname = pathname.substr(0, searchIndex); + } + + return { + pathname: pathname, + search: search === '?' ? '' : search, + hash: hash === '#' ? '' : hash + }; + }; + + var createPath = function createPath(location) { + var pathname = location.pathname, + search = location.search, + hash = location.hash; + + var path = pathname || '/'; + + if (search && search !== '?') path += search.charAt(0) === '?' ? search : '?' + search; + + if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : '#' + hash; + + return path; + }; + + 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; + }; + + var createLocation = function createLocation(path, state, key, currentLocation) { + var location = void 0; + if (typeof path === 'string') { + // Two-arg form: push(path, state) + location = parsePath(path); + location.state = state; + } else { + // One-arg form: push(location) + location = _extends({}, path); + + if (location.pathname === undefined) location.pathname = ''; + + if (location.search) { + if (location.search.charAt(0) !== '?') location.search = '?' + location.search; + } else { + location.search = ''; + } + + if (location.hash) { + if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash; + } else { + location.hash = ''; + } + + if (state !== undefined && location.state === undefined) location.state = state; + } + + try { + location.pathname = decodeURI(location.pathname); + } catch (e) { + if (e instanceof URIError) { + throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); + } else { + throw e; + } + } + + if (key) location.key = key; + + if (currentLocation) { + // Resolve incomplete/relative pathname relative to current location. + if (!location.pathname) { + location.pathname = currentLocation.pathname; + } else if (location.pathname.charAt(0) !== '/') { + location.pathname = resolvePathname(location.pathname, currentLocation.pathname); + } + } else { + // When there is no prior location and pathname is empty, set it to / + if (!location.pathname) { + location.pathname = '/'; + } + } + + return location; + }; + + var locationsAreEqual = function locationsAreEqual(a, b) { + return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && valueEqual(a.state, b.state); + }; + + var createTransitionManager = function createTransitionManager() { + var prompt = null; + + var setPrompt = function setPrompt(nextPrompt) { + warning_1(prompt == null, 'A history supports only one prompt at a time'); + + prompt = nextPrompt; + + return function () { + if (prompt === nextPrompt) prompt = null; + }; + }; + + var confirmTransitionTo = function confirmTransitionTo(location, action, getUserConfirmation, callback) { + // TODO: If another transition starts while we're still confirming + // the previous one, we may end up in a weird state. Figure out the + // best way to handle this. + if (prompt != null) { + var result = typeof prompt === 'function' ? prompt(location, action) : prompt; + + if (typeof result === 'string') { + if (typeof getUserConfirmation === 'function') { + getUserConfirmation(result, callback); + } else { + warning_1(false, 'A history needs a getUserConfirmation function in order to use a prompt message'); + + callback(true); + } + } else { + // Return false from a transition hook to cancel the transition. + callback(result !== false); + } + } else { + callback(true); + } + }; + + var listeners = []; + + var appendListener = function appendListener(fn) { + var isActive = true; + + var listener = function listener() { + if (isActive) fn.apply(undefined, arguments); + }; + + listeners.push(listener); + + return function () { + isActive = false; + listeners = listeners.filter(function (item) { + return item !== listener; + }); + }; + }; + + var notifyListeners = function notifyListeners() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + listeners.forEach(function (listener) { + return listener.apply(undefined, args); + }); + }; + + return { + setPrompt: setPrompt, + confirmTransitionTo: confirmTransitionTo, + appendListener: appendListener, + notifyListeners: notifyListeners + }; + }; + + var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); + + var addEventListener = function addEventListener(node, event, listener) { + return node.addEventListener ? node.addEventListener(event, listener, false) : node.attachEvent('on' + event, listener); + }; + + var removeEventListener = function removeEventListener(node, event, listener) { + return node.removeEventListener ? node.removeEventListener(event, listener, false) : node.detachEvent('on' + event, listener); + }; + + var getConfirmation = function getConfirmation(message, callback) { + return callback(window.confirm(message)); + }; // eslint-disable-line no-alert + + /** + * Returns true if the HTML5 history API is supported. Taken from Modernizr. + * + * https://github.com/Modernizr/Modernizr/blob/master/LICENSE + * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js + * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586 + */ + var supportsHistory = function supportsHistory() { + var ua = window.navigator.userAgent; + + if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false; + + return window.history && 'pushState' in window.history; + }; + + /** + * Returns true if browser fires popstate on hash change. + * IE10 and IE11 do not. + */ + var supportsPopStateOnHashChange = function supportsPopStateOnHashChange() { + return window.navigator.userAgent.indexOf('Trident') === -1; + }; + + /** + * Returns false if using go(n) with hash history causes a full page reload. + */ + var supportsGoWithoutReloadUsingHash = function supportsGoWithoutReloadUsingHash() { + return window.navigator.userAgent.indexOf('Firefox') === -1; + }; + + /** + * Returns true if a given popstate event is an extraneous WebKit event. + * Accounts for the fact that Chrome on iOS fires real popstate events + * containing undefined state when pressing the back button. + */ + var isExtraneousPopstateEvent = function isExtraneousPopstateEvent(event) { + return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1; + }; + + var _typeof$1 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + + var _extends$1 = 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; + }; + + var PopStateEvent = 'popstate'; + var HashChangeEvent = 'hashchange'; + + var getHistoryState = function getHistoryState() { + try { + return window.history.state || {}; + } catch (e) { + // IE 11 sometimes throws when accessing window.history.state + // See https://github.com/ReactTraining/history/pull/289 + return {}; + } + }; + + /** + * Creates a history object that uses the HTML5 history API including + * pushState, replaceState, and the popstate event. + */ + var createBrowserHistory = function createBrowserHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + invariant_1$1(canUseDOM, 'Browser history needs a DOM'); + + var globalHistory = window.history; + var canUseHistory = supportsHistory(); + var needsHashChangeListener = !supportsPopStateOnHashChange(); + + var _props$forceRefresh = props.forceRefresh, + forceRefresh = _props$forceRefresh === undefined ? false : _props$forceRefresh, + _props$getUserConfirm = props.getUserConfirmation, + getUserConfirmation = _props$getUserConfirm === undefined ? getConfirmation : _props$getUserConfirm, + _props$keyLength = props.keyLength, + keyLength = _props$keyLength === undefined ? 6 : _props$keyLength; + + var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; + + var getDOMLocation = function getDOMLocation(historyState) { + var _ref = historyState || {}, + key = _ref.key, + state = _ref.state; + + var _window$location = window.location, + pathname = _window$location.pathname, + search = _window$location.search, + hash = _window$location.hash; + + var path = pathname + search + hash; + + warning_1(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".'); + + if (basename) path = stripBasename(path, basename); + + return createLocation(path, state, key); + }; + + var createKey = function createKey() { + return Math.random().toString(36).substr(2, keyLength); + }; + + var transitionManager = createTransitionManager(); + + var setState = function setState(nextState) { + _extends$1(history, nextState); + + history.length = globalHistory.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var handlePopState = function handlePopState(event) { + // Ignore extraneous popstate events in WebKit. + if (isExtraneousPopstateEvent(event)) return; + + handlePop(getDOMLocation(event.state)); + }; + + var handleHashChange = function handleHashChange() { + handlePop(getDOMLocation(getHistoryState())); + }; + + var forceNextPop = false; + + var handlePop = function handlePop(location) { + if (forceNextPop) { + forceNextPop = false; + setState(); + } else { + var action = 'POP'; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ action: action, location: location }); + } else { + revertPop(location); + } + }); + } + }; + + var revertPop = function revertPop(fromLocation) { + var toLocation = history.location; + + // TODO: We could probably make this more reliable by + // keeping a list of keys we've seen in sessionStorage. + // Instead, we just default to 0 for keys we don't know. + + var toIndex = allKeys.indexOf(toLocation.key); + + if (toIndex === -1) toIndex = 0; + + var fromIndex = allKeys.indexOf(fromLocation.key); + + if (fromIndex === -1) fromIndex = 0; + + var delta = toIndex - fromIndex; + + if (delta) { + forceNextPop = true; + go(delta); + } + }; + + var initialLocation = getDOMLocation(getHistoryState()); + var allKeys = [initialLocation.key]; + + // Public interface + + var createHref = function createHref(location) { + return basename + createPath(location); + }; + + var push = function push(path, state) { + warning_1(!((typeof path === 'undefined' ? 'undefined' : _typeof$1(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'PUSH'; + var location = createLocation(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var href = createHref(location); + var key = location.key, + state = location.state; + + if (canUseHistory) { + globalHistory.pushState({ key: key, state: state }, null, href); + + if (forceRefresh) { + window.location.href = href; + } else { + var prevIndex = allKeys.indexOf(history.location.key); + var nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1); + + nextKeys.push(location.key); + allKeys = nextKeys; + + setState({ action: action, location: location }); + } + } else { + warning_1(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history'); + + window.location.href = href; + } + }); + }; + + var replace = function replace(path, state) { + warning_1(!((typeof path === 'undefined' ? 'undefined' : _typeof$1(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'REPLACE'; + var location = createLocation(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var href = createHref(location); + var key = location.key, + state = location.state; + + if (canUseHistory) { + globalHistory.replaceState({ key: key, state: state }, null, href); + + if (forceRefresh) { + window.location.replace(href); + } else { + var prevIndex = allKeys.indexOf(history.location.key); + + if (prevIndex !== -1) allKeys[prevIndex] = location.key; + + setState({ action: action, location: location }); + } + } else { + warning_1(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history'); + + window.location.replace(href); + } + }); + }; + + var go = function go(n) { + globalHistory.go(n); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var listenerCount = 0; + + var checkDOMListeners = function checkDOMListeners(delta) { + listenerCount += delta; + + if (listenerCount === 1) { + addEventListener(window, PopStateEvent, handlePopState); + + if (needsHashChangeListener) addEventListener(window, HashChangeEvent, handleHashChange); + } else if (listenerCount === 0) { + removeEventListener(window, PopStateEvent, handlePopState); + + if (needsHashChangeListener) removeEventListener(window, HashChangeEvent, handleHashChange); + } + }; + + var isBlocked = false; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + var unblock = transitionManager.setPrompt(prompt); + + if (!isBlocked) { + checkDOMListeners(1); + isBlocked = true; + } + + return function () { + if (isBlocked) { + isBlocked = false; + checkDOMListeners(-1); + } + + return unblock(); + }; + }; + + var listen = function listen(listener) { + var unlisten = transitionManager.appendListener(listener); + checkDOMListeners(1); + + return function () { + checkDOMListeners(-1); + unlisten(); + }; + }; + + var history = { + length: globalHistory.length, + action: 'POP', + location: initialLocation, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + block: block, + listen: listen + }; + + return history; + }; + + var _extends$2 = 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; + }; + + var HashChangeEvent$1 = 'hashchange'; + + var HashPathCoders = { + hashbang: { + encodePath: function encodePath(path) { + return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path); + }, + decodePath: function decodePath(path) { + return path.charAt(0) === '!' ? path.substr(1) : path; + } + }, + noslash: { + encodePath: stripLeadingSlash, + decodePath: addLeadingSlash + }, + slash: { + encodePath: addLeadingSlash, + decodePath: addLeadingSlash + } + }; + + var getHashPath = function getHashPath() { + // We can't use window.location.hash here because it's not + // consistent across browsers - Firefox will pre-decode it! + var href = window.location.href; + var hashIndex = href.indexOf('#'); + return hashIndex === -1 ? '' : href.substring(hashIndex + 1); + }; + + var pushHashPath = function pushHashPath(path) { + return window.location.hash = path; + }; + + var replaceHashPath = function replaceHashPath(path) { + var hashIndex = window.location.href.indexOf('#'); + + window.location.replace(window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path); + }; + + var createHashHistory = function createHashHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + invariant_1$1(canUseDOM, 'Hash history needs a DOM'); + + var globalHistory = window.history; + var canGoWithoutReload = supportsGoWithoutReloadUsingHash(); + + var _props$getUserConfirm = props.getUserConfirmation, + getUserConfirmation = _props$getUserConfirm === undefined ? getConfirmation : _props$getUserConfirm, + _props$hashType = props.hashType, + hashType = _props$hashType === undefined ? 'slash' : _props$hashType; + + var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; + + var _HashPathCoders$hashT = HashPathCoders[hashType], + encodePath = _HashPathCoders$hashT.encodePath, + decodePath = _HashPathCoders$hashT.decodePath; + + var getDOMLocation = function getDOMLocation() { + var path = decodePath(getHashPath()); + + warning_1(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".'); + + if (basename) path = stripBasename(path, basename); + + return createLocation(path); + }; + + var transitionManager = createTransitionManager(); + + var setState = function setState(nextState) { + _extends$2(history, nextState); + + history.length = globalHistory.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var forceNextPop = false; + var ignorePath = null; + + var handleHashChange = function handleHashChange() { + var path = getHashPath(); + var encodedPath = encodePath(path); + + if (path !== encodedPath) { + // Ensure we always have a properly-encoded hash. + replaceHashPath(encodedPath); + } else { + var location = getDOMLocation(); + var prevLocation = history.location; + + if (!forceNextPop && locationsAreEqual(prevLocation, location)) return; // A hashchange doesn't always == location change. + + if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace. + + ignorePath = null; + + handlePop(location); + } + }; + + var handlePop = function handlePop(location) { + if (forceNextPop) { + forceNextPop = false; + setState(); + } else { + var action = 'POP'; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ action: action, location: location }); + } else { + revertPop(location); + } + }); + } + }; + + var revertPop = function revertPop(fromLocation) { + var toLocation = history.location; + + // TODO: We could probably make this more reliable by + // keeping a list of paths we've seen in sessionStorage. + // Instead, we just default to 0 for paths we don't know. + + var toIndex = allPaths.lastIndexOf(createPath(toLocation)); + + if (toIndex === -1) toIndex = 0; + + var fromIndex = allPaths.lastIndexOf(createPath(fromLocation)); + + if (fromIndex === -1) fromIndex = 0; + + var delta = toIndex - fromIndex; + + if (delta) { + forceNextPop = true; + go(delta); + } + }; + + // Ensure the hash is encoded properly before doing anything else. + var path = getHashPath(); + var encodedPath = encodePath(path); + + if (path !== encodedPath) replaceHashPath(encodedPath); + + var initialLocation = getDOMLocation(); + var allPaths = [createPath(initialLocation)]; + + // Public interface + + var createHref = function createHref(location) { + return '#' + encodePath(basename + createPath(location)); + }; + + var push = function push(path, state) { + warning_1(state === undefined, 'Hash history cannot push state; it is ignored'); + + var action = 'PUSH'; + var location = createLocation(path, undefined, undefined, history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var path = createPath(location); + var encodedPath = encodePath(basename + path); + var hashChanged = getHashPath() !== encodedPath; + + if (hashChanged) { + // We cannot tell if a hashchange was caused by a PUSH, so we'd + // rather setState here and ignore the hashchange. The caveat here + // is that other hash histories in the page will consider it a POP. + ignorePath = path; + pushHashPath(encodedPath); + + var prevIndex = allPaths.lastIndexOf(createPath(history.location)); + var nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1); + + nextPaths.push(path); + allPaths = nextPaths; + + setState({ action: action, location: location }); + } else { + warning_1(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack'); + + setState(); + } + }); + }; + + var replace = function replace(path, state) { + warning_1(state === undefined, 'Hash history cannot replace state; it is ignored'); + + var action = 'REPLACE'; + var location = createLocation(path, undefined, undefined, history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var path = createPath(location); + var encodedPath = encodePath(basename + path); + var hashChanged = getHashPath() !== encodedPath; + + if (hashChanged) { + // We cannot tell if a hashchange was caused by a REPLACE, so we'd + // rather setState here and ignore the hashchange. The caveat here + // is that other hash histories in the page will consider it a POP. + ignorePath = path; + replaceHashPath(encodedPath); + } + + var prevIndex = allPaths.indexOf(createPath(history.location)); + + if (prevIndex !== -1) allPaths[prevIndex] = path; + + setState({ action: action, location: location }); + }); + }; + + var go = function go(n) { + warning_1(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser'); + + globalHistory.go(n); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var listenerCount = 0; + + var checkDOMListeners = function checkDOMListeners(delta) { + listenerCount += delta; + + if (listenerCount === 1) { + addEventListener(window, HashChangeEvent$1, handleHashChange); + } else if (listenerCount === 0) { + removeEventListener(window, HashChangeEvent$1, handleHashChange); + } + }; + + var isBlocked = false; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + var unblock = transitionManager.setPrompt(prompt); + + if (!isBlocked) { + checkDOMListeners(1); + isBlocked = true; + } + + return function () { + if (isBlocked) { + isBlocked = false; + checkDOMListeners(-1); + } + + return unblock(); + }; + }; + + var listen = function listen(listener) { + var unlisten = transitionManager.appendListener(listener); + checkDOMListeners(1); + + return function () { + checkDOMListeners(-1); + unlisten(); + }; + }; + + var history = { + length: globalHistory.length, + action: 'POP', + location: initialLocation, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + block: block, + listen: listen + }; + + return history; + }; + + var _typeof$2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + + var _extends$3 = 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; + }; + + var clamp = function clamp(n, lowerBound, upperBound) { + return Math.min(Math.max(n, lowerBound), upperBound); + }; + + /** + * Creates a history object that stores locations in memory. + */ + var createMemoryHistory = function createMemoryHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var getUserConfirmation = props.getUserConfirmation, + _props$initialEntries = props.initialEntries, + initialEntries = _props$initialEntries === undefined ? ['/'] : _props$initialEntries, + _props$initialIndex = props.initialIndex, + initialIndex = _props$initialIndex === undefined ? 0 : _props$initialIndex, + _props$keyLength = props.keyLength, + keyLength = _props$keyLength === undefined ? 6 : _props$keyLength; + + var transitionManager = createTransitionManager(); + + var setState = function setState(nextState) { + _extends$3(history, nextState); + + history.length = history.entries.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var createKey = function createKey() { + return Math.random().toString(36).substr(2, keyLength); + }; + + var index = clamp(initialIndex, 0, initialEntries.length - 1); + var entries = initialEntries.map(function (entry) { + return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey()); + }); + + // Public interface + + var createHref = createPath; + + var push = function push(path, state) { + warning_1(!((typeof path === 'undefined' ? 'undefined' : _typeof$2(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'PUSH'; + var location = createLocation(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var prevIndex = history.index; + var nextIndex = prevIndex + 1; + + var nextEntries = history.entries.slice(0); + if (nextEntries.length > nextIndex) { + nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location); + } else { + nextEntries.push(location); + } + + setState({ + action: action, + location: location, + index: nextIndex, + entries: nextEntries + }); + }); + }; + + var replace = function replace(path, state) { + warning_1(!((typeof path === 'undefined' ? 'undefined' : _typeof$2(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'REPLACE'; + var location = createLocation(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + history.entries[history.index] = location; + + setState({ action: action, location: location }); + }); + }; + + var go = function go(n) { + var nextIndex = clamp(history.index + n, 0, history.entries.length - 1); + + var action = 'POP'; + var location = history.entries[nextIndex]; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ + action: action, + location: location, + index: nextIndex + }); + } else { + // Mimic the behavior of DOM histories by + // causing a render after a cancelled POP. + setState(); + } + }); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var canGo = function canGo(n) { + var nextIndex = history.index + n; + return nextIndex >= 0 && nextIndex < history.entries.length; + }; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + return transitionManager.setPrompt(prompt); + }; + + var listen = function listen(listener) { + return transitionManager.appendListener(listener); + }; + + var history = { + length: entries.length, + action: 'POP', + location: entries[index], + index: index, + entries: entries, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + canGo: canGo, + block: block, + listen: listen + }; + + return history; + }; + + var _extends$4 = 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 _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + }return call && (typeof call === "object" || typeof call === "function") ? call : self; + } + + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + + /** + * The public API for putting history on context. + */ + + var Router = function (_React$Component) { + _inherits(Router, _React$Component); + + function Router() { + var _temp, _this, _ret; + + _classCallCheck(this, Router); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = { + match: _this.computeMatch(_this.props.history.location.pathname) + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + Router.prototype.getChildContext = function getChildContext() { + return { + router: _extends$4({}, this.context.router, { + history: this.props.history, + route: { + location: this.props.history.location, + match: this.state.match + } + }) + }; + }; + + Router.prototype.computeMatch = function computeMatch(pathname) { + return { + path: "/", + url: "/", + params: {}, + isExact: pathname === "/" + }; + }; + + Router.prototype.componentWillMount = function componentWillMount() { + var _this2 = this; + + var _props = this.props, + children = _props.children, + history = _props.history; + + invariant_1$1(children == null || React.Children.count(children) === 1, "A may have only one child element"); + + // Do this here so we can setState when a changes the + // location in componentWillMount. This happens e.g. when doing + // server rendering using a . + this.unlisten = history.listen(function () { + _this2.setState({ + match: _this2.computeMatch(history.location.pathname) + }); + }); + }; + + Router.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + warning_1(this.props.history === nextProps.history, "You cannot change "); + }; + + Router.prototype.componentWillUnmount = function componentWillUnmount() { + this.unlisten(); + }; + + Router.prototype.render = function render() { + var children = this.props.children; + + return children ? React.Children.only(children) : null; + }; + + return Router; + }(React.Component); + + Router.propTypes = { + history: propTypes.object.isRequired, + children: propTypes.node + }; + Router.contextTypes = { + router: propTypes.object + }; + Router.childContextTypes = { + router: propTypes.object.isRequired + }; + + // Written in this round about way for babel-transform-imports + + var _typeof$3 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + + var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + + var _extends$5 = 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; + }; + + var inherits = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + }; + + var objectWithoutProperties = function (obj, keys) { + var target = {}; + + for (var i in obj) { + if (keys.indexOf(i) >= 0) continue; + if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; + target[i] = obj[i]; + } + + return target; + }; + + var possibleConstructorReturn = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && (typeof call === "object" || typeof call === "function") ? call : self; + }; + + /** + * The public API for a that uses HTML5 history. + */ + + var BrowserRouter = function (_React$Component) { + inherits(BrowserRouter, _React$Component); + + function BrowserRouter() { + var _temp, _this, _ret; + + classCallCheck(this, BrowserRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = createBrowserHistory(_this.props), _temp), possibleConstructorReturn(_this, _ret); + } + + BrowserRouter.prototype.componentWillMount = function componentWillMount() { + warning_1(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { BrowserRouter as Router }`."); + }; + + BrowserRouter.prototype.render = function render() { + return React.createElement(Router, { history: this.history, children: this.props.children }); + }; + + return BrowserRouter; + }(React.Component); + + BrowserRouter.propTypes = { + basename: propTypes.string, + forceRefresh: propTypes.bool, + getUserConfirmation: propTypes.func, + keyLength: propTypes.number, + children: propTypes.node + }; + + /** + * The public API for a that uses window.location.hash. + */ + + var HashRouter = function (_React$Component) { + inherits(HashRouter, _React$Component); + + function HashRouter() { + var _temp, _this, _ret; + + classCallCheck(this, HashRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = createHashHistory(_this.props), _temp), possibleConstructorReturn(_this, _ret); + } + + HashRouter.prototype.componentWillMount = function componentWillMount() { + warning_1(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { HashRouter as Router }`."); + }; + + HashRouter.prototype.render = function render() { + return React.createElement(Router, { history: this.history, children: this.props.children }); + }; + + return HashRouter; + }(React.Component); + + HashRouter.propTypes = { + basename: propTypes.string, + getUserConfirmation: propTypes.func, + hashType: propTypes.oneOf(["hashbang", "noslash", "slash"]), + children: propTypes.node + }; + + var isModifiedEvent = function isModifiedEvent(event) { + return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); + }; + + /** + * The public API for rendering a history-aware . + */ + + var Link = function (_React$Component) { + inherits(Link, _React$Component); + + function Link() { + var _temp, _this, _ret; + + classCallCheck(this, Link); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function (event) { + if (_this.props.onClick) _this.props.onClick(event); + + if (!event.defaultPrevented && // onClick prevented default + event.button === 0 && // ignore everything but left clicks + !_this.props.target && // let browser handle "target=_blank" etc. + !isModifiedEvent(event) // ignore clicks with modifier keys + ) { + event.preventDefault(); + + var history = _this.context.router.history; + var _this$props = _this.props, + replace = _this$props.replace, + to = _this$props.to; + + + if (replace) { + history.replace(to); + } else { + history.push(to); + } + } + }, _temp), possibleConstructorReturn(_this, _ret); + } + + Link.prototype.render = function render() { + var _props = this.props, + replace = _props.replace, + to = _props.to, + innerRef = _props.innerRef, + props = objectWithoutProperties(_props, ["replace", "to", "innerRef"]); // eslint-disable-line no-unused-vars + + invariant_1$1(this.context.router, "You should not use outside a "); + + invariant_1$1(to !== undefined, 'You must specify the "to" property'); + + var history = this.context.router.history; + + var location = typeof to === "string" ? createLocation(to, null, null, history.location) : to; + + var href = history.createHref(location); + return React.createElement("a", _extends$5({}, props, { onClick: this.handleClick, href: href, ref: innerRef })); + }; + + return Link; + }(React.Component); + + Link.propTypes = { + onClick: propTypes.func, + target: propTypes.string, + replace: propTypes.bool, + to: propTypes.oneOfType([propTypes.string, propTypes.object]).isRequired, + innerRef: propTypes.oneOfType([propTypes.string, propTypes.func]) + }; + Link.defaultProps = { + replace: false + }; + Link.contextTypes = { + router: propTypes.shape({ + history: propTypes.shape({ + push: propTypes.func.isRequired, + replace: propTypes.func.isRequired, + createHref: propTypes.func.isRequired + }).isRequired + }).isRequired + }; + + function _classCallCheck$1(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _possibleConstructorReturn$1(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + }return call && (typeof call === "object" || typeof call === "function") ? call : self; + } + + function _inherits$1(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + + /** + * The public API for a that stores location in memory. + */ + + var MemoryRouter = function (_React$Component) { + _inherits$1(MemoryRouter, _React$Component); + + function MemoryRouter() { + var _temp, _this, _ret; + + _classCallCheck$1(this, MemoryRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn$1(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = createMemoryHistory(_this.props), _temp), _possibleConstructorReturn$1(_this, _ret); + } + + MemoryRouter.prototype.componentWillMount = function componentWillMount() { + warning_1(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { MemoryRouter as Router }`."); + }; + + MemoryRouter.prototype.render = function render() { + return React.createElement(Router, { history: this.history, children: this.props.children }); + }; + + return MemoryRouter; + }(React.Component); + + MemoryRouter.propTypes = { + initialEntries: propTypes.array, + initialIndex: propTypes.number, + getUserConfirmation: propTypes.func, + keyLength: propTypes.number, + children: propTypes.node + }; + + // Written in this round about way for babel-transform-imports + + var toString = {}.toString; + + var isarray = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; + }; + + /** + * Expose `pathToRegexp`. + */ + var pathToRegexp_1 = pathToRegexp; + var parse_1 = parse; + var compile_1 = compile; + var tokensToFunction_1 = tokensToFunction; + var tokensToRegExp_1 = tokensToRegExp; + + /** + * The main path matching regexp utility. + * + * @type {RegExp} + */ + var PATH_REGEXP = new RegExp([ + // Match escaped characters that would otherwise appear in future matches. + // This allows the user to escape special characters that won't transform. + '(\\\\.)', + // Match Express-style parameters and un-named parameters with a prefix + // and optional suffixes. Matches appear as: + // + // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined] + // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] + // "/*" => ["/", undefined, undefined, undefined, undefined, "*"] + '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'].join('|'), 'g'); + + /** + * Parse a string for the raw tokens. + * + * @param {string} str + * @param {Object=} options + * @return {!Array} + */ + function parse(str, options) { + var tokens = []; + var key = 0; + var index = 0; + var path = ''; + var defaultDelimiter = options && options.delimiter || '/'; + var res; + + while ((res = PATH_REGEXP.exec(str)) != null) { + var m = res[0]; + var escaped = res[1]; + var offset = res.index; + path += str.slice(index, offset); + index = offset + m.length; + + // Ignore already escaped sequences. + if (escaped) { + path += escaped[1]; + continue; + } + + var next = str[index]; + var prefix = res[2]; + var name = res[3]; + var capture = res[4]; + var group = res[5]; + var modifier = res[6]; + var asterisk = res[7]; + + // Push the current path onto the tokens. + if (path) { + tokens.push(path); + path = ''; + } + + var partial = prefix != null && next != null && next !== prefix; + var repeat = modifier === '+' || modifier === '*'; + var optional = modifier === '?' || modifier === '*'; + var delimiter = res[2] || defaultDelimiter; + var pattern = capture || group; + + tokens.push({ + name: name || key++, + prefix: prefix || '', + delimiter: delimiter, + optional: optional, + repeat: repeat, + partial: partial, + asterisk: !!asterisk, + pattern: pattern ? escapeGroup(pattern) : asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?' + }); + } + + // Match any characters still remaining. + if (index < str.length) { + path += str.substr(index); + } + + // If the path exists, push it onto the end. + if (path) { + tokens.push(path); + } + + return tokens; + } + + /** + * Compile a string to a template function for the path. + * + * @param {string} str + * @param {Object=} options + * @return {!function(Object=, Object=)} + */ + function compile(str, options) { + return tokensToFunction(parse(str, options)); + } + + /** + * Prettier encoding of URI path segments. + * + * @param {string} + * @return {string} + */ + function encodeURIComponentPretty(str) { + return encodeURI(str).replace(/[\/?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase(); + }); + } + + /** + * Encode the asterisk parameter. Similar to `pretty`, but allows slashes. + * + * @param {string} + * @return {string} + */ + function encodeAsterisk(str) { + return encodeURI(str).replace(/[?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase(); + }); + } + + /** + * Expose a method for transforming tokens into the path function. + */ + function tokensToFunction(tokens) { + // Compile all the tokens into regexps. + var matches = new Array(tokens.length); + + // Compile all the patterns before compilation. + for (var i = 0; i < tokens.length; i++) { + if (typeof tokens[i] === 'object') { + matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$'); + } + } + + return function (obj, opts) { + var path = ''; + var data = obj || {}; + var options = opts || {}; + var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent; + + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + + if (typeof token === 'string') { + path += token; + + continue; + } + + var value = data[token.name]; + var segment; + + if (value == null) { + if (token.optional) { + // Prepend partial segment prefixes. + if (token.partial) { + path += token.prefix; + } + + continue; + } else { + throw new TypeError('Expected "' + token.name + '" to be defined'); + } + } + + if (isarray(value)) { + if (!token.repeat) { + throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`'); + } + + if (value.length === 0) { + if (token.optional) { + continue; + } else { + throw new TypeError('Expected "' + token.name + '" to not be empty'); + } + } + + for (var j = 0; j < value.length; j++) { + segment = encode(value[j]); + + if (!matches[i].test(segment)) { + throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`'); + } + + path += (j === 0 ? token.prefix : token.delimiter) + segment; + } + + continue; + } + + segment = token.asterisk ? encodeAsterisk(value) : encode(value); + + if (!matches[i].test(segment)) { + throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"'); + } + + path += token.prefix + segment; + } + + return path; + }; + } + + /** + * Escape a regular expression string. + * + * @param {string} str + * @return {string} + */ + function escapeString(str) { + return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1'); + } + + /** + * Escape the capturing group by escaping special characters and meaning. + * + * @param {string} group + * @return {string} + */ + function escapeGroup(group) { + return group.replace(/([=!:$\/()])/g, '\\$1'); + } + + /** + * Attach the keys as a property of the regexp. + * + * @param {!RegExp} re + * @param {Array} keys + * @return {!RegExp} + */ + function attachKeys(re, keys) { + re.keys = keys; + return re; + } + + /** + * Get the flags for a regexp from the options. + * + * @param {Object} options + * @return {string} + */ + function flags(options) { + return options.sensitive ? '' : 'i'; + } + + /** + * Pull out keys from a regexp. + * + * @param {!RegExp} path + * @param {!Array} keys + * @return {!RegExp} + */ + function regexpToRegexp(path, keys) { + // Use a negative lookahead to match only capturing groups. + var groups = path.source.match(/\((?!\?)/g); + + if (groups) { + for (var i = 0; i < groups.length; i++) { + keys.push({ + name: i, + prefix: null, + delimiter: null, + optional: false, + repeat: false, + partial: false, + asterisk: false, + pattern: null + }); + } + } + + return attachKeys(path, keys); + } + + /** + * Transform an array into a regexp. + * + * @param {!Array} path + * @param {Array} keys + * @param {!Object} options + * @return {!RegExp} + */ + function arrayToRegexp(path, keys, options) { + var parts = []; + + for (var i = 0; i < path.length; i++) { + parts.push(pathToRegexp(path[i], keys, options).source); + } + + var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)); + + return attachKeys(regexp, keys); + } + + /** + * Create a path regexp from string input. + * + * @param {string} path + * @param {!Array} keys + * @param {!Object} options + * @return {!RegExp} + */ + function stringToRegexp(path, keys, options) { + return tokensToRegExp(parse(path, options), keys, options); + } + + /** + * Expose a function for taking tokens and returning a RegExp. + * + * @param {!Array} tokens + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ + function tokensToRegExp(tokens, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */keys || options; + keys = []; + } + + options = options || {}; + + var strict = options.strict; + var end = options.end !== false; + var route = ''; + + // Iterate over the tokens and create our regexp string. + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + + if (typeof token === 'string') { + route += escapeString(token); + } else { + var prefix = escapeString(token.prefix); + var capture = '(?:' + token.pattern + ')'; + + keys.push(token); + + if (token.repeat) { + capture += '(?:' + prefix + capture + ')*'; + } + + if (token.optional) { + if (!token.partial) { + capture = '(?:' + prefix + '(' + capture + '))?'; + } else { + capture = prefix + '(' + capture + ')?'; + } + } else { + capture = prefix + '(' + capture + ')'; + } + + route += capture; + } + } + + var delimiter = escapeString(options.delimiter || '/'); + var endsWithDelimiter = route.slice(-delimiter.length) === delimiter; + + // In non-strict mode we allow a slash at the end of match. If the path to + // match already ends with a slash, we remove it for consistency. The slash + // is valid at the end of a path match, not in the middle. This is important + // in non-ending mode, where "/test/" shouldn't match "/test//route". + if (!strict) { + route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?'; + } + + if (end) { + route += '$'; + } else { + // In non-ending mode, we need the capturing groups to match as much as + // possible by using a positive lookahead to the end or next path segment. + route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)'; + } + + return attachKeys(new RegExp('^' + route, flags(options)), keys); + } + + /** + * Normalize the given path string, returning a regular expression. + * + * An empty array can be passed in for the keys, which will hold the + * placeholder key descriptions. For example, using `/user/:id`, `keys` will + * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. + * + * @param {(string|RegExp|Array)} path + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ + function pathToRegexp(path, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */keys || options; + keys = []; + } + + options = options || {}; + + if (path instanceof RegExp) { + return regexpToRegexp(path, /** @type {!Array} */keys); + } + + if (isarray(path)) { + return arrayToRegexp( /** @type {!Array} */path, /** @type {!Array} */keys, options); + } + + return stringToRegexp( /** @type {string} */path, /** @type {!Array} */keys, options); + } + pathToRegexp_1.parse = parse_1; + pathToRegexp_1.compile = compile_1; + pathToRegexp_1.tokensToFunction = tokensToFunction_1; + pathToRegexp_1.tokensToRegExp = tokensToRegExp_1; + + var patternCache = {}; + var cacheLimit = 10000; + var cacheCount = 0; + + var compilePath = function compilePath(pattern, options) { + var cacheKey = "" + options.end + options.strict + options.sensitive; + var cache = patternCache[cacheKey] || (patternCache[cacheKey] = {}); + + if (cache[pattern]) return cache[pattern]; + + var keys = []; + var re = pathToRegexp_1(pattern, keys, options); + var compiledPattern = { re: re, keys: keys }; + + if (cacheCount < cacheLimit) { + cache[pattern] = compiledPattern; + cacheCount++; + } + + return compiledPattern; + }; + + /** + * Public API for matching a URL pathname to a path pattern. + */ + var matchPath = function matchPath(pathname) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parent = arguments[2]; + + if (typeof options === "string") options = { path: options }; + + var _options = options, + path = _options.path, + _options$exact = _options.exact, + exact = _options$exact === undefined ? false : _options$exact, + _options$strict = _options.strict, + strict = _options$strict === undefined ? false : _options$strict, + _options$sensitive = _options.sensitive, + sensitive = _options$sensitive === undefined ? false : _options$sensitive; + + if (path == null) return parent; + + var _compilePath = compilePath(path, { end: exact, strict: strict, sensitive: sensitive }), + re = _compilePath.re, + keys = _compilePath.keys; + + var match = re.exec(pathname); + + if (!match) return null; + + var url = match[0], + values = match.slice(1); + + var isExact = pathname === url; + + if (exact && !isExact) return null; + + return { + path: path, // the path pattern used to match + url: path === "/" && url === "" ? "/" : url, // the matched portion of the URL + isExact: isExact, // whether or not we matched exactly + params: keys.reduce(function (memo, key, index) { + memo[key.name] = values[index]; + return memo; + }, {}) + }; + }; + + var _extends$6 = 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 _classCallCheck$2(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _possibleConstructorReturn$2(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + }return call && (typeof call === "object" || typeof call === "function") ? call : self; + } + + function _inherits$2(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + + var isEmptyChildren = function isEmptyChildren(children) { + return React.Children.count(children) === 0; + }; + + /** + * The public API for matching a single path and rendering. + */ + + var Route = function (_React$Component) { + _inherits$2(Route, _React$Component); + + function Route() { + var _temp, _this, _ret; + + _classCallCheck$2(this, Route); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn$2(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = { + match: _this.computeMatch(_this.props, _this.context.router) + }, _temp), _possibleConstructorReturn$2(_this, _ret); + } + + Route.prototype.getChildContext = function getChildContext() { + return { + router: _extends$6({}, this.context.router, { + route: { + location: this.props.location || this.context.router.route.location, + match: this.state.match + } + }) + }; + }; + + Route.prototype.computeMatch = function computeMatch(_ref, router) { + var computedMatch = _ref.computedMatch, + location = _ref.location, + path = _ref.path, + strict = _ref.strict, + exact = _ref.exact, + sensitive = _ref.sensitive; + + if (computedMatch) return computedMatch; // already computed the match for us + + invariant_1$1(router, "You should not use or withRouter() outside a "); + + var route = router.route; + + var pathname = (location || route.location).pathname; + + return matchPath(pathname, { path: path, strict: strict, exact: exact, sensitive: sensitive }, route.match); + }; + + Route.prototype.componentWillMount = function componentWillMount() { + warning_1(!(this.props.component && this.props.render), "You should not use and in the same route; will be ignored"); + + warning_1(!(this.props.component && this.props.children && !isEmptyChildren(this.props.children)), "You should not use and in the same route; will be ignored"); + + warning_1(!(this.props.render && this.props.children && !isEmptyChildren(this.props.children)), "You should not use and in the same route; will be ignored"); + }; + + Route.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps, nextContext) { + warning_1(!(nextProps.location && !this.props.location), ' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'); + + warning_1(!(!nextProps.location && this.props.location), ' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'); + + this.setState({ + match: this.computeMatch(nextProps, nextContext.router) + }); + }; + + Route.prototype.render = function render() { + var match = this.state.match; + var _props = this.props, + children = _props.children, + component = _props.component, + render = _props.render; + var _context$router = this.context.router, + history = _context$router.history, + route = _context$router.route, + staticContext = _context$router.staticContext; + + var location = this.props.location || route.location; + var props = { match: match, location: location, history: history, staticContext: staticContext }; + + if (component) return match ? React.createElement(component, props) : null; + + if (render) return match ? render(props) : null; + + if (typeof children === "function") return children(props); + + if (children && !isEmptyChildren(children)) return React.Children.only(children); + + return null; + }; + + return Route; + }(React.Component); + + Route.propTypes = { + computedMatch: propTypes.object, // private, from + path: propTypes.string, + exact: propTypes.bool, + strict: propTypes.bool, + sensitive: propTypes.bool, + component: propTypes.func, + render: propTypes.func, + children: propTypes.oneOfType([propTypes.func, propTypes.node]), + location: propTypes.object + }; + Route.contextTypes = { + router: propTypes.shape({ + history: propTypes.object.isRequired, + route: propTypes.object.isRequired, + staticContext: propTypes.object + }) + }; + Route.childContextTypes = { + router: propTypes.object.isRequired + }; + + // Written in this round about way for babel-transform-imports + + /** + * A wrapper that knows if it's "active" or not. + */ + var NavLink = function NavLink(_ref) { + var to = _ref.to, + exact = _ref.exact, + strict = _ref.strict, + location = _ref.location, + activeClassName = _ref.activeClassName, + className = _ref.className, + activeStyle = _ref.activeStyle, + style = _ref.style, + getIsActive = _ref.isActive, + ariaCurrent = _ref["aria-current"], + rest = objectWithoutProperties(_ref, ["to", "exact", "strict", "location", "activeClassName", "className", "activeStyle", "style", "isActive", "aria-current"]); + + var path = (typeof to === "undefined" ? "undefined" : _typeof$3(to)) === "object" ? to.pathname : to; + + // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202 + var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1"); + + return React.createElement(Route, { + path: escapedPath, + exact: exact, + strict: strict, + location: location, + children: function children(_ref2) { + var location = _ref2.location, + match = _ref2.match; + + var isActive = !!(getIsActive ? getIsActive(match, location) : match); + + return React.createElement(Link, _extends$5({ + to: to, + className: isActive ? [className, activeClassName].filter(function (i) { + return i; + }).join(" ") : className, + style: isActive ? _extends$5({}, style, activeStyle) : style, + "aria-current": isActive && ariaCurrent || null + }, rest)); + } + }); + }; + + NavLink.propTypes = { + to: Link.propTypes.to, + exact: propTypes.bool, + strict: propTypes.bool, + location: propTypes.object, + activeClassName: propTypes.string, + className: propTypes.string, + activeStyle: propTypes.object, + style: propTypes.object, + isActive: propTypes.func, + "aria-current": propTypes.oneOf(["page", "step", "location", "date", "time", "true"]) + }; + + NavLink.defaultProps = { + activeClassName: "active", + "aria-current": "page" + }; + + function _classCallCheck$3(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _possibleConstructorReturn$3(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + }return call && (typeof call === "object" || typeof call === "function") ? call : self; + } + + function _inherits$3(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + + /** + * The public API for prompting the user before navigating away + * from a screen with a component. + */ + + var Prompt = function (_React$Component) { + _inherits$3(Prompt, _React$Component); + + function Prompt() { + _classCallCheck$3(this, Prompt); + + return _possibleConstructorReturn$3(this, _React$Component.apply(this, arguments)); + } + + Prompt.prototype.enable = function enable(message) { + if (this.unblock) this.unblock(); + + this.unblock = this.context.router.history.block(message); + }; + + Prompt.prototype.disable = function disable() { + if (this.unblock) { + this.unblock(); + this.unblock = null; + } + }; + + Prompt.prototype.componentWillMount = function componentWillMount() { + invariant_1$1(this.context.router, "You should not use outside a "); + + if (this.props.when) this.enable(this.props.message); + }; + + Prompt.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + if (nextProps.when) { + if (!this.props.when || this.props.message !== nextProps.message) this.enable(nextProps.message); + } else { + this.disable(); + } + }; + + Prompt.prototype.componentWillUnmount = function componentWillUnmount() { + this.disable(); + }; + + Prompt.prototype.render = function render() { + return null; + }; + + return Prompt; + }(React.Component); + + Prompt.propTypes = { + when: propTypes.bool, + message: propTypes.oneOfType([propTypes.func, propTypes.string]).isRequired + }; + Prompt.defaultProps = { + when: true + }; + Prompt.contextTypes = { + router: propTypes.shape({ + history: propTypes.shape({ + block: propTypes.func.isRequired + }).isRequired + }).isRequired + }; + + // Written in this round about way for babel-transform-imports + + var patternCache$1 = {}; + var cacheLimit$1 = 10000; + var cacheCount$1 = 0; + + var compileGenerator = function compileGenerator(pattern) { + var cacheKey = pattern; + var cache = patternCache$1[cacheKey] || (patternCache$1[cacheKey] = {}); + + if (cache[pattern]) return cache[pattern]; + + var compiledGenerator = pathToRegexp_1.compile(pattern); + + if (cacheCount$1 < cacheLimit$1) { + cache[pattern] = compiledGenerator; + cacheCount$1++; + } + + return compiledGenerator; + }; + + /** + * Public API for generating a URL pathname from a pattern and parameters. + */ + var generatePath = function generatePath() { + var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "/"; + var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (pattern === "/") { + return pattern; + } + var generator = compileGenerator(pattern); + return generator(params, { pretty: true }); + }; + + var _extends$7 = 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 _classCallCheck$4(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _possibleConstructorReturn$4(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + }return call && (typeof call === "object" || typeof call === "function") ? call : self; + } + + function _inherits$4(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + + /** + * The public API for updating the location programmatically + * with a component. + */ + + var Redirect = function (_React$Component) { + _inherits$4(Redirect, _React$Component); + + function Redirect() { + _classCallCheck$4(this, Redirect); + + return _possibleConstructorReturn$4(this, _React$Component.apply(this, arguments)); + } + + Redirect.prototype.isStatic = function isStatic() { + return this.context.router && this.context.router.staticContext; + }; + + Redirect.prototype.componentWillMount = function componentWillMount() { + invariant_1$1(this.context.router, "You should not use outside a "); + + if (this.isStatic()) this.perform(); + }; + + Redirect.prototype.componentDidMount = function componentDidMount() { + if (!this.isStatic()) this.perform(); + }; + + Redirect.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { + var prevTo = createLocation(prevProps.to); + var nextTo = createLocation(this.props.to); + + if (locationsAreEqual(prevTo, nextTo)) { + warning_1(false, "You tried to redirect to the same route you're currently on: " + ("\"" + nextTo.pathname + nextTo.search + "\"")); + return; + } + + this.perform(); + }; + + Redirect.prototype.computeTo = function computeTo(_ref) { + var computedMatch = _ref.computedMatch, + to = _ref.to; + + if (computedMatch) { + if (typeof to === "string") { + return generatePath(to, computedMatch.params); + } else { + return _extends$7({}, to, { + pathname: generatePath(to.pathname, computedMatch.params) + }); + } + } + + return to; + }; + + Redirect.prototype.perform = function perform() { + var history = this.context.router.history; + var push = this.props.push; + + var to = this.computeTo(this.props); + + if (push) { + history.push(to); + } else { + history.replace(to); + } + }; + + Redirect.prototype.render = function render() { + return null; + }; + + return Redirect; + }(React.Component); + + Redirect.propTypes = { + computedMatch: propTypes.object, // private, from + push: propTypes.bool, + from: propTypes.string, + to: propTypes.oneOfType([propTypes.string, propTypes.object]).isRequired + }; + Redirect.defaultProps = { + push: false + }; + Redirect.contextTypes = { + router: propTypes.shape({ + history: propTypes.shape({ + push: propTypes.func.isRequired, + replace: propTypes.func.isRequired + }).isRequired, + staticContext: propTypes.object + }).isRequired + }; + + // Written in this round about way for babel-transform-imports + + var _extends$8 = 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 _objectWithoutProperties(obj, keys) { + var target = {};for (var i in obj) { + if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; + }return target; + } + + function _classCallCheck$5(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _possibleConstructorReturn$5(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + }return call && (typeof call === "object" || typeof call === "function") ? call : self; + } + + function _inherits$5(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + + var addLeadingSlash$1 = function addLeadingSlash(path) { + return path.charAt(0) === "/" ? path : "/" + path; + }; + + var addBasename = function addBasename(basename, location) { + if (!basename) return location; + + return _extends$8({}, location, { + pathname: addLeadingSlash$1(basename) + location.pathname + }); + }; + + var stripBasename$1 = function stripBasename(basename, location) { + if (!basename) return location; + + var base = addLeadingSlash$1(basename); + + if (location.pathname.indexOf(base) !== 0) return location; + + return _extends$8({}, location, { + pathname: location.pathname.substr(base.length) + }); + }; + + var createURL = function createURL(location) { + return typeof location === "string" ? location : createPath(location); + }; + + var staticHandler = function staticHandler(methodName) { + return function () { + invariant_1$1(false, "You cannot %s with ", methodName); + }; + }; + + var noop = function noop() {}; + + /** + * The public top-level API for a "static" , so-called because it + * can't actually change the current location. Instead, it just records + * location changes in a context object. Useful mainly in testing and + * server-rendering scenarios. + */ + + var StaticRouter = function (_React$Component) { + _inherits$5(StaticRouter, _React$Component); + + function StaticRouter() { + var _temp, _this, _ret; + + _classCallCheck$5(this, StaticRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn$5(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.createHref = function (path) { + return addLeadingSlash$1(_this.props.basename + createURL(path)); + }, _this.handlePush = function (location) { + var _this$props = _this.props, + basename = _this$props.basename, + context = _this$props.context; + + context.action = "PUSH"; + context.location = addBasename(basename, createLocation(location)); + context.url = createURL(context.location); + }, _this.handleReplace = function (location) { + var _this$props2 = _this.props, + basename = _this$props2.basename, + context = _this$props2.context; + + context.action = "REPLACE"; + context.location = addBasename(basename, createLocation(location)); + context.url = createURL(context.location); + }, _this.handleListen = function () { + return noop; + }, _this.handleBlock = function () { + return noop; + }, _temp), _possibleConstructorReturn$5(_this, _ret); + } + + StaticRouter.prototype.getChildContext = function getChildContext() { + return { + router: { + staticContext: this.props.context + } + }; + }; + + StaticRouter.prototype.componentWillMount = function componentWillMount() { + warning_1(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { StaticRouter as Router }`."); + }; + + StaticRouter.prototype.render = function render() { + var _props = this.props, + basename = _props.basename, + context = _props.context, + location = _props.location, + props = _objectWithoutProperties(_props, ["basename", "context", "location"]); + + var history = { + createHref: this.createHref, + action: "POP", + location: stripBasename$1(basename, createLocation(location)), + push: this.handlePush, + replace: this.handleReplace, + go: staticHandler("go"), + goBack: staticHandler("goBack"), + goForward: staticHandler("goForward"), + listen: this.handleListen, + block: this.handleBlock + }; + + return React.createElement(Router, _extends$8({}, props, { history: history })); + }; + + return StaticRouter; + }(React.Component); + + StaticRouter.propTypes = { + basename: propTypes.string, + context: propTypes.object.isRequired, + location: propTypes.oneOfType([propTypes.string, propTypes.object]) + }; + StaticRouter.defaultProps = { + basename: "", + location: "/" + }; + StaticRouter.childContextTypes = { + router: propTypes.object.isRequired + }; + + // Written in this round about way for babel-transform-imports + + function _classCallCheck$6(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _possibleConstructorReturn$6(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + }return call && (typeof call === "object" || typeof call === "function") ? call : self; + } + + function _inherits$6(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + + /** + * The public API for rendering the first that matches. + */ + + var Switch = function (_React$Component) { + _inherits$6(Switch, _React$Component); + + function Switch() { + _classCallCheck$6(this, Switch); + + return _possibleConstructorReturn$6(this, _React$Component.apply(this, arguments)); + } + + Switch.prototype.componentWillMount = function componentWillMount() { + invariant_1$1(this.context.router, "You should not use outside a "); + }; + + Switch.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + warning_1(!(nextProps.location && !this.props.location), ' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'); + + warning_1(!(!nextProps.location && this.props.location), ' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'); + }; + + Switch.prototype.render = function render() { + var route = this.context.router.route; + var children = this.props.children; + + var location = this.props.location || route.location; + + var match = void 0, + child = void 0; + React.Children.forEach(children, function (element) { + if (match == null && React.isValidElement(element)) { + var _element$props = element.props, + pathProp = _element$props.path, + exact = _element$props.exact, + strict = _element$props.strict, + sensitive = _element$props.sensitive, + from = _element$props.from; + + var path = pathProp || from; + + child = element; + match = matchPath(location.pathname, { path: path, exact: exact, strict: strict, sensitive: sensitive }, route.match); + } + }); + + return match ? React.cloneElement(child, { location: location, computedMatch: match }) : null; + }; + + return Switch; + }(React.Component); + + Switch.contextTypes = { + router: propTypes.shape({ + route: propTypes.object.isRequired + }).isRequired + }; + Switch.propTypes = { + children: propTypes.node, + location: propTypes.object + }; + + // Written in this round about way for babel-transform-imports + + // Written in this round about way for babel-transform-imports + + // Written in this round about way for babel-transform-imports + + var hoistNonReactStatics = createCommonjsModule(function (module, exports) { + /** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ + (function (global, factory) { + module.exports = factory(); + })(commonjsGlobal, function () { + + var REACT_STATICS = { + childContextTypes: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true + }; + + var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true + }; + + var defineProperty = Object.defineProperty; + var getOwnPropertyNames = Object.getOwnPropertyNames; + var getOwnPropertySymbols = Object.getOwnPropertySymbols; + var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + var getPrototypeOf = Object.getPrototypeOf; + var objectPrototype = getPrototypeOf && getPrototypeOf(Object); + + return function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { + // don't hoist over string (html) components + + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + try { + // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + + return targetComponent; + } + + return targetComponent; + }; + }); + }); + + var _extends$9 = 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 _objectWithoutProperties$1(obj, keys) { + var target = {};for (var i in obj) { + if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; + }return target; + } + + /** + * A public higher-order component to access the imperative API + */ + var withRouter = function withRouter(Component) { + var C = function C(props) { + var wrappedComponentRef = props.wrappedComponentRef, + remainingProps = _objectWithoutProperties$1(props, ["wrappedComponentRef"]); + + return React.createElement(Route, { + children: function children(routeComponentProps) { + return React.createElement(Component, _extends$9({}, remainingProps, routeComponentProps, { + ref: wrappedComponentRef + })); + } + }); + }; + + C.displayName = "withRouter(" + (Component.displayName || Component.name) + ")"; + C.WrappedComponent = Component; + C.propTypes = { + wrappedComponentRef: propTypes.func + }; + + return hoistNonReactStatics(C, Component); + }; + + // Written in this round about way for babel-transform-imports + + exports.BrowserRouter = BrowserRouter; + exports.HashRouter = HashRouter; + exports.Link = Link; + exports.MemoryRouter = MemoryRouter; + exports.NavLink = NavLink; + exports.Prompt = Prompt; + exports.Redirect = Redirect; + exports.Route = Route; + exports.Router = Router; + exports.StaticRouter = StaticRouter; + exports.Switch = Switch; + exports.generatePath = generatePath; + exports.matchPath = matchPath; + exports.withRouter = withRouter; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/node_modules/react-router-dom/umd/react-router-dom.min.js b/node_modules/react-router-dom/umd/react-router-dom.min.js new file mode 100644 index 00000000..5d8b271d --- /dev/null +++ b/node_modules/react-router-dom/umd/react-router-dom.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t.ReactRouterDOM={},t.React)}(this,function(t,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var n=function(){};"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function o(t,e){return t(e={exports:{}},e.exports),e.exports}function r(t){return function(){return t}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(t){return t};var a=i,c=function(t){};var s=function(t,e,n,o,r,i,a,s){if(c(e),!t){var u;if(void 0===e)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,o,r,i,a,s],l=0;(u=new Error(e.replace(/%s/g,function(){return p[l++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}},u=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;(function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}})()&&Object.assign;var f="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",h=o(function(t){t.exports=function(){function t(t,e,n,o,r,i){i!==f&&s(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return n.checkPropTypes=a,n.PropTypes=n,n}()}),d=function(t,e,n,o,r,i,a,c){if(!t){var s;if(void 0===e)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,o,r,i,a,c],p=0;(s=new Error(e.replace(/%s/g,function(){return u[p++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}};function y(t){return"/"===t.charAt(0)}function v(t,e){for(var n=e,o=n+1,r=t.length;o1&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],o=e&&e.split("/")||[],r=t&&y(t),i=e&&y(e),a=r||i;if(t&&y(t)?o=n:n.length&&(o.pop(),o=o.concat(n)),!o.length)return"/";var c=void 0;if(o.length){var s=o[o.length-1];c="."===s||".."===s||""===s}else c=!1;for(var u=0,p=o.length;p>=0;p--){var l=o[p];"."===l?v(o,p):".."===l?(v(o,p),u++):u&&(v(o,p),u--)}if(!a)for(;u--;u)o.unshift("..");!a||""===o[0]||o[0]&&y(o[0])||o.unshift("");var f=o.join("/");return c&&"/"!==f.substr(-1)&&(f+="/"),f}(r.pathname,o.pathname)):r.pathname=o.pathname:r.pathname||(r.pathname="/"),r},E=function(t,e){return t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&function t(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(Array.isArray(e))return Array.isArray(n)&&e.length===n.length&&e.every(function(e,o){return t(e,n[o])});var o=void 0===e?"undefined":m(e);if(o!==(void 0===n?"undefined":m(n)))return!1;if("object"===o){var r=e.valueOf(),i=n.valueOf();if(r!==e||i!==n)return t(r,i);var a=Object.keys(e),c=Object.keys(n);return a.length===c.length&&a.every(function(o){return t(e[o],n[o])})}return!1}(t.state,e.state)},T=function(){var t=null,e=[];return{setPrompt:function(e){return n(null==t,"A history supports only one prompt at a time"),t=e,function(){t===e&&(t=null)}},confirmTransitionTo:function(e,o,r,i){if(null!=t){var a="function"==typeof t?t(e,o):t;"string"==typeof a?"function"==typeof r?r(a,i):(n(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),i(!0)):i(!1!==a)}else i(!0)},appendListener:function(t){var n=!0,o=function(){n&&t.apply(void 0,arguments)};return e.push(o),function(){n=!1,e=e.filter(function(t){return t!==o})}},notifyListeners:function(){for(var t=arguments.length,n=Array(t),o=0;o0&&void 0!==arguments[0]?arguments[0]:{};d(C,"Browser history needs a DOM");var e,o=window.history,r=(-1===(e=window.navigator.userAgent).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,i=!(-1===window.navigator.userAgent.indexOf("Trident")),a=t.forceRefresh,c=void 0!==a&&a,s=t.getUserConfirmation,u=void 0===s?A:s,p=t.keyLength,l=void 0===p?6:p,f=t.basename?x(b(t.basename)):"",h=function(t){var e=t||{},o=e.key,r=e.state,i=window.location,a=i.pathname+i.search+i.hash;return n(!f||w(a,f),'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "'+a+'" to begin with "'+f+'".'),f&&(a=O(a,f)),j(a,r,o)},y=function(){return Math.random().toString(36).substr(2,l)},v=T(),m=function(t){M($,t),$.length=o.length,v.notifyListeners($.location,$.action)},g=function(t){(function(t){return void 0===t.state&&-1===navigator.userAgent.indexOf("CriOS")})(t)||q(h(t.state))},P=function(){q(h(L()))},E=!1,q=function(t){if(E)E=!1,m();else{v.confirmTransitionTo(t,"POP",u,function(e){e?m({action:"POP",location:t}):U(t)})}},U=function(t){var e=$.location,n=Y.indexOf(e.key);-1===n&&(n=0);var o=Y.indexOf(t.key);-1===o&&(o=0);var r=n-o;r&&(E=!0,I(r))},H=h(L()),Y=[H.key],W=function(t){return f+R(t)},I=function(t){o.go(t)},N=0,B=function(t){1===(N+=t)?(S(window,"popstate",g),i&&S(window,"hashchange",P)):0===N&&(k(window,"popstate",g),i&&k(window,"hashchange",P))},D=!1,$={length:o.length,action:"POP",location:H,createHref:W,push:function(t,e){n(!("object"===(void 0===t?"undefined":_(t))&&void 0!==t.state&&void 0!==e),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var i=j(t,e,y(),$.location);v.confirmTransitionTo(i,"PUSH",u,function(t){if(t){var e=W(i),a=i.key,s=i.state;if(r)if(o.pushState({key:a,state:s},null,e),c)window.location.href=e;else{var u=Y.indexOf($.location.key),p=Y.slice(0,-1===u?0:u+1);p.push(i.key),Y=p,m({action:"PUSH",location:i})}else n(void 0===s,"Browser history cannot push state in browsers that do not support HTML5 history"),window.location.href=e}})},replace:function(t,e){n(!("object"===(void 0===t?"undefined":_(t))&&void 0!==t.state&&void 0!==e),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var i=j(t,e,y(),$.location);v.confirmTransitionTo(i,"REPLACE",u,function(t){if(t){var e=W(i),a=i.key,s=i.state;if(r)if(o.replaceState({key:a,state:s},null,e),c)window.location.replace(e);else{var u=Y.indexOf($.location.key);-1!==u&&(Y[u]=i.key),m({action:"REPLACE",location:i})}else n(void 0===s,"Browser history cannot replace state in browsers that do not support HTML5 history"),window.location.replace(e)}})},go:I,goBack:function(){return I(-1)},goForward:function(){return I(1)},block:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=v.setPrompt(t);return D||(B(1),D=!0),function(){return D&&(D=!1,B(-1)),e()}},listen:function(t){var e=v.appendListener(t);return B(1),function(){B(-1),e()}}};return $},U=Object.assign||function(t){for(var e=1;e=0?e:0)+"#"+t)},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d(C,"Hash history needs a DOM");var e=window.history,o=-1===window.navigator.userAgent.indexOf("Firefox"),r=t.getUserConfirmation,i=void 0===r?A:r,a=t.hashType,c=void 0===a?"slash":a,s=t.basename?x(b(t.basename)):"",u=H[c],p=u.encodePath,l=u.decodePath,f=function(){var t=l(Y());return n(!s||w(t,s),'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "'+t+'" to begin with "'+s+'".'),s&&(t=O(t,s)),j(t)},h=T(),y=function(t){U(F,t),F.length=e.length,h.notifyListeners(F.location,F.action)},v=!1,m=null,g=function(){var t=Y(),e=p(t);if(t!==e)W(e);else{var n=f(),o=F.location;if(!v&&E(o,n))return;if(m===R(n))return;m=null,P(n)}},P=function(t){if(v)v=!1,y();else{h.confirmTransitionTo(t,"POP",i,function(e){e?y({action:"POP",location:t}):_(t)})}},_=function(t){var e=F.location,n=I.lastIndexOf(R(e));-1===n&&(n=0);var o=I.lastIndexOf(R(t));-1===o&&(o=0);var r=n-o;r&&(v=!0,N(r))},M=Y(),L=p(M);M!==L&&W(L);var q=f(),I=[R(q)],N=function(t){n(o,"Hash history go(n) causes a full page reload in this browser"),e.go(t)},B=0,D=function(t){1===(B+=t)?S(window,"hashchange",g):0===B&&k(window,"hashchange",g)},$=!1,F={length:e.length,action:"POP",location:q,createHref:function(t){return"#"+p(s+R(t))},push:function(t,e){n(void 0===e,"Hash history cannot push state; it is ignored");var o=j(t,void 0,void 0,F.location);h.confirmTransitionTo(o,"PUSH",i,function(t){if(t){var e=R(o),r=p(s+e);if(Y()!==r){m=e,function(t){window.location.hash=t}(r);var i=I.lastIndexOf(R(F.location)),a=I.slice(0,-1===i?0:i+1);a.push(e),I=a,y({action:"PUSH",location:o})}else n(!1,"Hash history cannot PUSH the same path; a new entry will not be added to the history stack"),y()}})},replace:function(t,e){n(void 0===e,"Hash history cannot replace state; it is ignored");var o=j(t,void 0,void 0,F.location);h.confirmTransitionTo(o,"REPLACE",i,function(t){if(t){var e=R(o),n=p(s+e);Y()!==n&&(m=e,W(n));var r=I.indexOf(R(F.location));-1!==r&&(I[r]=e),y({action:"REPLACE",location:o})}})},go:N,goBack:function(){return N(-1)},goForward:function(){return N(1)},block:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=h.setPrompt(t);return $||(D(1),$=!0),function(){return $&&($=!1,D(-1)),e()}},listen:function(t){var e=h.appendListener(t);return D(1),function(){D(-1),e()}}};return F},N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{},e=t.getUserConfirmation,o=t.initialEntries,r=void 0===o?["/"]:o,i=t.initialIndex,a=void 0===i?0:i,c=t.keyLength,s=void 0===c?6:c,u=T(),p=function(t){B(v,t),v.length=v.entries.length,u.notifyListeners(v.location,v.action)},l=function(){return Math.random().toString(36).substr(2,s)},f=D(a,0,r.length-1),h=r.map(function(t){return j(t,void 0,"string"==typeof t?l():t.key||l())}),d=R,y=function(t){var n=D(v.index+t,0,v.entries.length-1),o=v.entries[n];u.confirmTransitionTo(o,"POP",e,function(t){t?p({action:"POP",location:o,index:n}):p()})},v={length:h.length,action:"POP",location:h[f],index:f,entries:h,createHref:d,push:function(t,o){n(!("object"===(void 0===t?"undefined":N(t))&&void 0!==t.state&&void 0!==o),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var r=j(t,o,l(),v.location);u.confirmTransitionTo(r,"PUSH",e,function(t){if(t){var e=v.index+1,n=v.entries.slice(0);n.length>e?n.splice(e,n.length-e,r):n.push(r),p({action:"PUSH",location:r,index:e,entries:n})}})},replace:function(t,o){n(!("object"===(void 0===t?"undefined":N(t))&&void 0!==t.state&&void 0!==o),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var r=j(t,o,l(),v.location);u.confirmTransitionTo(r,"REPLACE",e,function(t){t&&(v.entries[v.index]=r,p({action:"REPLACE",location:r}))})},go:y,goBack:function(){return y(-1)},goForward:function(){return y(1)},canGo:function(t){var e=v.index+t;return e>=0&&e0&&void 0!==arguments[0]&&arguments[0];return u.setPrompt(t)},listen:function(t){return u.appendListener(t)}};return v},F=Object.assign||function(t){for(var e=1;e may have only one child element"),this.unlisten=r.listen(function(){t.setState({match:t.computeMatch(r.location.pathname)})})},o.prototype.componentWillReceiveProps=function(t){n(this.props.history===t.history,"You cannot change ")},o.prototype.componentWillUnmount=function(){this.unlisten()},o.prototype.render=function(){var t=this.props.children;return t?e.Children.only(t):null},o}(e.Component);V.propTypes={history:h.object.isRequired,children:h.node},V.contextTypes={router:h.object},V.childContextTypes={router:h.object.isRequired};var J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},z=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n},Z=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},tt=function(t){function n(){var e,o;G(this,n);for(var r=arguments.length,i=Array(r),a=0;a ignores the history prop. To use a custom history, use `import { Router }` instead of `import { MemoryRouter as Router }`.")},o.prototype.render=function(){return e.createElement(V,{history:this.history,children:this.props.children})},o}(e.Component);it.propTypes={initialEntries:h.array,initialIndex:h.number,getUserConfirmation:h.func,keyLength:h.number,children:h.node};var at={}.toString,ct=Array.isArray||function(t){return"[object Array]"==at.call(t)},st=xt,ut=dt,pt=function(t,e){return vt(dt(t,e))},lt=vt,ft=Ot,ht=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function dt(t,e){for(var n,o=[],r=0,i=0,a="",c=e&&e.delimiter||"/";null!=(n=ht.exec(t));){var s=n[0],u=n[1],p=n.index;if(a+=t.slice(i,p),i=p+s.length,u)a+=u[1];else{var l=t[i],f=n[2],h=n[3],d=n[4],y=n[5],v=n[6],m=n[7];a&&(o.push(a),a="");var b=null!=f&&null!=l&&l!==f,g="+"===v||"*"===v,w="?"===v||"*"===v,O=n[2]||c,x=d||y;o.push({name:h||r++,prefix:f||"",delimiter:O,optional:w,repeat:g,partial:b,asterisk:!!m,pattern:x?bt(x):m?".*":"[^"+mt(O)+"]+?"})}}return i1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];"string"==typeof e&&(e={path:e});var o=e,r=o.path,i=o.exact,a=void 0!==i&&i,c=o.strict,s=void 0!==c&&c,u=o.sensitive,p=void 0!==u&&u;if(null==r)return n;var l=function(t,e){var n=""+e.end+e.strict+e.sensitive,o=Rt[n]||(Rt[n]={});if(o[t])return o[t];var r=[],i={re:st(t,r,e),keys:r};return Pt<1e4&&(o[t]=i,Pt++),i}(r,{end:a,strict:s,sensitive:p}),f=l.re,h=l.keys,d=f.exec(t);if(!d)return null;var y=d[0],v=d.slice(1),m=t===y;return a&&!m?null:{path:r,url:"/"===r&&""===y?"/":y,isExact:m,params:h.reduce(function(t,e,n){return t[e.name]=v[n],t},{})}},Et=Object.assign||function(t){for(var e=1;e or withRouter() outside a ");var s=e.route,u=(o||s.location).pathname;return jt(u,{path:r,strict:i,exact:a,sensitive:c},s.match)},o.prototype.componentWillMount=function(){n(!(this.props.component&&this.props.render),"You should not use and in the same route; will be ignored"),n(!(this.props.component&&this.props.children&&!Ct(this.props.children)),"You should not use and in the same route; will be ignored"),n(!(this.props.render&&this.props.children&&!Ct(this.props.children)),"You should not use and in the same route; will be ignored")},o.prototype.componentWillReceiveProps=function(t,e){n(!(t.location&&!this.props.location),' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),n(!(!t.location&&this.props.location),' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'),this.setState({match:this.computeMatch(t,e.router)})},o.prototype.render=function(){var t=this.state.match,n=this.props,o=n.children,r=n.component,i=n.render,a=this.context.router,c=a.history,s=a.route,u=a.staticContext,p={match:t,location:this.props.location||s.location,history:c,staticContext:u};return r?t?e.createElement(r,p):null:i?t?i(p):null:"function"==typeof o?o(p):o&&!Ct(o)?e.Children.only(o):null},o}(e.Component);St.propTypes={computedMatch:h.object,path:h.string,exact:h.bool,strict:h.bool,sensitive:h.bool,component:h.func,render:h.func,children:h.oneOfType([h.func,h.node]),location:h.object},St.contextTypes={router:h.shape({history:h.object.isRequired,route:h.object.isRequired,staticContext:h.object})},St.childContextTypes={router:h.object.isRequired};var kt=function(t){var n=t.to,o=t.exact,r=t.strict,i=t.location,a=t.activeClassName,c=t.className,s=t.activeStyle,u=t.style,p=t.isActive,l=t["aria-current"],f=X(t,["to","exact","strict","location","activeClassName","className","activeStyle","style","isActive","aria-current"]),h="object"===(void 0===n?"undefined":J(n))?n.pathname:n,d=h&&h.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1");return e.createElement(St,{path:d,exact:o,strict:r,location:i,children:function(t){var o=t.location,r=t.match,i=!!(p?p(r,o):r);return e.createElement(ot,z({to:n,className:i?[c,a].filter(function(t){return t}).join(" "):c,style:i?z({},u,s):u,"aria-current":i&&l||null},f))}})};kt.defaultProps={activeClassName:"active","aria-current":"page"};var At=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.enable=function(t){this.unblock&&this.unblock(),this.unblock=this.context.router.history.block(t)},e.prototype.disable=function(){this.unblock&&(this.unblock(),this.unblock=null)},e.prototype.componentWillMount=function(){d(this.context.router,"You should not use outside a "),this.props.when&&this.enable(this.props.message)},e.prototype.componentWillReceiveProps=function(t){t.when?this.props.when&&this.props.message===t.message||this.enable(t.message):this.disable()},e.prototype.componentWillUnmount=function(){this.disable()},e.prototype.render=function(){return null},e}(e.Component);At.propTypes={when:h.bool,message:h.oneOfType([h.func,h.string]).isRequired},At.defaultProps={when:!0},At.contextTypes={router:h.shape({history:h.shape({block:h.func.isRequired}).isRequired}).isRequired};var _t={},Mt=0,Lt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"/"===t?t:function(t){var e=t,n=_t[e]||(_t[e]={});if(n[t])return n[t];var o=st.compile(t);return Mt<1e4&&(n[t]=o,Mt++),o}(t)(e,{pretty:!0})},qt=Object.assign||function(t){for(var e=1;e outside a "),this.isStatic()&&this.perform()},e.prototype.componentDidMount=function(){this.isStatic()||this.perform()},e.prototype.componentDidUpdate=function(t){var e=j(t.to),o=j(this.props.to);E(e,o)?n(!1,"You tried to redirect to the same route you're currently on: \""+o.pathname+o.search+'"'):this.perform()},e.prototype.computeTo=function(t){var e=t.computedMatch,n=t.to;return e?"string"==typeof n?Lt(n,e.params):qt({},n,{pathname:Lt(n.pathname,e.params)}):n},e.prototype.perform=function(){var t=this.context.router.history,e=this.props.push,n=this.computeTo(this.props);e?t.push(n):t.replace(n)},e.prototype.render=function(){return null},e}(e.Component);Ut.propTypes={computedMatch:h.object,push:h.bool,from:h.string,to:h.oneOfType([h.string,h.object]).isRequired},Ut.defaultProps={push:!1},Ut.contextTypes={router:h.shape({history:h.shape({push:h.func.isRequired,replace:h.func.isRequired}).isRequired,staticContext:h.object}).isRequired};var Ht=Object.assign||function(t){for(var e=1;e",t)}},Dt=function(){},$t=function(t){function o(){var e,n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);for(var r=arguments.length,i=Array(r),a=0;a ignores the history prop. To use a custom history, use `import { Router }` instead of `import { StaticRouter as Router }`.")},o.prototype.render=function(){var t=this.props,n=t.basename,o=(t.context,t.location),r=function(t,e){var n={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}(t,["basename","context","location"]),i={createHref:this.createHref,action:"POP",location:function(t,e){if(!t)return e;var n=Wt(t);return 0!==e.pathname.indexOf(n)?e:Ht({},e,{pathname:e.pathname.substr(n.length)})}(n,j(o)),push:this.handlePush,replace:this.handleReplace,go:Bt("go"),goBack:Bt("goBack"),goForward:Bt("goForward"),listen:this.handleListen,block:this.handleBlock};return e.createElement(V,Ht({},r,{history:i}))},o}(e.Component);$t.propTypes={basename:h.string,context:h.object.isRequired,location:h.oneOfType([h.string,h.object])},$t.defaultProps={basename:"",location:"/"},$t.childContextTypes={router:h.object.isRequired};var Ft=function(t){function o(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,t),o.prototype.componentWillMount=function(){d(this.context.router,"You should not use outside a ")},o.prototype.componentWillReceiveProps=function(t){n(!(t.location&&!this.props.location),' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),n(!(!t.location&&this.props.location),' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.')},o.prototype.render=function(){var t=this.context.router.route,n=this.props.children,o=this.props.location||t.location,r=void 0,i=void 0;return e.Children.forEach(n,function(n){if(null==r&&e.isValidElement(n)){var a=n.props,c=a.path,s=a.exact,u=a.strict,p=a.sensitive,l=a.from,f=c||l;i=n,r=jt(o.pathname,{path:f,exact:s,strict:u,sensitive:p},t.match)}}),r?e.cloneElement(i,{location:o,computedMatch:r}):null},o}(e.Component);Ft.contextTypes={router:h.shape({route:h.object.isRequired}).isRequired},Ft.propTypes={children:h.node,location:h.object};var Kt=o(function(t,e){var n,o,r,i,a,c,s,u;t.exports=(n={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r=Object.defineProperty,i=Object.getOwnPropertyNames,a=Object.getOwnPropertySymbols,c=Object.getOwnPropertyDescriptor,s=Object.getPrototypeOf,u=s&&s(Object),function t(e,p,l){if("string"!=typeof p){if(u){var f=s(p);f&&f!==u&&t(e,f,l)}var h=i(p);a&&(h=h.concat(a(p)));for(var d=0;d=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}(n,["wrappedComponentRef"]);return e.createElement(St,{children:function(n){return e.createElement(t,Vt({},r,n,{ref:o}))}})};return n.displayName="withRouter("+(t.displayName||t.name)+")",n.WrappedComponent=t,n.propTypes={wrappedComponentRef:h.func},Kt(n,t)},Object.defineProperty(t,"__esModule",{value:!0})}); diff --git a/node_modules/react-router-dom/withRouter.js b/node_modules/react-router-dom/withRouter.js new file mode 100644 index 00000000..53f20a47 --- /dev/null +++ b/node_modules/react-router-dom/withRouter.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.__esModule = true; + +var _withRouter = require("react-router/withRouter"); + +var _withRouter2 = _interopRequireDefault(_withRouter); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _withRouter2.default; // Written in this round about way for babel-transform-imports \ No newline at end of file diff --git a/node_modules/react-router/MemoryRouter.js b/node_modules/react-router/MemoryRouter.js new file mode 100644 index 00000000..774ea7a9 --- /dev/null +++ b/node_modules/react-router/MemoryRouter.js @@ -0,0 +1,67 @@ +"use strict"; + +exports.__esModule = true; + +var _warning = require("warning"); + +var _warning2 = _interopRequireDefault(_warning); + +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _history = require("history"); + +var _Router = require("./Router"); + +var _Router2 = _interopRequireDefault(_Router); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +/** + * The public API for a that stores location in memory. + */ +var MemoryRouter = function (_React$Component) { + _inherits(MemoryRouter, _React$Component); + + function MemoryRouter() { + var _temp, _this, _ret; + + _classCallCheck(this, MemoryRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = (0, _history.createMemoryHistory)(_this.props), _temp), _possibleConstructorReturn(_this, _ret); + } + + MemoryRouter.prototype.componentWillMount = function componentWillMount() { + (0, _warning2.default)(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { MemoryRouter as Router }`."); + }; + + MemoryRouter.prototype.render = function render() { + return _react2.default.createElement(_Router2.default, { history: this.history, children: this.props.children }); + }; + + return MemoryRouter; +}(_react2.default.Component); + +MemoryRouter.propTypes = { + initialEntries: _propTypes2.default.array, + initialIndex: _propTypes2.default.number, + getUserConfirmation: _propTypes2.default.func, + keyLength: _propTypes2.default.number, + children: _propTypes2.default.node +}; +exports.default = MemoryRouter; \ No newline at end of file diff --git a/node_modules/react-router/Prompt.js b/node_modules/react-router/Prompt.js new file mode 100644 index 00000000..c0cd0f61 --- /dev/null +++ b/node_modules/react-router/Prompt.js @@ -0,0 +1,90 @@ +"use strict"; + +exports.__esModule = true; + +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _invariant = require("invariant"); + +var _invariant2 = _interopRequireDefault(_invariant); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +/** + * The public API for prompting the user before navigating away + * from a screen with a component. + */ +var Prompt = function (_React$Component) { + _inherits(Prompt, _React$Component); + + function Prompt() { + _classCallCheck(this, Prompt); + + return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); + } + + Prompt.prototype.enable = function enable(message) { + if (this.unblock) this.unblock(); + + this.unblock = this.context.router.history.block(message); + }; + + Prompt.prototype.disable = function disable() { + if (this.unblock) { + this.unblock(); + this.unblock = null; + } + }; + + Prompt.prototype.componentWillMount = function componentWillMount() { + (0, _invariant2.default)(this.context.router, "You should not use outside a "); + + if (this.props.when) this.enable(this.props.message); + }; + + Prompt.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + if (nextProps.when) { + if (!this.props.when || this.props.message !== nextProps.message) this.enable(nextProps.message); + } else { + this.disable(); + } + }; + + Prompt.prototype.componentWillUnmount = function componentWillUnmount() { + this.disable(); + }; + + Prompt.prototype.render = function render() { + return null; + }; + + return Prompt; +}(_react2.default.Component); + +Prompt.propTypes = { + when: _propTypes2.default.bool, + message: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.string]).isRequired +}; +Prompt.defaultProps = { + when: true +}; +Prompt.contextTypes = { + router: _propTypes2.default.shape({ + history: _propTypes2.default.shape({ + block: _propTypes2.default.func.isRequired + }).isRequired + }).isRequired +}; +exports.default = Prompt; \ No newline at end of file diff --git a/node_modules/react-router/README.md b/node_modules/react-router/README.md new file mode 100644 index 00000000..a46e3167 --- /dev/null +++ b/node_modules/react-router/README.md @@ -0,0 +1,40 @@ +# react-router + +Declarative routing for [React](https://facebook.github.io/react). + +## Installation + +Using [npm](https://www.npmjs.com/): + + $ npm install --save react-router + +**Note:** This package provides the core routing functionality for React Router, but you might not want to install it directly. If you are writing an application that will run in the browser, you should instead install `react-router-dom`. Similarly, if you are writing a React Native application, you should instead install `react-router-native`. Both of those will install `react-router` as a dependency. + + +Then with a module bundler like [webpack](https://webpack.github.io/), use as you would anything else: + +```js +// using ES6 modules +import { Router, Route, Switch } from 'react-router' + +// using CommonJS modules +var Router = require('react-router').Router +var Route = require('react-router').Route +var Switch = require('react-router').Switch +``` + +The UMD build is also available on [unpkg](https://unpkg.com): + +```html + +``` + +You can find the library on `window.ReactRouter`. + +## Issues + +If you find a bug, please file an issue on [our issue tracker on GitHub](https://github.com/ReactTraining/react-router/issues). + +## Credits + +React Router is built and maintained by [React Training](https://reacttraining.com). diff --git a/node_modules/react-router/Redirect.js b/node_modules/react-router/Redirect.js new file mode 100644 index 00000000..e731d19c --- /dev/null +++ b/node_modules/react-router/Redirect.js @@ -0,0 +1,131 @@ +"use strict"; + +exports.__esModule = true; + +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; }; + +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _warning = require("warning"); + +var _warning2 = _interopRequireDefault(_warning); + +var _invariant = require("invariant"); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _history = require("history"); + +var _generatePath = require("./generatePath"); + +var _generatePath2 = _interopRequireDefault(_generatePath); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +/** + * The public API for updating the location programmatically + * with a component. + */ +var Redirect = function (_React$Component) { + _inherits(Redirect, _React$Component); + + function Redirect() { + _classCallCheck(this, Redirect); + + return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); + } + + Redirect.prototype.isStatic = function isStatic() { + return this.context.router && this.context.router.staticContext; + }; + + Redirect.prototype.componentWillMount = function componentWillMount() { + (0, _invariant2.default)(this.context.router, "You should not use outside a "); + + if (this.isStatic()) this.perform(); + }; + + Redirect.prototype.componentDidMount = function componentDidMount() { + if (!this.isStatic()) this.perform(); + }; + + Redirect.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { + var prevTo = (0, _history.createLocation)(prevProps.to); + var nextTo = (0, _history.createLocation)(this.props.to); + + if ((0, _history.locationsAreEqual)(prevTo, nextTo)) { + (0, _warning2.default)(false, "You tried to redirect to the same route you're currently on: " + ("\"" + nextTo.pathname + nextTo.search + "\"")); + return; + } + + this.perform(); + }; + + Redirect.prototype.computeTo = function computeTo(_ref) { + var computedMatch = _ref.computedMatch, + to = _ref.to; + + if (computedMatch) { + if (typeof to === "string") { + return (0, _generatePath2.default)(to, computedMatch.params); + } else { + return _extends({}, to, { + pathname: (0, _generatePath2.default)(to.pathname, computedMatch.params) + }); + } + } + + return to; + }; + + Redirect.prototype.perform = function perform() { + var history = this.context.router.history; + var push = this.props.push; + + var to = this.computeTo(this.props); + + if (push) { + history.push(to); + } else { + history.replace(to); + } + }; + + Redirect.prototype.render = function render() { + return null; + }; + + return Redirect; +}(_react2.default.Component); + +Redirect.propTypes = { + computedMatch: _propTypes2.default.object, // private, from + push: _propTypes2.default.bool, + from: _propTypes2.default.string, + to: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]).isRequired +}; +Redirect.defaultProps = { + push: false +}; +Redirect.contextTypes = { + router: _propTypes2.default.shape({ + history: _propTypes2.default.shape({ + push: _propTypes2.default.func.isRequired, + replace: _propTypes2.default.func.isRequired + }).isRequired, + staticContext: _propTypes2.default.object + }).isRequired +}; +exports.default = Redirect; \ No newline at end of file diff --git a/node_modules/react-router/Route.js b/node_modules/react-router/Route.js new file mode 100644 index 00000000..fec13ffe --- /dev/null +++ b/node_modules/react-router/Route.js @@ -0,0 +1,157 @@ +"use strict"; + +exports.__esModule = true; + +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; }; + +var _warning = require("warning"); + +var _warning2 = _interopRequireDefault(_warning); + +var _invariant = require("invariant"); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _matchPath = require("./matchPath"); + +var _matchPath2 = _interopRequireDefault(_matchPath); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var isEmptyChildren = function isEmptyChildren(children) { + return _react2.default.Children.count(children) === 0; +}; + +/** + * The public API for matching a single path and rendering. + */ + +var Route = function (_React$Component) { + _inherits(Route, _React$Component); + + function Route() { + var _temp, _this, _ret; + + _classCallCheck(this, Route); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = { + match: _this.computeMatch(_this.props, _this.context.router) + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + Route.prototype.getChildContext = function getChildContext() { + return { + router: _extends({}, this.context.router, { + route: { + location: this.props.location || this.context.router.route.location, + match: this.state.match + } + }) + }; + }; + + Route.prototype.computeMatch = function computeMatch(_ref, router) { + var computedMatch = _ref.computedMatch, + location = _ref.location, + path = _ref.path, + strict = _ref.strict, + exact = _ref.exact, + sensitive = _ref.sensitive; + + if (computedMatch) return computedMatch; // already computed the match for us + + (0, _invariant2.default)(router, "You should not use or withRouter() outside a "); + + var route = router.route; + + var pathname = (location || route.location).pathname; + + return (0, _matchPath2.default)(pathname, { path: path, strict: strict, exact: exact, sensitive: sensitive }, route.match); + }; + + Route.prototype.componentWillMount = function componentWillMount() { + (0, _warning2.default)(!(this.props.component && this.props.render), "You should not use and in the same route; will be ignored"); + + (0, _warning2.default)(!(this.props.component && this.props.children && !isEmptyChildren(this.props.children)), "You should not use and in the same route; will be ignored"); + + (0, _warning2.default)(!(this.props.render && this.props.children && !isEmptyChildren(this.props.children)), "You should not use and in the same route; will be ignored"); + }; + + Route.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps, nextContext) { + (0, _warning2.default)(!(nextProps.location && !this.props.location), ' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'); + + (0, _warning2.default)(!(!nextProps.location && this.props.location), ' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'); + + this.setState({ + match: this.computeMatch(nextProps, nextContext.router) + }); + }; + + Route.prototype.render = function render() { + var match = this.state.match; + var _props = this.props, + children = _props.children, + component = _props.component, + render = _props.render; + var _context$router = this.context.router, + history = _context$router.history, + route = _context$router.route, + staticContext = _context$router.staticContext; + + var location = this.props.location || route.location; + var props = { match: match, location: location, history: history, staticContext: staticContext }; + + if (component) return match ? _react2.default.createElement(component, props) : null; + + if (render) return match ? render(props) : null; + + if (typeof children === "function") return children(props); + + if (children && !isEmptyChildren(children)) return _react2.default.Children.only(children); + + return null; + }; + + return Route; +}(_react2.default.Component); + +Route.propTypes = { + computedMatch: _propTypes2.default.object, // private, from + path: _propTypes2.default.string, + exact: _propTypes2.default.bool, + strict: _propTypes2.default.bool, + sensitive: _propTypes2.default.bool, + component: _propTypes2.default.func, + render: _propTypes2.default.func, + children: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.node]), + location: _propTypes2.default.object +}; +Route.contextTypes = { + router: _propTypes2.default.shape({ + history: _propTypes2.default.object.isRequired, + route: _propTypes2.default.object.isRequired, + staticContext: _propTypes2.default.object + }) +}; +Route.childContextTypes = { + router: _propTypes2.default.object.isRequired +}; +exports.default = Route; \ No newline at end of file diff --git a/node_modules/react-router/Router.js b/node_modules/react-router/Router.js new file mode 100644 index 00000000..97abc9fe --- /dev/null +++ b/node_modules/react-router/Router.js @@ -0,0 +1,119 @@ +"use strict"; + +exports.__esModule = true; + +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; }; + +var _warning = require("warning"); + +var _warning2 = _interopRequireDefault(_warning); + +var _invariant = require("invariant"); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +/** + * The public API for putting history on context. + */ +var Router = function (_React$Component) { + _inherits(Router, _React$Component); + + function Router() { + var _temp, _this, _ret; + + _classCallCheck(this, Router); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = { + match: _this.computeMatch(_this.props.history.location.pathname) + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + Router.prototype.getChildContext = function getChildContext() { + return { + router: _extends({}, this.context.router, { + history: this.props.history, + route: { + location: this.props.history.location, + match: this.state.match + } + }) + }; + }; + + Router.prototype.computeMatch = function computeMatch(pathname) { + return { + path: "/", + url: "/", + params: {}, + isExact: pathname === "/" + }; + }; + + Router.prototype.componentWillMount = function componentWillMount() { + var _this2 = this; + + var _props = this.props, + children = _props.children, + history = _props.history; + + + (0, _invariant2.default)(children == null || _react2.default.Children.count(children) === 1, "A may have only one child element"); + + // Do this here so we can setState when a changes the + // location in componentWillMount. This happens e.g. when doing + // server rendering using a . + this.unlisten = history.listen(function () { + _this2.setState({ + match: _this2.computeMatch(history.location.pathname) + }); + }); + }; + + Router.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + (0, _warning2.default)(this.props.history === nextProps.history, "You cannot change "); + }; + + Router.prototype.componentWillUnmount = function componentWillUnmount() { + this.unlisten(); + }; + + Router.prototype.render = function render() { + var children = this.props.children; + + return children ? _react2.default.Children.only(children) : null; + }; + + return Router; +}(_react2.default.Component); + +Router.propTypes = { + history: _propTypes2.default.object.isRequired, + children: _propTypes2.default.node +}; +Router.contextTypes = { + router: _propTypes2.default.object +}; +Router.childContextTypes = { + router: _propTypes2.default.object.isRequired +}; +exports.default = Router; \ No newline at end of file diff --git a/node_modules/react-router/StaticRouter.js b/node_modules/react-router/StaticRouter.js new file mode 100644 index 00000000..5a00f37d --- /dev/null +++ b/node_modules/react-router/StaticRouter.js @@ -0,0 +1,169 @@ +"use strict"; + +exports.__esModule = true; + +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; }; + +var _warning = require("warning"); + +var _warning2 = _interopRequireDefault(_warning); + +var _invariant = require("invariant"); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _history = require("history"); + +var _Router = require("./Router"); + +var _Router2 = _interopRequireDefault(_Router); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var addLeadingSlash = function addLeadingSlash(path) { + return path.charAt(0) === "/" ? path : "/" + path; +}; + +var addBasename = function addBasename(basename, location) { + if (!basename) return location; + + return _extends({}, location, { + pathname: addLeadingSlash(basename) + location.pathname + }); +}; + +var stripBasename = function stripBasename(basename, location) { + if (!basename) return location; + + var base = addLeadingSlash(basename); + + if (location.pathname.indexOf(base) !== 0) return location; + + return _extends({}, location, { + pathname: location.pathname.substr(base.length) + }); +}; + +var createURL = function createURL(location) { + return typeof location === "string" ? location : (0, _history.createPath)(location); +}; + +var staticHandler = function staticHandler(methodName) { + return function () { + (0, _invariant2.default)(false, "You cannot %s with ", methodName); + }; +}; + +var noop = function noop() {}; + +/** + * The public top-level API for a "static" , so-called because it + * can't actually change the current location. Instead, it just records + * location changes in a context object. Useful mainly in testing and + * server-rendering scenarios. + */ + +var StaticRouter = function (_React$Component) { + _inherits(StaticRouter, _React$Component); + + function StaticRouter() { + var _temp, _this, _ret; + + _classCallCheck(this, StaticRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.createHref = function (path) { + return addLeadingSlash(_this.props.basename + createURL(path)); + }, _this.handlePush = function (location) { + var _this$props = _this.props, + basename = _this$props.basename, + context = _this$props.context; + + context.action = "PUSH"; + context.location = addBasename(basename, (0, _history.createLocation)(location)); + context.url = createURL(context.location); + }, _this.handleReplace = function (location) { + var _this$props2 = _this.props, + basename = _this$props2.basename, + context = _this$props2.context; + + context.action = "REPLACE"; + context.location = addBasename(basename, (0, _history.createLocation)(location)); + context.url = createURL(context.location); + }, _this.handleListen = function () { + return noop; + }, _this.handleBlock = function () { + return noop; + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + StaticRouter.prototype.getChildContext = function getChildContext() { + return { + router: { + staticContext: this.props.context + } + }; + }; + + StaticRouter.prototype.componentWillMount = function componentWillMount() { + (0, _warning2.default)(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { StaticRouter as Router }`."); + }; + + StaticRouter.prototype.render = function render() { + var _props = this.props, + basename = _props.basename, + context = _props.context, + location = _props.location, + props = _objectWithoutProperties(_props, ["basename", "context", "location"]); + + var history = { + createHref: this.createHref, + action: "POP", + location: stripBasename(basename, (0, _history.createLocation)(location)), + push: this.handlePush, + replace: this.handleReplace, + go: staticHandler("go"), + goBack: staticHandler("goBack"), + goForward: staticHandler("goForward"), + listen: this.handleListen, + block: this.handleBlock + }; + + return _react2.default.createElement(_Router2.default, _extends({}, props, { history: history })); + }; + + return StaticRouter; +}(_react2.default.Component); + +StaticRouter.propTypes = { + basename: _propTypes2.default.string, + context: _propTypes2.default.object.isRequired, + location: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]) +}; +StaticRouter.defaultProps = { + basename: "", + location: "/" +}; +StaticRouter.childContextTypes = { + router: _propTypes2.default.object.isRequired +}; +exports.default = StaticRouter; \ No newline at end of file diff --git a/node_modules/react-router/Switch.js b/node_modules/react-router/Switch.js new file mode 100644 index 00000000..b1033465 --- /dev/null +++ b/node_modules/react-router/Switch.js @@ -0,0 +1,94 @@ +"use strict"; + +exports.__esModule = true; + +var _react = require("react"); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _warning = require("warning"); + +var _warning2 = _interopRequireDefault(_warning); + +var _invariant = require("invariant"); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _matchPath = require("./matchPath"); + +var _matchPath2 = _interopRequireDefault(_matchPath); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +/** + * The public API for rendering the first that matches. + */ +var Switch = function (_React$Component) { + _inherits(Switch, _React$Component); + + function Switch() { + _classCallCheck(this, Switch); + + return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); + } + + Switch.prototype.componentWillMount = function componentWillMount() { + (0, _invariant2.default)(this.context.router, "You should not use outside a "); + }; + + Switch.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + (0, _warning2.default)(!(nextProps.location && !this.props.location), ' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'); + + (0, _warning2.default)(!(!nextProps.location && this.props.location), ' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'); + }; + + Switch.prototype.render = function render() { + var route = this.context.router.route; + var children = this.props.children; + + var location = this.props.location || route.location; + + var match = void 0, + child = void 0; + _react2.default.Children.forEach(children, function (element) { + if (match == null && _react2.default.isValidElement(element)) { + var _element$props = element.props, + pathProp = _element$props.path, + exact = _element$props.exact, + strict = _element$props.strict, + sensitive = _element$props.sensitive, + from = _element$props.from; + + var path = pathProp || from; + + child = element; + match = (0, _matchPath2.default)(location.pathname, { path: path, exact: exact, strict: strict, sensitive: sensitive }, route.match); + } + }); + + return match ? _react2.default.cloneElement(child, { location: location, computedMatch: match }) : null; + }; + + return Switch; +}(_react2.default.Component); + +Switch.contextTypes = { + router: _propTypes2.default.shape({ + route: _propTypes2.default.object.isRequired + }).isRequired +}; +Switch.propTypes = { + children: _propTypes2.default.node, + location: _propTypes2.default.object +}; +exports.default = Switch; \ No newline at end of file diff --git a/node_modules/react-router/es/MemoryRouter.js b/node_modules/react-router/es/MemoryRouter.js new file mode 100644 index 00000000..22690635 --- /dev/null +++ b/node_modules/react-router/es/MemoryRouter.js @@ -0,0 +1,52 @@ +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +import warning from "warning"; +import React from "react"; +import PropTypes from "prop-types"; +import { createMemoryHistory as createHistory } from "history"; +import Router from "./Router"; + +/** + * The public API for a that stores location in memory. + */ + +var MemoryRouter = function (_React$Component) { + _inherits(MemoryRouter, _React$Component); + + function MemoryRouter() { + var _temp, _this, _ret; + + _classCallCheck(this, MemoryRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = createHistory(_this.props), _temp), _possibleConstructorReturn(_this, _ret); + } + + MemoryRouter.prototype.componentWillMount = function componentWillMount() { + warning(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { MemoryRouter as Router }`."); + }; + + MemoryRouter.prototype.render = function render() { + return React.createElement(Router, { history: this.history, children: this.props.children }); + }; + + return MemoryRouter; +}(React.Component); + +MemoryRouter.propTypes = { + initialEntries: PropTypes.array, + initialIndex: PropTypes.number, + getUserConfirmation: PropTypes.func, + keyLength: PropTypes.number, + children: PropTypes.node +}; + + +export default MemoryRouter; \ No newline at end of file diff --git a/node_modules/react-router/es/Prompt.js b/node_modules/react-router/es/Prompt.js new file mode 100644 index 00000000..7eb4da84 --- /dev/null +++ b/node_modules/react-router/es/Prompt.js @@ -0,0 +1,79 @@ +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +import React from "react"; +import PropTypes from "prop-types"; +import invariant from "invariant"; + +/** + * The public API for prompting the user before navigating away + * from a screen with a component. + */ + +var Prompt = function (_React$Component) { + _inherits(Prompt, _React$Component); + + function Prompt() { + _classCallCheck(this, Prompt); + + return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); + } + + Prompt.prototype.enable = function enable(message) { + if (this.unblock) this.unblock(); + + this.unblock = this.context.router.history.block(message); + }; + + Prompt.prototype.disable = function disable() { + if (this.unblock) { + this.unblock(); + this.unblock = null; + } + }; + + Prompt.prototype.componentWillMount = function componentWillMount() { + invariant(this.context.router, "You should not use outside a "); + + if (this.props.when) this.enable(this.props.message); + }; + + Prompt.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + if (nextProps.when) { + if (!this.props.when || this.props.message !== nextProps.message) this.enable(nextProps.message); + } else { + this.disable(); + } + }; + + Prompt.prototype.componentWillUnmount = function componentWillUnmount() { + this.disable(); + }; + + Prompt.prototype.render = function render() { + return null; + }; + + return Prompt; +}(React.Component); + +Prompt.propTypes = { + when: PropTypes.bool, + message: PropTypes.oneOfType([PropTypes.func, PropTypes.string]).isRequired +}; +Prompt.defaultProps = { + when: true +}; +Prompt.contextTypes = { + router: PropTypes.shape({ + history: PropTypes.shape({ + block: PropTypes.func.isRequired + }).isRequired + }).isRequired +}; + + +export default Prompt; \ No newline at end of file diff --git a/node_modules/react-router/es/Redirect.js b/node_modules/react-router/es/Redirect.js new file mode 100644 index 00000000..1647c100 --- /dev/null +++ b/node_modules/react-router/es/Redirect.js @@ -0,0 +1,113 @@ +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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +import React from "react"; +import PropTypes from "prop-types"; +import warning from "warning"; +import invariant from "invariant"; +import { createLocation, locationsAreEqual } from "history"; +import generatePath from "./generatePath"; + +/** + * The public API for updating the location programmatically + * with a component. + */ + +var Redirect = function (_React$Component) { + _inherits(Redirect, _React$Component); + + function Redirect() { + _classCallCheck(this, Redirect); + + return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); + } + + Redirect.prototype.isStatic = function isStatic() { + return this.context.router && this.context.router.staticContext; + }; + + Redirect.prototype.componentWillMount = function componentWillMount() { + invariant(this.context.router, "You should not use outside a "); + + if (this.isStatic()) this.perform(); + }; + + Redirect.prototype.componentDidMount = function componentDidMount() { + if (!this.isStatic()) this.perform(); + }; + + Redirect.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { + var prevTo = createLocation(prevProps.to); + var nextTo = createLocation(this.props.to); + + if (locationsAreEqual(prevTo, nextTo)) { + warning(false, "You tried to redirect to the same route you're currently on: " + ("\"" + nextTo.pathname + nextTo.search + "\"")); + return; + } + + this.perform(); + }; + + Redirect.prototype.computeTo = function computeTo(_ref) { + var computedMatch = _ref.computedMatch, + to = _ref.to; + + if (computedMatch) { + if (typeof to === "string") { + return generatePath(to, computedMatch.params); + } else { + return _extends({}, to, { + pathname: generatePath(to.pathname, computedMatch.params) + }); + } + } + + return to; + }; + + Redirect.prototype.perform = function perform() { + var history = this.context.router.history; + var push = this.props.push; + + var to = this.computeTo(this.props); + + if (push) { + history.push(to); + } else { + history.replace(to); + } + }; + + Redirect.prototype.render = function render() { + return null; + }; + + return Redirect; +}(React.Component); + +Redirect.propTypes = { + computedMatch: PropTypes.object, // private, from + push: PropTypes.bool, + from: PropTypes.string, + to: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired +}; +Redirect.defaultProps = { + push: false +}; +Redirect.contextTypes = { + router: PropTypes.shape({ + history: PropTypes.shape({ + push: PropTypes.func.isRequired, + replace: PropTypes.func.isRequired + }).isRequired, + staticContext: PropTypes.object + }).isRequired +}; + + +export default Redirect; \ No newline at end of file diff --git a/node_modules/react-router/es/Route.js b/node_modules/react-router/es/Route.js new file mode 100644 index 00000000..6f2821b2 --- /dev/null +++ b/node_modules/react-router/es/Route.js @@ -0,0 +1,139 @@ +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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +import warning from "warning"; +import invariant from "invariant"; +import React from "react"; +import PropTypes from "prop-types"; +import matchPath from "./matchPath"; + +var isEmptyChildren = function isEmptyChildren(children) { + return React.Children.count(children) === 0; +}; + +/** + * The public API for matching a single path and rendering. + */ + +var Route = function (_React$Component) { + _inherits(Route, _React$Component); + + function Route() { + var _temp, _this, _ret; + + _classCallCheck(this, Route); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = { + match: _this.computeMatch(_this.props, _this.context.router) + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + Route.prototype.getChildContext = function getChildContext() { + return { + router: _extends({}, this.context.router, { + route: { + location: this.props.location || this.context.router.route.location, + match: this.state.match + } + }) + }; + }; + + Route.prototype.computeMatch = function computeMatch(_ref, router) { + var computedMatch = _ref.computedMatch, + location = _ref.location, + path = _ref.path, + strict = _ref.strict, + exact = _ref.exact, + sensitive = _ref.sensitive; + + if (computedMatch) return computedMatch; // already computed the match for us + + invariant(router, "You should not use or withRouter() outside a "); + + var route = router.route; + + var pathname = (location || route.location).pathname; + + return matchPath(pathname, { path: path, strict: strict, exact: exact, sensitive: sensitive }, route.match); + }; + + Route.prototype.componentWillMount = function componentWillMount() { + warning(!(this.props.component && this.props.render), "You should not use and in the same route; will be ignored"); + + warning(!(this.props.component && this.props.children && !isEmptyChildren(this.props.children)), "You should not use and in the same route; will be ignored"); + + warning(!(this.props.render && this.props.children && !isEmptyChildren(this.props.children)), "You should not use and in the same route; will be ignored"); + }; + + Route.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps, nextContext) { + warning(!(nextProps.location && !this.props.location), ' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'); + + warning(!(!nextProps.location && this.props.location), ' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'); + + this.setState({ + match: this.computeMatch(nextProps, nextContext.router) + }); + }; + + Route.prototype.render = function render() { + var match = this.state.match; + var _props = this.props, + children = _props.children, + component = _props.component, + render = _props.render; + var _context$router = this.context.router, + history = _context$router.history, + route = _context$router.route, + staticContext = _context$router.staticContext; + + var location = this.props.location || route.location; + var props = { match: match, location: location, history: history, staticContext: staticContext }; + + if (component) return match ? React.createElement(component, props) : null; + + if (render) return match ? render(props) : null; + + if (typeof children === "function") return children(props); + + if (children && !isEmptyChildren(children)) return React.Children.only(children); + + return null; + }; + + return Route; +}(React.Component); + +Route.propTypes = { + computedMatch: PropTypes.object, // private, from + path: PropTypes.string, + exact: PropTypes.bool, + strict: PropTypes.bool, + sensitive: PropTypes.bool, + component: PropTypes.func, + render: PropTypes.func, + children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]), + location: PropTypes.object +}; +Route.contextTypes = { + router: PropTypes.shape({ + history: PropTypes.object.isRequired, + route: PropTypes.object.isRequired, + staticContext: PropTypes.object + }) +}; +Route.childContextTypes = { + router: PropTypes.object.isRequired +}; + + +export default Route; \ No newline at end of file diff --git a/node_modules/react-router/es/Router.js b/node_modules/react-router/es/Router.js new file mode 100644 index 00000000..00e15884 --- /dev/null +++ b/node_modules/react-router/es/Router.js @@ -0,0 +1,105 @@ +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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +import warning from "warning"; +import invariant from "invariant"; +import React from "react"; +import PropTypes from "prop-types"; + +/** + * The public API for putting history on context. + */ + +var Router = function (_React$Component) { + _inherits(Router, _React$Component); + + function Router() { + var _temp, _this, _ret; + + _classCallCheck(this, Router); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = { + match: _this.computeMatch(_this.props.history.location.pathname) + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + Router.prototype.getChildContext = function getChildContext() { + return { + router: _extends({}, this.context.router, { + history: this.props.history, + route: { + location: this.props.history.location, + match: this.state.match + } + }) + }; + }; + + Router.prototype.computeMatch = function computeMatch(pathname) { + return { + path: "/", + url: "/", + params: {}, + isExact: pathname === "/" + }; + }; + + Router.prototype.componentWillMount = function componentWillMount() { + var _this2 = this; + + var _props = this.props, + children = _props.children, + history = _props.history; + + + invariant(children == null || React.Children.count(children) === 1, "A may have only one child element"); + + // Do this here so we can setState when a changes the + // location in componentWillMount. This happens e.g. when doing + // server rendering using a . + this.unlisten = history.listen(function () { + _this2.setState({ + match: _this2.computeMatch(history.location.pathname) + }); + }); + }; + + Router.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + warning(this.props.history === nextProps.history, "You cannot change "); + }; + + Router.prototype.componentWillUnmount = function componentWillUnmount() { + this.unlisten(); + }; + + Router.prototype.render = function render() { + var children = this.props.children; + + return children ? React.Children.only(children) : null; + }; + + return Router; +}(React.Component); + +Router.propTypes = { + history: PropTypes.object.isRequired, + children: PropTypes.node +}; +Router.contextTypes = { + router: PropTypes.object +}; +Router.childContextTypes = { + router: PropTypes.object.isRequired +}; + + +export default Router; \ No newline at end of file diff --git a/node_modules/react-router/es/RouterContext.js b/node_modules/react-router/es/RouterContext.js new file mode 100644 index 00000000..9f0a55e0 --- /dev/null +++ b/node_modules/react-router/es/RouterContext.js @@ -0,0 +1,5 @@ +import createReactContext from "create-react-context"; + +var RouterContext = createReactContext({}); + +export default RouterContext; \ No newline at end of file diff --git a/node_modules/react-router/es/StaticRouter.js b/node_modules/react-router/es/StaticRouter.js new file mode 100644 index 00000000..a299e3a4 --- /dev/null +++ b/node_modules/react-router/es/StaticRouter.js @@ -0,0 +1,150 @@ +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 _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +import warning from "warning"; +import invariant from "invariant"; +import React from "react"; +import PropTypes from "prop-types"; +import { createLocation, createPath } from "history"; +import Router from "./Router"; + +var addLeadingSlash = function addLeadingSlash(path) { + return path.charAt(0) === "/" ? path : "/" + path; +}; + +var addBasename = function addBasename(basename, location) { + if (!basename) return location; + + return _extends({}, location, { + pathname: addLeadingSlash(basename) + location.pathname + }); +}; + +var stripBasename = function stripBasename(basename, location) { + if (!basename) return location; + + var base = addLeadingSlash(basename); + + if (location.pathname.indexOf(base) !== 0) return location; + + return _extends({}, location, { + pathname: location.pathname.substr(base.length) + }); +}; + +var createURL = function createURL(location) { + return typeof location === "string" ? location : createPath(location); +}; + +var staticHandler = function staticHandler(methodName) { + return function () { + invariant(false, "You cannot %s with ", methodName); + }; +}; + +var noop = function noop() {}; + +/** + * The public top-level API for a "static" , so-called because it + * can't actually change the current location. Instead, it just records + * location changes in a context object. Useful mainly in testing and + * server-rendering scenarios. + */ + +var StaticRouter = function (_React$Component) { + _inherits(StaticRouter, _React$Component); + + function StaticRouter() { + var _temp, _this, _ret; + + _classCallCheck(this, StaticRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.createHref = function (path) { + return addLeadingSlash(_this.props.basename + createURL(path)); + }, _this.handlePush = function (location) { + var _this$props = _this.props, + basename = _this$props.basename, + context = _this$props.context; + + context.action = "PUSH"; + context.location = addBasename(basename, createLocation(location)); + context.url = createURL(context.location); + }, _this.handleReplace = function (location) { + var _this$props2 = _this.props, + basename = _this$props2.basename, + context = _this$props2.context; + + context.action = "REPLACE"; + context.location = addBasename(basename, createLocation(location)); + context.url = createURL(context.location); + }, _this.handleListen = function () { + return noop; + }, _this.handleBlock = function () { + return noop; + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + StaticRouter.prototype.getChildContext = function getChildContext() { + return { + router: { + staticContext: this.props.context + } + }; + }; + + StaticRouter.prototype.componentWillMount = function componentWillMount() { + warning(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { StaticRouter as Router }`."); + }; + + StaticRouter.prototype.render = function render() { + var _props = this.props, + basename = _props.basename, + context = _props.context, + location = _props.location, + props = _objectWithoutProperties(_props, ["basename", "context", "location"]); + + var history = { + createHref: this.createHref, + action: "POP", + location: stripBasename(basename, createLocation(location)), + push: this.handlePush, + replace: this.handleReplace, + go: staticHandler("go"), + goBack: staticHandler("goBack"), + goForward: staticHandler("goForward"), + listen: this.handleListen, + block: this.handleBlock + }; + + return React.createElement(Router, _extends({}, props, { history: history })); + }; + + return StaticRouter; +}(React.Component); + +StaticRouter.propTypes = { + basename: PropTypes.string, + context: PropTypes.object.isRequired, + location: PropTypes.oneOfType([PropTypes.string, PropTypes.object]) +}; +StaticRouter.defaultProps = { + basename: "", + location: "/" +}; +StaticRouter.childContextTypes = { + router: PropTypes.object.isRequired +}; + + +export default StaticRouter; \ No newline at end of file diff --git a/node_modules/react-router/es/Switch.js b/node_modules/react-router/es/Switch.js new file mode 100644 index 00000000..97485cb2 --- /dev/null +++ b/node_modules/react-router/es/Switch.js @@ -0,0 +1,77 @@ +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +import React from "react"; +import PropTypes from "prop-types"; +import warning from "warning"; +import invariant from "invariant"; +import matchPath from "./matchPath"; + +/** + * The public API for rendering the first that matches. + */ + +var Switch = function (_React$Component) { + _inherits(Switch, _React$Component); + + function Switch() { + _classCallCheck(this, Switch); + + return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); + } + + Switch.prototype.componentWillMount = function componentWillMount() { + invariant(this.context.router, "You should not use outside a "); + }; + + Switch.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + warning(!(nextProps.location && !this.props.location), ' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'); + + warning(!(!nextProps.location && this.props.location), ' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'); + }; + + Switch.prototype.render = function render() { + var route = this.context.router.route; + var children = this.props.children; + + var location = this.props.location || route.location; + + var match = void 0, + child = void 0; + React.Children.forEach(children, function (element) { + if (match == null && React.isValidElement(element)) { + var _element$props = element.props, + pathProp = _element$props.path, + exact = _element$props.exact, + strict = _element$props.strict, + sensitive = _element$props.sensitive, + from = _element$props.from; + + var path = pathProp || from; + + child = element; + match = matchPath(location.pathname, { path: path, exact: exact, strict: strict, sensitive: sensitive }, route.match); + } + }); + + return match ? React.cloneElement(child, { location: location, computedMatch: match }) : null; + }; + + return Switch; +}(React.Component); + +Switch.contextTypes = { + router: PropTypes.shape({ + route: PropTypes.object.isRequired + }).isRequired +}; +Switch.propTypes = { + children: PropTypes.node, + location: PropTypes.object +}; + + +export default Switch; \ No newline at end of file diff --git a/node_modules/react-router/es/generatePath.js b/node_modules/react-router/es/generatePath.js new file mode 100644 index 00000000..b72e83e6 --- /dev/null +++ b/node_modules/react-router/es/generatePath.js @@ -0,0 +1,37 @@ +import pathToRegexp from "path-to-regexp"; + +var patternCache = {}; +var cacheLimit = 10000; +var cacheCount = 0; + +var compileGenerator = function compileGenerator(pattern) { + var cacheKey = pattern; + var cache = patternCache[cacheKey] || (patternCache[cacheKey] = {}); + + if (cache[pattern]) return cache[pattern]; + + var compiledGenerator = pathToRegexp.compile(pattern); + + if (cacheCount < cacheLimit) { + cache[pattern] = compiledGenerator; + cacheCount++; + } + + return compiledGenerator; +}; + +/** + * Public API for generating a URL pathname from a pattern and parameters. + */ +var generatePath = function generatePath() { + var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "/"; + var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (pattern === "/") { + return pattern; + } + var generator = compileGenerator(pattern); + return generator(params, { pretty: true }); +}; + +export default generatePath; \ No newline at end of file diff --git a/node_modules/react-router/es/index.js b/node_modules/react-router/es/index.js new file mode 100644 index 00000000..f9f692f4 --- /dev/null +++ b/node_modules/react-router/es/index.js @@ -0,0 +1,20 @@ +import _MemoryRouter from "./MemoryRouter"; +export { _MemoryRouter as MemoryRouter }; +import _Prompt from "./Prompt"; +export { _Prompt as Prompt }; +import _Redirect from "./Redirect"; +export { _Redirect as Redirect }; +import _Route from "./Route"; +export { _Route as Route }; +import _Router from "./Router"; +export { _Router as Router }; +import _StaticRouter from "./StaticRouter"; +export { _StaticRouter as StaticRouter }; +import _Switch from "./Switch"; +export { _Switch as Switch }; +import _generatePath from "./generatePath"; +export { _generatePath as generatePath }; +import _matchPath from "./matchPath"; +export { _matchPath as matchPath }; +import _withRouter from "./withRouter"; +export { _withRouter as withRouter }; \ No newline at end of file diff --git a/node_modules/react-router/es/matchPath.js b/node_modules/react-router/es/matchPath.js new file mode 100644 index 00000000..04a9831c --- /dev/null +++ b/node_modules/react-router/es/matchPath.js @@ -0,0 +1,72 @@ +import pathToRegexp from "path-to-regexp"; + +var patternCache = {}; +var cacheLimit = 10000; +var cacheCount = 0; + +var compilePath = function compilePath(pattern, options) { + var cacheKey = "" + options.end + options.strict + options.sensitive; + var cache = patternCache[cacheKey] || (patternCache[cacheKey] = {}); + + if (cache[pattern]) return cache[pattern]; + + var keys = []; + var re = pathToRegexp(pattern, keys, options); + var compiledPattern = { re: re, keys: keys }; + + if (cacheCount < cacheLimit) { + cache[pattern] = compiledPattern; + cacheCount++; + } + + return compiledPattern; +}; + +/** + * Public API for matching a URL pathname to a path pattern. + */ +var matchPath = function matchPath(pathname) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parent = arguments[2]; + + if (typeof options === "string") options = { path: options }; + + var _options = options, + path = _options.path, + _options$exact = _options.exact, + exact = _options$exact === undefined ? false : _options$exact, + _options$strict = _options.strict, + strict = _options$strict === undefined ? false : _options$strict, + _options$sensitive = _options.sensitive, + sensitive = _options$sensitive === undefined ? false : _options$sensitive; + + + if (path == null) return parent; + + var _compilePath = compilePath(path, { end: exact, strict: strict, sensitive: sensitive }), + re = _compilePath.re, + keys = _compilePath.keys; + + var match = re.exec(pathname); + + if (!match) return null; + + var url = match[0], + values = match.slice(1); + + var isExact = pathname === url; + + if (exact && !isExact) return null; + + return { + path: path, // the path pattern used to match + url: path === "/" && url === "" ? "/" : url, // the matched portion of the URL + isExact: isExact, // whether or not we matched exactly + params: keys.reduce(function (memo, key, index) { + memo[key.name] = values[index]; + return memo; + }, {}) + }; +}; + +export default matchPath; \ No newline at end of file diff --git a/node_modules/react-router/es/withRouter.js b/node_modules/react-router/es/withRouter.js new file mode 100644 index 00000000..1344578d --- /dev/null +++ b/node_modules/react-router/es/withRouter.js @@ -0,0 +1,36 @@ +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 _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +import React from "react"; +import PropTypes from "prop-types"; +import hoistStatics from "hoist-non-react-statics"; +import Route from "./Route"; + +/** + * A public higher-order component to access the imperative API + */ +var withRouter = function withRouter(Component) { + var C = function C(props) { + var wrappedComponentRef = props.wrappedComponentRef, + remainingProps = _objectWithoutProperties(props, ["wrappedComponentRef"]); + + return React.createElement(Route, { + children: function children(routeComponentProps) { + return React.createElement(Component, _extends({}, remainingProps, routeComponentProps, { + ref: wrappedComponentRef + })); + } + }); + }; + + C.displayName = "withRouter(" + (Component.displayName || Component.name) + ")"; + C.WrappedComponent = Component; + C.propTypes = { + wrappedComponentRef: PropTypes.func + }; + + return hoistStatics(C, Component); +}; + +export default withRouter; \ No newline at end of file diff --git a/node_modules/react-router/generatePath.js b/node_modules/react-router/generatePath.js new file mode 100644 index 00000000..d1e3b945 --- /dev/null +++ b/node_modules/react-router/generatePath.js @@ -0,0 +1,45 @@ +"use strict"; + +exports.__esModule = true; + +var _pathToRegexp = require("path-to-regexp"); + +var _pathToRegexp2 = _interopRequireDefault(_pathToRegexp); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var patternCache = {}; +var cacheLimit = 10000; +var cacheCount = 0; + +var compileGenerator = function compileGenerator(pattern) { + var cacheKey = pattern; + var cache = patternCache[cacheKey] || (patternCache[cacheKey] = {}); + + if (cache[pattern]) return cache[pattern]; + + var compiledGenerator = _pathToRegexp2.default.compile(pattern); + + if (cacheCount < cacheLimit) { + cache[pattern] = compiledGenerator; + cacheCount++; + } + + return compiledGenerator; +}; + +/** + * Public API for generating a URL pathname from a pattern and parameters. + */ +var generatePath = function generatePath() { + var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "/"; + var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (pattern === "/") { + return pattern; + } + var generator = compileGenerator(pattern); + return generator(params, { pretty: true }); +}; + +exports.default = generatePath; \ No newline at end of file diff --git a/node_modules/react-router/index.js b/node_modules/react-router/index.js new file mode 100644 index 00000000..01a16e22 --- /dev/null +++ b/node_modules/react-router/index.js @@ -0,0 +1,57 @@ +"use strict"; + +exports.__esModule = true; +exports.withRouter = exports.matchPath = exports.generatePath = exports.Switch = exports.StaticRouter = exports.Router = exports.Route = exports.Redirect = exports.Prompt = exports.MemoryRouter = undefined; + +var _MemoryRouter2 = require("./MemoryRouter"); + +var _MemoryRouter3 = _interopRequireDefault(_MemoryRouter2); + +var _Prompt2 = require("./Prompt"); + +var _Prompt3 = _interopRequireDefault(_Prompt2); + +var _Redirect2 = require("./Redirect"); + +var _Redirect3 = _interopRequireDefault(_Redirect2); + +var _Route2 = require("./Route"); + +var _Route3 = _interopRequireDefault(_Route2); + +var _Router2 = require("./Router"); + +var _Router3 = _interopRequireDefault(_Router2); + +var _StaticRouter2 = require("./StaticRouter"); + +var _StaticRouter3 = _interopRequireDefault(_StaticRouter2); + +var _Switch2 = require("./Switch"); + +var _Switch3 = _interopRequireDefault(_Switch2); + +var _generatePath2 = require("./generatePath"); + +var _generatePath3 = _interopRequireDefault(_generatePath2); + +var _matchPath2 = require("./matchPath"); + +var _matchPath3 = _interopRequireDefault(_matchPath2); + +var _withRouter2 = require("./withRouter"); + +var _withRouter3 = _interopRequireDefault(_withRouter2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.MemoryRouter = _MemoryRouter3.default; +exports.Prompt = _Prompt3.default; +exports.Redirect = _Redirect3.default; +exports.Route = _Route3.default; +exports.Router = _Router3.default; +exports.StaticRouter = _StaticRouter3.default; +exports.Switch = _Switch3.default; +exports.generatePath = _generatePath3.default; +exports.matchPath = _matchPath3.default; +exports.withRouter = _withRouter3.default; \ No newline at end of file diff --git a/node_modules/react-router/matchPath.js b/node_modules/react-router/matchPath.js new file mode 100644 index 00000000..f5519f0c --- /dev/null +++ b/node_modules/react-router/matchPath.js @@ -0,0 +1,80 @@ +"use strict"; + +exports.__esModule = true; + +var _pathToRegexp = require("path-to-regexp"); + +var _pathToRegexp2 = _interopRequireDefault(_pathToRegexp); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var patternCache = {}; +var cacheLimit = 10000; +var cacheCount = 0; + +var compilePath = function compilePath(pattern, options) { + var cacheKey = "" + options.end + options.strict + options.sensitive; + var cache = patternCache[cacheKey] || (patternCache[cacheKey] = {}); + + if (cache[pattern]) return cache[pattern]; + + var keys = []; + var re = (0, _pathToRegexp2.default)(pattern, keys, options); + var compiledPattern = { re: re, keys: keys }; + + if (cacheCount < cacheLimit) { + cache[pattern] = compiledPattern; + cacheCount++; + } + + return compiledPattern; +}; + +/** + * Public API for matching a URL pathname to a path pattern. + */ +var matchPath = function matchPath(pathname) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parent = arguments[2]; + + if (typeof options === "string") options = { path: options }; + + var _options = options, + path = _options.path, + _options$exact = _options.exact, + exact = _options$exact === undefined ? false : _options$exact, + _options$strict = _options.strict, + strict = _options$strict === undefined ? false : _options$strict, + _options$sensitive = _options.sensitive, + sensitive = _options$sensitive === undefined ? false : _options$sensitive; + + + if (path == null) return parent; + + var _compilePath = compilePath(path, { end: exact, strict: strict, sensitive: sensitive }), + re = _compilePath.re, + keys = _compilePath.keys; + + var match = re.exec(pathname); + + if (!match) return null; + + var url = match[0], + values = match.slice(1); + + var isExact = pathname === url; + + if (exact && !isExact) return null; + + return { + path: path, // the path pattern used to match + url: path === "/" && url === "" ? "/" : url, // the matched portion of the URL + isExact: isExact, // whether or not we matched exactly + params: keys.reduce(function (memo, key, index) { + memo[key.name] = values[index]; + return memo; + }, {}) + }; +}; + +exports.default = matchPath; \ No newline at end of file diff --git a/node_modules/react-router/package.json b/node_modules/react-router/package.json new file mode 100644 index 00000000..66e90c69 --- /dev/null +++ b/node_modules/react-router/package.json @@ -0,0 +1,126 @@ +{ + "_from": "react-router@^4.3.1", + "_id": "react-router@4.3.1", + "_inBundle": false, + "_integrity": "sha512-yrvL8AogDh2X42Dt9iknk4wF4V8bWREPirFfS9gLU1huk6qK41sg7Z/1S81jjTrGHxa3B8R3J6xIkDAA6CVarg==", + "_location": "/react-router", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "react-router@^4.3.1", + "name": "react-router", + "escapedName": "react-router", + "rawSpec": "^4.3.1", + "saveSpec": null, + "fetchSpec": "^4.3.1" + }, + "_requiredBy": [ + "/react-router-dom" + ], + "_resolved": "https://registry.npmjs.org/react-router/-/react-router-4.3.1.tgz", + "_shasum": "aada4aef14c809cb2e686b05cee4742234506c4e", + "_spec": "react-router@^4.3.1", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/react-router-dom", + "authors": [ + "Michael Jackson", + "Ryan Florence" + ], + "browserify": { + "transform": [ + "loose-envify" + ] + }, + "bugs": { + "url": "https://github.com/ReactTraining/react-router/issues" + }, + "bundleDependencies": false, + "dependencies": { + "history": "^4.7.2", + "hoist-non-react-statics": "^2.5.0", + "invariant": "^2.2.4", + "loose-envify": "^1.3.1", + "path-to-regexp": "^1.7.0", + "prop-types": "^15.6.1", + "warning": "^4.0.1" + }, + "deprecated": false, + "description": "Declarative routing for React", + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-eslint": "^8.2.3", + "babel-jest": "^23.0.1", + "babel-plugin-dev-expression": "^0.2.1", + "babel-plugin-external-helpers": "^6.22.0", + "babel-plugin-transform-react-remove-prop-types": "^0.4.13", + "babel-preset-es2015": "^6.14.0", + "babel-preset-react": "^6.5.0", + "babel-preset-stage-1": "^6.5.0", + "eslint": "^4.19.1", + "eslint-plugin-import": "^2.12.0", + "eslint-plugin-react": "^7.9.1", + "gzip-size": "^4.1.0", + "jest": "^23.1.0", + "pretty-bytes": "^5.0.0", + "raf": "^3.4.0", + "react": "^16.4.0", + "react-addons-test-utils": "^15.6.2", + "react-dom": "^16.4.0", + "rollup": "^0.60.0", + "rollup-plugin-babel": "^3.0.4", + "rollup-plugin-commonjs": "^9.1.3", + "rollup-plugin-node-resolve": "^3.3.0", + "rollup-plugin-replace": "^2.0.0", + "rollup-plugin-uglify": "^3.0.0" + }, + "files": [ + "MemoryRouter.js", + "Prompt.js", + "Redirect.js", + "Route.js", + "Router.js", + "StaticRouter.js", + "Switch.js", + "es", + "index.js", + "generatePath.js", + "matchPath.js", + "withRouter.js", + "umd" + ], + "homepage": "https://github.com/ReactTraining/react-router#readme", + "jest": { + "setupFiles": [ + "raf/polyfill" + ] + }, + "keywords": [ + "react", + "router", + "route", + "routing", + "history", + "link" + ], + "license": "MIT", + "main": "index.js", + "module": "es/index.js", + "name": "react-router", + "peerDependencies": { + "react": ">=15" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ReactTraining/react-router.git" + }, + "scripts": { + "build": "node ./tools/build.js", + "clean": "git clean -fdX .", + "lint": "eslint modules", + "prepublishOnly": "node ./tools/build.js", + "test": "jest", + "watch": "babel ./modules -d . --ignore __tests__ --watch" + }, + "sideEffects": false, + "version": "4.3.1" +} diff --git a/node_modules/react-router/umd/react-router.js b/node_modules/react-router/umd/react-router.js new file mode 100644 index 00000000..fdf64579 --- /dev/null +++ b/node_modules/react-router/umd/react-router.js @@ -0,0 +1,2743 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) : + typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) : + (factory((global.ReactRouter = {}),global.React)); +}(this, (function (exports,React) { 'use strict'; + + React = React && React.hasOwnProperty('default') ? React['default'] : React; + + /** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @providesModule warning + */ + + var warning = function() {}; + + { + var printWarning = function printWarning(format, args) { + var len = arguments.length; + args = new Array(len > 2 ? len - 2 : 0); + for (var key = 2; key < len; key++) { + args[key - 2] = arguments[key]; + } + var argIndex = 0; + var message = 'Warning: ' + + format.replace(/%s/g, function() { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + warning = function(condition, format, args) { + var len = arguments.length; + args = new Array(len > 2 ? len - 2 : 0); + for (var key = 2; key < len; key++) { + args[key - 2] = arguments[key]; + } + if (format === undefined) { + throw new Error( + '`warning(condition, format, ...args)` requires a warning ' + + 'message argument' + ); + } + if (!condition) { + printWarning.apply(null, [format].concat(args)); + } + }; + } + + var warning_1 = warning; + + var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + function makeEmptyFunction(arg) { + return function () { + return arg; + }; + } + + /** + * This function accepts and discards inputs; it has no side effects. This is + * primarily useful idiomatically for overridable function endpoints which + * always need to be callable, since JS lacks a null-call idiom ala Cocoa. + */ + var emptyFunction = function emptyFunction() {}; + + emptyFunction.thatReturns = makeEmptyFunction; + emptyFunction.thatReturnsFalse = makeEmptyFunction(false); + emptyFunction.thatReturnsTrue = makeEmptyFunction(true); + emptyFunction.thatReturnsNull = makeEmptyFunction(null); + emptyFunction.thatReturnsThis = function () { + return this; + }; + emptyFunction.thatReturnsArgument = function (arg) { + return arg; + }; + + var emptyFunction_1 = emptyFunction; + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ + + /** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + + var validateFormat = function validateFormat(format) {}; + + { + validateFormat = function validateFormat(format) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + }; + } + + function invariant(condition, format, a, b, c, d, e, f) { + validateFormat(format); + + if (!condition) { + var error; + if (format === undefined) { + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error(format.replace(/%s/g, function () { + return args[argIndex++]; + })); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } + } + + var invariant_1 = invariant; + + /** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + + var warning$1 = emptyFunction_1; + + { + var printWarning$1 = function printWarning(format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + warning$1 = function warning(condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + + if (format.indexOf('Failed Composite propType: ') === 0) { + return; // Ignore CompositeComponent proptype check. + } + + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + printWarning$1.apply(undefined, [format].concat(args)); + } + }; + } + + var warning_1$1 = warning$1; + + /* + object-assign + (c) Sindre Sorhus + @license MIT + */ + /* eslint-disable no-unused-vars */ + var getOwnPropertySymbols = Object.getOwnPropertySymbols; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var propIsEnumerable = Object.prototype.propertyIsEnumerable; + + function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); + } + + function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } + } + + var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; + }; + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + + var ReactPropTypesSecret_1 = ReactPropTypesSecret; + + { + var invariant$1 = invariant_1; + var warning$2 = warning_1$1; + var ReactPropTypesSecret$1 = ReactPropTypesSecret_1; + var loggedTypeFailures = {}; + } + + /** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ + function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + { + for (var typeSpecName in typeSpecs) { + if (typeSpecs.hasOwnProperty(typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + invariant$1(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1); + } catch (ex) { + error = ex; + } + warning$2(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var stack = getStack ? getStack() : ''; + + warning$2(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); + } + } + } + } + } + + var checkPropTypes_1 = checkPropTypes; + + var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } + + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message) { + this.message = message; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret_1) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + invariant_1( + false, + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + } else if (typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + warning_1$1( + false, + 'You are manually calling a React.PropTypes validation ' + + 'function for the `%s` prop on `%s`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', + propFullName, + componentName + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunction_1.thatReturnsNull); + } + + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + warning_1$1(false, 'Invalid argument supplied to oneOf, expected an instance of array.'); + return emptyFunction_1.thatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (propValue.hasOwnProperty(key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + warning_1$1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.'); + return emptyFunction_1.thatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + warning_1$1( + false, + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received %s at index %s.', + getPostfixForTypeWarning(checker), + i + ); + return emptyFunction_1.thatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) { + return null; + } + } + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (!checker) { + continue; + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from + // props. + var allKeys = objectAssign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes_1; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; + }; + + var propTypes = createCommonjsModule(function (module) { + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + { + var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && + Symbol.for && + Symbol.for('react.element')) || + 0xeac7; + + var isValidElement = function(object) { + return typeof object === 'object' && + object !== null && + object.$$typeof === REACT_ELEMENT_TYPE; + }; + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess); + } + }); + + /** + * Copyright 2014-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + + var warning$3 = function() {}; + + { + warning$3 = function(condition, format, args) { + var len = arguments.length; + args = new Array(len > 2 ? len - 2 : 0); + for (var key = 2; key < len; key++) { + args[key - 2] = arguments[key]; + } + if (format === undefined) { + throw new Error( + '`warning(condition, format, ...args)` requires a warning ' + + 'message argument' + ); + } + + if (format.length < 10 || (/^[s\W]*$/).test(format)) { + throw new Error( + 'The warning format should be able to uniquely identify this ' + + 'warning. Please, use a more descriptive format than: ' + format + ); + } + + if (!condition) { + var argIndex = 0; + var message = 'Warning: ' + + format.replace(/%s/g, function() { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch(x) {} + } + }; + } + + var warning_1$2 = warning$3; + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + var invariant$2 = function(condition, format, a, b, c, d, e, f) { + { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + } + + if (!condition) { + var error; + if (format === undefined) { + error = new Error( + 'Minified exception occurred; use the non-minified dev environment ' + + 'for the full error message and additional helpful warnings.' + ); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error( + format.replace(/%s/g, function() { return args[argIndex++]; }) + ); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } + }; + + var invariant_1$1 = invariant$2; + + function isAbsolute(pathname) { + return pathname.charAt(0) === '/'; + } + + // About 1.5x faster than the two-arg version of Array#splice() + function spliceOne(list, index) { + for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) { + list[i] = list[k]; + } + + list.pop(); + } + + // This implementation is based heavily on node's url.parse + function resolvePathname(to) { + var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + var toParts = to && to.split('/') || []; + var fromParts = from && from.split('/') || []; + + var isToAbs = to && isAbsolute(to); + var isFromAbs = from && isAbsolute(from); + var mustEndAbs = isToAbs || isFromAbs; + + if (to && isAbsolute(to)) { + // to is absolute + fromParts = toParts; + } else if (toParts.length) { + // to is relative, drop the filename + fromParts.pop(); + fromParts = fromParts.concat(toParts); + } + + if (!fromParts.length) return '/'; + + var hasTrailingSlash = void 0; + if (fromParts.length) { + var last = fromParts[fromParts.length - 1]; + hasTrailingSlash = last === '.' || last === '..' || last === ''; + } else { + hasTrailingSlash = false; + } + + var up = 0; + for (var i = fromParts.length; i >= 0; i--) { + var part = fromParts[i]; + + if (part === '.') { + spliceOne(fromParts, i); + } else if (part === '..') { + spliceOne(fromParts, i); + up++; + } else if (up) { + spliceOne(fromParts, i); + up--; + } + } + + if (!mustEndAbs) for (; up--; up) { + fromParts.unshift('..'); + }if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift(''); + + var result = fromParts.join('/'); + + if (hasTrailingSlash && result.substr(-1) !== '/') result += '/'; + + return result; + } + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + function valueEqual(a, b) { + if (a === b) return true; + + if (a == null || b == null) return false; + + if (Array.isArray(a)) { + return Array.isArray(b) && a.length === b.length && a.every(function (item, index) { + return valueEqual(item, b[index]); + }); + } + + var aType = typeof a === 'undefined' ? 'undefined' : _typeof(a); + var bType = typeof b === 'undefined' ? 'undefined' : _typeof(b); + + if (aType !== bType) return false; + + if (aType === 'object') { + var aValue = a.valueOf(); + var bValue = b.valueOf(); + + if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); + + var aKeys = Object.keys(a); + var bKeys = Object.keys(b); + + if (aKeys.length !== bKeys.length) return false; + + return aKeys.every(function (key) { + return valueEqual(a[key], b[key]); + }); + } + + return false; + } + + var parsePath = function parsePath(path) { + var pathname = path || '/'; + var search = ''; + var hash = ''; + + var hashIndex = pathname.indexOf('#'); + if (hashIndex !== -1) { + hash = pathname.substr(hashIndex); + pathname = pathname.substr(0, hashIndex); + } + + var searchIndex = pathname.indexOf('?'); + if (searchIndex !== -1) { + search = pathname.substr(searchIndex); + pathname = pathname.substr(0, searchIndex); + } + + return { + pathname: pathname, + search: search === '?' ? '' : search, + hash: hash === '#' ? '' : hash + }; + }; + + var createPath = function createPath(location) { + var pathname = location.pathname, + search = location.search, + hash = location.hash; + + + var path = pathname || '/'; + + if (search && search !== '?') path += search.charAt(0) === '?' ? search : '?' + search; + + if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : '#' + hash; + + return path; + }; + + 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; }; + + var createLocation = function createLocation(path, state, key, currentLocation) { + var location = void 0; + if (typeof path === 'string') { + // Two-arg form: push(path, state) + location = parsePath(path); + location.state = state; + } else { + // One-arg form: push(location) + location = _extends({}, path); + + if (location.pathname === undefined) location.pathname = ''; + + if (location.search) { + if (location.search.charAt(0) !== '?') location.search = '?' + location.search; + } else { + location.search = ''; + } + + if (location.hash) { + if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash; + } else { + location.hash = ''; + } + + if (state !== undefined && location.state === undefined) location.state = state; + } + + try { + location.pathname = decodeURI(location.pathname); + } catch (e) { + if (e instanceof URIError) { + throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); + } else { + throw e; + } + } + + if (key) location.key = key; + + if (currentLocation) { + // Resolve incomplete/relative pathname relative to current location. + if (!location.pathname) { + location.pathname = currentLocation.pathname; + } else if (location.pathname.charAt(0) !== '/') { + location.pathname = resolvePathname(location.pathname, currentLocation.pathname); + } + } else { + // When there is no prior location and pathname is empty, set it to / + if (!location.pathname) { + location.pathname = '/'; + } + } + + return location; + }; + + var locationsAreEqual = function locationsAreEqual(a, b) { + return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && valueEqual(a.state, b.state); + }; + + var createTransitionManager = function createTransitionManager() { + var prompt = null; + + var setPrompt = function setPrompt(nextPrompt) { + warning_1$2(prompt == null, 'A history supports only one prompt at a time'); + + prompt = nextPrompt; + + return function () { + if (prompt === nextPrompt) prompt = null; + }; + }; + + var confirmTransitionTo = function confirmTransitionTo(location, action, getUserConfirmation, callback) { + // TODO: If another transition starts while we're still confirming + // the previous one, we may end up in a weird state. Figure out the + // best way to handle this. + if (prompt != null) { + var result = typeof prompt === 'function' ? prompt(location, action) : prompt; + + if (typeof result === 'string') { + if (typeof getUserConfirmation === 'function') { + getUserConfirmation(result, callback); + } else { + warning_1$2(false, 'A history needs a getUserConfirmation function in order to use a prompt message'); + + callback(true); + } + } else { + // Return false from a transition hook to cancel the transition. + callback(result !== false); + } + } else { + callback(true); + } + }; + + var listeners = []; + + var appendListener = function appendListener(fn) { + var isActive = true; + + var listener = function listener() { + if (isActive) fn.apply(undefined, arguments); + }; + + listeners.push(listener); + + return function () { + isActive = false; + listeners = listeners.filter(function (item) { + return item !== listener; + }); + }; + }; + + var notifyListeners = function notifyListeners() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + listeners.forEach(function (listener) { + return listener.apply(undefined, args); + }); + }; + + return { + setPrompt: setPrompt, + confirmTransitionTo: confirmTransitionTo, + appendListener: appendListener, + notifyListeners: notifyListeners + }; + }; + + var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); + + var _typeof$2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var _extends$3 = 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; }; + + var clamp = function clamp(n, lowerBound, upperBound) { + return Math.min(Math.max(n, lowerBound), upperBound); + }; + + /** + * Creates a history object that stores locations in memory. + */ + var createMemoryHistory = function createMemoryHistory() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var getUserConfirmation = props.getUserConfirmation, + _props$initialEntries = props.initialEntries, + initialEntries = _props$initialEntries === undefined ? ['/'] : _props$initialEntries, + _props$initialIndex = props.initialIndex, + initialIndex = _props$initialIndex === undefined ? 0 : _props$initialIndex, + _props$keyLength = props.keyLength, + keyLength = _props$keyLength === undefined ? 6 : _props$keyLength; + + + var transitionManager = createTransitionManager(); + + var setState = function setState(nextState) { + _extends$3(history, nextState); + + history.length = history.entries.length; + + transitionManager.notifyListeners(history.location, history.action); + }; + + var createKey = function createKey() { + return Math.random().toString(36).substr(2, keyLength); + }; + + var index = clamp(initialIndex, 0, initialEntries.length - 1); + var entries = initialEntries.map(function (entry) { + return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey()); + }); + + // Public interface + + var createHref = createPath; + + var push = function push(path, state) { + warning_1$2(!((typeof path === 'undefined' ? 'undefined' : _typeof$2(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'PUSH'; + var location = createLocation(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + var prevIndex = history.index; + var nextIndex = prevIndex + 1; + + var nextEntries = history.entries.slice(0); + if (nextEntries.length > nextIndex) { + nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location); + } else { + nextEntries.push(location); + } + + setState({ + action: action, + location: location, + index: nextIndex, + entries: nextEntries + }); + }); + }; + + var replace = function replace(path, state) { + warning_1$2(!((typeof path === 'undefined' ? 'undefined' : _typeof$2(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored'); + + var action = 'REPLACE'; + var location = createLocation(path, state, createKey(), history.location); + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + + history.entries[history.index] = location; + + setState({ action: action, location: location }); + }); + }; + + var go = function go(n) { + var nextIndex = clamp(history.index + n, 0, history.entries.length - 1); + + var action = 'POP'; + var location = history.entries[nextIndex]; + + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ + action: action, + location: location, + index: nextIndex + }); + } else { + // Mimic the behavior of DOM histories by + // causing a render after a cancelled POP. + setState(); + } + }); + }; + + var goBack = function goBack() { + return go(-1); + }; + + var goForward = function goForward() { + return go(1); + }; + + var canGo = function canGo(n) { + var nextIndex = history.index + n; + return nextIndex >= 0 && nextIndex < history.entries.length; + }; + + var block = function block() { + var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + return transitionManager.setPrompt(prompt); + }; + + var listen = function listen(listener) { + return transitionManager.appendListener(listener); + }; + + var history = { + length: entries.length, + action: 'POP', + location: entries[index], + index: index, + entries: entries, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + canGo: canGo, + block: block, + listen: listen + }; + + return history; + }; + + var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + + var _extends$4 = 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; + }; + + var inherits = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + }; + + var objectWithoutProperties = function (obj, keys) { + var target = {}; + + for (var i in obj) { + if (keys.indexOf(i) >= 0) continue; + if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; + target[i] = obj[i]; + } + + return target; + }; + + var possibleConstructorReturn = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && (typeof call === "object" || typeof call === "function") ? call : self; + }; + + /** + * The public API for putting history on context. + */ + + var Router = function (_React$Component) { + inherits(Router, _React$Component); + + function Router() { + var _temp, _this, _ret; + + classCallCheck(this, Router); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = { + match: _this.computeMatch(_this.props.history.location.pathname) + }, _temp), possibleConstructorReturn(_this, _ret); + } + + Router.prototype.getChildContext = function getChildContext() { + return { + router: _extends$4({}, this.context.router, { + history: this.props.history, + route: { + location: this.props.history.location, + match: this.state.match + } + }) + }; + }; + + Router.prototype.computeMatch = function computeMatch(pathname) { + return { + path: "/", + url: "/", + params: {}, + isExact: pathname === "/" + }; + }; + + Router.prototype.componentWillMount = function componentWillMount() { + var _this2 = this; + + var _props = this.props, + children = _props.children, + history = _props.history; + + + invariant_1$1(children == null || React.Children.count(children) === 1, "A may have only one child element"); + + // Do this here so we can setState when a changes the + // location in componentWillMount. This happens e.g. when doing + // server rendering using a . + this.unlisten = history.listen(function () { + _this2.setState({ + match: _this2.computeMatch(history.location.pathname) + }); + }); + }; + + Router.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + warning_1(this.props.history === nextProps.history, "You cannot change "); + }; + + Router.prototype.componentWillUnmount = function componentWillUnmount() { + this.unlisten(); + }; + + Router.prototype.render = function render() { + var children = this.props.children; + + return children ? React.Children.only(children) : null; + }; + + return Router; + }(React.Component); + + Router.propTypes = { + history: propTypes.object.isRequired, + children: propTypes.node + }; + Router.contextTypes = { + router: propTypes.object + }; + Router.childContextTypes = { + router: propTypes.object.isRequired + }; + + /** + * The public API for a that stores location in memory. + */ + + var MemoryRouter = function (_React$Component) { + inherits(MemoryRouter, _React$Component); + + function MemoryRouter() { + var _temp, _this, _ret; + + classCallCheck(this, MemoryRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.history = createMemoryHistory(_this.props), _temp), possibleConstructorReturn(_this, _ret); + } + + MemoryRouter.prototype.componentWillMount = function componentWillMount() { + warning_1(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { MemoryRouter as Router }`."); + }; + + MemoryRouter.prototype.render = function render() { + return React.createElement(Router, { history: this.history, children: this.props.children }); + }; + + return MemoryRouter; + }(React.Component); + + MemoryRouter.propTypes = { + initialEntries: propTypes.array, + initialIndex: propTypes.number, + getUserConfirmation: propTypes.func, + keyLength: propTypes.number, + children: propTypes.node + }; + + /** + * The public API for prompting the user before navigating away + * from a screen with a component. + */ + + var Prompt = function (_React$Component) { + inherits(Prompt, _React$Component); + + function Prompt() { + classCallCheck(this, Prompt); + return possibleConstructorReturn(this, _React$Component.apply(this, arguments)); + } + + Prompt.prototype.enable = function enable(message) { + if (this.unblock) this.unblock(); + + this.unblock = this.context.router.history.block(message); + }; + + Prompt.prototype.disable = function disable() { + if (this.unblock) { + this.unblock(); + this.unblock = null; + } + }; + + Prompt.prototype.componentWillMount = function componentWillMount() { + invariant_1$1(this.context.router, "You should not use outside a "); + + if (this.props.when) this.enable(this.props.message); + }; + + Prompt.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + if (nextProps.when) { + if (!this.props.when || this.props.message !== nextProps.message) this.enable(nextProps.message); + } else { + this.disable(); + } + }; + + Prompt.prototype.componentWillUnmount = function componentWillUnmount() { + this.disable(); + }; + + Prompt.prototype.render = function render() { + return null; + }; + + return Prompt; + }(React.Component); + + Prompt.propTypes = { + when: propTypes.bool, + message: propTypes.oneOfType([propTypes.func, propTypes.string]).isRequired + }; + Prompt.defaultProps = { + when: true + }; + Prompt.contextTypes = { + router: propTypes.shape({ + history: propTypes.shape({ + block: propTypes.func.isRequired + }).isRequired + }).isRequired + }; + + var isarray = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; + }; + + /** + * Expose `pathToRegexp`. + */ + var pathToRegexp_1 = pathToRegexp; + var parse_1 = parse; + var compile_1 = compile; + var tokensToFunction_1 = tokensToFunction; + var tokensToRegExp_1 = tokensToRegExp; + + /** + * The main path matching regexp utility. + * + * @type {RegExp} + */ + var PATH_REGEXP = new RegExp([ + // Match escaped characters that would otherwise appear in future matches. + // This allows the user to escape special characters that won't transform. + '(\\\\.)', + // Match Express-style parameters and un-named parameters with a prefix + // and optional suffixes. Matches appear as: + // + // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined] + // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] + // "/*" => ["/", undefined, undefined, undefined, undefined, "*"] + '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))' + ].join('|'), 'g'); + + /** + * Parse a string for the raw tokens. + * + * @param {string} str + * @param {Object=} options + * @return {!Array} + */ + function parse (str, options) { + var tokens = []; + var key = 0; + var index = 0; + var path = ''; + var defaultDelimiter = options && options.delimiter || '/'; + var res; + + while ((res = PATH_REGEXP.exec(str)) != null) { + var m = res[0]; + var escaped = res[1]; + var offset = res.index; + path += str.slice(index, offset); + index = offset + m.length; + + // Ignore already escaped sequences. + if (escaped) { + path += escaped[1]; + continue + } + + var next = str[index]; + var prefix = res[2]; + var name = res[3]; + var capture = res[4]; + var group = res[5]; + var modifier = res[6]; + var asterisk = res[7]; + + // Push the current path onto the tokens. + if (path) { + tokens.push(path); + path = ''; + } + + var partial = prefix != null && next != null && next !== prefix; + var repeat = modifier === '+' || modifier === '*'; + var optional = modifier === '?' || modifier === '*'; + var delimiter = res[2] || defaultDelimiter; + var pattern = capture || group; + + tokens.push({ + name: name || key++, + prefix: prefix || '', + delimiter: delimiter, + optional: optional, + repeat: repeat, + partial: partial, + asterisk: !!asterisk, + pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?') + }); + } + + // Match any characters still remaining. + if (index < str.length) { + path += str.substr(index); + } + + // If the path exists, push it onto the end. + if (path) { + tokens.push(path); + } + + return tokens + } + + /** + * Compile a string to a template function for the path. + * + * @param {string} str + * @param {Object=} options + * @return {!function(Object=, Object=)} + */ + function compile (str, options) { + return tokensToFunction(parse(str, options)) + } + + /** + * Prettier encoding of URI path segments. + * + * @param {string} + * @return {string} + */ + function encodeURIComponentPretty (str) { + return encodeURI(str).replace(/[\/?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) + } + + /** + * Encode the asterisk parameter. Similar to `pretty`, but allows slashes. + * + * @param {string} + * @return {string} + */ + function encodeAsterisk (str) { + return encodeURI(str).replace(/[?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) + } + + /** + * Expose a method for transforming tokens into the path function. + */ + function tokensToFunction (tokens) { + // Compile all the tokens into regexps. + var matches = new Array(tokens.length); + + // Compile all the patterns before compilation. + for (var i = 0; i < tokens.length; i++) { + if (typeof tokens[i] === 'object') { + matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$'); + } + } + + return function (obj, opts) { + var path = ''; + var data = obj || {}; + var options = opts || {}; + var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent; + + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + + if (typeof token === 'string') { + path += token; + + continue + } + + var value = data[token.name]; + var segment; + + if (value == null) { + if (token.optional) { + // Prepend partial segment prefixes. + if (token.partial) { + path += token.prefix; + } + + continue + } else { + throw new TypeError('Expected "' + token.name + '" to be defined') + } + } + + if (isarray(value)) { + if (!token.repeat) { + throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`') + } + + if (value.length === 0) { + if (token.optional) { + continue + } else { + throw new TypeError('Expected "' + token.name + '" to not be empty') + } + } + + for (var j = 0; j < value.length; j++) { + segment = encode(value[j]); + + if (!matches[i].test(segment)) { + throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`') + } + + path += (j === 0 ? token.prefix : token.delimiter) + segment; + } + + continue + } + + segment = token.asterisk ? encodeAsterisk(value) : encode(value); + + if (!matches[i].test(segment)) { + throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"') + } + + path += token.prefix + segment; + } + + return path + } + } + + /** + * Escape a regular expression string. + * + * @param {string} str + * @return {string} + */ + function escapeString (str) { + return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1') + } + + /** + * Escape the capturing group by escaping special characters and meaning. + * + * @param {string} group + * @return {string} + */ + function escapeGroup (group) { + return group.replace(/([=!:$\/()])/g, '\\$1') + } + + /** + * Attach the keys as a property of the regexp. + * + * @param {!RegExp} re + * @param {Array} keys + * @return {!RegExp} + */ + function attachKeys (re, keys) { + re.keys = keys; + return re + } + + /** + * Get the flags for a regexp from the options. + * + * @param {Object} options + * @return {string} + */ + function flags (options) { + return options.sensitive ? '' : 'i' + } + + /** + * Pull out keys from a regexp. + * + * @param {!RegExp} path + * @param {!Array} keys + * @return {!RegExp} + */ + function regexpToRegexp (path, keys) { + // Use a negative lookahead to match only capturing groups. + var groups = path.source.match(/\((?!\?)/g); + + if (groups) { + for (var i = 0; i < groups.length; i++) { + keys.push({ + name: i, + prefix: null, + delimiter: null, + optional: false, + repeat: false, + partial: false, + asterisk: false, + pattern: null + }); + } + } + + return attachKeys(path, keys) + } + + /** + * Transform an array into a regexp. + * + * @param {!Array} path + * @param {Array} keys + * @param {!Object} options + * @return {!RegExp} + */ + function arrayToRegexp (path, keys, options) { + var parts = []; + + for (var i = 0; i < path.length; i++) { + parts.push(pathToRegexp(path[i], keys, options).source); + } + + var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)); + + return attachKeys(regexp, keys) + } + + /** + * Create a path regexp from string input. + * + * @param {string} path + * @param {!Array} keys + * @param {!Object} options + * @return {!RegExp} + */ + function stringToRegexp (path, keys, options) { + return tokensToRegExp(parse(path, options), keys, options) + } + + /** + * Expose a function for taking tokens and returning a RegExp. + * + * @param {!Array} tokens + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ + function tokensToRegExp (tokens, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */ (keys || options); + keys = []; + } + + options = options || {}; + + var strict = options.strict; + var end = options.end !== false; + var route = ''; + + // Iterate over the tokens and create our regexp string. + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + + if (typeof token === 'string') { + route += escapeString(token); + } else { + var prefix = escapeString(token.prefix); + var capture = '(?:' + token.pattern + ')'; + + keys.push(token); + + if (token.repeat) { + capture += '(?:' + prefix + capture + ')*'; + } + + if (token.optional) { + if (!token.partial) { + capture = '(?:' + prefix + '(' + capture + '))?'; + } else { + capture = prefix + '(' + capture + ')?'; + } + } else { + capture = prefix + '(' + capture + ')'; + } + + route += capture; + } + } + + var delimiter = escapeString(options.delimiter || '/'); + var endsWithDelimiter = route.slice(-delimiter.length) === delimiter; + + // In non-strict mode we allow a slash at the end of match. If the path to + // match already ends with a slash, we remove it for consistency. The slash + // is valid at the end of a path match, not in the middle. This is important + // in non-ending mode, where "/test/" shouldn't match "/test//route". + if (!strict) { + route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?'; + } + + if (end) { + route += '$'; + } else { + // In non-ending mode, we need the capturing groups to match as much as + // possible by using a positive lookahead to the end or next path segment. + route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)'; + } + + return attachKeys(new RegExp('^' + route, flags(options)), keys) + } + + /** + * Normalize the given path string, returning a regular expression. + * + * An empty array can be passed in for the keys, which will hold the + * placeholder key descriptions. For example, using `/user/:id`, `keys` will + * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. + * + * @param {(string|RegExp|Array)} path + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ + function pathToRegexp (path, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */ (keys || options); + keys = []; + } + + options = options || {}; + + if (path instanceof RegExp) { + return regexpToRegexp(path, /** @type {!Array} */ (keys)) + } + + if (isarray(path)) { + return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options) + } + + return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options) + } + pathToRegexp_1.parse = parse_1; + pathToRegexp_1.compile = compile_1; + pathToRegexp_1.tokensToFunction = tokensToFunction_1; + pathToRegexp_1.tokensToRegExp = tokensToRegExp_1; + + var patternCache = {}; + var cacheLimit = 10000; + var cacheCount = 0; + + var compileGenerator = function compileGenerator(pattern) { + var cacheKey = pattern; + var cache = patternCache[cacheKey] || (patternCache[cacheKey] = {}); + + if (cache[pattern]) return cache[pattern]; + + var compiledGenerator = pathToRegexp_1.compile(pattern); + + if (cacheCount < cacheLimit) { + cache[pattern] = compiledGenerator; + cacheCount++; + } + + return compiledGenerator; + }; + + /** + * Public API for generating a URL pathname from a pattern and parameters. + */ + var generatePath = function generatePath() { + var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "/"; + var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (pattern === "/") { + return pattern; + } + var generator = compileGenerator(pattern); + return generator(params, { pretty: true }); + }; + + /** + * The public API for updating the location programmatically + * with a component. + */ + + var Redirect = function (_React$Component) { + inherits(Redirect, _React$Component); + + function Redirect() { + classCallCheck(this, Redirect); + return possibleConstructorReturn(this, _React$Component.apply(this, arguments)); + } + + Redirect.prototype.isStatic = function isStatic() { + return this.context.router && this.context.router.staticContext; + }; + + Redirect.prototype.componentWillMount = function componentWillMount() { + invariant_1$1(this.context.router, "You should not use outside a "); + + if (this.isStatic()) this.perform(); + }; + + Redirect.prototype.componentDidMount = function componentDidMount() { + if (!this.isStatic()) this.perform(); + }; + + Redirect.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { + var prevTo = createLocation(prevProps.to); + var nextTo = createLocation(this.props.to); + + if (locationsAreEqual(prevTo, nextTo)) { + warning_1(false, "You tried to redirect to the same route you're currently on: " + ("\"" + nextTo.pathname + nextTo.search + "\"")); + return; + } + + this.perform(); + }; + + Redirect.prototype.computeTo = function computeTo(_ref) { + var computedMatch = _ref.computedMatch, + to = _ref.to; + + if (computedMatch) { + if (typeof to === "string") { + return generatePath(to, computedMatch.params); + } else { + return _extends$4({}, to, { + pathname: generatePath(to.pathname, computedMatch.params) + }); + } + } + + return to; + }; + + Redirect.prototype.perform = function perform() { + var history = this.context.router.history; + var push = this.props.push; + + var to = this.computeTo(this.props); + + if (push) { + history.push(to); + } else { + history.replace(to); + } + }; + + Redirect.prototype.render = function render() { + return null; + }; + + return Redirect; + }(React.Component); + + Redirect.propTypes = { + computedMatch: propTypes.object, // private, from + push: propTypes.bool, + from: propTypes.string, + to: propTypes.oneOfType([propTypes.string, propTypes.object]).isRequired + }; + Redirect.defaultProps = { + push: false + }; + Redirect.contextTypes = { + router: propTypes.shape({ + history: propTypes.shape({ + push: propTypes.func.isRequired, + replace: propTypes.func.isRequired + }).isRequired, + staticContext: propTypes.object + }).isRequired + }; + + var patternCache$1 = {}; + var cacheLimit$1 = 10000; + var cacheCount$1 = 0; + + var compilePath = function compilePath(pattern, options) { + var cacheKey = "" + options.end + options.strict + options.sensitive; + var cache = patternCache$1[cacheKey] || (patternCache$1[cacheKey] = {}); + + if (cache[pattern]) return cache[pattern]; + + var keys = []; + var re = pathToRegexp_1(pattern, keys, options); + var compiledPattern = { re: re, keys: keys }; + + if (cacheCount$1 < cacheLimit$1) { + cache[pattern] = compiledPattern; + cacheCount$1++; + } + + return compiledPattern; + }; + + /** + * Public API for matching a URL pathname to a path pattern. + */ + var matchPath = function matchPath(pathname) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parent = arguments[2]; + + if (typeof options === "string") options = { path: options }; + + var _options = options, + path = _options.path, + _options$exact = _options.exact, + exact = _options$exact === undefined ? false : _options$exact, + _options$strict = _options.strict, + strict = _options$strict === undefined ? false : _options$strict, + _options$sensitive = _options.sensitive, + sensitive = _options$sensitive === undefined ? false : _options$sensitive; + + + if (path == null) return parent; + + var _compilePath = compilePath(path, { end: exact, strict: strict, sensitive: sensitive }), + re = _compilePath.re, + keys = _compilePath.keys; + + var match = re.exec(pathname); + + if (!match) return null; + + var url = match[0], + values = match.slice(1); + + var isExact = pathname === url; + + if (exact && !isExact) return null; + + return { + path: path, // the path pattern used to match + url: path === "/" && url === "" ? "/" : url, // the matched portion of the URL + isExact: isExact, // whether or not we matched exactly + params: keys.reduce(function (memo, key, index) { + memo[key.name] = values[index]; + return memo; + }, {}) + }; + }; + + var isEmptyChildren = function isEmptyChildren(children) { + return React.Children.count(children) === 0; + }; + + /** + * The public API for matching a single path and rendering. + */ + + var Route = function (_React$Component) { + inherits(Route, _React$Component); + + function Route() { + var _temp, _this, _ret; + + classCallCheck(this, Route); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = { + match: _this.computeMatch(_this.props, _this.context.router) + }, _temp), possibleConstructorReturn(_this, _ret); + } + + Route.prototype.getChildContext = function getChildContext() { + return { + router: _extends$4({}, this.context.router, { + route: { + location: this.props.location || this.context.router.route.location, + match: this.state.match + } + }) + }; + }; + + Route.prototype.computeMatch = function computeMatch(_ref, router) { + var computedMatch = _ref.computedMatch, + location = _ref.location, + path = _ref.path, + strict = _ref.strict, + exact = _ref.exact, + sensitive = _ref.sensitive; + + if (computedMatch) return computedMatch; // already computed the match for us + + invariant_1$1(router, "You should not use or withRouter() outside a "); + + var route = router.route; + + var pathname = (location || route.location).pathname; + + return matchPath(pathname, { path: path, strict: strict, exact: exact, sensitive: sensitive }, route.match); + }; + + Route.prototype.componentWillMount = function componentWillMount() { + warning_1(!(this.props.component && this.props.render), "You should not use and in the same route; will be ignored"); + + warning_1(!(this.props.component && this.props.children && !isEmptyChildren(this.props.children)), "You should not use and in the same route; will be ignored"); + + warning_1(!(this.props.render && this.props.children && !isEmptyChildren(this.props.children)), "You should not use and in the same route; will be ignored"); + }; + + Route.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps, nextContext) { + warning_1(!(nextProps.location && !this.props.location), ' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'); + + warning_1(!(!nextProps.location && this.props.location), ' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'); + + this.setState({ + match: this.computeMatch(nextProps, nextContext.router) + }); + }; + + Route.prototype.render = function render() { + var match = this.state.match; + var _props = this.props, + children = _props.children, + component = _props.component, + render = _props.render; + var _context$router = this.context.router, + history = _context$router.history, + route = _context$router.route, + staticContext = _context$router.staticContext; + + var location = this.props.location || route.location; + var props = { match: match, location: location, history: history, staticContext: staticContext }; + + if (component) return match ? React.createElement(component, props) : null; + + if (render) return match ? render(props) : null; + + if (typeof children === "function") return children(props); + + if (children && !isEmptyChildren(children)) return React.Children.only(children); + + return null; + }; + + return Route; + }(React.Component); + + Route.propTypes = { + computedMatch: propTypes.object, // private, from + path: propTypes.string, + exact: propTypes.bool, + strict: propTypes.bool, + sensitive: propTypes.bool, + component: propTypes.func, + render: propTypes.func, + children: propTypes.oneOfType([propTypes.func, propTypes.node]), + location: propTypes.object + }; + Route.contextTypes = { + router: propTypes.shape({ + history: propTypes.object.isRequired, + route: propTypes.object.isRequired, + staticContext: propTypes.object + }) + }; + Route.childContextTypes = { + router: propTypes.object.isRequired + }; + + var addLeadingSlash$1 = function addLeadingSlash(path) { + return path.charAt(0) === "/" ? path : "/" + path; + }; + + var addBasename = function addBasename(basename, location) { + if (!basename) return location; + + return _extends$4({}, location, { + pathname: addLeadingSlash$1(basename) + location.pathname + }); + }; + + var stripBasename$1 = function stripBasename(basename, location) { + if (!basename) return location; + + var base = addLeadingSlash$1(basename); + + if (location.pathname.indexOf(base) !== 0) return location; + + return _extends$4({}, location, { + pathname: location.pathname.substr(base.length) + }); + }; + + var createURL = function createURL(location) { + return typeof location === "string" ? location : createPath(location); + }; + + var staticHandler = function staticHandler(methodName) { + return function () { + invariant_1$1(false, "You cannot %s with ", methodName); + }; + }; + + var noop = function noop() {}; + + /** + * The public top-level API for a "static" , so-called because it + * can't actually change the current location. Instead, it just records + * location changes in a context object. Useful mainly in testing and + * server-rendering scenarios. + */ + + var StaticRouter = function (_React$Component) { + inherits(StaticRouter, _React$Component); + + function StaticRouter() { + var _temp, _this, _ret; + + classCallCheck(this, StaticRouter); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.createHref = function (path) { + return addLeadingSlash$1(_this.props.basename + createURL(path)); + }, _this.handlePush = function (location) { + var _this$props = _this.props, + basename = _this$props.basename, + context = _this$props.context; + + context.action = "PUSH"; + context.location = addBasename(basename, createLocation(location)); + context.url = createURL(context.location); + }, _this.handleReplace = function (location) { + var _this$props2 = _this.props, + basename = _this$props2.basename, + context = _this$props2.context; + + context.action = "REPLACE"; + context.location = addBasename(basename, createLocation(location)); + context.url = createURL(context.location); + }, _this.handleListen = function () { + return noop; + }, _this.handleBlock = function () { + return noop; + }, _temp), possibleConstructorReturn(_this, _ret); + } + + StaticRouter.prototype.getChildContext = function getChildContext() { + return { + router: { + staticContext: this.props.context + } + }; + }; + + StaticRouter.prototype.componentWillMount = function componentWillMount() { + warning_1(!this.props.history, " ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { StaticRouter as Router }`."); + }; + + StaticRouter.prototype.render = function render() { + var _props = this.props, + basename = _props.basename, + context = _props.context, + location = _props.location, + props = objectWithoutProperties(_props, ["basename", "context", "location"]); + + + var history = { + createHref: this.createHref, + action: "POP", + location: stripBasename$1(basename, createLocation(location)), + push: this.handlePush, + replace: this.handleReplace, + go: staticHandler("go"), + goBack: staticHandler("goBack"), + goForward: staticHandler("goForward"), + listen: this.handleListen, + block: this.handleBlock + }; + + return React.createElement(Router, _extends$4({}, props, { history: history })); + }; + + return StaticRouter; + }(React.Component); + + StaticRouter.propTypes = { + basename: propTypes.string, + context: propTypes.object.isRequired, + location: propTypes.oneOfType([propTypes.string, propTypes.object]) + }; + StaticRouter.defaultProps = { + basename: "", + location: "/" + }; + StaticRouter.childContextTypes = { + router: propTypes.object.isRequired + }; + + /** + * The public API for rendering the first that matches. + */ + + var Switch = function (_React$Component) { + inherits(Switch, _React$Component); + + function Switch() { + classCallCheck(this, Switch); + return possibleConstructorReturn(this, _React$Component.apply(this, arguments)); + } + + Switch.prototype.componentWillMount = function componentWillMount() { + invariant_1$1(this.context.router, "You should not use outside a "); + }; + + Switch.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + warning_1(!(nextProps.location && !this.props.location), ' elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'); + + warning_1(!(!nextProps.location && this.props.location), ' elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'); + }; + + Switch.prototype.render = function render() { + var route = this.context.router.route; + var children = this.props.children; + + var location = this.props.location || route.location; + + var match = void 0, + child = void 0; + React.Children.forEach(children, function (element) { + if (match == null && React.isValidElement(element)) { + var _element$props = element.props, + pathProp = _element$props.path, + exact = _element$props.exact, + strict = _element$props.strict, + sensitive = _element$props.sensitive, + from = _element$props.from; + + var path = pathProp || from; + + child = element; + match = matchPath(location.pathname, { path: path, exact: exact, strict: strict, sensitive: sensitive }, route.match); + } + }); + + return match ? React.cloneElement(child, { location: location, computedMatch: match }) : null; + }; + + return Switch; + }(React.Component); + + Switch.contextTypes = { + router: propTypes.shape({ + route: propTypes.object.isRequired + }).isRequired + }; + Switch.propTypes = { + children: propTypes.node, + location: propTypes.object + }; + + var hoistNonReactStatics = createCommonjsModule(function (module, exports) { + /** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ + (function (global, factory) { + module.exports = factory(); + }(commonjsGlobal, (function () { + + var REACT_STATICS = { + childContextTypes: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true + }; + + var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true + }; + + var defineProperty = Object.defineProperty; + var getOwnPropertyNames = Object.getOwnPropertyNames; + var getOwnPropertySymbols = Object.getOwnPropertySymbols; + var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + var getPrototypeOf = Object.getPrototypeOf; + var objectPrototype = getPrototypeOf && getPrototypeOf(Object); + + return function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components + + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + try { // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + + return targetComponent; + } + + return targetComponent; + }; + }))); + }); + + /** + * A public higher-order component to access the imperative API + */ + var withRouter = function withRouter(Component) { + var C = function C(props) { + var wrappedComponentRef = props.wrappedComponentRef, + remainingProps = objectWithoutProperties(props, ["wrappedComponentRef"]); + + return React.createElement(Route, { + children: function children(routeComponentProps) { + return React.createElement(Component, _extends$4({}, remainingProps, routeComponentProps, { + ref: wrappedComponentRef + })); + } + }); + }; + + C.displayName = "withRouter(" + (Component.displayName || Component.name) + ")"; + C.WrappedComponent = Component; + C.propTypes = { + wrappedComponentRef: propTypes.func + }; + + return hoistNonReactStatics(C, Component); + }; + + exports.MemoryRouter = MemoryRouter; + exports.Prompt = Prompt; + exports.Redirect = Redirect; + exports.Route = Route; + exports.Router = Router; + exports.StaticRouter = StaticRouter; + exports.Switch = Switch; + exports.generatePath = generatePath; + exports.matchPath = matchPath; + exports.withRouter = withRouter; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/node_modules/react-router/umd/react-router.min.js b/node_modules/react-router/umd/react-router.min.js new file mode 100644 index 00000000..1ca46a1b --- /dev/null +++ b/node_modules/react-router/umd/react-router.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t.ReactRouter={},t.React)}(this,function(t,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function n(t,e){return t(e={exports:{}},e.exports),e.exports}function r(t){return function(){return t}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(t){return t};var i=o,a=function(t){};var c=function(t,e,n,r,o,i,c,u){if(a(e),!t){var s;if(void 0===e)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,r,o,i,c,u],l=0;(s=new Error(e.replace(/%s/g,function(){return p[l++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}},u=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;(function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}})()&&Object.assign;var l="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",h=n(function(t){t.exports=function(){function t(t,e,n,r,o,i){i!==l&&c(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return n.checkPropTypes=i,n.PropTypes=n,n}()}),f=function(){},d=function(t,e,n,r,o,i,a,c){if(!t){var u;if(void 0===e)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,o,i,a,c],p=0;(u=new Error(e.replace(/%s/g,function(){return s[p++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}};function y(t){return"/"===t.charAt(0)}function m(t,e){for(var n=e,r=n+1,o=t.length;r1&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],r=e&&e.split("/")||[],o=t&&y(t),i=e&&y(e),a=o||i;if(t&&y(t)?r=n:n.length&&(r.pop(),r=r.concat(n)),!r.length)return"/";var c=void 0;if(r.length){var u=r[r.length-1];c="."===u||".."===u||""===u}else c=!1;for(var s=0,p=r.length;p>=0;p--){var l=r[p];"."===l?m(r,p):".."===l?(m(r,p),s++):s&&(m(r,p),s--)}if(!a)for(;s--;s)r.unshift("..");!a||""===r[0]||r[0]&&y(r[0])||r.unshift("");var h=r.join("/");return c&&"/"!==h.substr(-1)&&(h+="/"),h}(o.pathname,r.pathname)):o.pathname=r.pathname:o.pathname||(o.pathname="/"),o},w=function(t,e){return t.pathname===e.pathname&&t.search===e.search&&t.hash===e.hash&&t.key===e.key&&function t(e,n){if(e===n)return!0;if(null==e||null==n)return!1;if(Array.isArray(e))return Array.isArray(n)&&e.length===n.length&&e.every(function(e,r){return t(e,n[r])});var r=void 0===e?"undefined":v(e);if(r!==(void 0===n?"undefined":v(n)))return!1;if("object"===r){var o=e.valueOf(),i=n.valueOf();if(o!==e||i!==n)return t(o,i);var a=Object.keys(e),c=Object.keys(n);return a.length===c.length&&a.every(function(r){return t(e[r],n[r])})}return!1}(t.state,e.state)},O=("undefined"==typeof window||!window.document||window.document.createElement,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t}),R=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{},r=n.getUserConfirmation,o=n.initialEntries,i=void 0===o?["/"]:o,a=n.initialIndex,c=void 0===a?0:a,u=n.keyLength,s=void 0===u?6:u,p=(t=null,e=[],{setPrompt:function(e){return f(null==t,"A history supports only one prompt at a time"),t=e,function(){t===e&&(t=null)}},confirmTransitionTo:function(e,n,r,o){if(null!=t){var i="function"==typeof t?t(e,n):t;"string"==typeof i?"function"==typeof r?r(i,o):(f(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),o(!0)):o(!1!==i)}else o(!0)},appendListener:function(t){var n=!0,r=function(){n&&t.apply(void 0,arguments)};return e.push(r),function(){n=!1,e=e.filter(function(t){return t!==r})}},notifyListeners:function(){for(var t=arguments.length,n=Array(t),r=0;re?r.splice(e,r.length-e,n):r.push(n),l({action:"PUSH",location:n,index:e,entries:r})}})},replace:function(t,e){f(!("object"===(void 0===t?"undefined":O(t))&&void 0!==t.state&&void 0!==e),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var n=x(t,e,h(),b.location);p.confirmTransitionTo(n,"REPLACE",r,function(t){t&&(b.entries[b.index]=n,l({action:"REPLACE",location:n}))})},go:v,goBack:function(){return v(-1)},goForward:function(){return v(1)},canGo:function(t){var e=b.index+t;return e>=0&&e0&&void 0!==arguments[0]&&arguments[0];return p.setPrompt(t)},listen:function(t){return p.appendListener(t)}};return b},E=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},C=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},S=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},A=function(t){function n(){var e,r;E(this,n);for(var o=arguments.length,i=Array(o),a=0;a0&&void 0!==arguments[0]?arguments[0]:"/",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"/"===t?t:function(t){var e=t,n=K[e]||(K[e]={});if(n[t])return n[t];var r=_.compile(t);return Q<1e4&&(n[t]=r,Q++),r}(t)(e,{pretty:!0})},Z=function(t){function e(){return E(this,e),S(this,t.apply(this,arguments))}return T(e,t),e.prototype.isStatic=function(){return this.context.router&&this.context.router.staticContext},e.prototype.componentWillMount=function(){this.context.router||d(!1),this.isStatic()&&this.perform()},e.prototype.componentDidMount=function(){this.isStatic()||this.perform()},e.prototype.componentDidUpdate=function(t){var e=x(t.to),n=x(this.props.to);w(e,n)||this.perform()},e.prototype.computeTo=function(t){var e=t.computedMatch,n=t.to;return e?"string"==typeof n?X(n,e.params):C({},n,{pathname:X(n.pathname,e.params)}):n},e.prototype.perform=function(){var t=this.context.router.history,e=this.props.push,n=this.computeTo(this.props);e?t.push(n):t.replace(n)},e.prototype.render=function(){return null},e}(e.Component);Z.defaultProps={push:!1},Z.contextTypes={router:h.shape({history:h.shape({push:h.func.isRequired,replace:h.func.isRequired}).isRequired,staticContext:h.object}).isRequired};var tt={},et=0,nt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];"string"==typeof e&&(e={path:e});var r=e,o=r.path,i=r.exact,a=void 0!==i&&i,c=r.strict,u=void 0!==c&&c,s=r.sensitive,p=void 0!==s&&s;if(null==o)return n;var l=function(t,e){var n=""+e.end+e.strict+e.sensitive,r=tt[n]||(tt[n]={});if(r[t])return r[t];var o=[],i={re:_(t,o,e),keys:o};return et<1e4&&(r[t]=i,et++),i}(o,{end:a,strict:u,sensitive:p}),h=l.re,f=l.keys,d=h.exec(t);if(!d)return null;var y=d[0],m=d.slice(1),v=t===y;return a&&!v?null:{path:o,url:"/"===o&&""===y?"/":y,isExact:v,params:f.reduce(function(t,e,n){return t[e.name]=m[n],t},{})}},rt=function(t){function n(){var e,r;E(this,n);for(var o=arguments.length,i=Array(o),a=0;a= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +/** + * A public higher-order component to access the imperative API + */ +var withRouter = function withRouter(Component) { + var C = function C(props) { + var wrappedComponentRef = props.wrappedComponentRef, + remainingProps = _objectWithoutProperties(props, ["wrappedComponentRef"]); + + return _react2.default.createElement(_Route2.default, { + children: function children(routeComponentProps) { + return _react2.default.createElement(Component, _extends({}, remainingProps, routeComponentProps, { + ref: wrappedComponentRef + })); + } + }); + }; + + C.displayName = "withRouter(" + (Component.displayName || Component.name) + ")"; + C.WrappedComponent = Component; + C.propTypes = { + wrappedComponentRef: _propTypes2.default.func + }; + + return (0, _hoistNonReactStatics2.default)(C, Component); +}; + +exports.default = withRouter; \ No newline at end of file diff --git a/node_modules/resolve-pathname/README.md b/node_modules/resolve-pathname/README.md new file mode 100644 index 00000000..e893e5d8 --- /dev/null +++ b/node_modules/resolve-pathname/README.md @@ -0,0 +1,65 @@ +# resolve-pathname [![Travis][build-badge]][build] [![npm package][npm-badge]][npm] + +[build-badge]: https://img.shields.io/travis/mjackson/resolve-pathname/master.svg?style=flat-square +[build]: https://travis-ci.org/mjackson/resolve-pathname + +[npm-badge]: https://img.shields.io/npm/v/resolve-pathname.svg?style=flat-square +[npm]: https://www.npmjs.org/package/resolve-pathname + +[resolve-pathname](https://www.npmjs.com/package/resolve-pathname) resolves URL pathnames identical to the way browsers resolve the pathname of an `` value. The goals are: + + - 100% compatibility with browser pathname resolution + - Pure JavaScript implementation (no DOM dependency) + +## Installation + +Using [npm](https://www.npmjs.com/): + + $ npm install --save resolve-pathname + +Then, use as you would anything else: + +```js +// using ES6 modules +import resolvePathname from 'resolve-pathname' + +// using CommonJS modules +var resolvePathname = require('resolve-pathname') +``` + +The UMD build is also available on [unpkg](https://unpkg.com): + +```html + +``` + +You can find the library on `window.resolvePathname`. + +## Usage + +```js +import resolvePathname from 'resolve-pathname' + +// Simply pass the pathname you'd like to resolve. Second +// argument is the path we're coming from, or the current +// pathname. It defaults to "/". +resolvePathname('about', '/company/jobs') // /company/about +resolvePathname('../jobs', '/company/team/ceo') // /company/jobs +resolvePathname('about') // /about +resolvePathname('/about') // /about + +// Index paths (with a trailing slash) are also supported and +// work the same way as browsers. +resolvePathname('about', '/company/info/') // /company/info/about + +// In browsers, it's easy to resolve a URL pathname relative to +// the current page. Just use window.location! e.g. if +// window.location.pathname == '/company/team/ceo' then +resolvePathname('cto', window.location.pathname) // /company/team/cto +resolvePathname('../jobs', window.location.pathname) // /company/jobs +``` + +## Prior Work + +- [url.resolve](https://nodejs.org/api/url.html#url_url_resolve_from_to) - node's `url.resolve` implementation for full URLs +- [resolve-url](https://www.npmjs.com/package/resolve-url) - A DOM-dependent implementation of the same algorithm diff --git a/node_modules/resolve-pathname/cjs/index.js b/node_modules/resolve-pathname/cjs/index.js new file mode 100644 index 00000000..01bd61e8 --- /dev/null +++ b/node_modules/resolve-pathname/cjs/index.js @@ -0,0 +1,74 @@ +'use strict'; + +exports.__esModule = true; +function isAbsolute(pathname) { + return pathname.charAt(0) === '/'; +} + +// About 1.5x faster than the two-arg version of Array#splice() +function spliceOne(list, index) { + for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) { + list[i] = list[k]; + } + + list.pop(); +} + +// This implementation is based heavily on node's url.parse +function resolvePathname(to) { + var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + var toParts = to && to.split('/') || []; + var fromParts = from && from.split('/') || []; + + var isToAbs = to && isAbsolute(to); + var isFromAbs = from && isAbsolute(from); + var mustEndAbs = isToAbs || isFromAbs; + + if (to && isAbsolute(to)) { + // to is absolute + fromParts = toParts; + } else if (toParts.length) { + // to is relative, drop the filename + fromParts.pop(); + fromParts = fromParts.concat(toParts); + } + + if (!fromParts.length) return '/'; + + var hasTrailingSlash = void 0; + if (fromParts.length) { + var last = fromParts[fromParts.length - 1]; + hasTrailingSlash = last === '.' || last === '..' || last === ''; + } else { + hasTrailingSlash = false; + } + + var up = 0; + for (var i = fromParts.length; i >= 0; i--) { + var part = fromParts[i]; + + if (part === '.') { + spliceOne(fromParts, i); + } else if (part === '..') { + spliceOne(fromParts, i); + up++; + } else if (up) { + spliceOne(fromParts, i); + up--; + } + } + + if (!mustEndAbs) for (; up--; up) { + fromParts.unshift('..'); + }if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift(''); + + var result = fromParts.join('/'); + + if (hasTrailingSlash && result.substr(-1) !== '/') result += '/'; + + return result; +} + +exports.default = resolvePathname; +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/resolve-pathname/index.js b/node_modules/resolve-pathname/index.js new file mode 100644 index 00000000..a9907ca2 --- /dev/null +++ b/node_modules/resolve-pathname/index.js @@ -0,0 +1,70 @@ +function isAbsolute(pathname) { + return pathname.charAt(0) === '/'; +} + +// About 1.5x faster than the two-arg version of Array#splice() +function spliceOne(list, index) { + for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) { + list[i] = list[k]; + } + + list.pop(); +} + +// This implementation is based heavily on node's url.parse +function resolvePathname(to) { + var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + var toParts = to && to.split('/') || []; + var fromParts = from && from.split('/') || []; + + var isToAbs = to && isAbsolute(to); + var isFromAbs = from && isAbsolute(from); + var mustEndAbs = isToAbs || isFromAbs; + + if (to && isAbsolute(to)) { + // to is absolute + fromParts = toParts; + } else if (toParts.length) { + // to is relative, drop the filename + fromParts.pop(); + fromParts = fromParts.concat(toParts); + } + + if (!fromParts.length) return '/'; + + var hasTrailingSlash = void 0; + if (fromParts.length) { + var last = fromParts[fromParts.length - 1]; + hasTrailingSlash = last === '.' || last === '..' || last === ''; + } else { + hasTrailingSlash = false; + } + + var up = 0; + for (var i = fromParts.length; i >= 0; i--) { + var part = fromParts[i]; + + if (part === '.') { + spliceOne(fromParts, i); + } else if (part === '..') { + spliceOne(fromParts, i); + up++; + } else if (up) { + spliceOne(fromParts, i); + up--; + } + } + + if (!mustEndAbs) for (; up--; up) { + fromParts.unshift('..'); + }if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift(''); + + var result = fromParts.join('/'); + + if (hasTrailingSlash && result.substr(-1) !== '/') result += '/'; + + return result; +} + +export default resolvePathname; \ No newline at end of file diff --git a/node_modules/resolve-pathname/package.json b/node_modules/resolve-pathname/package.json new file mode 100644 index 00000000..736ee84c --- /dev/null +++ b/node_modules/resolve-pathname/package.json @@ -0,0 +1,75 @@ +{ + "_from": "resolve-pathname@^2.2.0", + "_id": "resolve-pathname@2.2.0", + "_inBundle": false, + "_integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg==", + "_location": "/resolve-pathname", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "resolve-pathname@^2.2.0", + "name": "resolve-pathname", + "escapedName": "resolve-pathname", + "rawSpec": "^2.2.0", + "saveSpec": null, + "fetchSpec": "^2.2.0" + }, + "_requiredBy": [ + "/history" + ], + "_resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz", + "_shasum": "7e9ae21ed815fd63ab189adeee64dc831eefa879", + "_spec": "resolve-pathname@^2.2.0", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/history", + "author": { + "name": "Michael Jackson" + }, + "bugs": { + "url": "https://github.com/mjackson/resolve-pathname/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Resolve URL pathnames using JavaScript", + "devDependencies": { + "babel-cli": "^6.5.1", + "babel-core": "^6.5.2", + "babel-eslint": "^7.0.0", + "babel-loader": "^6.2.3", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-preset-es2015": "^6.5.0", + "babel-preset-stage-1": "^6.24.1", + "eslint": "^3.2.2", + "eslint-plugin-import": "^2.0.0", + "expect": "^1.14.0", + "gzip-size": "^3.0.0", + "in-publish": "^2.0.0", + "mocha": "^3.0.0", + "pretty-bytes": "^4.0.2", + "readline-sync": "^1.4.1", + "webpack": "^1.12.14" + }, + "files": [ + "cjs", + "index.js", + "umd" + ], + "homepage": "https://github.com/mjackson/resolve-pathname#readme", + "license": "MIT", + "main": "cjs/index.js", + "module": "index.js", + "name": "resolve-pathname", + "repository": { + "type": "git", + "url": "git+https://github.com/mjackson/resolve-pathname.git" + }, + "scripts": { + "build": "node ./tools/build.js", + "clean": "git clean -fdX .", + "lint": "eslint modules", + "prepublish": "node ./tools/build.js", + "release": "node ./tools/release.js", + "test": "mocha --compilers js:babel-core/register modules/**/*-test.js" + }, + "version": "2.2.0" +} diff --git a/node_modules/resolve-pathname/umd/resolve-pathname.js b/node_modules/resolve-pathname/umd/resolve-pathname.js new file mode 100644 index 00000000..e8d238f8 --- /dev/null +++ b/node_modules/resolve-pathname/umd/resolve-pathname.js @@ -0,0 +1,134 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["resolvePathname"] = factory(); + else + root["resolvePathname"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + function isAbsolute(pathname) { + return pathname.charAt(0) === '/'; + } + + // About 1.5x faster than the two-arg version of Array#splice() + function spliceOne(list, index) { + for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) { + list[i] = list[k]; + } + + list.pop(); + } + + // This implementation is based heavily on node's url.parse + function resolvePathname(to) { + var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + var toParts = to && to.split('/') || []; + var fromParts = from && from.split('/') || []; + + var isToAbs = to && isAbsolute(to); + var isFromAbs = from && isAbsolute(from); + var mustEndAbs = isToAbs || isFromAbs; + + if (to && isAbsolute(to)) { + // to is absolute + fromParts = toParts; + } else if (toParts.length) { + // to is relative, drop the filename + fromParts.pop(); + fromParts = fromParts.concat(toParts); + } + + if (!fromParts.length) return '/'; + + var hasTrailingSlash = void 0; + if (fromParts.length) { + var last = fromParts[fromParts.length - 1]; + hasTrailingSlash = last === '.' || last === '..' || last === ''; + } else { + hasTrailingSlash = false; + } + + var up = 0; + for (var i = fromParts.length; i >= 0; i--) { + var part = fromParts[i]; + + if (part === '.') { + spliceOne(fromParts, i); + } else if (part === '..') { + spliceOne(fromParts, i); + up++; + } else if (up) { + spliceOne(fromParts, i); + up--; + } + } + + if (!mustEndAbs) for (; up--; up) { + fromParts.unshift('..'); + }if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift(''); + + var result = fromParts.join('/'); + + if (hasTrailingSlash && result.substr(-1) !== '/') result += '/'; + + return result; + } + + exports.default = resolvePathname; + +/***/ }) +/******/ ]) +}); +; \ No newline at end of file diff --git a/node_modules/resolve-pathname/umd/resolve-pathname.min.js b/node_modules/resolve-pathname/umd/resolve-pathname.min.js new file mode 100644 index 00000000..5b09a170 --- /dev/null +++ b/node_modules/resolve-pathname/umd/resolve-pathname.min.js @@ -0,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.resolvePathname=t():e.resolvePathname=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){"use strict";function n(e){return"/"===e.charAt(0)}function o(e,t){for(var n=t,o=n+1,r=e.length;o1&&void 0!==arguments[1]?arguments[1]:"",r=e&&e.split("/")||[],f=t&&t.split("/")||[],i=e&&n(e),u=t&&n(t),s=i||u;if(e&&n(e)?f=r:r.length&&(f.pop(),f=f.concat(r)),!f.length)return"/";var a=void 0;if(f.length){var l=f[f.length-1];a="."===l||".."===l||""===l}else a=!1;for(var p=0,c=f.length;c>=0;c--){var d=f[c];"."===d?o(f,c):".."===d?(o(f,c),p++):p&&(o(f,c),p--)}if(!s)for(;p--;p)f.unshift("..");!s||""===f[0]||f[0]&&n(f[0])||f.unshift("");var h=f.join("/");return a&&"/"!==h.substr(-1)&&(h+="/"),h}t.__esModule=!0,t.default=r}])}); \ No newline at end of file diff --git a/node_modules/value-equal/README.md b/node_modules/value-equal/README.md new file mode 100644 index 00000000..473a81ce --- /dev/null +++ b/node_modules/value-equal/README.md @@ -0,0 +1,55 @@ +# value-equal [![Travis][build-badge]][build] [![npm package][npm-badge]][npm] + +[build-badge]: https://img.shields.io/travis/mjackson/value-equal/master.svg?style=flat-square +[build]: https://travis-ci.org/mjackson/value-equal + +[npm-badge]: https://img.shields.io/npm/v/value-equal.svg?style=flat-square +[npm]: https://www.npmjs.org/package/value-equal + +[`value-equal`](https://www.npmjs.com/package/value-equal) determines if two JavaScript values are equal using [`Object.prototype.valueOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf). + +In many instances when I'm checking for object equality, what I really want to know is if their **values** are equal. This is good for: + +- Stuff you keep in `localStorage` +- `window.history.state` values +- Query strings + +## Installation + +Using [npm](https://www.npmjs.com/): + + $ npm install --save value-equal + +Then with a module bundler like [webpack](https://webpack.github.io/), use as you would anything else: + +```js +// using ES6 modules +import valueEqual from 'value-equal' + +// using CommonJS modules +var valueEqual = require('value-equal') +``` + +The UMD build is also available on [unpkg](https://unpkg.com): + +```html + +``` + +You can find the library on `window.valueEqual`. + +## Usage + +```js +valueEqual(1, 1) // true +valueEqual('asdf', 'asdf') // true +valueEqual('asdf', new String('asdf')) // true +valueEqual(true, true) // true +valueEqual(true, false) // false +valueEqual({ a: 'a' }, { a: 'a' }) // true +valueEqual({ a: 'a' }, { a: 'b' }) // false +valueEqual([ 1, 2, 3 ], [ 1, 2, 3 ]) // true +valueEqual([ 1, 2, 3 ], [ 2, 3, 4 ]) // false +``` + +That's it. Enjoy! diff --git a/node_modules/value-equal/cjs/index.js b/node_modules/value-equal/cjs/index.js new file mode 100644 index 00000000..3562c44c --- /dev/null +++ b/node_modules/value-equal/cjs/index.js @@ -0,0 +1,43 @@ +'use strict'; + +exports.__esModule = true; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +function valueEqual(a, b) { + if (a === b) return true; + + if (a == null || b == null) return false; + + if (Array.isArray(a)) { + return Array.isArray(b) && a.length === b.length && a.every(function (item, index) { + return valueEqual(item, b[index]); + }); + } + + var aType = typeof a === 'undefined' ? 'undefined' : _typeof(a); + var bType = typeof b === 'undefined' ? 'undefined' : _typeof(b); + + if (aType !== bType) return false; + + if (aType === 'object') { + var aValue = a.valueOf(); + var bValue = b.valueOf(); + + if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); + + var aKeys = Object.keys(a); + var bKeys = Object.keys(b); + + if (aKeys.length !== bKeys.length) return false; + + return aKeys.every(function (key) { + return valueEqual(a[key], b[key]); + }); + } + + return false; +} + +exports.default = valueEqual; +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/value-equal/index.js b/node_modules/value-equal/index.js new file mode 100644 index 00000000..aa9ae333 --- /dev/null +++ b/node_modules/value-equal/index.js @@ -0,0 +1,38 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +function valueEqual(a, b) { + if (a === b) return true; + + if (a == null || b == null) return false; + + if (Array.isArray(a)) { + return Array.isArray(b) && a.length === b.length && a.every(function (item, index) { + return valueEqual(item, b[index]); + }); + } + + var aType = typeof a === 'undefined' ? 'undefined' : _typeof(a); + var bType = typeof b === 'undefined' ? 'undefined' : _typeof(b); + + if (aType !== bType) return false; + + if (aType === 'object') { + var aValue = a.valueOf(); + var bValue = b.valueOf(); + + if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); + + var aKeys = Object.keys(a); + var bKeys = Object.keys(b); + + if (aKeys.length !== bKeys.length) return false; + + return aKeys.every(function (key) { + return valueEqual(a[key], b[key]); + }); + } + + return false; +} + +export default valueEqual; \ No newline at end of file diff --git a/node_modules/value-equal/package.json b/node_modules/value-equal/package.json new file mode 100644 index 00000000..bb949450 --- /dev/null +++ b/node_modules/value-equal/package.json @@ -0,0 +1,70 @@ +{ + "_from": "value-equal@^0.4.0", + "_id": "value-equal@0.4.0", + "_inBundle": false, + "_integrity": "sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw==", + "_location": "/value-equal", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "value-equal@^0.4.0", + "name": "value-equal", + "escapedName": "value-equal", + "rawSpec": "^0.4.0", + "saveSpec": null, + "fetchSpec": "^0.4.0" + }, + "_requiredBy": [ + "/history" + ], + "_resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.4.0.tgz", + "_shasum": "c5bdd2f54ee093c04839d71ce2e4758a6890abc7", + "_spec": "value-equal@^0.4.0", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/history", + "author": { + "name": "Michael Jackson" + }, + "bugs": { + "url": "https://github.com/mjackson/value-equal/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Are these two JavaScript values equal?", + "devDependencies": { + "babel-cli": "^6.18.0", + "babel-core": "^6.18.0", + "babel-loader": "^6.2.5", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-preset-es2015": "^6.16.0", + "expect": "^1.20.2", + "gzip-size": "^3.0.0", + "in-publish": "^2.0.0", + "mocha": "^3.1.2", + "pretty-bytes": "^4.0.2", + "readline-sync": "^1.4.4", + "webpack": "^1.13.3" + }, + "files": [ + "cjs", + "index.js", + "umd" + ], + "homepage": "https://github.com/mjackson/value-equal#readme", + "license": "MIT", + "main": "cjs/index.js", + "module": "index.js", + "name": "value-equal", + "repository": { + "type": "git", + "url": "git+https://github.com/mjackson/value-equal.git" + }, + "scripts": { + "build": "node ./tools/build.js", + "clean": "git clean -fdX .", + "prepublish": "node ./tools/build.js", + "release": "node ./tools/release.js", + "test": "mocha --compilers js:babel-core/register modules/**/*-test.js" + }, + "version": "0.4.0" +} diff --git a/node_modules/value-equal/umd/resolve-pathname.js b/node_modules/value-equal/umd/resolve-pathname.js new file mode 100644 index 00000000..3d0802ae --- /dev/null +++ b/node_modules/value-equal/umd/resolve-pathname.js @@ -0,0 +1,101 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["valueEqual"] = factory(); + else + root["valueEqual"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var valueEqual = function valueEqual(a, b) { + if (a === b) return true; + + if (a == null || b == null) return false; + + if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every(function (item, index) { + return valueEqual(item, b[index]); + }); + + var aType = typeof a === 'undefined' ? 'undefined' : _typeof(a); + var bType = typeof b === 'undefined' ? 'undefined' : _typeof(b); + + if (aType !== bType) return false; + + if (aType === 'object') { + var aValue = a.valueOf(); + var bValue = b.valueOf(); + + if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); + + var aKeys = Object.keys(a); + var bKeys = Object.keys(b); + + if (aKeys.length !== bKeys.length) return false; + + return aKeys.every(function (key) { + return valueEqual(a[key], b[key]); + }); + } + + return false; + }; + + exports.default = valueEqual; + +/***/ }) +/******/ ]) +}); +; \ No newline at end of file diff --git a/node_modules/value-equal/umd/resolve-pathname.min.js b/node_modules/value-equal/umd/resolve-pathname.min.js new file mode 100644 index 00000000..fb145d9f --- /dev/null +++ b/node_modules/value-equal/umd/resolve-pathname.min.js @@ -0,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.valueEqual=t():e.valueEqual=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t){"use strict";t.__esModule=!0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function e(t,n){if(t===n)return!0;if(null==t||null==n)return!1;if(Array.isArray(t))return Array.isArray(n)&&t.length===n.length&&t.every(function(t,r){return e(t,n[r])});var o="undefined"==typeof t?"undefined":r(t),u="undefined"==typeof n?"undefined":r(n);if(o!==u)return!1;if("object"===o){var f=t.valueOf(),i=n.valueOf();if(f!==t||i!==n)return e(f,i);var l=Object.keys(t),y=Object.keys(n);return l.length===y.length&&l.every(function(r){return e(t[r],n[r])})}return!1};t.default=n}])}); \ No newline at end of file diff --git a/node_modules/value-equal/umd/value-equal.js b/node_modules/value-equal/umd/value-equal.js new file mode 100644 index 00000000..253c3209 --- /dev/null +++ b/node_modules/value-equal/umd/value-equal.js @@ -0,0 +1,103 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["valueEqual"] = factory(); + else + root["valueEqual"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + function valueEqual(a, b) { + if (a === b) return true; + + if (a == null || b == null) return false; + + if (Array.isArray(a)) { + return Array.isArray(b) && a.length === b.length && a.every(function (item, index) { + return valueEqual(item, b[index]); + }); + } + + var aType = typeof a === 'undefined' ? 'undefined' : _typeof(a); + var bType = typeof b === 'undefined' ? 'undefined' : _typeof(b); + + if (aType !== bType) return false; + + if (aType === 'object') { + var aValue = a.valueOf(); + var bValue = b.valueOf(); + + if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); + + var aKeys = Object.keys(a); + var bKeys = Object.keys(b); + + if (aKeys.length !== bKeys.length) return false; + + return aKeys.every(function (key) { + return valueEqual(a[key], b[key]); + }); + } + + return false; + } + + exports.default = valueEqual; + +/***/ }) +/******/ ]) +}); +; \ No newline at end of file diff --git a/node_modules/value-equal/umd/value-equal.min.js b/node_modules/value-equal/umd/value-equal.min.js new file mode 100644 index 00000000..2b56171a --- /dev/null +++ b/node_modules/value-equal/umd/value-equal.min.js @@ -0,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.valueEqual=t():e.valueEqual=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t){"use strict";function r(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e))return Array.isArray(t)&&e.length===t.length&&e.every(function(e,n){return r(e,t[n])});var o="undefined"==typeof e?"undefined":n(e),u="undefined"==typeof t?"undefined":n(t);if(o!==u)return!1;if("object"===o){var f=e.valueOf(),i=t.valueOf();if(f!==e||i!==t)return r(f,i);var l=Object.keys(e),y=Object.keys(t);return l.length===y.length&&l.every(function(n){return r(e[n],t[n])})}return!1}t.__esModule=!0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=r}])}); \ No newline at end of file diff --git a/node_modules/warning/CHANGELOG.md b/node_modules/warning/CHANGELOG.md new file mode 100644 index 00000000..b62957a1 --- /dev/null +++ b/node_modules/warning/CHANGELOG.md @@ -0,0 +1,73 @@ + +## [4.0.2](https://github.com/BerkeleyTrue/warning/compare/v4.0.1...v4.0.2) (2018-08-17) + + +### Bug Fixes + +* **use jest instead of tap:** tap is a PITA to debug ([c4c026b](https://github.com/BerkeleyTrue/warning/commit/c4c026b)) +* remove [@provides](https://github.com/provides)Module annotation ([1d808f1](https://github.com/BerkeleyTrue/warning/commit/1d808f1)) + + + +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + + +## [4.0.1](https://github.com/BerkeleyTrue/warning/compare/v4.0.0...v4.0.1) (2018-05-30) + + +### Bug Fixes + +* add `var printWarning =` to comply with ES5 strict mode ([677dcfa](https://github.com/BerkeleyTrue/warning/commit/677dcfa)), closes [#25](https://github.com/BerkeleyTrue/warning/issues/25) + + +## [4.0.0](https://github.com/BerkeleyTrue/warning/compare/v3.0.0...v4.0.0) (2018-05-22) + + +### Bug Fixes + +* Remove "browser" version ([521f5f5](https://github.com/BerkeleyTrue/warning/commit/521f5f5)), closes [#18](https://github.com/BerkeleyTrue/warning/issues/18) [/github.com/facebook/fbjs/pull/86#issuecomment-285204734](https://github.com//github.com/facebook/fbjs/pull/86/issues/issuecomment-285204734) +* Update warning to use the latest version from facebook/fbjs ([0572ddd](https://github.com/BerkeleyTrue/warning/commit/0572ddd)) + + +### Chores + +* **LICENSE:** Change from BSD modified to MIT ([5a63a1b](https://github.com/BerkeleyTrue/warning/commit/5a63a1b)) + + +### BREAKING CHANGES + +* **LICENSE:** Change License to MIT from BSD+patents +* This changes the internal workings. A major release is +made to ensure minimal effect on downstream users. + + + +## [3.0.0](https://github.com/BerkeleyTrue/warning/compare/v2.1.0...v3.0.0) (2015-10-04) + +### BREAKING CHANGE + +* **package.json** correct license field ([6bd7ad5](https://github.com/BerkeleyTrue/warning/commit/6bd7ad5)) + + +## [2.1.0](https://github.com/BerkeleyTrue/warning/compare/v2.0.0...v2.1.0) (2015-10-04) + +### Features + +* switch to loose-envify ([dacc2da](https://github.com/BerkeleyTrue/warning/commit/dacc2da)) + + +## [2.0.0](https://github.com/BerkeleyTrue/warning/compare/v1.0.2...v2.0.0) (2015-07-11) + +### BREAKING CHANGE + +* add browser(ify) friendly version ([1a33d40fa1](https://github.com/BerkeleyTrue/warning/commit/1a33d40fa1)) + + +## [1.0.2](https://github.com/BerkeleyTrue/warning/compare/v1.0.1...v1.0.2) (2015-05-30) + +### Bug Fixes + +* return args in replace ([2ac6962](https://github.com/BerkeleyTrue/warning/commit/2ac6962263)) diff --git a/node_modules/warning/LICENSE.md b/node_modules/warning/LICENSE.md new file mode 100644 index 00000000..188fb2b0 --- /dev/null +++ b/node_modules/warning/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013-present, Facebook, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/warning/README.md b/node_modules/warning/README.md new file mode 100644 index 00000000..81e88ceb --- /dev/null +++ b/node_modules/warning/README.md @@ -0,0 +1,69 @@ +# Warning [![npm version](https://badge.fury.io/js/warning.svg)](https://badge.fury.io/js/warning) + +[![Greenkeeper badge](https://badges.greenkeeper.io/BerkeleyTrue/warning.svg)](https://greenkeeper.io/) +A mirror of Facebook's [Warning](https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/warning.js) + + +## Usage +``` +npm install warning +``` + +``` +// some script +var warning = require('warning'); + +var ShouldBeTrue = false; + +warning( + ShouldBeTrue, + 'This thing should be true but you set to false. No soup for you!' +); +// 'This thing should be true but you set to false. No soup for you!' +``` + +Similar to Facebook's (FB) invariant but only logs a warning if the condition is not met. +This can be used to log issues in development environments in critical +paths. Removing the logging code for production environments will keep the +same logic and follow the same code paths. + +## FAQ (READ before opening an issue) + +> Why do you use `console.error` instead of `console.warn` ? + +This is a mirror of Facebook's (FB) [warning](https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/warning.js) module used within React's source code (and other FB software). +As such this module will mirror their code as much as possible. + +The descision to use `error` over `warn` was made a long time ago by the FB team and isn't going to change anytime soon. + +The source can be found here: https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/warning.js +The reasoning can be found here and elsewhere: https://github.com/facebook/fbjs/pull/94#issuecomment-168332326 + +> Can I add X feature? + +This is a mirror of Facebook's (FB) [warning](https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/warning.js) and as such the source and signature will mirror that module. + +If you believe a feature is missing than please open a feature request [there](https://github.com/facebook/fbjs). +If it is approved and merged in that this module will be updated to reflect that change, otherwise this module will not change. + +## Use in Production + +It is recommended to add [babel-plugin-dev-expression](https://github.com/4Catalyzer/babel-plugin-dev-expression) with this module to remove warning messages in production. +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Don't Forget To Be Awesome diff --git a/node_modules/warning/package.json b/node_modules/warning/package.json new file mode 100644 index 00000000..531347dc --- /dev/null +++ b/node_modules/warning/package.json @@ -0,0 +1,85 @@ +{ + "_from": "warning@^4.0.1", + "_id": "warning@4.0.2", + "_inBundle": false, + "_integrity": "sha512-wbTp09q/9C+jJn4KKJfJfoS6VleK/Dti0yqWSm6KMvJ4MRCXFQNapHuJXutJIrWV0Cf4AhTdeIe4qdKHR1+Hug==", + "_location": "/warning", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "warning@^4.0.1", + "name": "warning", + "escapedName": "warning", + "rawSpec": "^4.0.1", + "saveSpec": null, + "fetchSpec": "^4.0.1" + }, + "_requiredBy": [ + "/react-router", + "/react-router-dom" + ], + "_resolved": "https://registry.npmjs.org/warning/-/warning-4.0.2.tgz", + "_shasum": "aa6876480872116fa3e11d434b0d0d8d91e44607", + "_spec": "warning@^4.0.1", + "_where": "/Users/lindsayterchin/Desktop/Documents/ada/javascript/VideoStoreConsumer-API/node_modules/react-router-dom", + "author": { + "name": "Berkeley Martinez", + "email": "berkeley@berkeleytrue.com", + "url": "http://www.berkeleytrue.com" + }, + "browserify": { + "transform": [ + "loose-envify" + ] + }, + "bugs": { + "url": "https://github.com/BerkeleyTrue/warning/issues" + }, + "bundleDependencies": false, + "config": { + "commitizen": { + "path": "cz-conventional-changelog" + } + }, + "dependencies": { + "loose-envify": "^1.0.0" + }, + "deprecated": false, + "description": "A mirror of Facebook's Warning", + "devDependencies": { + "@commitlint/cli": "^6.2.0", + "@commitlint/config-conventional": "^6.1.3", + "browserify": "^16.2.2", + "commitizen": "^2.10.1", + "cz-conventional-changelog": "^2.1.0", + "husky": "^0.14.3", + "jest": "^23.1.0", + "uglify-js": "^3.3.25" + }, + "files": [ + "warning.js" + ], + "homepage": "https://github.com/BerkeleyTrue/warning", + "keywords": [ + "warning", + "facebook", + "react", + "invariant" + ], + "license": "MIT", + "main": "warning.js", + "name": "warning", + "repository": { + "type": "git", + "url": "git+https://github.com/BerkeleyTrue/warning.git" + }, + "scripts": { + "commit": "git cz", + "commitmsg": "commitlint -e $GIT_PARAMS", + "test": "npm run test:dev && npm run test:prod", + "test:dev": "NODE_ENV=development jest", + "test:prod": "NODE_ENV=production jest" + }, + "version": "4.0.2" +} diff --git a/node_modules/warning/warning.js b/node_modules/warning/warning.js new file mode 100644 index 00000000..2d910e64 --- /dev/null +++ b/node_modules/warning/warning.js @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +/** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + +var __DEV__ = process.env.NODE_ENV !== 'production'; + +var warning = function() {}; + +if (__DEV__) { + var printWarning = function printWarning(format, args) { + var len = arguments.length; + args = new Array(len > 2 ? len - 2 : 0); + for (var key = 2; key < len; key++) { + args[key - 2] = arguments[key]; + } + var argIndex = 0; + var message = 'Warning: ' + + format.replace(/%s/g, function() { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + } + + warning = function(condition, format, args) { + var len = arguments.length; + args = new Array(len > 2 ? len - 2 : 0); + for (var key = 2; key < len; key++) { + args[key - 2] = arguments[key]; + } + if (format === undefined) { + throw new Error( + '`warning(condition, format, ...args)` requires a warning ' + + 'message argument' + ); + } + if (!condition) { + printWarning.apply(null, [format].concat(args)); + } + }; +} + +module.exports = warning; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..9dec8558 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,128 @@ +{ + "name": "video-store-api", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "history": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/history/-/history-4.7.2.tgz", + "integrity": "sha512-1zkBRWW6XweO0NBcjiphtVJVsIQ+SXF29z9DVkceeaSLVMFXHool+fdCZD4spDCfZJCILPILc3bm7Bc+HRi0nA==", + "requires": { + "invariant": "^2.2.1", + "loose-envify": "^1.2.0", + "resolve-pathname": "^2.2.0", + "value-equal": "^0.4.0", + "warning": "^3.0.0" + }, + "dependencies": { + "warning": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz", + "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=", + "requires": { + "loose-envify": "^1.0.0" + } + } + } + }, + "hoist-non-react-statics": { + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz", + "integrity": "sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw==" + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "requires": { + "loose-envify": "^1.0.0" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "path-to-regexp": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "requires": { + "isarray": "0.0.1" + } + }, + "prop-types": { + "version": "15.6.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz", + "integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==", + "requires": { + "loose-envify": "^1.3.1", + "object-assign": "^4.1.1" + } + }, + "react-router": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-4.3.1.tgz", + "integrity": "sha512-yrvL8AogDh2X42Dt9iknk4wF4V8bWREPirFfS9gLU1huk6qK41sg7Z/1S81jjTrGHxa3B8R3J6xIkDAA6CVarg==", + "requires": { + "history": "^4.7.2", + "hoist-non-react-statics": "^2.5.0", + "invariant": "^2.2.4", + "loose-envify": "^1.3.1", + "path-to-regexp": "^1.7.0", + "prop-types": "^15.6.1", + "warning": "^4.0.1" + } + }, + "react-router-dom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-4.3.1.tgz", + "integrity": "sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==", + "requires": { + "history": "^4.7.2", + "invariant": "^2.2.4", + "loose-envify": "^1.3.1", + "prop-types": "^15.6.1", + "react-router": "^4.3.1", + "warning": "^4.0.1" + } + }, + "resolve-pathname": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz", + "integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg==" + }, + "value-equal": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.4.0.tgz", + "integrity": "sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw==" + }, + "warning": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.2.tgz", + "integrity": "sha512-wbTp09q/9C+jJn4KKJfJfoS6VleK/Dti0yqWSm6KMvJ4MRCXFQNapHuJXutJIrWV0Cf4AhTdeIe4qdKHR1+Hug==", + "requires": { + "loose-envify": "^1.0.0" + } + } + } +} diff --git a/package.json b/package.json index 36e9d1a1..5bc90504 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "express": "~4.13.1", "jade": "~1.11.0", "morgan": "~1.6.1", + "react-router-dom": "^4.3.1", "sequelize": "^3.23.3", "serve-favicon": "~2.3.0" },