Created
April 11, 2018 22:46
-
-
Save adrice727/685ea1abb8ba1dcbe47ef5014f88e4d0 to your computer and use it in GitHub Desktop.
Bundled react components lib.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******/ (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] = { | |
/******/ i: moduleId, | |
/******/ l: false, | |
/******/ exports: {} | |
/******/ }; | |
/******/ | |
/******/ // Execute the module function | |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
/******/ | |
/******/ // Flag the module as loaded | |
/******/ module.l = 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; | |
/******/ | |
/******/ // define getter function for harmony exports | |
/******/ __webpack_require__.d = function(exports, name, getter) { | |
/******/ if(!__webpack_require__.o(exports, name)) { | |
/******/ Object.defineProperty(exports, name, { | |
/******/ configurable: false, | |
/******/ enumerable: true, | |
/******/ get: getter | |
/******/ }); | |
/******/ } | |
/******/ }; | |
/******/ | |
/******/ // define __esModule on exports | |
/******/ __webpack_require__.r = function(exports) { | |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | |
/******/ }; | |
/******/ | |
/******/ // getDefaultExport function for compatibility with non-harmony modules | |
/******/ __webpack_require__.n = function(module) { | |
/******/ var getter = module && module.__esModule ? | |
/******/ function getDefault() { return module['default']; } : | |
/******/ function getModuleExports() { return module; }; | |
/******/ __webpack_require__.d(getter, 'a', getter); | |
/******/ return getter; | |
/******/ }; | |
/******/ | |
/******/ // Object.prototype.hasOwnProperty.call | |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | |
/******/ | |
/******/ // __webpack_public_path__ | |
/******/ __webpack_require__.p = ""; | |
/******/ | |
/******/ | |
/******/ // Load entry module and return exports | |
/******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts"); | |
/******/ }) | |
/************************************************************************/ | |
/******/ ({ | |
/***/ "./node_modules/fbjs/lib/emptyFunction.js": | |
/*!************************************************!*\ | |
!*** ./node_modules/fbjs/lib/emptyFunction.js ***! | |
\************************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* 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; | |
}; | |
module.exports = emptyFunction; | |
/***/ }), | |
/***/ "./node_modules/fbjs/lib/emptyObject.js": | |
/*!**********************************************!*\ | |
!*** ./node_modules/fbjs/lib/emptyObject.js ***! | |
\**********************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* 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 emptyObject = {}; | |
if (true) { | |
Object.freeze(emptyObject); | |
} | |
module.exports = emptyObject; | |
/***/ }), | |
/***/ "./node_modules/fbjs/lib/invariant.js": | |
/*!********************************************!*\ | |
!*** ./node_modules/fbjs/lib/invariant.js ***! | |
\********************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* 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) {}; | |
if (true) { | |
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; | |
} | |
} | |
module.exports = invariant; | |
/***/ }), | |
/***/ "./node_modules/fbjs/lib/warning.js": | |
/*!******************************************!*\ | |
!*** ./node_modules/fbjs/lib/warning.js ***! | |
\******************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* 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. | |
* | |
*/ | |
var emptyFunction = __webpack_require__(/*! ./emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); | |
/** | |
* 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 = emptyFunction; | |
if (true) { | |
var printWarning = 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 = 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.apply(undefined, [format].concat(args)); | |
} | |
}; | |
} | |
module.exports = warning; | |
/***/ }), | |
/***/ "./node_modules/history/DOMUtils.js": | |
/*!******************************************!*\ | |
!*** ./node_modules/history/DOMUtils.js ***! | |
\******************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"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; | |
}; | |
/***/ }), | |
/***/ "./node_modules/history/LocationUtils.js": | |
/*!***********************************************!*\ | |
!*** ./node_modules/history/LocationUtils.js ***! | |
\***********************************************/ | |
/*! no static exports found */ | |
/***/ (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__(/*! resolve-pathname */ "./node_modules/resolve-pathname/index.js"); | |
var _resolvePathname2 = _interopRequireDefault(_resolvePathname); | |
var _valueEqual = __webpack_require__(/*! value-equal */ "./node_modules/value-equal/index.js"); | |
var _valueEqual2 = _interopRequireDefault(_valueEqual); | |
var _PathUtils = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/PathUtils.js"); | |
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); | |
}; | |
/***/ }), | |
/***/ "./node_modules/history/PathUtils.js": | |
/*!*******************************************!*\ | |
!*** ./node_modules/history/PathUtils.js ***! | |
\*******************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"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; | |
}; | |
/***/ }), | |
/***/ "./node_modules/history/createBrowserHistory.js": | |
/*!******************************************************!*\ | |
!*** ./node_modules/history/createBrowserHistory.js ***! | |
\******************************************************/ | |
/*! no static exports found */ | |
/***/ (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__(/*! warning */ "./node_modules/warning/browser.js"); | |
var _warning2 = _interopRequireDefault(_warning); | |
var _invariant = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
var _invariant2 = _interopRequireDefault(_invariant); | |
var _LocationUtils = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/LocationUtils.js"); | |
var _PathUtils = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/PathUtils.js"); | |
var _createTransitionManager = __webpack_require__(/*! ./createTransitionManager */ "./node_modules/history/createTransitionManager.js"); | |
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); | |
var _DOMUtils = __webpack_require__(/*! ./DOMUtils */ "./node_modules/history/DOMUtils.js"); | |
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; | |
/***/ }), | |
/***/ "./node_modules/history/createHashHistory.js": | |
/*!***************************************************!*\ | |
!*** ./node_modules/history/createHashHistory.js ***! | |
\***************************************************/ | |
/*! no static exports found */ | |
/***/ (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__(/*! warning */ "./node_modules/warning/browser.js"); | |
var _warning2 = _interopRequireDefault(_warning); | |
var _invariant = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
var _invariant2 = _interopRequireDefault(_invariant); | |
var _LocationUtils = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/LocationUtils.js"); | |
var _PathUtils = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/PathUtils.js"); | |
var _createTransitionManager = __webpack_require__(/*! ./createTransitionManager */ "./node_modules/history/createTransitionManager.js"); | |
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); | |
var _DOMUtils = __webpack_require__(/*! ./DOMUtils */ "./node_modules/history/DOMUtils.js"); | |
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; | |
/***/ }), | |
/***/ "./node_modules/history/createMemoryHistory.js": | |
/*!*****************************************************!*\ | |
!*** ./node_modules/history/createMemoryHistory.js ***! | |
\*****************************************************/ | |
/*! no static exports found */ | |
/***/ (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__(/*! warning */ "./node_modules/warning/browser.js"); | |
var _warning2 = _interopRequireDefault(_warning); | |
var _PathUtils = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/PathUtils.js"); | |
var _LocationUtils = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/LocationUtils.js"); | |
var _createTransitionManager = __webpack_require__(/*! ./createTransitionManager */ "./node_modules/history/createTransitionManager.js"); | |
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; | |
/***/ }), | |
/***/ "./node_modules/history/createTransitionManager.js": | |
/*!*********************************************************!*\ | |
!*** ./node_modules/history/createTransitionManager.js ***! | |
\*********************************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.__esModule = true; | |
var _warning = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
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; | |
/***/ }), | |
/***/ "./node_modules/history/es/DOMUtils.js": | |
/*!*********************************************!*\ | |
!*** ./node_modules/history/es/DOMUtils.js ***! | |
\*********************************************/ | |
/*! exports provided: canUseDOM, addEventListener, removeEventListener, getConfirmation, supportsHistory, supportsPopStateOnHashChange, supportsGoWithoutReloadUsingHash, isExtraneousPopstateEvent */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "canUseDOM", function() { return canUseDOM; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addEventListener", function() { return addEventListener; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeEventListener", function() { return removeEventListener; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getConfirmation", function() { return getConfirmation; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "supportsHistory", function() { return supportsHistory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "supportsPopStateOnHashChange", function() { return supportsPopStateOnHashChange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "supportsGoWithoutReloadUsingHash", function() { return supportsGoWithoutReloadUsingHash; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isExtraneousPopstateEvent", function() { return isExtraneousPopstateEvent; }); | |
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; | |
}; | |
/***/ }), | |
/***/ "./node_modules/history/es/LocationUtils.js": | |
/*!**************************************************!*\ | |
!*** ./node_modules/history/es/LocationUtils.js ***! | |
\**************************************************/ | |
/*! exports provided: createLocation, locationsAreEqual */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLocation", function() { return createLocation; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "locationsAreEqual", function() { return locationsAreEqual; }); | |
/* harmony import */ var resolve_pathname__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! resolve-pathname */ "./node_modules/resolve-pathname/index.js"); | |
/* harmony import */ var value_equal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! value-equal */ "./node_modules/value-equal/index.js"); | |
/* harmony import */ var _PathUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/es/PathUtils.js"); | |
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 = Object(_PathUtils__WEBPACK_IMPORTED_MODULE_2__["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 = Object(resolve_pathname__WEBPACK_IMPORTED_MODULE_0__["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 = function locationsAreEqual(a, b) { | |
return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && Object(value_equal__WEBPACK_IMPORTED_MODULE_1__["default"])(a.state, b.state); | |
}; | |
/***/ }), | |
/***/ "./node_modules/history/es/PathUtils.js": | |
/*!**********************************************!*\ | |
!*** ./node_modules/history/es/PathUtils.js ***! | |
\**********************************************/ | |
/*! exports provided: addLeadingSlash, stripLeadingSlash, hasBasename, stripBasename, stripTrailingSlash, parsePath, createPath */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addLeadingSlash", function() { return addLeadingSlash; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stripLeadingSlash", function() { return stripLeadingSlash; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasBasename", function() { return hasBasename; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stripBasename", function() { return stripBasename; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stripTrailingSlash", function() { return stripTrailingSlash; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return parsePath; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return createPath; }); | |
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; | |
}; | |
/***/ }), | |
/***/ "./node_modules/history/es/createBrowserHistory.js": | |
/*!*********************************************************!*\ | |
!*** ./node_modules/history/es/createBrowserHistory.js ***! | |
\*********************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var _LocationUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/es/LocationUtils.js"); | |
/* harmony import */ var _PathUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/es/PathUtils.js"); | |
/* harmony import */ var _createTransitionManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./createTransitionManager */ "./node_modules/history/es/createTransitionManager.js"); | |
/* harmony import */ var _DOMUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DOMUtils */ "./node_modules/history/es/DOMUtils.js"); | |
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 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__WEBPACK_IMPORTED_MODULE_1___default()(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["canUseDOM"], 'Browser history needs a DOM'); | |
var globalHistory = window.history; | |
var canUseHistory = Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["supportsHistory"])(); | |
var needsHashChangeListener = !Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["supportsPopStateOnHashChange"])(); | |
var _props$forceRefresh = props.forceRefresh, | |
forceRefresh = _props$forceRefresh === undefined ? false : _props$forceRefresh, | |
_props$getUserConfirm = props.getUserConfirmation, | |
getUserConfirmation = _props$getUserConfirm === undefined ? _DOMUtils__WEBPACK_IMPORTED_MODULE_5__["getConfirmation"] : _props$getUserConfirm, | |
_props$keyLength = props.keyLength, | |
keyLength = _props$keyLength === undefined ? 6 : _props$keyLength; | |
var basename = props.basename ? Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripTrailingSlash"])(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["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__WEBPACK_IMPORTED_MODULE_0___default()(!basename || Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["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 = Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripBasename"])(path, basename); | |
return Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path, state, key); | |
}; | |
var createKey = function createKey() { | |
return Math.random().toString(36).substr(2, keyLength); | |
}; | |
var transitionManager = Object(_createTransitionManager__WEBPACK_IMPORTED_MODULE_4__["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 (Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["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 + Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(location); | |
}; | |
var push = function push(path, state) { | |
warning__WEBPACK_IMPORTED_MODULE_0___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 = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["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__WEBPACK_IMPORTED_MODULE_0___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) { | |
warning__WEBPACK_IMPORTED_MODULE_0___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 = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["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__WEBPACK_IMPORTED_MODULE_0___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) { | |
Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["addEventListener"])(window, PopStateEvent, handlePopState); | |
if (needsHashChangeListener) Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["addEventListener"])(window, HashChangeEvent, handleHashChange); | |
} else if (listenerCount === 0) { | |
Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["removeEventListener"])(window, PopStateEvent, handlePopState); | |
if (needsHashChangeListener) Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["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; | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (createBrowserHistory); | |
/***/ }), | |
/***/ "./node_modules/history/es/createHashHistory.js": | |
/*!******************************************************!*\ | |
!*** ./node_modules/history/es/createHashHistory.js ***! | |
\******************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var _LocationUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/es/LocationUtils.js"); | |
/* harmony import */ var _PathUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/es/PathUtils.js"); | |
/* harmony import */ var _createTransitionManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./createTransitionManager */ "./node_modules/history/es/createTransitionManager.js"); | |
/* harmony import */ var _DOMUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DOMUtils */ "./node_modules/history/es/DOMUtils.js"); | |
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 HashChangeEvent = 'hashchange'; | |
var HashPathCoders = { | |
hashbang: { | |
encodePath: function encodePath(path) { | |
return path.charAt(0) === '!' ? path : '!/' + Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripLeadingSlash"])(path); | |
}, | |
decodePath: function decodePath(path) { | |
return path.charAt(0) === '!' ? path.substr(1) : path; | |
} | |
}, | |
noslash: { | |
encodePath: _PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripLeadingSlash"], | |
decodePath: _PathUtils__WEBPACK_IMPORTED_MODULE_3__["addLeadingSlash"] | |
}, | |
slash: { | |
encodePath: _PathUtils__WEBPACK_IMPORTED_MODULE_3__["addLeadingSlash"], | |
decodePath: _PathUtils__WEBPACK_IMPORTED_MODULE_3__["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__WEBPACK_IMPORTED_MODULE_1___default()(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["canUseDOM"], 'Hash history needs a DOM'); | |
var globalHistory = window.history; | |
var canGoWithoutReload = Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["supportsGoWithoutReloadUsingHash"])(); | |
var _props$getUserConfirm = props.getUserConfirmation, | |
getUserConfirmation = _props$getUserConfirm === undefined ? _DOMUtils__WEBPACK_IMPORTED_MODULE_5__["getConfirmation"] : _props$getUserConfirm, | |
_props$hashType = props.hashType, | |
hashType = _props$hashType === undefined ? 'slash' : _props$hashType; | |
var basename = props.basename ? Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripTrailingSlash"])(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["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__WEBPACK_IMPORTED_MODULE_0___default()(!basename || Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["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 = Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["stripBasename"])(path, basename); | |
return Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path); | |
}; | |
var transitionManager = Object(_createTransitionManager__WEBPACK_IMPORTED_MODULE_4__["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 && Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["locationsAreEqual"])(prevLocation, location)) return; // A hashchange doesn't always == location change. | |
if (ignorePath === Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["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(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(toLocation)); | |
if (toIndex === -1) toIndex = 0; | |
var fromIndex = allPaths.lastIndexOf(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["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 = [Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(initialLocation)]; | |
// Public interface | |
var createHref = function createHref(location) { | |
return '#' + encodePath(basename + Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(location)); | |
}; | |
var push = function push(path, state) { | |
warning__WEBPACK_IMPORTED_MODULE_0___default()(state === undefined, 'Hash history cannot push state; it is ignored'); | |
var action = 'PUSH'; | |
var location = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path, undefined, undefined, history.location); | |
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { | |
if (!ok) return; | |
var path = Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["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(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["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__WEBPACK_IMPORTED_MODULE_0___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) { | |
warning__WEBPACK_IMPORTED_MODULE_0___default()(state === undefined, 'Hash history cannot replace state; it is ignored'); | |
var action = 'REPLACE'; | |
var location = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(path, undefined, undefined, history.location); | |
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { | |
if (!ok) return; | |
var path = Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["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(Object(_PathUtils__WEBPACK_IMPORTED_MODULE_3__["createPath"])(history.location)); | |
if (prevIndex !== -1) allPaths[prevIndex] = path; | |
setState({ action: action, location: location }); | |
}); | |
}; | |
var go = function go(n) { | |
warning__WEBPACK_IMPORTED_MODULE_0___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) { | |
Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["addEventListener"])(window, HashChangeEvent, handleHashChange); | |
} else if (listenerCount === 0) { | |
Object(_DOMUtils__WEBPACK_IMPORTED_MODULE_5__["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; | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (createHashHistory); | |
/***/ }), | |
/***/ "./node_modules/history/es/createMemoryHistory.js": | |
/*!********************************************************!*\ | |
!*** ./node_modules/history/es/createMemoryHistory.js ***! | |
\********************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var _PathUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/es/PathUtils.js"); | |
/* harmony import */ var _LocationUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/es/LocationUtils.js"); | |
/* harmony import */ var _createTransitionManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./createTransitionManager */ "./node_modules/history/es/createTransitionManager.js"); | |
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 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 = Object(_createTransitionManager__WEBPACK_IMPORTED_MODULE_3__["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' ? Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(entry, undefined, createKey()) : Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["createLocation"])(entry, undefined, entry.key || createKey()); | |
}); | |
// Public interface | |
var createHref = _PathUtils__WEBPACK_IMPORTED_MODULE_1__["createPath"]; | |
var push = function push(path, state) { | |
warning__WEBPACK_IMPORTED_MODULE_0___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 = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["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__WEBPACK_IMPORTED_MODULE_0___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 = Object(_LocationUtils__WEBPACK_IMPORTED_MODULE_2__["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; | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (createMemoryHistory); | |
/***/ }), | |
/***/ "./node_modules/history/es/createTransitionManager.js": | |
/*!************************************************************!*\ | |
!*** ./node_modules/history/es/createTransitionManager.js ***! | |
\************************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__); | |
var createTransitionManager = function createTransitionManager() { | |
var prompt = null; | |
var setPrompt = function setPrompt(nextPrompt) { | |
warning__WEBPACK_IMPORTED_MODULE_0___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 { | |
warning__WEBPACK_IMPORTED_MODULE_0___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 | |
}; | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (createTransitionManager); | |
/***/ }), | |
/***/ "./node_modules/history/es/index.js": | |
/*!******************************************!*\ | |
!*** ./node_modules/history/es/index.js ***! | |
\******************************************/ | |
/*! exports provided: createBrowserHistory, createHashHistory, createMemoryHistory, createLocation, locationsAreEqual, parsePath, createPath */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var _createBrowserHistory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./createBrowserHistory */ "./node_modules/history/es/createBrowserHistory.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createBrowserHistory", function() { return _createBrowserHistory__WEBPACK_IMPORTED_MODULE_0__["default"]; }); | |
/* harmony import */ var _createHashHistory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createHashHistory */ "./node_modules/history/es/createHashHistory.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createHashHistory", function() { return _createHashHistory__WEBPACK_IMPORTED_MODULE_1__["default"]; }); | |
/* harmony import */ var _createMemoryHistory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./createMemoryHistory */ "./node_modules/history/es/createMemoryHistory.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createMemoryHistory", function() { return _createMemoryHistory__WEBPACK_IMPORTED_MODULE_2__["default"]; }); | |
/* harmony import */ var _LocationUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LocationUtils */ "./node_modules/history/es/LocationUtils.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createLocation", function() { return _LocationUtils__WEBPACK_IMPORTED_MODULE_3__["createLocation"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "locationsAreEqual", function() { return _LocationUtils__WEBPACK_IMPORTED_MODULE_3__["locationsAreEqual"]; }); | |
/* harmony import */ var _PathUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./PathUtils */ "./node_modules/history/es/PathUtils.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return _PathUtils__WEBPACK_IMPORTED_MODULE_4__["parsePath"]; }); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return _PathUtils__WEBPACK_IMPORTED_MODULE_4__["createPath"]; }); | |
/***/ }), | |
/***/ "./node_modules/hoist-non-react-statics/index.js": | |
/*!*******************************************************!*\ | |
!*** ./node_modules/hoist-non-react-statics/index.js ***! | |
\*******************************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/** | |
* Copyright 2015, Yahoo! Inc. | |
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. | |
*/ | |
(function (global, factory) { | |
true ? module.exports = factory() : | |
undefined; | |
}(this, (function () { | |
'use strict'; | |
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; | |
}; | |
}))); | |
/***/ }), | |
/***/ "./node_modules/invariant/browser.js": | |
/*!*******************************************!*\ | |
!*** ./node_modules/invariant/browser.js ***! | |
\*******************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* 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 invariant = function(condition, format, a, b, c, d, e, f) { | |
if (true) { | |
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; | |
/***/ }), | |
/***/ "./node_modules/object-assign/index.js": | |
/*!*********************************************!*\ | |
!*** ./node_modules/object-assign/index.js ***! | |
\*********************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* | |
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; | |
} | |
} | |
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; | |
}; | |
/***/ }), | |
/***/ "./node_modules/path-to-regexp/index.js": | |
/*!**********************************************!*\ | |
!*** ./node_modules/path-to-regexp/index.js ***! | |
\**********************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var isarray = __webpack_require__(/*! isarray */ "./node_modules/path-to-regexp/node_modules/isarray/index.js") | |
/** | |
* 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) | |
} | |
/***/ }), | |
/***/ "./node_modules/path-to-regexp/node_modules/isarray/index.js": | |
/*!*******************************************************************!*\ | |
!*** ./node_modules/path-to-regexp/node_modules/isarray/index.js ***! | |
\*******************************************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports) { | |
module.exports = Array.isArray || function (arr) { | |
return Object.prototype.toString.call(arr) == '[object Array]'; | |
}; | |
/***/ }), | |
/***/ "./node_modules/prop-types/checkPropTypes.js": | |
/*!***************************************************!*\ | |
!*** ./node_modules/prop-types/checkPropTypes.js ***! | |
\***************************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* 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 (true) { | |
var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); | |
var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); | |
var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); | |
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) { | |
if (true) { | |
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(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); | |
} catch (ex) { | |
error = ex; | |
} | |
warning(!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(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); | |
} | |
} | |
} | |
} | |
} | |
module.exports = checkPropTypes; | |
/***/ }), | |
/***/ "./node_modules/prop-types/factoryWithTypeCheckers.js": | |
/*!************************************************************!*\ | |
!*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***! | |
\************************************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* 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 emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); | |
var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); | |
var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); | |
var assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); | |
var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); | |
var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); | |
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 = '<<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 (true) { | |
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 | |
invariant( | |
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 ("development" !== '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 | |
) { | |
warning( | |
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.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); | |
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)) { | |
true ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : undefined; | |
return emptyFunction.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); | |
if (error instanceof Error) { | |
return error; | |
} | |
} | |
} | |
return null; | |
} | |
return createChainableTypeChecker(validate); | |
} | |
function createUnionTypeChecker(arrayOfTypeCheckers) { | |
if (!Array.isArray(arrayOfTypeCheckers)) { | |
true ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : undefined; | |
return emptyFunction.thatReturnsNull; | |
} | |
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | |
var checker = arrayOfTypeCheckers[i]; | |
if (typeof checker !== 'function') { | |
warning( | |
false, | |
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + | |
'received %s at index %s.', | |
getPostfixForTypeWarning(checker), | |
i | |
); | |
return emptyFunction.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) == 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; | |
}; | |
/***/ }), | |
/***/ "./node_modules/prop-types/index.js": | |
/*!******************************************!*\ | |
!*** ./node_modules/prop-types/index.js ***! | |
\******************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/** | |
* 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 (true) { | |
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 = __webpack_require__(/*! ./factoryWithTypeCheckers */ "./node_modules/prop-types/factoryWithTypeCheckers.js")(isValidElement, throwOnDirectAccess); | |
} else {} | |
/***/ }), | |
/***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js": | |
/*!*************************************************************!*\ | |
!*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***! | |
\*************************************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* 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'; | |
module.exports = ReactPropTypesSecret; | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/BrowserRouter.js": | |
/*!***********************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/BrowserRouter.js ***! | |
\***********************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var history_createBrowserHistory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! history/createBrowserHistory */ "./node_modules/history/createBrowserHistory.js"); | |
/* harmony import */ var history_createBrowserHistory__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(history_createBrowserHistory__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var _Router__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Router */ "./node_modules/react-router-dom/es/Router.js"); | |
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 <Router> 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 = history_createBrowserHistory__WEBPACK_IMPORTED_MODULE_3___default()(_this.props), _temp), _possibleConstructorReturn(_this, _ret); | |
} | |
BrowserRouter.prototype.componentWillMount = function componentWillMount() { | |
warning__WEBPACK_IMPORTED_MODULE_0___default()(!this.props.history, '<BrowserRouter> 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__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_Router__WEBPACK_IMPORTED_MODULE_4__["default"], { history: this.history, children: this.props.children }); | |
}; | |
return BrowserRouter; | |
}(react__WEBPACK_IMPORTED_MODULE_1___default.a.Component); | |
BrowserRouter.propTypes = { | |
basename: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, | |
forceRefresh: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.bool, | |
getUserConfirmation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.func, | |
keyLength: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number, | |
children: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.node | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (BrowserRouter); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/HashRouter.js": | |
/*!********************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/HashRouter.js ***! | |
\********************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var history_createHashHistory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! history/createHashHistory */ "./node_modules/history/createHashHistory.js"); | |
/* harmony import */ var history_createHashHistory__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(history_createHashHistory__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var _Router__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Router */ "./node_modules/react-router-dom/es/Router.js"); | |
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 <Router> 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 = history_createHashHistory__WEBPACK_IMPORTED_MODULE_3___default()(_this.props), _temp), _possibleConstructorReturn(_this, _ret); | |
} | |
HashRouter.prototype.componentWillMount = function componentWillMount() { | |
warning__WEBPACK_IMPORTED_MODULE_0___default()(!this.props.history, '<HashRouter> 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__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_Router__WEBPACK_IMPORTED_MODULE_4__["default"], { history: this.history, children: this.props.children }); | |
}; | |
return HashRouter; | |
}(react__WEBPACK_IMPORTED_MODULE_1___default.a.Component); | |
HashRouter.propTypes = { | |
basename: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, | |
getUserConfirmation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.func, | |
hashType: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOf(['hashbang', 'noslash', 'slash']), | |
children: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.node | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (HashRouter); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/Link.js": | |
/*!**************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/Link.js ***! | |
\**************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_2__); | |
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; } | |
var isModifiedEvent = function isModifiedEvent(event) { | |
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); | |
}; | |
/** | |
* The public API for rendering a history-aware <a>. | |
*/ | |
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 right 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__WEBPACK_IMPORTED_MODULE_2___default()(this.context.router, 'You should not use <Link> outside a <Router>'); | |
var href = this.context.router.history.createHref(typeof to === 'string' ? { pathname: to } : to); | |
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement('a', _extends({}, props, { onClick: this.handleClick, href: href, ref: innerRef })); | |
}; | |
return Link; | |
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); | |
Link.propTypes = { | |
onClick: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func, | |
target: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string, | |
replace: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool, | |
to: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object]).isRequired, | |
innerRef: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func]) | |
}; | |
Link.defaultProps = { | |
replace: false | |
}; | |
Link.contextTypes = { | |
router: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.shape({ | |
history: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.shape({ | |
push: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func.isRequired, | |
replace: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func.isRequired, | |
createHref: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func.isRequired | |
}).isRequired | |
}).isRequired | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (Link); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/MemoryRouter.js": | |
/*!**********************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/MemoryRouter.js ***! | |
\**********************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react_router_es_MemoryRouter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router/es/MemoryRouter */ "./node_modules/react-router/es/MemoryRouter.js"); | |
// Written in this round about way for babel-transform-imports | |
/* harmony default export */ __webpack_exports__["default"] = (react_router_es_MemoryRouter__WEBPACK_IMPORTED_MODULE_0__["default"]); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/NavLink.js": | |
/*!*****************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/NavLink.js ***! | |
\*****************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var _Route__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Route */ "./node_modules/react-router-dom/es/Route.js"); | |
/* harmony import */ var _Link__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Link */ "./node_modules/react-router-dom/es/Link.js"); | |
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; } | |
/** | |
* A <Link> 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.ariaCurrent, | |
rest = _objectWithoutProperties(_ref, ['to', 'exact', 'strict', 'location', 'activeClassName', 'className', 'activeStyle', 'style', 'isActive', 'ariaCurrent']); | |
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Route__WEBPACK_IMPORTED_MODULE_2__["default"], { | |
path: (typeof to === 'undefined' ? 'undefined' : _typeof(to)) === 'object' ? to.pathname : to, | |
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__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Link__WEBPACK_IMPORTED_MODULE_3__["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 | |
}, rest)); | |
} | |
}); | |
}; | |
NavLink.propTypes = { | |
to: _Link__WEBPACK_IMPORTED_MODULE_3__["default"].propTypes.to, | |
exact: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool, | |
strict: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool, | |
location: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object, | |
activeClassName: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string, | |
className: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string, | |
activeStyle: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object, | |
style: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object, | |
isActive: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func, | |
ariaCurrent: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOf(['page', 'step', 'location', 'true']) | |
}; | |
NavLink.defaultProps = { | |
activeClassName: 'active', | |
ariaCurrent: 'true' | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (NavLink); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/Prompt.js": | |
/*!****************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/Prompt.js ***! | |
\****************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react_router_es_Prompt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router/es/Prompt */ "./node_modules/react-router/es/Prompt.js"); | |
// Written in this round about way for babel-transform-imports | |
/* harmony default export */ __webpack_exports__["default"] = (react_router_es_Prompt__WEBPACK_IMPORTED_MODULE_0__["default"]); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/Redirect.js": | |
/*!******************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/Redirect.js ***! | |
\******************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react_router_es_Redirect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router/es/Redirect */ "./node_modules/react-router/es/Redirect.js"); | |
// Written in this round about way for babel-transform-imports | |
/* harmony default export */ __webpack_exports__["default"] = (react_router_es_Redirect__WEBPACK_IMPORTED_MODULE_0__["default"]); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/Route.js": | |
/*!***************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/Route.js ***! | |
\***************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react_router_es_Route__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router/es/Route */ "./node_modules/react-router/es/Route.js"); | |
// Written in this round about way for babel-transform-imports | |
/* harmony default export */ __webpack_exports__["default"] = (react_router_es_Route__WEBPACK_IMPORTED_MODULE_0__["default"]); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/Router.js": | |
/*!****************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/Router.js ***! | |
\****************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react_router_es_Router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router/es/Router */ "./node_modules/react-router/es/Router.js"); | |
// Written in this round about way for babel-transform-imports | |
/* harmony default export */ __webpack_exports__["default"] = (react_router_es_Router__WEBPACK_IMPORTED_MODULE_0__["default"]); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/StaticRouter.js": | |
/*!**********************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/StaticRouter.js ***! | |
\**********************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react_router_es_StaticRouter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router/es/StaticRouter */ "./node_modules/react-router/es/StaticRouter.js"); | |
// Written in this round about way for babel-transform-imports | |
/* harmony default export */ __webpack_exports__["default"] = (react_router_es_StaticRouter__WEBPACK_IMPORTED_MODULE_0__["default"]); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/Switch.js": | |
/*!****************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/Switch.js ***! | |
\****************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react_router_es_Switch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router/es/Switch */ "./node_modules/react-router/es/Switch.js"); | |
// Written in this round about way for babel-transform-imports | |
/* harmony default export */ __webpack_exports__["default"] = (react_router_es_Switch__WEBPACK_IMPORTED_MODULE_0__["default"]); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/index.js": | |
/*!***************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/index.js ***! | |
\***************************************************/ | |
/*! exports provided: BrowserRouter, HashRouter, Link, MemoryRouter, NavLink, Prompt, Redirect, Route, Router, StaticRouter, Switch, matchPath, withRouter */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var _BrowserRouter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BrowserRouter */ "./node_modules/react-router-dom/es/BrowserRouter.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BrowserRouter", function() { return _BrowserRouter__WEBPACK_IMPORTED_MODULE_0__["default"]; }); | |
/* harmony import */ var _HashRouter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HashRouter */ "./node_modules/react-router-dom/es/HashRouter.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HashRouter", function() { return _HashRouter__WEBPACK_IMPORTED_MODULE_1__["default"]; }); | |
/* harmony import */ var _Link__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Link */ "./node_modules/react-router-dom/es/Link.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Link", function() { return _Link__WEBPACK_IMPORTED_MODULE_2__["default"]; }); | |
/* harmony import */ var _MemoryRouter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./MemoryRouter */ "./node_modules/react-router-dom/es/MemoryRouter.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MemoryRouter", function() { return _MemoryRouter__WEBPACK_IMPORTED_MODULE_3__["default"]; }); | |
/* harmony import */ var _NavLink__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NavLink */ "./node_modules/react-router-dom/es/NavLink.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NavLink", function() { return _NavLink__WEBPACK_IMPORTED_MODULE_4__["default"]; }); | |
/* harmony import */ var _Prompt__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Prompt */ "./node_modules/react-router-dom/es/Prompt.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Prompt", function() { return _Prompt__WEBPACK_IMPORTED_MODULE_5__["default"]; }); | |
/* harmony import */ var _Redirect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Redirect */ "./node_modules/react-router-dom/es/Redirect.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Redirect", function() { return _Redirect__WEBPACK_IMPORTED_MODULE_6__["default"]; }); | |
/* harmony import */ var _Route__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Route */ "./node_modules/react-router-dom/es/Route.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Route", function() { return _Route__WEBPACK_IMPORTED_MODULE_7__["default"]; }); | |
/* harmony import */ var _Router__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Router */ "./node_modules/react-router-dom/es/Router.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Router", function() { return _Router__WEBPACK_IMPORTED_MODULE_8__["default"]; }); | |
/* harmony import */ var _StaticRouter__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./StaticRouter */ "./node_modules/react-router-dom/es/StaticRouter.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StaticRouter", function() { return _StaticRouter__WEBPACK_IMPORTED_MODULE_9__["default"]; }); | |
/* harmony import */ var _Switch__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Switch */ "./node_modules/react-router-dom/es/Switch.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return _Switch__WEBPACK_IMPORTED_MODULE_10__["default"]; }); | |
/* harmony import */ var _matchPath__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./matchPath */ "./node_modules/react-router-dom/es/matchPath.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "matchPath", function() { return _matchPath__WEBPACK_IMPORTED_MODULE_11__["default"]; }); | |
/* harmony import */ var _withRouter__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./withRouter */ "./node_modules/react-router-dom/es/withRouter.js"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withRouter", function() { return _withRouter__WEBPACK_IMPORTED_MODULE_12__["default"]; }); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/matchPath.js": | |
/*!*******************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/matchPath.js ***! | |
\*******************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react_router_es_matchPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router/es/matchPath */ "./node_modules/react-router/es/matchPath.js"); | |
// Written in this round about way for babel-transform-imports | |
/* harmony default export */ __webpack_exports__["default"] = (react_router_es_matchPath__WEBPACK_IMPORTED_MODULE_0__["default"]); | |
/***/ }), | |
/***/ "./node_modules/react-router-dom/es/withRouter.js": | |
/*!********************************************************!*\ | |
!*** ./node_modules/react-router-dom/es/withRouter.js ***! | |
\********************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react_router_es_withRouter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router/es/withRouter */ "./node_modules/react-router/es/withRouter.js"); | |
// Written in this round about way for babel-transform-imports | |
/* harmony default export */ __webpack_exports__["default"] = (react_router_es_withRouter__WEBPACK_IMPORTED_MODULE_0__["default"]); | |
/***/ }), | |
/***/ "./node_modules/react-router/es/MemoryRouter.js": | |
/*!******************************************************!*\ | |
!*** ./node_modules/react-router/es/MemoryRouter.js ***! | |
\******************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var history_createMemoryHistory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! history/createMemoryHistory */ "./node_modules/history/createMemoryHistory.js"); | |
/* harmony import */ var history_createMemoryHistory__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(history_createMemoryHistory__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var _Router__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Router */ "./node_modules/react-router/es/Router.js"); | |
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 <Router> 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 = history_createMemoryHistory__WEBPACK_IMPORTED_MODULE_3___default()(_this.props), _temp), _possibleConstructorReturn(_this, _ret); | |
} | |
MemoryRouter.prototype.componentWillMount = function componentWillMount() { | |
warning__WEBPACK_IMPORTED_MODULE_0___default()(!this.props.history, '<MemoryRouter> 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__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_Router__WEBPACK_IMPORTED_MODULE_4__["default"], { history: this.history, children: this.props.children }); | |
}; | |
return MemoryRouter; | |
}(react__WEBPACK_IMPORTED_MODULE_1___default.a.Component); | |
MemoryRouter.propTypes = { | |
initialEntries: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.array, | |
initialIndex: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number, | |
getUserConfirmation: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.func, | |
keyLength: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number, | |
children: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.node | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (MemoryRouter); | |
/***/ }), | |
/***/ "./node_modules/react-router/es/Prompt.js": | |
/*!************************************************!*\ | |
!*** ./node_modules/react-router/es/Prompt.js ***! | |
\************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_2__); | |
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() { | |
invariant__WEBPACK_IMPORTED_MODULE_2___default()(this.context.router, 'You should not use <Prompt> outside a <Router>'); | |
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__WEBPACK_IMPORTED_MODULE_0___default.a.Component); | |
Prompt.propTypes = { | |
when: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool, | |
message: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string]).isRequired | |
}; | |
Prompt.defaultProps = { | |
when: true | |
}; | |
Prompt.contextTypes = { | |
router: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.shape({ | |
history: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.shape({ | |
block: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func.isRequired | |
}).isRequired | |
}).isRequired | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (Prompt); | |
/***/ }), | |
/***/ "./node_modules/react-router/es/Redirect.js": | |
/*!**************************************************!*\ | |
!*** ./node_modules/react-router/es/Redirect.js ***! | |
\**************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var history__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! history */ "./node_modules/history/es/index.js"); | |
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() { | |
invariant__WEBPACK_IMPORTED_MODULE_3___default()(this.context.router, 'You should not use <Redirect> outside a <Router>'); | |
if (this.isStatic()) this.perform(); | |
}; | |
Redirect.prototype.componentDidMount = function componentDidMount() { | |
if (!this.isStatic()) this.perform(); | |
}; | |
Redirect.prototype.componentDidUpdate = function componentDidUpdate(prevProps) { | |
var prevTo = Object(history__WEBPACK_IMPORTED_MODULE_4__["createLocation"])(prevProps.to); | |
var nextTo = Object(history__WEBPACK_IMPORTED_MODULE_4__["createLocation"])(this.props.to); | |
if (Object(history__WEBPACK_IMPORTED_MODULE_4__["locationsAreEqual"])(prevTo, nextTo)) { | |
warning__WEBPACK_IMPORTED_MODULE_2___default()(false, 'You tried to redirect to the same route you\'re currently on: ' + ('"' + nextTo.pathname + nextTo.search + '"')); | |
return; | |
} | |
this.perform(); | |
}; | |
Redirect.prototype.perform = function perform() { | |
var history = this.context.router.history; | |
var _props = this.props, | |
push = _props.push, | |
to = _props.to; | |
if (push) { | |
history.push(to); | |
} else { | |
history.replace(to); | |
} | |
}; | |
Redirect.prototype.render = function render() { | |
return null; | |
}; | |
return Redirect; | |
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); | |
Redirect.propTypes = { | |
push: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool, | |
from: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string, | |
to: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object]).isRequired | |
}; | |
Redirect.defaultProps = { | |
push: false | |
}; | |
Redirect.contextTypes = { | |
router: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.shape({ | |
history: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.shape({ | |
push: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func.isRequired, | |
replace: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func.isRequired | |
}).isRequired, | |
staticContext: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object | |
}).isRequired | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (Redirect); | |
/***/ }), | |
/***/ "./node_modules/react-router/es/Route.js": | |
/*!***********************************************!*\ | |
!*** ./node_modules/react-router/es/Route.js ***! | |
\***********************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var _matchPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./matchPath */ "./node_modules/react-router/es/matchPath.js"); | |
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; } | |
var isEmptyChildren = function isEmptyChildren(children) { | |
return react__WEBPACK_IMPORTED_MODULE_2___default.a.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; // <Switch> already computed the match for us | |
invariant__WEBPACK_IMPORTED_MODULE_1___default()(router, 'You should not use <Route> or withRouter() outside a <Router>'); | |
var route = router.route; | |
var pathname = (location || route.location).pathname; | |
return path ? Object(_matchPath__WEBPACK_IMPORTED_MODULE_4__["default"])(pathname, { path: path, strict: strict, exact: exact, sensitive: sensitive }) : route.match; | |
}; | |
Route.prototype.componentWillMount = function componentWillMount() { | |
warning__WEBPACK_IMPORTED_MODULE_0___default()(!(this.props.component && this.props.render), 'You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored'); | |
warning__WEBPACK_IMPORTED_MODULE_0___default()(!(this.props.component && this.props.children && !isEmptyChildren(this.props.children)), 'You should not use <Route component> and <Route children> in the same route; <Route children> will be ignored'); | |
warning__WEBPACK_IMPORTED_MODULE_0___default()(!(this.props.render && this.props.children && !isEmptyChildren(this.props.children)), 'You should not use <Route render> and <Route children> in the same route; <Route children> will be ignored'); | |
}; | |
Route.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps, nextContext) { | |
warning__WEBPACK_IMPORTED_MODULE_0___default()(!(nextProps.location && !this.props.location), '<Route> 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__WEBPACK_IMPORTED_MODULE_0___default()(!(!nextProps.location && this.props.location), '<Route> 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 }; | |
return component ? // component prop gets first priority, only called if there's a match | |
match ? react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(component, props) : null : render ? // render prop is next, only called if there's a match | |
match ? render(props) : null : children ? // children come last, always called | |
typeof children === 'function' ? children(props) : !isEmptyChildren(children) ? react__WEBPACK_IMPORTED_MODULE_2___default.a.Children.only(children) : null : null; | |
}; | |
return Route; | |
}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component); | |
Route.propTypes = { | |
computedMatch: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object, // private, from <Switch> | |
path: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string, | |
exact: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.bool, | |
strict: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.bool, | |
sensitive: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.bool, | |
component: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.func, | |
render: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.func, | |
children: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.node]), | |
location: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object | |
}; | |
Route.contextTypes = { | |
router: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.shape({ | |
history: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object.isRequired, | |
route: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object.isRequired, | |
staticContext: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object | |
}) | |
}; | |
Route.childContextTypes = { | |
router: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object.isRequired | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (Route); | |
/***/ }), | |
/***/ "./node_modules/react-router/es/Router.js": | |
/*!************************************************!*\ | |
!*** ./node_modules/react-router/es/Router.js ***! | |
\************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_3__); | |
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; } | |
/** | |
* 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__WEBPACK_IMPORTED_MODULE_1___default()(children == null || react__WEBPACK_IMPORTED_MODULE_2___default.a.Children.count(children) === 1, 'A <Router> may have only one child element'); | |
// Do this here so we can setState when a <Redirect> changes the | |
// location in componentWillMount. This happens e.g. when doing | |
// server rendering using a <StaticRouter>. | |
this.unlisten = history.listen(function () { | |
_this2.setState({ | |
match: _this2.computeMatch(history.location.pathname) | |
}); | |
}); | |
}; | |
Router.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | |
warning__WEBPACK_IMPORTED_MODULE_0___default()(this.props.history === nextProps.history, 'You cannot change <Router history>'); | |
}; | |
Router.prototype.componentWillUnmount = function componentWillUnmount() { | |
this.unlisten(); | |
}; | |
Router.prototype.render = function render() { | |
var children = this.props.children; | |
return children ? react__WEBPACK_IMPORTED_MODULE_2___default.a.Children.only(children) : null; | |
}; | |
return Router; | |
}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component); | |
Router.propTypes = { | |
history: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object.isRequired, | |
children: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.node | |
}; | |
Router.contextTypes = { | |
router: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object | |
}; | |
Router.childContextTypes = { | |
router: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object.isRequired | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (Router); | |
/***/ }), | |
/***/ "./node_modules/react-router/es/StaticRouter.js": | |
/*!******************************************************!*\ | |
!*** ./node_modules/react-router/es/StaticRouter.js ***! | |
\******************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var history_PathUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! history/PathUtils */ "./node_modules/history/PathUtils.js"); | |
/* harmony import */ var history_PathUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(history_PathUtils__WEBPACK_IMPORTED_MODULE_4__); | |
/* harmony import */ var _Router__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Router */ "./node_modules/react-router/es/Router.js"); | |
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; } | |
var normalizeLocation = function normalizeLocation(object) { | |
var _object$pathname = object.pathname, | |
pathname = _object$pathname === undefined ? '/' : _object$pathname, | |
_object$search = object.search, | |
search = _object$search === undefined ? '' : _object$search, | |
_object$hash = object.hash, | |
hash = _object$hash === undefined ? '' : _object$hash; | |
return { | |
pathname: pathname, | |
search: search === '?' ? '' : search, | |
hash: hash === '#' ? '' : hash | |
}; | |
}; | |
var addBasename = function addBasename(basename, location) { | |
if (!basename) return location; | |
return _extends({}, location, { | |
pathname: Object(history_PathUtils__WEBPACK_IMPORTED_MODULE_4__["addLeadingSlash"])(basename) + location.pathname | |
}); | |
}; | |
var stripBasename = function stripBasename(basename, location) { | |
if (!basename) return location; | |
var base = Object(history_PathUtils__WEBPACK_IMPORTED_MODULE_4__["addLeadingSlash"])(basename); | |
if (location.pathname.indexOf(base) !== 0) return location; | |
return _extends({}, location, { | |
pathname: location.pathname.substr(base.length) | |
}); | |
}; | |
var createLocation = function createLocation(location) { | |
return typeof location === 'string' ? Object(history_PathUtils__WEBPACK_IMPORTED_MODULE_4__["parsePath"])(location) : normalizeLocation(location); | |
}; | |
var createURL = function createURL(location) { | |
return typeof location === 'string' ? location : Object(history_PathUtils__WEBPACK_IMPORTED_MODULE_4__["createPath"])(location); | |
}; | |
var staticHandler = function staticHandler(methodName) { | |
return function () { | |
invariant__WEBPACK_IMPORTED_MODULE_1___default()(false, 'You cannot %s with <StaticRouter>', methodName); | |
}; | |
}; | |
var noop = function noop() {}; | |
/** | |
* The public top-level API for a "static" <Router>, 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 Object(history_PathUtils__WEBPACK_IMPORTED_MODULE_4__["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__WEBPACK_IMPORTED_MODULE_0___default()(!this.props.history, '<StaticRouter> 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__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(_Router__WEBPACK_IMPORTED_MODULE_5__["default"], _extends({}, props, { history: history })); | |
}; | |
return StaticRouter; | |
}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component); | |
StaticRouter.propTypes = { | |
basename: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string, | |
context: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object.isRequired, | |
location: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object]) | |
}; | |
StaticRouter.defaultProps = { | |
basename: '', | |
location: '/' | |
}; | |
StaticRouter.childContextTypes = { | |
router: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object.isRequired | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (StaticRouter); | |
/***/ }), | |
/***/ "./node_modules/react-router/es/Switch.js": | |
/*!************************************************!*\ | |
!*** ./node_modules/react-router/es/Switch.js ***! | |
\************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! warning */ "./node_modules/warning/browser.js"); | |
/* harmony import */ var warning__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(warning__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); | |
/* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_3__); | |
/* harmony import */ var _matchPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./matchPath */ "./node_modules/react-router/es/matchPath.js"); | |
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 <Route> 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__WEBPACK_IMPORTED_MODULE_3___default()(this.context.router, 'You should not use <Switch> outside a <Router>'); | |
}; | |
Switch.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | |
warning__WEBPACK_IMPORTED_MODULE_2___default()(!(nextProps.location && !this.props.location), '<Switch> 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__WEBPACK_IMPORTED_MODULE_2___default()(!(!nextProps.location && this.props.location), '<Switch> 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__WEBPACK_IMPORTED_MODULE_0___default.a.Children.forEach(children, function (element) { | |
if (!react__WEBPACK_IMPORTED_MODULE_0___default.a.isValidElement(element)) return; | |
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; | |
if (match == null) { | |
child = element; | |
match = path ? Object(_matchPath__WEBPACK_IMPORTED_MODULE_4__["default"])(location.pathname, { path: path, exact: exact, strict: strict, sensitive: sensitive }) : route.match; | |
} | |
}); | |
return match ? react__WEBPACK_IMPORTED_MODULE_0___default.a.cloneElement(child, { location: location, computedMatch: match }) : null; | |
}; | |
return Switch; | |
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); | |
Switch.contextTypes = { | |
router: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.shape({ | |
route: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object.isRequired | |
}).isRequired | |
}; | |
Switch.propTypes = { | |
children: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.node, | |
location: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (Switch); | |
/***/ }), | |
/***/ "./node_modules/react-router/es/matchPath.js": | |
/*!***************************************************!*\ | |
!*** ./node_modules/react-router/es/matchPath.js ***! | |
\***************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var path_to_regexp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path-to-regexp */ "./node_modules/path-to-regexp/index.js"); | |
/* harmony import */ var path_to_regexp__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path_to_regexp__WEBPACK_IMPORTED_MODULE_0__); | |
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 = path_to_regexp__WEBPACK_IMPORTED_MODULE_0___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] : {}; | |
if (typeof options === 'string') options = { path: options }; | |
var _options = options, | |
_options$path = _options.path, | |
path = _options$path === undefined ? '/' : _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; | |
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; | |
}, {}) | |
}; | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (matchPath); | |
/***/ }), | |
/***/ "./node_modules/react-router/es/withRouter.js": | |
/*!****************************************************!*\ | |
!*** ./node_modules/react-router/es/withRouter.js ***! | |
\****************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); | |
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__); | |
/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! hoist-non-react-statics */ "./node_modules/hoist-non-react-statics/index.js"); | |
/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_2__); | |
/* harmony import */ var _Route__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Route */ "./node_modules/react-router/es/Route.js"); | |
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; } | |
/** | |
* 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__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Route__WEBPACK_IMPORTED_MODULE_3__["default"], { render: function render(routeComponentProps) { | |
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Component, _extends({}, remainingProps, routeComponentProps, { ref: wrappedComponentRef })); | |
} }); | |
}; | |
C.displayName = 'withRouter(' + (Component.displayName || Component.name) + ')'; | |
C.WrappedComponent = Component; | |
C.propTypes = { | |
wrappedComponentRef: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func | |
}; | |
return hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_2___default()(C, Component); | |
}; | |
/* harmony default export */ __webpack_exports__["default"] = (withRouter); | |
/***/ }), | |
/***/ "./node_modules/react/cjs/react.development.js": | |
/*!*****************************************************!*\ | |
!*** ./node_modules/react/cjs/react.development.js ***! | |
\*****************************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** @license React v16.3.1 | |
* react.development.js | |
* | |
* 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 (true) { | |
(function() { | |
'use strict'; | |
var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); | |
var emptyObject = __webpack_require__(/*! fbjs/lib/emptyObject */ "./node_modules/fbjs/lib/emptyObject.js"); | |
var invariant = __webpack_require__(/*! fbjs/lib/invariant */ "./node_modules/fbjs/lib/invariant.js"); | |
var warning = __webpack_require__(/*! fbjs/lib/warning */ "./node_modules/fbjs/lib/warning.js"); | |
var emptyFunction = __webpack_require__(/*! fbjs/lib/emptyFunction */ "./node_modules/fbjs/lib/emptyFunction.js"); | |
var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); | |
// TODO: this is special because it gets imported during build. | |
var ReactVersion = '16.3.1'; | |
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol | |
// nor polyfill, then a plain number is used for performance. | |
var hasSymbol = typeof Symbol === 'function' && Symbol['for']; | |
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7; | |
var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8; | |
var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9; | |
var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca; | |
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb; | |
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc; | |
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd; | |
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace; | |
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf; | |
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol['for']('react.forward_ref') : 0xead0; | |
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | |
var FAUX_ITERATOR_SYMBOL = '@@iterator'; | |
function getIteratorFn(maybeIterable) { | |
if (maybeIterable === null || typeof maybeIterable === 'undefined') { | |
return null; | |
} | |
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; | |
if (typeof maybeIterator === 'function') { | |
return maybeIterator; | |
} | |
return null; | |
} | |
/** | |
* WARNING: DO NOT manually require this module. | |
* This is a replacement for `invariant(...)` used by the error code system | |
* and will _only_ be required by the corresponding babel pass. | |
* It always throws. | |
*/ | |
/** | |
* Forked from fbjs/warning: | |
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js | |
* | |
* Only change is we use console.warn instead of console.error, | |
* and do nothing when 'console' is not supported. | |
* This really simplifies the code. | |
* --- | |
* 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 lowPriorityWarning = function () {}; | |
{ | |
var printWarning = function (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.warn(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) {} | |
}; | |
lowPriorityWarning = function (condition, format) { | |
if (format === undefined) { | |
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | |
} | |
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.apply(undefined, [format].concat(args)); | |
} | |
}; | |
} | |
var lowPriorityWarning$1 = lowPriorityWarning; | |
var didWarnStateUpdateForUnmountedComponent = {}; | |
function warnNoop(publicInstance, callerName) { | |
{ | |
var _constructor = publicInstance.constructor; | |
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; | |
var warningKey = componentName + '.' + callerName; | |
if (didWarnStateUpdateForUnmountedComponent[warningKey]) { | |
return; | |
} | |
warning(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); | |
didWarnStateUpdateForUnmountedComponent[warningKey] = true; | |
} | |
} | |
/** | |
* This is the abstract API for an update queue. | |
*/ | |
var ReactNoopUpdateQueue = { | |
/** | |
* Checks whether or not this composite component is mounted. | |
* @param {ReactClass} publicInstance The instance we want to test. | |
* @return {boolean} True if mounted, false otherwise. | |
* @protected | |
* @final | |
*/ | |
isMounted: function (publicInstance) { | |
return false; | |
}, | |
/** | |
* Forces an update. This should only be invoked when it is known with | |
* certainty that we are **not** in a DOM transaction. | |
* | |
* You may want to call this when you know that some deeper aspect of the | |
* component's state has changed but `setState` was not called. | |
* | |
* This will not invoke `shouldComponentUpdate`, but it will invoke | |
* `componentWillUpdate` and `componentDidUpdate`. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {?function} callback Called after component is updated. | |
* @param {?string} callerName name of the calling function in the public API. | |
* @internal | |
*/ | |
enqueueForceUpdate: function (publicInstance, callback, callerName) { | |
warnNoop(publicInstance, 'forceUpdate'); | |
}, | |
/** | |
* Replaces all of the state. Always use this or `setState` to mutate state. | |
* You should treat `this.state` as immutable. | |
* | |
* There is no guarantee that `this.state` will be immediately updated, so | |
* accessing `this.state` after calling this method may return the old value. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {object} completeState Next state. | |
* @param {?function} callback Called after component is updated. | |
* @param {?string} callerName name of the calling function in the public API. | |
* @internal | |
*/ | |
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { | |
warnNoop(publicInstance, 'replaceState'); | |
}, | |
/** | |
* Sets a subset of the state. This only exists because _pendingState is | |
* internal. This provides a merging strategy that is not available to deep | |
* properties which is confusing. TODO: Expose pendingState or don't use it | |
* during the merge. | |
* | |
* @param {ReactClass} publicInstance The instance that should rerender. | |
* @param {object} partialState Next partial state to be merged with state. | |
* @param {?function} callback Called after component is updated. | |
* @param {?string} Name of the calling function in the public API. | |
* @internal | |
*/ | |
enqueueSetState: function (publicInstance, partialState, callback, callerName) { | |
warnNoop(publicInstance, 'setState'); | |
} | |
}; | |
/** | |
* Base class helpers for the updating state of a component. | |
*/ | |
function Component(props, context, updater) { | |
this.props = props; | |
this.context = context; | |
this.refs = emptyObject; | |
// We initialize the default updater but the real one gets injected by the | |
// renderer. | |
this.updater = updater || ReactNoopUpdateQueue; | |
} | |
Component.prototype.isReactComponent = {}; | |
/** | |
* Sets a subset of the state. Always use this to mutate | |
* state. You should treat `this.state` as immutable. | |
* | |
* There is no guarantee that `this.state` will be immediately updated, so | |
* accessing `this.state` after calling this method may return the old value. | |
* | |
* There is no guarantee that calls to `setState` will run synchronously, | |
* as they may eventually be batched together. You can provide an optional | |
* callback that will be executed when the call to setState is actually | |
* completed. | |
* | |
* When a function is provided to setState, it will be called at some point in | |
* the future (not synchronously). It will be called with the up to date | |
* component arguments (state, props, context). These values can be different | |
* from this.* because your function may be called after receiveProps but before | |
* shouldComponentUpdate, and this new state, props, and context will not yet be | |
* assigned to this. | |
* | |
* @param {object|function} partialState Next partial state or function to | |
* produce next partial state to be merged with current state. | |
* @param {?function} callback Called after state is updated. | |
* @final | |
* @protected | |
*/ | |
Component.prototype.setState = function (partialState, callback) { | |
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0; | |
this.updater.enqueueSetState(this, partialState, callback, 'setState'); | |
}; | |
/** | |
* Forces an update. This should only be invoked when it is known with | |
* certainty that we are **not** in a DOM transaction. | |
* | |
* You may want to call this when you know that some deeper aspect of the | |
* component's state has changed but `setState` was not called. | |
* | |
* This will not invoke `shouldComponentUpdate`, but it will invoke | |
* `componentWillUpdate` and `componentDidUpdate`. | |
* | |
* @param {?function} callback Called after update is complete. | |
* @final | |
* @protected | |
*/ | |
Component.prototype.forceUpdate = function (callback) { | |
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); | |
}; | |
/** | |
* Deprecated APIs. These APIs used to exist on classic React classes but since | |
* we would like to deprecate them, we're not going to move them over to this | |
* modern base class. Instead, we define a getter that warns if it's accessed. | |
*/ | |
{ | |
var deprecatedAPIs = { | |
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], | |
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] | |
}; | |
var defineDeprecationWarning = function (methodName, info) { | |
Object.defineProperty(Component.prototype, methodName, { | |
get: function () { | |
lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); | |
return undefined; | |
} | |
}); | |
}; | |
for (var fnName in deprecatedAPIs) { | |
if (deprecatedAPIs.hasOwnProperty(fnName)) { | |
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); | |
} | |
} | |
} | |
function ComponentDummy() {} | |
ComponentDummy.prototype = Component.prototype; | |
/** | |
* Convenience component with default shallow equality check for sCU. | |
*/ | |
function PureComponent(props, context, updater) { | |
this.props = props; | |
this.context = context; | |
this.refs = emptyObject; | |
this.updater = updater || ReactNoopUpdateQueue; | |
} | |
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); | |
pureComponentPrototype.constructor = PureComponent; | |
// Avoid an extra prototype jump for these methods. | |
_assign(pureComponentPrototype, Component.prototype); | |
pureComponentPrototype.isPureReactComponent = true; | |
// an immutable object with a single mutable value | |
function createRef() { | |
var refObject = { | |
current: null | |
}; | |
{ | |
Object.seal(refObject); | |
} | |
return refObject; | |
} | |
/** | |
* Keeps track of the current owner. | |
* | |
* The current owner is the component who should own any components that are | |
* currently being constructed. | |
*/ | |
var ReactCurrentOwner = { | |
/** | |
* @internal | |
* @type {ReactComponent} | |
*/ | |
current: null | |
}; | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var RESERVED_PROPS = { | |
key: true, | |
ref: true, | |
__self: true, | |
__source: true | |
}; | |
var specialPropKeyWarningShown = void 0; | |
var specialPropRefWarningShown = void 0; | |
function hasValidRef(config) { | |
{ | |
if (hasOwnProperty.call(config, 'ref')) { | |
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; | |
if (getter && getter.isReactWarning) { | |
return false; | |
} | |
} | |
} | |
return config.ref !== undefined; | |
} | |
function hasValidKey(config) { | |
{ | |
if (hasOwnProperty.call(config, 'key')) { | |
var getter = Object.getOwnPropertyDescriptor(config, 'key').get; | |
if (getter && getter.isReactWarning) { | |
return false; | |
} | |
} | |
} | |
return config.key !== undefined; | |
} | |
function defineKeyPropWarningGetter(props, displayName) { | |
var warnAboutAccessingKey = function () { | |
if (!specialPropKeyWarningShown) { | |
specialPropKeyWarningShown = true; | |
warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName); | |
} | |
}; | |
warnAboutAccessingKey.isReactWarning = true; | |
Object.defineProperty(props, 'key', { | |
get: warnAboutAccessingKey, | |
configurable: true | |
}); | |
} | |
function defineRefPropWarningGetter(props, displayName) { | |
var warnAboutAccessingRef = function () { | |
if (!specialPropRefWarningShown) { | |
specialPropRefWarningShown = true; | |
warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName); | |
} | |
}; | |
warnAboutAccessingRef.isReactWarning = true; | |
Object.defineProperty(props, 'ref', { | |
get: warnAboutAccessingRef, | |
configurable: true | |
}); | |
} | |
/** | |
* Factory method to create a new React element. This no longer adheres to | |
* the class pattern, so do not use new to call it. Also, no instanceof check | |
* will work. Instead test $$typeof field against Symbol.for('react.element') to check | |
* if something is a React Element. | |
* | |
* @param {*} type | |
* @param {*} key | |
* @param {string|object} ref | |
* @param {*} self A *temporary* helper to detect places where `this` is | |
* different from the `owner` when React.createElement is called, so that we | |
* can warn. We want to get rid of owner and replace string `ref`s with arrow | |
* functions, and as long as `this` and owner are the same, there will be no | |
* change in behavior. | |
* @param {*} source An annotation object (added by a transpiler or otherwise) | |
* indicating filename, line number, and/or other information. | |
* @param {*} owner | |
* @param {*} props | |
* @internal | |
*/ | |
var ReactElement = function (type, key, ref, self, source, owner, props) { | |
var element = { | |
// This tag allows us to uniquely identify this as a React Element | |
$$typeof: REACT_ELEMENT_TYPE, | |
// Built-in properties that belong on the element | |
type: type, | |
key: key, | |
ref: ref, | |
props: props, | |
// Record the component responsible for creating this element. | |
_owner: owner | |
}; | |
{ | |
// The validation flag is currently mutative. We put it on | |
// an external backing store so that we can freeze the whole object. | |
// This can be replaced with a WeakMap once they are implemented in | |
// commonly used development environments. | |
element._store = {}; | |
// To make comparing ReactElements easier for testing purposes, we make | |
// the validation flag non-enumerable (where possible, which should | |
// include every environment we run tests in), so the test framework | |
// ignores it. | |
Object.defineProperty(element._store, 'validated', { | |
configurable: false, | |
enumerable: false, | |
writable: true, | |
value: false | |
}); | |
// self and source are DEV only properties. | |
Object.defineProperty(element, '_self', { | |
configurable: false, | |
enumerable: false, | |
writable: false, | |
value: self | |
}); | |
// Two elements created in two different places should be considered | |
// equal for testing purposes and therefore we hide it from enumeration. | |
Object.defineProperty(element, '_source', { | |
configurable: false, | |
enumerable: false, | |
writable: false, | |
value: source | |
}); | |
if (Object.freeze) { | |
Object.freeze(element.props); | |
Object.freeze(element); | |
} | |
} | |
return element; | |
}; | |
/** | |
* Create and return a new ReactElement of the given type. | |
* See https://reactjs.org/docs/react-api.html#createelement | |
*/ | |
function createElement(type, config, children) { | |
var propName = void 0; | |
// Reserved names are extracted | |
var props = {}; | |
var key = null; | |
var ref = null; | |
var self = null; | |
var source = null; | |
if (config != null) { | |
if (hasValidRef(config)) { | |
ref = config.ref; | |
} | |
if (hasValidKey(config)) { | |
key = '' + config.key; | |
} | |
self = config.__self === undefined ? null : config.__self; | |
source = config.__source === undefined ? null : config.__source; | |
// Remaining properties are added to a new props object | |
for (propName in config) { | |
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | |
props[propName] = config[propName]; | |
} | |
} | |
} | |
// Children can be more than one argument, and those are transferred onto | |
// the newly allocated props object. | |
var childrenLength = arguments.length - 2; | |
if (childrenLength === 1) { | |
props.children = children; | |
} else if (childrenLength > 1) { | |
var childArray = Array(childrenLength); | |
for (var i = 0; i < childrenLength; i++) { | |
childArray[i] = arguments[i + 2]; | |
} | |
{ | |
if (Object.freeze) { | |
Object.freeze(childArray); | |
} | |
} | |
props.children = childArray; | |
} | |
// Resolve default props | |
if (type && type.defaultProps) { | |
var defaultProps = type.defaultProps; | |
for (propName in defaultProps) { | |
if (props[propName] === undefined) { | |
props[propName] = defaultProps[propName]; | |
} | |
} | |
} | |
{ | |
if (key || ref) { | |
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { | |
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; | |
if (key) { | |
defineKeyPropWarningGetter(props, displayName); | |
} | |
if (ref) { | |
defineRefPropWarningGetter(props, displayName); | |
} | |
} | |
} | |
} | |
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); | |
} | |
/** | |
* Return a function that produces ReactElements of a given type. | |
* See https://reactjs.org/docs/react-api.html#createfactory | |
*/ | |
function cloneAndReplaceKey(oldElement, newKey) { | |
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); | |
return newElement; | |
} | |
/** | |
* Clone and return a new ReactElement using element as the starting point. | |
* See https://reactjs.org/docs/react-api.html#cloneelement | |
*/ | |
function cloneElement(element, config, children) { | |
var propName = void 0; | |
// Original props are copied | |
var props = _assign({}, element.props); | |
// Reserved names are extracted | |
var key = element.key; | |
var ref = element.ref; | |
// Self is preserved since the owner is preserved. | |
var self = element._self; | |
// Source is preserved since cloneElement is unlikely to be targeted by a | |
// transpiler, and the original source is probably a better indicator of the | |
// true owner. | |
var source = element._source; | |
// Owner will be preserved, unless ref is overridden | |
var owner = element._owner; | |
if (config != null) { | |
if (hasValidRef(config)) { | |
// Silently steal the ref from the parent. | |
ref = config.ref; | |
owner = ReactCurrentOwner.current; | |
} | |
if (hasValidKey(config)) { | |
key = '' + config.key; | |
} | |
// Remaining properties override existing props | |
var defaultProps = void 0; | |
if (element.type && element.type.defaultProps) { | |
defaultProps = element.type.defaultProps; | |
} | |
for (propName in config) { | |
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { | |
if (config[propName] === undefined && defaultProps !== undefined) { | |
// Resolve default props | |
props[propName] = defaultProps[propName]; | |
} else { | |
props[propName] = config[propName]; | |
} | |
} | |
} | |
} | |
// Children can be more than one argument, and those are transferred onto | |
// the newly allocated props object. | |
var childrenLength = arguments.length - 2; | |
if (childrenLength === 1) { | |
props.children = children; | |
} else if (childrenLength > 1) { | |
var childArray = Array(childrenLength); | |
for (var i = 0; i < childrenLength; i++) { | |
childArray[i] = arguments[i + 2]; | |
} | |
props.children = childArray; | |
} | |
return ReactElement(element.type, key, ref, self, source, owner, props); | |
} | |
/** | |
* Verifies the object is a ReactElement. | |
* See https://reactjs.org/docs/react-api.html#isvalidelement | |
* @param {?object} object | |
* @return {boolean} True if `object` is a valid component. | |
* @final | |
*/ | |
function isValidElement(object) { | |
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | |
} | |
var ReactDebugCurrentFrame = {}; | |
{ | |
// Component that is being worked on | |
ReactDebugCurrentFrame.getCurrentStack = null; | |
ReactDebugCurrentFrame.getStackAddendum = function () { | |
var impl = ReactDebugCurrentFrame.getCurrentStack; | |
if (impl) { | |
return impl(); | |
} | |
return null; | |
}; | |
} | |
var SEPARATOR = '.'; | |
var SUBSEPARATOR = ':'; | |
/** | |
* Escape and wrap key so it is safe to use as a reactid | |
* | |
* @param {string} key to be escaped. | |
* @return {string} the escaped key. | |
*/ | |
function escape(key) { | |
var escapeRegex = /[=:]/g; | |
var escaperLookup = { | |
'=': '=0', | |
':': '=2' | |
}; | |
var escapedString = ('' + key).replace(escapeRegex, function (match) { | |
return escaperLookup[match]; | |
}); | |
return '$' + escapedString; | |
} | |
/** | |
* TODO: Test that a single child and an array with one item have the same key | |
* pattern. | |
*/ | |
var didWarnAboutMaps = false; | |
var userProvidedKeyEscapeRegex = /\/+/g; | |
function escapeUserProvidedKey(text) { | |
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/'); | |
} | |
var POOL_SIZE = 10; | |
var traverseContextPool = []; | |
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) { | |
if (traverseContextPool.length) { | |
var traverseContext = traverseContextPool.pop(); | |
traverseContext.result = mapResult; | |
traverseContext.keyPrefix = keyPrefix; | |
traverseContext.func = mapFunction; | |
traverseContext.context = mapContext; | |
traverseContext.count = 0; | |
return traverseContext; | |
} else { | |
return { | |
result: mapResult, | |
keyPrefix: keyPrefix, | |
func: mapFunction, | |
context: mapContext, | |
count: 0 | |
}; | |
} | |
} | |
function releaseTraverseContext(traverseContext) { | |
traverseContext.result = null; | |
traverseContext.keyPrefix = null; | |
traverseContext.func = null; | |
traverseContext.context = null; | |
traverseContext.count = 0; | |
if (traverseContextPool.length < POOL_SIZE) { | |
traverseContextPool.push(traverseContext); | |
} | |
} | |
/** | |
* @param {?*} children Children tree container. | |
* @param {!string} nameSoFar Name of the key path so far. | |
* @param {!function} callback Callback to invoke with each child found. | |
* @param {?*} traverseContext Used to pass information throughout the traversal | |
* process. | |
* @return {!number} The number of children in this subtree. | |
*/ | |
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { | |
var type = typeof children; | |
if (type === 'undefined' || type === 'boolean') { | |
// All of the above are perceived as null. | |
children = null; | |
} | |
var invokeCallback = false; | |
if (children === null) { | |
invokeCallback = true; | |
} else { | |
switch (type) { | |
case 'string': | |
case 'number': | |
invokeCallback = true; | |
break; | |
case 'object': | |
switch (children.$$typeof) { | |
case REACT_ELEMENT_TYPE: | |
case REACT_PORTAL_TYPE: | |
invokeCallback = true; | |
} | |
} | |
} | |
if (invokeCallback) { | |
callback(traverseContext, children, | |
// If it's the only child, treat the name as if it was wrapped in an array | |
// so that it's consistent if the number of children grows. | |
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); | |
return 1; | |
} | |
var child = void 0; | |
var nextName = void 0; | |
var subtreeCount = 0; // Count of children found in the current subtree. | |
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; | |
if (Array.isArray(children)) { | |
for (var i = 0; i < children.length; i++) { | |
child = children[i]; | |
nextName = nextNamePrefix + getComponentKey(child, i); | |
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | |
} | |
} else { | |
var iteratorFn = getIteratorFn(children); | |
if (typeof iteratorFn === 'function') { | |
{ | |
// Warn about using Maps as children | |
if (iteratorFn === children.entries) { | |
warning(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', ReactDebugCurrentFrame.getStackAddendum()); | |
didWarnAboutMaps = true; | |
} | |
} | |
var iterator = iteratorFn.call(children); | |
var step = void 0; | |
var ii = 0; | |
while (!(step = iterator.next()).done) { | |
child = step.value; | |
nextName = nextNamePrefix + getComponentKey(child, ii++); | |
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); | |
} | |
} else if (type === 'object') { | |
var addendum = ''; | |
{ | |
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum(); | |
} | |
var childrenString = '' + children; | |
invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum); | |
} | |
} | |
return subtreeCount; | |
} | |
/** | |
* Traverses children that are typically specified as `props.children`, but | |
* might also be specified through attributes: | |
* | |
* - `traverseAllChildren(this.props.children, ...)` | |
* - `traverseAllChildren(this.props.leftPanelChildren, ...)` | |
* | |
* The `traverseContext` is an optional argument that is passed through the | |
* entire traversal. It can be used to store accumulations or anything else that | |
* the callback might find relevant. | |
* | |
* @param {?*} children Children tree object. | |
* @param {!function} callback To invoke upon traversing each child. | |
* @param {?*} traverseContext Context for traversal. | |
* @return {!number} The number of children in this subtree. | |
*/ | |
function traverseAllChildren(children, callback, traverseContext) { | |
if (children == null) { | |
return 0; | |
} | |
return traverseAllChildrenImpl(children, '', callback, traverseContext); | |
} | |
/** | |
* Generate a key string that identifies a component within a set. | |
* | |
* @param {*} component A component that could contain a manual key. | |
* @param {number} index Index that is used if a manual key is not provided. | |
* @return {string} | |
*/ | |
function getComponentKey(component, index) { | |
// Do some typechecking here since we call this blindly. We want to ensure | |
// that we don't block potential future ES APIs. | |
if (typeof component === 'object' && component !== null && component.key != null) { | |
// Explicit key | |
return escape(component.key); | |
} | |
// Implicit key determined by the index in the set | |
return index.toString(36); | |
} | |
function forEachSingleChild(bookKeeping, child, name) { | |
var func = bookKeeping.func, | |
context = bookKeeping.context; | |
func.call(context, child, bookKeeping.count++); | |
} | |
/** | |
* Iterates through children that are typically specified as `props.children`. | |
* | |
* See https://reactjs.org/docs/react-api.html#react.children.foreach | |
* | |
* The provided forEachFunc(child, index) will be called for each | |
* leaf child. | |
* | |
* @param {?*} children Children tree container. | |
* @param {function(*, int)} forEachFunc | |
* @param {*} forEachContext Context for forEachContext. | |
*/ | |
function forEachChildren(children, forEachFunc, forEachContext) { | |
if (children == null) { | |
return children; | |
} | |
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext); | |
traverseAllChildren(children, forEachSingleChild, traverseContext); | |
releaseTraverseContext(traverseContext); | |
} | |
function mapSingleChildIntoContext(bookKeeping, child, childKey) { | |
var result = bookKeeping.result, | |
keyPrefix = bookKeeping.keyPrefix, | |
func = bookKeeping.func, | |
context = bookKeeping.context; | |
var mappedChild = func.call(context, child, bookKeeping.count++); | |
if (Array.isArray(mappedChild)) { | |
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument); | |
} else if (mappedChild != null) { | |
if (isValidElement(mappedChild)) { | |
mappedChild = cloneAndReplaceKey(mappedChild, | |
// Keep both the (mapped) and old keys if they differ, just as | |
// traverseAllChildren used to do for objects as children | |
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey); | |
} | |
result.push(mappedChild); | |
} | |
} | |
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { | |
var escapedPrefix = ''; | |
if (prefix != null) { | |
escapedPrefix = escapeUserProvidedKey(prefix) + '/'; | |
} | |
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context); | |
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); | |
releaseTraverseContext(traverseContext); | |
} | |
/** | |
* Maps children that are typically specified as `props.children`. | |
* | |
* See https://reactjs.org/docs/react-api.html#react.children.map | |
* | |
* The provided mapFunction(child, key, index) will be called for each | |
* leaf child. | |
* | |
* @param {?*} children Children tree container. | |
* @param {function(*, int)} func The map function. | |
* @param {*} context Context for mapFunction. | |
* @return {object} Object containing the ordered map of results. | |
*/ | |
function mapChildren(children, func, context) { | |
if (children == null) { | |
return children; | |
} | |
var result = []; | |
mapIntoWithKeyPrefixInternal(children, result, null, func, context); | |
return result; | |
} | |
/** | |
* Count the number of children that are typically specified as | |
* `props.children`. | |
* | |
* See https://reactjs.org/docs/react-api.html#react.children.count | |
* | |
* @param {?*} children Children tree container. | |
* @return {number} The number of children. | |
*/ | |
function countChildren(children, context) { | |
return traverseAllChildren(children, emptyFunction.thatReturnsNull, null); | |
} | |
/** | |
* Flatten a children object (typically specified as `props.children`) and | |
* return an array with appropriately re-keyed children. | |
* | |
* See https://reactjs.org/docs/react-api.html#react.children.toarray | |
*/ | |
function toArray(children) { | |
var result = []; | |
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); | |
return result; | |
} | |
/** | |
* Returns the first child in a collection of children and verifies that there | |
* is only one child in the collection. | |
* | |
* See https://reactjs.org/docs/react-api.html#react.children.only | |
* | |
* The current implementation of this function assumes that a single child gets | |
* passed without a wrapper, but the purpose of this helper function is to | |
* abstract away the particular structure of children. | |
* | |
* @param {?object} children Child collection structure. | |
* @return {ReactElement} The first and only `ReactElement` contained in the | |
* structure. | |
*/ | |
function onlyChild(children) { | |
!isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0; | |
return children; | |
} | |
function createContext(defaultValue, calculateChangedBits) { | |
if (calculateChangedBits === undefined) { | |
calculateChangedBits = null; | |
} else { | |
{ | |
warning(calculateChangedBits === null || typeof calculateChangedBits === 'function', 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits); | |
} | |
} | |
var context = { | |
$$typeof: REACT_CONTEXT_TYPE, | |
_calculateChangedBits: calculateChangedBits, | |
_defaultValue: defaultValue, | |
_currentValue: defaultValue, | |
_changedBits: 0, | |
// These are circular | |
Provider: null, | |
Consumer: null | |
}; | |
context.Provider = { | |
$$typeof: REACT_PROVIDER_TYPE, | |
_context: context | |
}; | |
context.Consumer = context; | |
{ | |
context._currentRenderer = null; | |
} | |
return context; | |
} | |
function forwardRef(render) { | |
{ | |
warning(typeof render === 'function', 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); | |
} | |
return { | |
$$typeof: REACT_FORWARD_REF_TYPE, | |
render: render | |
}; | |
} | |
var describeComponentFrame = function (name, source, ownerName) { | |
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); | |
}; | |
function isValidElementType(type) { | |
return typeof type === 'string' || typeof type === 'function' || | |
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. | |
type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE); | |
} | |
function getComponentName(fiber) { | |
var type = fiber.type; | |
if (typeof type === 'function') { | |
return type.displayName || type.name; | |
} | |
if (typeof type === 'string') { | |
return type; | |
} | |
switch (type) { | |
case REACT_FRAGMENT_TYPE: | |
return 'ReactFragment'; | |
case REACT_PORTAL_TYPE: | |
return 'ReactPortal'; | |
case REACT_CALL_TYPE: | |
return 'ReactCall'; | |
case REACT_RETURN_TYPE: | |
return 'ReactReturn'; | |
} | |
return null; | |
} | |
/** | |
* ReactElementValidator provides a wrapper around a element factory | |
* which validates the props passed to the element. This is intended to be | |
* used only in DEV and could be replaced by a static type checker for languages | |
* that support it. | |
*/ | |
var currentlyValidatingElement = void 0; | |
var propTypesMisspellWarningShown = void 0; | |
var getDisplayName = function () {}; | |
var getStackAddendum = function () {}; | |
{ | |
currentlyValidatingElement = null; | |
propTypesMisspellWarningShown = false; | |
getDisplayName = function (element) { | |
if (element == null) { | |
return '#empty'; | |
} else if (typeof element === 'string' || typeof element === 'number') { | |
return '#text'; | |
} else if (typeof element.type === 'string') { | |
return element.type; | |
} else if (element.type === REACT_FRAGMENT_TYPE) { | |
return 'React.Fragment'; | |
} else { | |
return element.type.displayName || element.type.name || 'Unknown'; | |
} | |
}; | |
getStackAddendum = function () { | |
var stack = ''; | |
if (currentlyValidatingElement) { | |
var name = getDisplayName(currentlyValidatingElement); | |
var owner = currentlyValidatingElement._owner; | |
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner)); | |
} | |
stack += ReactDebugCurrentFrame.getStackAddendum() || ''; | |
return stack; | |
}; | |
} | |
function getDeclarationErrorAddendum() { | |
if (ReactCurrentOwner.current) { | |
var name = getComponentName(ReactCurrentOwner.current); | |
if (name) { | |
return '\n\nCheck the render method of `' + name + '`.'; | |
} | |
} | |
return ''; | |
} | |
function getSourceInfoErrorAddendum(elementProps) { | |
if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) { | |
var source = elementProps.__source; | |
var fileName = source.fileName.replace(/^.*[\\\/]/, ''); | |
var lineNumber = source.lineNumber; | |
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; | |
} | |
return ''; | |
} | |
/** | |
* Warn if there's no key explicitly set on dynamic arrays of children or | |
* object keys are not valid. This allows us to keep track of children between | |
* updates. | |
*/ | |
var ownerHasKeyUseWarning = {}; | |
function getCurrentComponentErrorInfo(parentType) { | |
var info = getDeclarationErrorAddendum(); | |
if (!info) { | |
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; | |
if (parentName) { | |
info = '\n\nCheck the top-level render call using <' + parentName + '>.'; | |
} | |
} | |
return info; | |
} | |
/** | |
* Warn if the element doesn't have an explicit key assigned to it. | |
* This element is in an array. The array could grow and shrink or be | |
* reordered. All children that haven't already been validated are required to | |
* have a "key" property assigned to it. Error statuses are cached so a warning | |
* will only be shown once. | |
* | |
* @internal | |
* @param {ReactElement} element Element that requires a key. | |
* @param {*} parentType element's parent's type. | |
*/ | |
function validateExplicitKey(element, parentType) { | |
if (!element._store || element._store.validated || element.key != null) { | |
return; | |
} | |
element._store.validated = true; | |
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); | |
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { | |
return; | |
} | |
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; | |
// Usually the current owner is the offender, but if it accepts children as a | |
// property, it may be the creator of the child that's responsible for | |
// assigning it a key. | |
var childOwner = ''; | |
if (element && element._owner && element._owner !== ReactCurrentOwner.current) { | |
// Give the component that originally created this child. | |
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.'; | |
} | |
currentlyValidatingElement = element; | |
{ | |
warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getStackAddendum()); | |
} | |
currentlyValidatingElement = null; | |
} | |
/** | |
* Ensure that every element either is passed in a static location, in an | |
* array with an explicit keys property defined, or in an object literal | |
* with valid key property. | |
* | |
* @internal | |
* @param {ReactNode} node Statically passed child of any type. | |
* @param {*} parentType node's parent's type. | |
*/ | |
function validateChildKeys(node, parentType) { | |
if (typeof node !== 'object') { | |
return; | |
} | |
if (Array.isArray(node)) { | |
for (var i = 0; i < node.length; i++) { | |
var child = node[i]; | |
if (isValidElement(child)) { | |
validateExplicitKey(child, parentType); | |
} | |
} | |
} else if (isValidElement(node)) { | |
// This element was passed in a valid location. | |
if (node._store) { | |
node._store.validated = true; | |
} | |
} else if (node) { | |
var iteratorFn = getIteratorFn(node); | |
if (typeof iteratorFn === 'function') { | |
// Entry iterators used to provide implicit keys, | |
// but now we print a separate warning for them later. | |
if (iteratorFn !== node.entries) { | |
var iterator = iteratorFn.call(node); | |
var step = void 0; | |
while (!(step = iterator.next()).done) { | |
if (isValidElement(step.value)) { | |
validateExplicitKey(step.value, parentType); | |
} | |
} | |
} | |
} | |
} | |
} | |
/** | |
* Given an element, validate that its props follow the propTypes definition, | |
* provided by the type. | |
* | |
* @param {ReactElement} element | |
*/ | |
function validatePropTypes(element) { | |
var componentClass = element.type; | |
if (typeof componentClass !== 'function') { | |
return; | |
} | |
var name = componentClass.displayName || componentClass.name; | |
var propTypes = componentClass.propTypes; | |
if (propTypes) { | |
currentlyValidatingElement = element; | |
checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum); | |
currentlyValidatingElement = null; | |
} else if (componentClass.PropTypes !== undefined && !propTypesMisspellWarningShown) { | |
propTypesMisspellWarningShown = true; | |
warning(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown'); | |
} | |
if (typeof componentClass.getDefaultProps === 'function') { | |
warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); | |
} | |
} | |
/** | |
* Given a fragment, validate that it can only be provided with fragment props | |
* @param {ReactElement} fragment | |
*/ | |
function validateFragmentProps(fragment) { | |
currentlyValidatingElement = fragment; | |
var keys = Object.keys(fragment.props); | |
for (var i = 0; i < keys.length; i++) { | |
var key = keys[i]; | |
if (key !== 'children' && key !== 'key') { | |
warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum()); | |
break; | |
} | |
} | |
if (fragment.ref !== null) { | |
warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum()); | |
} | |
currentlyValidatingElement = null; | |
} | |
function createElementWithValidation(type, props, children) { | |
var validType = isValidElementType(type); | |
// We warn in this case but don't throw. We expect the element creation to | |
// succeed and there will likely be errors in render. | |
if (!validType) { | |
var info = ''; | |
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { | |
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; | |
} | |
var sourceInfo = getSourceInfoErrorAddendum(props); | |
if (sourceInfo) { | |
info += sourceInfo; | |
} else { | |
info += getDeclarationErrorAddendum(); | |
} | |
info += getStackAddendum() || ''; | |
var typeString = void 0; | |
if (type === null) { | |
typeString = 'null'; | |
} else if (Array.isArray(type)) { | |
typeString = 'array'; | |
} else { | |
typeString = typeof type; | |
} | |
warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); | |
} | |
var element = createElement.apply(this, arguments); | |
// The result can be nullish if a mock or a custom function is used. | |
// TODO: Drop this when these are no longer allowed as the type argument. | |
if (element == null) { | |
return element; | |
} | |
// Skip key warning if the type isn't valid since our key validation logic | |
// doesn't expect a non-string/function type and can throw confusing errors. | |
// We don't want exception behavior to differ between dev and prod. | |
// (Rendering will throw with a helpful message and as soon as the type is | |
// fixed, the key warnings will appear.) | |
if (validType) { | |
for (var i = 2; i < arguments.length; i++) { | |
validateChildKeys(arguments[i], type); | |
} | |
} | |
if (type === REACT_FRAGMENT_TYPE) { | |
validateFragmentProps(element); | |
} else { | |
validatePropTypes(element); | |
} | |
return element; | |
} | |
function createFactoryWithValidation(type) { | |
var validatedFactory = createElementWithValidation.bind(null, type); | |
validatedFactory.type = type; | |
// Legacy hook: remove it | |
{ | |
Object.defineProperty(validatedFactory, 'type', { | |
enumerable: false, | |
get: function () { | |
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); | |
Object.defineProperty(this, 'type', { | |
value: type | |
}); | |
return type; | |
} | |
}); | |
} | |
return validatedFactory; | |
} | |
function cloneElementWithValidation(element, props, children) { | |
var newElement = cloneElement.apply(this, arguments); | |
for (var i = 2; i < arguments.length; i++) { | |
validateChildKeys(arguments[i], newElement.type); | |
} | |
validatePropTypes(newElement); | |
return newElement; | |
} | |
var React = { | |
Children: { | |
map: mapChildren, | |
forEach: forEachChildren, | |
count: countChildren, | |
toArray: toArray, | |
only: onlyChild | |
}, | |
createRef: createRef, | |
Component: Component, | |
PureComponent: PureComponent, | |
createContext: createContext, | |
forwardRef: forwardRef, | |
Fragment: REACT_FRAGMENT_TYPE, | |
StrictMode: REACT_STRICT_MODE_TYPE, | |
unstable_AsyncMode: REACT_ASYNC_MODE_TYPE, | |
createElement: createElementWithValidation, | |
cloneElement: cloneElementWithValidation, | |
createFactory: createFactoryWithValidation, | |
isValidElement: isValidElement, | |
version: ReactVersion, | |
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { | |
ReactCurrentOwner: ReactCurrentOwner, | |
// Used by renderers to avoid bundling object-assign twice in UMD bundles: | |
assign: _assign | |
} | |
}; | |
{ | |
_assign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, { | |
// These should not be included in production. | |
ReactDebugCurrentFrame: ReactDebugCurrentFrame, | |
// Shim for React DOM 16.0.0 which still destructured (but not used) this. | |
// TODO: remove in React 17.0. | |
ReactComponentTreeHook: {} | |
}); | |
} | |
var React$2 = Object.freeze({ | |
default: React | |
}); | |
var React$3 = ( React$2 && React ) || React$2; | |
// TODO: decide on the top-level export form. | |
// This is hacky but makes it work with both Rollup and Jest. | |
var react = React$3['default'] ? React$3['default'] : React$3; | |
module.exports = react; | |
})(); | |
} | |
/***/ }), | |
/***/ "./node_modules/react/index.js": | |
/*!*************************************!*\ | |
!*** ./node_modules/react/index.js ***! | |
\*************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
if (false) {} else { | |
module.exports = __webpack_require__(/*! ./cjs/react.development.js */ "./node_modules/react/cjs/react.development.js"); | |
} | |
/***/ }), | |
/***/ "./node_modules/resolve-pathname/index.js": | |
/*!************************************************!*\ | |
!*** ./node_modules/resolve-pathname/index.js ***! | |
\************************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
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; | |
} | |
/* harmony default export */ __webpack_exports__["default"] = (resolvePathname); | |
/***/ }), | |
/***/ "./node_modules/value-equal/index.js": | |
/*!*******************************************!*\ | |
!*** ./node_modules/value-equal/index.js ***! | |
\*******************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
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; | |
} | |
/* harmony default export */ __webpack_exports__["default"] = (valueEqual); | |
/***/ }), | |
/***/ "./node_modules/warning/browser.js": | |
/*!*****************************************!*\ | |
!*** ./node_modules/warning/browser.js ***! | |
\*****************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* 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. | |
*/ | |
/** | |
* 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 (true) { | |
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; | |
/***/ }), | |
/***/ "./src/components/Button/Button.css": | |
/*!******************************************!*\ | |
!*** ./src/components/Button/Button.css ***! | |
\******************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports, __webpack_require__) { | |
// extracted by mini-css-extract-plugin | |
module.exports = {"btn":"Button__btn","link":"Button__link","action":"Button__action"}; | |
/***/ }), | |
/***/ "./src/components/Button/Button.tsx": | |
/*!******************************************!*\ | |
!*** ./src/components/Button/Button.tsx ***! | |
\******************************************/ | |
/*! exports provided: default */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Button; }); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); | |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/es/index.js"); | |
/* harmony import */ var _Button_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Button.css */ "./src/components/Button/Button.css"); | |
/* harmony import */ var _Button_css__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_Button_css__WEBPACK_IMPORTED_MODULE_2__); | |
function Button(_a) { | |
var onClick = _a.onClick, label = _a.label, children = _a.children, _b = _a.kind, kind = _b === void 0 ? 'action' : _b, _c = _a.style, style = _c === void 0 ? {} : _c, href = _a.href, target = _a.target, className = _a.className; | |
var text = label || children; | |
var kindStyle = _Button_css__WEBPACK_IMPORTED_MODULE_2__[kind] || ''; | |
var classes = className || ''; | |
if (href) { | |
return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react_router_dom__WEBPACK_IMPORTED_MODULE_1__["Link"], { className: style.btn + " " + kindStyle + " " + classes, to: href, target: target, onClick: onClick, style: style }, | |
react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", { className: style.background }), | |
react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("span", null, text))); | |
} | |
return (react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("button", { className: style.btn + " " + kindStyle, onClick: onClick, style: style }, | |
react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", null, text))); | |
} | |
/***/ }), | |
/***/ "./src/components/Button/index.ts": | |
/*!****************************************!*\ | |
!*** ./src/components/Button/index.ts ***! | |
\****************************************/ | |
/*! exports provided: Button */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Button */ "./src/components/Button/Button.tsx"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Button", function() { return _Button__WEBPACK_IMPORTED_MODULE_0__["default"]; }); | |
/***/ }), | |
/***/ "./src/index.ts": | |
/*!**********************!*\ | |
!*** ./src/index.ts ***! | |
\**********************/ | |
/*! exports provided: Button */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var _components_Button__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/Button */ "./src/components/Button/index.ts"); | |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Button", function() { return _components_Button__WEBPACK_IMPORTED_MODULE_0__["Button"]; }); | |
/***/ }) | |
/******/ }); | |
//# sourceMappingURL=index.js.map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment