/** * Copyright (c) 2014-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @providesModule warning
*/
var warning = function () {};
{ var printWarning = function printWarning(format, args) { var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0); for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
} var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function () { return args[argIndex++];
}); if (typeof console !== 'undefined') {
console.error(message);
} try { // --- Welcome to debugging React --- // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. thrownew Error(message);
} catch (x) {}
};
warning = function (condition, format, args) { var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0); for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
} if (format === undefined) { thrownew Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
} if (!condition) {
printWarning.apply(null, [format].concat(args));
}
};
}
var warning_1 = warning;
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
/** * 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) { returnfunction () { 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() {};
/** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *
*/
/** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
{
validateFormat = function validateFormat(format) { if (format === undefined) { thrownew Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) { var error; if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else { var args = [a, b, c, d, e, f]; var argIndex = 0;
error = new Error(format.replace(/%s/g, function () { return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame throw error;
}
}
var invariant_1 = invariant;
/** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths.
*/
var 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. thrownew Error(message);
} catch (x) {}
};
warning$1 = function warning(condition, format) { if (format === undefined) { thrownew Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) { if (val === null || val === undefined) { thrownew TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() { try { if (!Object.assign) { returnfalse;
}
// 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') { returnfalse;
}
// 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') { returnfalse;
}
returntrue;
} catch (err) { // We don't expect any of the above to throw, but better to be safe. returnfalse;
}
}
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) { if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++) { if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
{ var invariant$1 = invariant_1; var warning$2 = warning_1$1; var ReactPropTypesSecret$1 = ReactPropTypesSecret_1; var loggedTypeFailures = {};
}
/** * Assert that the values match with the type specs. * Error messages are memorized and will only be shown once. * * @param {object} typeSpecs Map of name to a ReactPropType * @param {object} values Runtime values that need to be type-checked * @param {string} location e.g. "prop", "context", "child context" * @param {string} componentName Name of the component for error messages. * @param {?Function} getStack Returns the component stack. * @private
*/ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
{ for (var typeSpecName in typeSpecs) { if (typeSpecs.hasOwnProperty(typeSpecName)) { var error; // Prop type validation may throw. In case they do, we don't want to // fail the render phase where it didn't fail before. So we log it. // After these have been cleaned up, we'll let them throw. try { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message.
invariant$1(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
} catch (ex) {
error = ex;
}
warning$2(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); if (error instanceof Error && !(error.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the // same error.
loggedTypeFailures[error.message] = true;
var factoryWithTypeCheckers = function (isValidElement, throwOnDirectAccess) { /* global Symbol */ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/** * Returns the iterator method function contained on the iterable object. * * Be sure to invoke the function with the iterable as context: * * var iteratorFn = getIteratorFn(myIterable); * if (iteratorFn) { * var iterator = iteratorFn.call(myIterable); * ... * } * * @param {?object} maybeIterable * @return {?function}
*/ function getIteratorFn(maybeIterable) { var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); if (typeof iteratorFn === 'function') { return iteratorFn;
}
}
/** * Collection of methods that allow declaration and validation of props that are * supplied to React components. Example usage: * * var Props = require('ReactPropTypes'); * var MyArticle = React.createClass({ * propTypes: { * // An optional string prop named "description". * description: Props.string, * * // A required enum prop named "category". * category: Props.oneOf(['News','Photos']).isRequired, * * // A prop named "dialog" that requires an instance of Dialog. * dialog: Props.instanceOf(Dialog).isRequired * }, * render: function() { ... } * }); * * A more formal specification of how these methods are used: * * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) * decl := ReactPropTypes.{type}(.isRequired)? * * Each and every declaration produces a function with the same signature. This * allows the creation of custom validation functions. For example: * * var MyLink = React.createClass({ * propTypes: { * // An optional string or URI prop named "href". * href: function(props, propName, componentName) { * var propValue = props[propName]; * if (propValue != null && typeof propValue !== 'string' && * !(propValue instanceof URI)) { * return new Error( * 'Expected a string or an URI for ' + propName + ' in ' + * componentName * ); * } * } * }, * render: function() {...} * }); * * @internal
*/
var ANONYMOUS = '<>';
// Important! // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
symbol: createPrimitiveTypeChecker('symbol'),
/** * inlined Object.is polyfill to avoid requiring consumers ship their own * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/ /*eslint-disable no-self-compare*/ function is(x, y) { // SameValue algorithm if (x === y) { // Steps 1-5, 7-10 // Steps 6.b-6.e: +0 != -0 return x !== 0 || 1 / x === 1 / y;
} else { // Step 6.a: NaN == NaN return x !== x && y !== y;
}
} /*eslint-enable no-self-compare*/
/** * We use an Error-like object for backward compatibility as people may call * PropTypes directly and inspect their output. However, we don't use real * Errors anymore. We don't inspect their stack anyway, and creating them * is prohibitively expensive if they are created too often, such as what * happens in oneOfType() for any type before the one that matched.
*/ function PropTypeError(message) { this.message = message; this.stack = '';
} // Make `instanceof Error` still work for returned errors.
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
{ var manualPropTypeCallCache = {}; var manualPropTypeWarningCount = 0;
} function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret_1) { if (throwOnDirectAccess) { // New behavior only for users of `prop-types` package
invariant_1(false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
} elseif (typeof console !== 'undefined') { // Old behavior for people using React.PropTypes var cacheKey = componentName + ':' + propName; if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3) {
warning_1$1(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
} if (props[propName] == null) { if (isRequired) { if (props[propName] === null) { returnnew PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
} returnnew PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
} returnnull;
} 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);
function createAnyTypeChecker() { return createChainableTypeChecker(emptyFunction_1.thatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { returnnew PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
} var propValue = props[propName]; if (!Array.isArray(propValue)) { var propType = getPropType(propValue); returnnew PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
} for (var i = 0; i < propValue.length; i++) { var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1); if (error instanceof Error) { return error;
}
} returnnull;
} return createChainableTypeChecker(validate);
}
function createElementTypeChecker() { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!isValidElement(propValue)) { var propType = getPropType(propValue); returnnew PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
} returnnull;
} 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]); returnnew PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
} returnnull;
} return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) {
warning_1$1(false, 'Invalid argument supplied to oneOf, expected an instance of array.'); return emptyFunction_1.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; for (var i = 0; i < expectedValues.length; i++) { if (is(propValue, expectedValues[i])) { returnnull;
}
}
var valuesString = JSON.stringify(expectedValues); returnnew 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') { returnnew PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
} var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { returnnew PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
} for (var key in propValue) { if (propValue.hasOwnProperty(key)) { var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); if (error instanceof Error) { return error;
}
}
} returnnull;
} return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) {
warning_1$1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.'); return emptyFunction_1.thatReturnsNull;
}
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (typeof checker !== 'function') {
warning_1$1(false, 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received %s at index %s.', getPostfixForTypeWarning(checker), i); return emptyFunction_1.thatReturnsNull;
}
}
function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) { returnnull;
}
}
function createNodeChecker() { function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { returnnew PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
} returnnull;
} return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { returnnew PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
} for (var key in shapeTypes) { var checker = shapeTypes[key]; if (!checker) { continue;
} var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); if (error) { return error;
}
} returnnull;
} return createChainableTypeChecker(validate);
}
function createStrictShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { returnnew PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
} // We need to check all keys in case some are required but missing from // props. var allKeys = objectAssign({}, props[propName], shapeTypes); for (var key in allKeys) { var checker = shapeTypes[key]; if (!checker) { returnnew PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' '));
} var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); if (error) { return error;
}
} returnnull;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) { switch (typeof propValue) { case'number': case'string': case'undefined': returntrue; case'boolean': return !propValue; case'object': if (Array.isArray(propValue)) { return propValue.every(isNode);
} if (propValue === null || isValidElement(propValue)) { returntrue;
}
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)) { returnfalse;
}
}
} 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])) { returnfalse;
}
}
}
}
} else { returnfalse;
}
returntrue; default: returnfalse;
}
}
function isSymbol(propType, propValue) { // Native Symbol. if (propType === 'symbol') { returntrue;
}
// Fallback for non-spec compliant Symbols which are polyfilled. if (typeof Symbol === 'function' && propValue instanceof Symbol) { returntrue;
}
returnfalse;
}
// 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';
} elseif (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;
}
var propTypes = createCommonjsModule(function (module) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree.
*/
{ var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element') || 0xeac7;
var isValidElement = function (object) { returntypeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true;
module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
}
});
/** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree.
*/
var invariant$2 = function (condition, format, a, b, c, d, e, f) {
{ if (format === undefined) { thrownew Error('invariant requires an error message argument');
}
}
if (!condition) { var error; if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else { var args = [a, b, c, d, e, f]; var argIndex = 0;
error = new Error(format.replace(/%s/g, function () { return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame throw error;
}
};
var invariant_1$1 = invariant$2;
function isAbsolute(pathname) { return pathname.charAt(0) === '/';
}
// About 1.5x faster than the two-arg version of Array#splice() function spliceOne(list, index) { for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
list[i] = list[k];
}
list.pop();
}
// This implementation is based heavily on node's url.parse function resolvePathname(to) { var from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var toParts = to && to.split('/') || []; var fromParts = from && from.split('/') || [];
var isToAbs = to && isAbsolute(to); var isFromAbs = from && isAbsolute(from); var mustEndAbs = isToAbs || isFromAbs;
if (to && isAbsolute(to)) { // to is absolute
fromParts = toParts;
} elseif (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];
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;
};
try {
location.pathname = decodeURI(location.pathname);
} catch (e) { if (e instanceof URIError) { thrownew 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;
} elseif (location.pathname.charAt(0) !== '/') {
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
}
} else { // When there is no prior location and pathname is empty, set it to / if (!location.pathname) {
location.pathname = '/';
}
}
return location;
};
var locationsAreEqual = function locationsAreEqual(a, b) { return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && valueEqual(a.state, b.state);
};
var createTransitionManager = function createTransitionManager() { var prompt = null;
var setPrompt = function setPrompt(nextPrompt) {
warning_1(prompt == null, 'A history supports only one prompt at a time');
var confirmTransitionTo = function confirmTransitionTo(location, action, getUserConfirmation, callback) { // TODO: If another transition starts while we're still confirming // the previous one, we may end up in a weird state. Figure out the // best way to handle this. if (prompt != null) { var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
if (typeof result === 'string') { if (typeof getUserConfirmation === 'function') {
getUserConfirmation(result, callback);
} else {
warning_1(false, 'A history needs a getUserConfirmation function in order to use a prompt message');
callback(true);
}
} else { // Return false from a transition hook to cancel the transition.
callback(result !== false);
}
} else {
callback(true);
}
};
var listeners = [];
var appendListener = function appendListener(fn) { var isActive = true;
var listener = function listener() { if (isActive) fn.apply(undefined, arguments);
};
return window.history && 'pushState' in window.history;
};
/** * Returns true if browser fires popstate on hash change. * IE10 and IE11 do not.
*/ var supportsPopStateOnHashChange = function supportsPopStateOnHashChange() { return window.navigator.userAgent.indexOf('Trident') === -1;
};
/** * Returns false if using go(n) with hash history causes a full page reload.
*/ var supportsGoWithoutReloadUsingHash = function supportsGoWithoutReloadUsingHash() { return window.navigator.userAgent.indexOf('Firefox') === -1;
};
/** * Returns true if a given popstate event is an extraneous WebKit event. * Accounts for the fact that Chrome on iOS fires real popstate events * containing undefined state when pressing the back button.
*/ var isExtraneousPopstateEvent = function isExtraneousPopstateEvent(event) { return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
};
var _typeof$1 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { returntypeof obj;
} : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i];for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
var PopStateEvent = 'popstate'; var HashChangeEvent = 'hashchange';
var getHistoryState = function getHistoryState() { try { return window.history.state || {};
} catch (e) { // IE 11 sometimes throws when accessing window.history.state // See https://github.com/ReactTraining/history/pull/289 return {};
}
};
/** * Creates a history object that uses the HTML5 history API including * pushState, replaceState, and the popstate event.
*/ var createBrowserHistory = function createBrowserHistory() { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
invariant_1$1(canUseDOM, 'Browser history needs a DOM');
var globalHistory = window.history; var canUseHistory = supportsHistory(); var needsHashChangeListener = !supportsPopStateOnHashChange();
warning_1(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".');
if (basename) path = stripBasename(path, basename);
return createLocation(path, state, key);
};
var createKey = function createKey() { return Math.random().toString(36).substr(2, keyLength);
};
var transitionManager = createTransitionManager();
var setState = function setState(nextState) {
_extends$1(history, nextState);
var revertPop = function revertPop(fromLocation) { var toLocation = history.location;
// TODO: We could probably make this more reliable by // keeping a list of keys we've seen in sessionStorage. // Instead, we just default to 0 for keys we don't know.
var toIndex = allKeys.indexOf(toLocation.key);
if (toIndex === -1) toIndex = 0;
var fromIndex = allKeys.indexOf(fromLocation.key);
if (fromIndex === -1) fromIndex = 0;
var delta = toIndex - fromIndex;
if (delta) {
forceNextPop = true;
go(delta);
}
};
var initialLocation = getDOMLocation(getHistoryState()); var allKeys = [initialLocation.key];
// Public interface
var createHref = function createHref(location) { return basename + createPath(location);
};
var push = function push(path, state) {
warning_1(!((typeof path === 'undefined' ? 'undefined' : _typeof$1(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored');
var action = 'PUSH'; var location = createLocation(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return;
var href = createHref(location); var key = location.key,
state = location.state;
if (canUseHistory) {
globalHistory.pushState({ key: key, state: state }, null, href);
if (forceRefresh) {
window.location.href = href;
} else { var prevIndex = allKeys.indexOf(history.location.key); var nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
nextKeys.push(location.key);
allKeys = nextKeys;
setState({ action: action, location: location });
}
} else {
warning_1(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history');
window.location.href = href;
}
});
};
var replace = function replace(path, state) {
warning_1(!((typeof path === 'undefined' ? 'undefined' : _typeof$1(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored');
var action = 'REPLACE'; var location = createLocation(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return;
var href = createHref(location); var key = location.key,
state = location.state;
if (canUseHistory) {
globalHistory.replaceState({ key: key, state: state }, null, href);
if (forceRefresh) {
window.location.replace(href);
} else { var prevIndex = allKeys.indexOf(history.location.key);
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
setState({ action: action, location: location });
}
} else {
warning_1(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history');
window.location.replace(href);
}
});
};
var go = function go(n) {
globalHistory.go(n);
};
var goBack = function goBack() { return go(-1);
};
var goForward = function goForward() { return go(1);
};
var listenerCount = 0;
var checkDOMListeners = function checkDOMListeners(delta) {
listenerCount += delta;
if (listenerCount === 1) {
addEventListener(window, PopStateEvent, handlePopState);
var _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i];for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
var 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('#');
var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
var _HashPathCoders$hashT = HashPathCoders[hashType],
encodePath = _HashPathCoders$hashT.encodePath,
decodePath = _HashPathCoders$hashT.decodePath;
var getDOMLocation = function getDOMLocation() { var path = decodePath(getHashPath());
warning_1(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".');
if (basename) path = stripBasename(path, basename);
return createLocation(path);
};
var transitionManager = createTransitionManager();
var setState = function setState(nextState) {
_extends$2(history, nextState);
var handleHashChange = function handleHashChange() { var path = getHashPath(); var encodedPath = encodePath(path);
if (path !== encodedPath) { // Ensure we always have a properly-encoded hash.
replaceHashPath(encodedPath);
} else { var location = getDOMLocation(); var prevLocation = history.location;
if (!forceNextPop && locationsAreEqual(prevLocation, location)) return; // A hashchange doesn't always == location change.
if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.
ignorePath = null;
handlePop(location);
}
};
var handlePop = function handlePop(location) { if (forceNextPop) {
forceNextPop = false;
setState();
} else { var action = 'POP';
var revertPop = function revertPop(fromLocation) { var toLocation = history.location;
// TODO: We could probably make this more reliable by // keeping a list of paths we've seen in sessionStorage. // Instead, we just default to 0 for paths we don't know.
var toIndex = allPaths.lastIndexOf(createPath(toLocation));
if (toIndex === -1) toIndex = 0;
var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
if (fromIndex === -1) fromIndex = 0;
var delta = toIndex - fromIndex;
if (delta) {
forceNextPop = true;
go(delta);
}
};
// Ensure the hash is encoded properly before doing anything else. var path = getHashPath(); var encodedPath = encodePath(path);
if (path !== encodedPath) replaceHashPath(encodedPath);
var initialLocation = getDOMLocation(); var allPaths = [createPath(initialLocation)];
// Public interface
var createHref = function createHref(location) { return'#' + encodePath(basename + createPath(location));
};
var push = function push(path, state) {
warning_1(state === undefined, 'Hash history cannot push state; it is ignored');
var action = 'PUSH'; var location = createLocation(path, undefined, undefined, history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return;
var path = createPath(location); var encodedPath = encodePath(basename + path); var hashChanged = getHashPath() !== encodedPath;
if (hashChanged) { // We cannot tell if a hashchange was caused by a PUSH, so we'd // rather setState here and ignore the hashchange. The caveat here // is that other hash histories in the page will consider it a POP.
ignorePath = path;
pushHashPath(encodedPath);
var prevIndex = allPaths.lastIndexOf(createPath(history.location)); var nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
nextPaths.push(path);
allPaths = nextPaths;
setState({ action: action, location: location });
} else {
warning_1(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack');
setState();
}
});
};
var replace = function replace(path, state) {
warning_1(state === undefined, 'Hash history cannot replace state; it is ignored');
var action = 'REPLACE'; var location = createLocation(path, undefined, undefined, history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return;
var path = createPath(location); var encodedPath = encodePath(basename + path); var hashChanged = getHashPath() !== encodedPath;
if (hashChanged) { // We cannot tell if a hashchange was caused by a REPLACE, so we'd // rather setState here and ignore the hashchange. The caveat here // is that other hash histories in the page will consider it a POP.
ignorePath = path;
replaceHashPath(encodedPath);
}
var prevIndex = allPaths.indexOf(createPath(history.location));
var _typeof$2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { returntypeof obj;
} : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i];for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
var clamp = function clamp(n, lowerBound, upperBound) { return Math.min(Math.max(n, lowerBound), upperBound);
};
/** * Creates a history object that stores locations in memory.
*/ var createMemoryHistory = function createMemoryHistory() { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var getUserConfirmation = props.getUserConfirmation,
_props$initialEntries = props.initialEntries,
initialEntries = _props$initialEntries === undefined ? ['/'] : _props$initialEntries,
_props$initialIndex = props.initialIndex,
initialIndex = _props$initialIndex === undefined ? 0 : _props$initialIndex,
_props$keyLength = props.keyLength,
keyLength = _props$keyLength === undefined ? 6 : _props$keyLength;
var transitionManager = createTransitionManager();
var setState = function setState(nextState) {
_extends$3(history, nextState);
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) { returntypeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey());
});
// Public interface
var createHref = createPath;
var push = function push(path, state) {
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.25Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.