mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-10 17:12:48 +00:00
8379 lines
244 KiB
JavaScript
8379 lines
244 KiB
JavaScript
webpackJsonp([1,2],[
|
|
/* 0 */,
|
|
/* 1 */,
|
|
/* 2 */,
|
|
/* 3 */,
|
|
/* 4 */,
|
|
/* 5 */,
|
|
/* 6 */,
|
|
/* 7 */,
|
|
/* 8 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {/**
|
|
* Copyright 2013-2015, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* Use 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 invariant(condition, format, a, b, c, d, e, f) {
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
if (format === undefined) {
|
|
throw new Error('invariant requires an error message argument');
|
|
}
|
|
}
|
|
|
|
if (!condition) {
|
|
var error;
|
|
if (format === undefined) {
|
|
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
} else {
|
|
var args = [a, b, c, d, e, f];
|
|
var argIndex = 0;
|
|
error = new Error(format.replace(/%s/g, function () {
|
|
return args[argIndex++];
|
|
}));
|
|
error.name = 'Invariant Violation';
|
|
}
|
|
|
|
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
module.exports = invariant;
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 9 */,
|
|
/* 10 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
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 bind = __webpack_require__(80);
|
|
|
|
/*global toString:true*/
|
|
|
|
// utils is a library of generic helper functions non-specific to axios
|
|
|
|
var toString = Object.prototype.toString;
|
|
|
|
/**
|
|
* Determine if a value is an Array
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
*/
|
|
function isArray(val) {
|
|
return toString.call(val) === '[object Array]';
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is an ArrayBuffer
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
*/
|
|
function isArrayBuffer(val) {
|
|
return toString.call(val) === '[object ArrayBuffer]';
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is a FormData
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
*/
|
|
function isFormData(val) {
|
|
return typeof FormData !== 'undefined' && val instanceof FormData;
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is a view on an ArrayBuffer
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
|
*/
|
|
function isArrayBufferView(val) {
|
|
var result;
|
|
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
result = ArrayBuffer.isView(val);
|
|
} else {
|
|
result = val && val.buffer && val.buffer instanceof ArrayBuffer;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is a String
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is a String, otherwise false
|
|
*/
|
|
function isString(val) {
|
|
return typeof val === 'string';
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is a Number
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
*/
|
|
function isNumber(val) {
|
|
return typeof val === 'number';
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is undefined
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
*/
|
|
function isUndefined(val) {
|
|
return typeof val === 'undefined';
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is an Object
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
*/
|
|
function isObject(val) {
|
|
return val !== null && (typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object';
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is a Date
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
*/
|
|
function isDate(val) {
|
|
return toString.call(val) === '[object Date]';
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is a File
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is a File, otherwise false
|
|
*/
|
|
function isFile(val) {
|
|
return toString.call(val) === '[object File]';
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is a Blob
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
*/
|
|
function isBlob(val) {
|
|
return toString.call(val) === '[object Blob]';
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is a Function
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
*/
|
|
function isFunction(val) {
|
|
return toString.call(val) === '[object Function]';
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is a Stream
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
*/
|
|
function isStream(val) {
|
|
return isObject(val) && isFunction(val.pipe);
|
|
}
|
|
|
|
/**
|
|
* Determine if a value is a URLSearchParams object
|
|
*
|
|
* @param {Object} val The value to test
|
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
*/
|
|
function isURLSearchParams(val) {
|
|
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
|
}
|
|
|
|
/**
|
|
* Trim excess whitespace off the beginning and end of a string
|
|
*
|
|
* @param {String} str The String to trim
|
|
* @returns {String} The String freed of excess whitespace
|
|
*/
|
|
function trim(str) {
|
|
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
|
}
|
|
|
|
/**
|
|
* Determine if we're running in a standard browser environment
|
|
*
|
|
* This allows axios to run in a web worker, and react-native.
|
|
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
*
|
|
* web workers:
|
|
* typeof window -> undefined
|
|
* typeof document -> undefined
|
|
*
|
|
* react-native:
|
|
* typeof document.createElement -> undefined
|
|
*/
|
|
function isStandardBrowserEnv() {
|
|
return typeof window !== 'undefined' && typeof document !== 'undefined' && typeof document.createElement === 'function';
|
|
}
|
|
|
|
/**
|
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
*
|
|
* If `obj` is an Array callback will be called passing
|
|
* the value, index, and complete array for each item.
|
|
*
|
|
* If 'obj' is an Object callback will be called passing
|
|
* the value, key, and complete object for each property.
|
|
*
|
|
* @param {Object|Array} obj The object to iterate
|
|
* @param {Function} fn The callback to invoke for each item
|
|
*/
|
|
function forEach(obj, fn) {
|
|
// Don't bother if no value provided
|
|
if (obj === null || typeof obj === 'undefined') {
|
|
return;
|
|
}
|
|
|
|
// Force an array if not already something iterable
|
|
if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' && !isArray(obj)) {
|
|
/*eslint no-param-reassign:0*/
|
|
obj = [obj];
|
|
}
|
|
|
|
if (isArray(obj)) {
|
|
// Iterate over array values
|
|
for (var i = 0, l = obj.length; i < l; i++) {
|
|
fn.call(null, obj[i], i, obj);
|
|
}
|
|
} else {
|
|
// Iterate over object keys
|
|
for (var key in obj) {
|
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
fn.call(null, obj[key], key, obj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Accepts varargs expecting each argument to be an object, then
|
|
* immutably merges the properties of each object and returns result.
|
|
*
|
|
* When multiple objects contain the same key the later object in
|
|
* the arguments list will take precedence.
|
|
*
|
|
* Example:
|
|
*
|
|
* ```js
|
|
* var result = merge({foo: 123}, {foo: 456});
|
|
* console.log(result.foo); // outputs 456
|
|
* ```
|
|
*
|
|
* @param {Object} obj1 Object to merge
|
|
* @returns {Object} Result of all merge properties
|
|
*/
|
|
function merge() /* obj1, obj2, obj3, ... */{
|
|
var result = {};
|
|
function assignValue(val, key) {
|
|
if (_typeof(result[key]) === 'object' && (typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object') {
|
|
result[key] = merge(result[key], val);
|
|
} else {
|
|
result[key] = val;
|
|
}
|
|
}
|
|
|
|
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
forEach(arguments[i], assignValue);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Extends object a by mutably adding to it the properties of object b.
|
|
*
|
|
* @param {Object} a The object to be extended
|
|
* @param {Object} b The object to copy properties from
|
|
* @param {Object} thisArg The object to bind function to
|
|
* @return {Object} The resulting value of object a
|
|
*/
|
|
function extend(a, b, thisArg) {
|
|
forEach(b, function assignValue(val, key) {
|
|
if (thisArg && typeof val === 'function') {
|
|
a[key] = bind(val, thisArg);
|
|
} else {
|
|
a[key] = val;
|
|
}
|
|
});
|
|
return a;
|
|
}
|
|
|
|
module.exports = {
|
|
isArray: isArray,
|
|
isArrayBuffer: isArrayBuffer,
|
|
isFormData: isFormData,
|
|
isArrayBufferView: isArrayBufferView,
|
|
isString: isString,
|
|
isNumber: isNumber,
|
|
isObject: isObject,
|
|
isUndefined: isUndefined,
|
|
isDate: isDate,
|
|
isFile: isFile,
|
|
isBlob: isBlob,
|
|
isFunction: isFunction,
|
|
isStream: isStream,
|
|
isURLSearchParams: isURLSearchParams,
|
|
isStandardBrowserEnv: isStandardBrowserEnv,
|
|
forEach: forEach,
|
|
merge: merge,
|
|
extend: extend,
|
|
trim: trim
|
|
};
|
|
|
|
/***/ }),
|
|
/* 11 */,
|
|
/* 12 */,
|
|
/* 13 */,
|
|
/* 14 */,
|
|
/* 15 */,
|
|
/* 16 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
exports.__esModule = true;
|
|
exports.createPath = exports.parsePath = exports.getQueryStringValueFromPath = exports.stripQueryStringValueFromPath = exports.addQueryStringValueToPath = undefined;
|
|
|
|
var _warning = __webpack_require__(19);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
var addQueryStringValueToPath = exports.addQueryStringValueToPath = function addQueryStringValueToPath(path, key, value) {
|
|
var _parsePath = parsePath(path);
|
|
|
|
var pathname = _parsePath.pathname;
|
|
var search = _parsePath.search;
|
|
var hash = _parsePath.hash;
|
|
|
|
return createPath({
|
|
pathname: pathname,
|
|
search: search + (search.indexOf('?') === -1 ? '?' : '&') + key + '=' + value,
|
|
hash: hash
|
|
});
|
|
};
|
|
|
|
var stripQueryStringValueFromPath = exports.stripQueryStringValueFromPath = function stripQueryStringValueFromPath(path, key) {
|
|
var _parsePath2 = parsePath(path);
|
|
|
|
var pathname = _parsePath2.pathname;
|
|
var search = _parsePath2.search;
|
|
var hash = _parsePath2.hash;
|
|
|
|
return createPath({
|
|
pathname: pathname,
|
|
search: search.replace(new RegExp('([?&])' + key + '=[a-zA-Z0-9]+(&?)'), function (match, prefix, suffix) {
|
|
return prefix === '?' ? prefix : suffix;
|
|
}),
|
|
hash: hash
|
|
});
|
|
};
|
|
|
|
var getQueryStringValueFromPath = exports.getQueryStringValueFromPath = function getQueryStringValueFromPath(path, key) {
|
|
var _parsePath3 = parsePath(path);
|
|
|
|
var search = _parsePath3.search;
|
|
|
|
var match = search.match(new RegExp('[?&]' + key + '=([a-zA-Z0-9]+)'));
|
|
return match && match[1];
|
|
};
|
|
|
|
var extractPath = function extractPath(string) {
|
|
var match = string.match(/^(https?:)?\/\/[^\/]*/);
|
|
return match == null ? string : string.substring(match[0].length);
|
|
};
|
|
|
|
var parsePath = exports.parsePath = function parsePath(path) {
|
|
var pathname = extractPath(path);
|
|
var search = '';
|
|
var hash = '';
|
|
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(path === pathname, 'A path must be pathname + search + hash only, not a full URL like "%s"', path) : void 0;
|
|
|
|
var hashIndex = pathname.indexOf('#');
|
|
if (hashIndex !== -1) {
|
|
hash = pathname.substring(hashIndex);
|
|
pathname = pathname.substring(0, hashIndex);
|
|
}
|
|
|
|
var searchIndex = pathname.indexOf('?');
|
|
if (searchIndex !== -1) {
|
|
search = pathname.substring(searchIndex);
|
|
pathname = pathname.substring(0, searchIndex);
|
|
}
|
|
|
|
if (pathname === '') pathname = '/';
|
|
|
|
return {
|
|
pathname: pathname,
|
|
search: search,
|
|
hash: hash
|
|
};
|
|
};
|
|
|
|
var createPath = exports.createPath = function createPath(location) {
|
|
if (location == null || typeof location === 'string') return location;
|
|
|
|
var basename = location.basename;
|
|
var pathname = location.pathname;
|
|
var search = location.search;
|
|
var hash = location.hash;
|
|
|
|
var path = (basename || '') + pathname;
|
|
|
|
if (search && search !== '?') path += search;
|
|
|
|
if (hash) path += hash;
|
|
|
|
return path;
|
|
};
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 17 */,
|
|
/* 18 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.isReactChildren = isReactChildren;
|
|
exports.createRouteFromReactElement = createRouteFromReactElement;
|
|
exports.createRoutesFromReactChildren = createRoutesFromReactChildren;
|
|
exports.createRoutes = createRoutes;
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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;
|
|
};
|
|
|
|
function isValidChild(object) {
|
|
return object == null || _react2.default.isValidElement(object);
|
|
}
|
|
|
|
function isReactChildren(object) {
|
|
return isValidChild(object) || Array.isArray(object) && object.every(isValidChild);
|
|
}
|
|
|
|
function createRoute(defaultProps, props) {
|
|
return _extends({}, defaultProps, props);
|
|
}
|
|
|
|
function createRouteFromReactElement(element) {
|
|
var type = element.type;
|
|
var route = createRoute(type.defaultProps, element.props);
|
|
|
|
if (route.children) {
|
|
var childRoutes = createRoutesFromReactChildren(route.children, route);
|
|
|
|
if (childRoutes.length) route.childRoutes = childRoutes;
|
|
|
|
delete route.children;
|
|
}
|
|
|
|
return route;
|
|
}
|
|
|
|
/**
|
|
* Creates and returns a routes object from the given ReactChildren. JSX
|
|
* provides a convenient way to visualize how routes in the hierarchy are
|
|
* nested.
|
|
*
|
|
* import { Route, createRoutesFromReactChildren } from 'react-router'
|
|
*
|
|
* const routes = createRoutesFromReactChildren(
|
|
* <Route component={App}>
|
|
* <Route path="home" component={Dashboard}/>
|
|
* <Route path="news" component={NewsFeed}/>
|
|
* </Route>
|
|
* )
|
|
*
|
|
* Note: This method is automatically used when you provide <Route> children
|
|
* to a <Router> component.
|
|
*/
|
|
function createRoutesFromReactChildren(children, parentRoute) {
|
|
var routes = [];
|
|
|
|
_react2.default.Children.forEach(children, function (element) {
|
|
if (_react2.default.isValidElement(element)) {
|
|
// Component classes may have a static create* method.
|
|
if (element.type.createRouteFromReactElement) {
|
|
var route = element.type.createRouteFromReactElement(element, parentRoute);
|
|
|
|
if (route) routes.push(route);
|
|
} else {
|
|
routes.push(createRouteFromReactElement(element));
|
|
}
|
|
}
|
|
});
|
|
|
|
return routes;
|
|
}
|
|
|
|
/**
|
|
* Creates and returns an array of routes from the given object which
|
|
* may be a JSX route, a plain object route, or an array of either.
|
|
*/
|
|
function createRoutes(routes) {
|
|
if (isReactChildren(routes)) {
|
|
routes = createRoutesFromReactChildren(routes);
|
|
} else if (routes && !Array.isArray(routes)) {
|
|
routes = [routes];
|
|
}
|
|
|
|
return routes;
|
|
}
|
|
|
|
/***/ }),
|
|
/* 19 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {/**
|
|
* 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 warning() {};
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
warning = function warning(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;
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 20 */,
|
|
/* 21 */,
|
|
/* 22 */,
|
|
/* 23 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
var _typeof2 = 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; };
|
|
|
|
exports.__esModule = true;
|
|
exports.locationsAreEqual = exports.statesAreEqual = exports.createLocation = exports.createQuery = undefined;
|
|
|
|
var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
|
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
|
|
} : function (obj) {
|
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(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 _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _warning = __webpack_require__(19);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
var _PathUtils = __webpack_require__(16);
|
|
|
|
var _Actions = __webpack_require__(35);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
var createQuery = exports.createQuery = function createQuery(props) {
|
|
return _extends(Object.create(null), props);
|
|
};
|
|
|
|
var createLocation = exports.createLocation = function createLocation() {
|
|
var input = arguments.length <= 0 || arguments[0] === undefined ? '/' : arguments[0];
|
|
var action = arguments.length <= 1 || arguments[1] === undefined ? _Actions.POP : arguments[1];
|
|
var key = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
|
|
|
|
var object = typeof input === 'string' ? (0, _PathUtils.parsePath)(input) : input;
|
|
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(!object.path, 'Location descriptor objects should have a `pathname`, not a `path`.') : void 0;
|
|
|
|
var pathname = object.pathname || '/';
|
|
var search = object.search || '';
|
|
var hash = object.hash || '';
|
|
var state = object.state;
|
|
|
|
return {
|
|
pathname: pathname,
|
|
search: search,
|
|
hash: hash,
|
|
state: state,
|
|
action: action,
|
|
key: key
|
|
};
|
|
};
|
|
|
|
var isDate = function isDate(object) {
|
|
return Object.prototype.toString.call(object) === '[object Date]';
|
|
};
|
|
|
|
var statesAreEqual = exports.statesAreEqual = function statesAreEqual(a, b) {
|
|
if (a === b) return true;
|
|
|
|
var typeofA = typeof a === 'undefined' ? 'undefined' : _typeof(a);
|
|
var typeofB = typeof b === 'undefined' ? 'undefined' : _typeof(b);
|
|
|
|
if (typeofA !== typeofB) return false;
|
|
|
|
!(typeofA !== 'function') ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'You must not store functions in location state') : (0, _invariant2.default)(false) : void 0;
|
|
|
|
// Not the same object, but same type.
|
|
if (typeofA === 'object') {
|
|
!!(isDate(a) && isDate(b)) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'You must not store Date objects in location state') : (0, _invariant2.default)(false) : void 0;
|
|
|
|
if (!Array.isArray(a)) {
|
|
var keysofA = Object.keys(a);
|
|
var keysofB = Object.keys(b);
|
|
return keysofA.length === keysofB.length && keysofA.every(function (key) {
|
|
return statesAreEqual(a[key], b[key]);
|
|
});
|
|
}
|
|
|
|
return Array.isArray(b) && a.length === b.length && a.every(function (item, index) {
|
|
return statesAreEqual(item, b[index]);
|
|
});
|
|
}
|
|
|
|
// All other serializable types (string, number, boolean)
|
|
// should be strict equal.
|
|
return false;
|
|
};
|
|
|
|
var locationsAreEqual = exports.locationsAreEqual = function locationsAreEqual(a, b) {
|
|
return a.key === b.key &&
|
|
// a.action === b.action && // Different action !== location change.
|
|
a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && statesAreEqual(a.state, b.state);
|
|
};
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 24 */,
|
|
/* 25 */,
|
|
/* 26 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.compilePattern = compilePattern;
|
|
exports.matchPattern = matchPattern;
|
|
exports.getParamNames = getParamNames;
|
|
exports.getParams = getParams;
|
|
exports.formatPattern = formatPattern;
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function escapeRegExp(string) {
|
|
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
}
|
|
|
|
function _compilePattern(pattern) {
|
|
var regexpSource = '';
|
|
var paramNames = [];
|
|
var tokens = [];
|
|
|
|
var match = void 0,
|
|
lastIndex = 0,
|
|
matcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|\*\*|\*|\(|\)|\\\(|\\\)/g;
|
|
while (match = matcher.exec(pattern)) {
|
|
if (match.index !== lastIndex) {
|
|
tokens.push(pattern.slice(lastIndex, match.index));
|
|
regexpSource += escapeRegExp(pattern.slice(lastIndex, match.index));
|
|
}
|
|
|
|
if (match[1]) {
|
|
regexpSource += '([^/]+)';
|
|
paramNames.push(match[1]);
|
|
} else if (match[0] === '**') {
|
|
regexpSource += '(.*)';
|
|
paramNames.push('splat');
|
|
} else if (match[0] === '*') {
|
|
regexpSource += '(.*?)';
|
|
paramNames.push('splat');
|
|
} else if (match[0] === '(') {
|
|
regexpSource += '(?:';
|
|
} else if (match[0] === ')') {
|
|
regexpSource += ')?';
|
|
} else if (match[0] === '\\(') {
|
|
regexpSource += '\\(';
|
|
} else if (match[0] === '\\)') {
|
|
regexpSource += '\\)';
|
|
}
|
|
|
|
tokens.push(match[0]);
|
|
|
|
lastIndex = matcher.lastIndex;
|
|
}
|
|
|
|
if (lastIndex !== pattern.length) {
|
|
tokens.push(pattern.slice(lastIndex, pattern.length));
|
|
regexpSource += escapeRegExp(pattern.slice(lastIndex, pattern.length));
|
|
}
|
|
|
|
return {
|
|
pattern: pattern,
|
|
regexpSource: regexpSource,
|
|
paramNames: paramNames,
|
|
tokens: tokens
|
|
};
|
|
}
|
|
|
|
var CompiledPatternsCache = Object.create(null);
|
|
|
|
function compilePattern(pattern) {
|
|
if (!CompiledPatternsCache[pattern]) CompiledPatternsCache[pattern] = _compilePattern(pattern);
|
|
|
|
return CompiledPatternsCache[pattern];
|
|
}
|
|
|
|
/**
|
|
* Attempts to match a pattern on the given pathname. Patterns may use
|
|
* the following special characters:
|
|
*
|
|
* - :paramName Matches a URL segment up to the next /, ?, or #. The
|
|
* captured string is considered a "param"
|
|
* - () Wraps a segment of the URL that is optional
|
|
* - * Consumes (non-greedy) all characters up to the next
|
|
* character in the pattern, or to the end of the URL if
|
|
* there is none
|
|
* - ** Consumes (greedy) all characters up to the next character
|
|
* in the pattern, or to the end of the URL if there is none
|
|
*
|
|
* The function calls callback(error, matched) when finished.
|
|
* The return value is an object with the following properties:
|
|
*
|
|
* - remainingPathname
|
|
* - paramNames
|
|
* - paramValues
|
|
*/
|
|
function matchPattern(pattern, pathname) {
|
|
// Ensure pattern starts with leading slash for consistency with pathname.
|
|
if (pattern.charAt(0) !== '/') {
|
|
pattern = '/' + pattern;
|
|
}
|
|
|
|
var _compilePattern2 = compilePattern(pattern),
|
|
regexpSource = _compilePattern2.regexpSource,
|
|
paramNames = _compilePattern2.paramNames,
|
|
tokens = _compilePattern2.tokens;
|
|
|
|
if (pattern.charAt(pattern.length - 1) !== '/') {
|
|
regexpSource += '/?'; // Allow optional path separator at end.
|
|
}
|
|
|
|
// Special-case patterns like '*' for catch-all routes.
|
|
if (tokens[tokens.length - 1] === '*') {
|
|
regexpSource += '$';
|
|
}
|
|
|
|
var match = pathname.match(new RegExp('^' + regexpSource, 'i'));
|
|
if (match == null) {
|
|
return null;
|
|
}
|
|
|
|
var matchedPath = match[0];
|
|
var remainingPathname = pathname.substr(matchedPath.length);
|
|
|
|
if (remainingPathname) {
|
|
// Require that the match ends at a path separator, if we didn't match
|
|
// the full path, so any remaining pathname is a new path segment.
|
|
if (matchedPath.charAt(matchedPath.length - 1) !== '/') {
|
|
return null;
|
|
}
|
|
|
|
// If there is a remaining pathname, treat the path separator as part of
|
|
// the remaining pathname for properly continuing the match.
|
|
remainingPathname = '/' + remainingPathname;
|
|
}
|
|
|
|
return {
|
|
remainingPathname: remainingPathname,
|
|
paramNames: paramNames,
|
|
paramValues: match.slice(1).map(function (v) {
|
|
return v && decodeURIComponent(v);
|
|
})
|
|
};
|
|
}
|
|
|
|
function getParamNames(pattern) {
|
|
return compilePattern(pattern).paramNames;
|
|
}
|
|
|
|
function getParams(pattern, pathname) {
|
|
var match = matchPattern(pattern, pathname);
|
|
if (!match) {
|
|
return null;
|
|
}
|
|
|
|
var paramNames = match.paramNames,
|
|
paramValues = match.paramValues;
|
|
|
|
var params = {};
|
|
|
|
paramNames.forEach(function (paramName, index) {
|
|
params[paramName] = paramValues[index];
|
|
});
|
|
|
|
return params;
|
|
}
|
|
|
|
/**
|
|
* Returns a version of the given pattern with params interpolated. Throws
|
|
* if there is a dynamic segment of the pattern for which there is no param.
|
|
*/
|
|
function formatPattern(pattern, params) {
|
|
params = params || {};
|
|
|
|
var _compilePattern3 = compilePattern(pattern),
|
|
tokens = _compilePattern3.tokens;
|
|
|
|
var parenCount = 0,
|
|
pathname = '',
|
|
splatIndex = 0,
|
|
parenHistory = [];
|
|
|
|
var token = void 0,
|
|
paramName = void 0,
|
|
paramValue = void 0;
|
|
for (var i = 0, len = tokens.length; i < len; ++i) {
|
|
token = tokens[i];
|
|
|
|
if (token === '*' || token === '**') {
|
|
paramValue = Array.isArray(params.splat) ? params.splat[splatIndex++] : params.splat;
|
|
|
|
!(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Missing splat #%s for path "%s"', splatIndex, pattern) : (0, _invariant2.default)(false) : void 0;
|
|
|
|
if (paramValue != null) pathname += encodeURI(paramValue);
|
|
} else if (token === '(') {
|
|
parenHistory[parenCount] = '';
|
|
parenCount += 1;
|
|
} else if (token === ')') {
|
|
var parenText = parenHistory.pop();
|
|
parenCount -= 1;
|
|
|
|
if (parenCount) parenHistory[parenCount - 1] += parenText;else pathname += parenText;
|
|
} else if (token === '\\(') {
|
|
pathname += '(';
|
|
} else if (token === '\\)') {
|
|
pathname += ')';
|
|
} else if (token.charAt(0) === ':') {
|
|
paramName = token.substring(1);
|
|
paramValue = params[paramName];
|
|
|
|
!(paramValue != null || parenCount > 0) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Missing "%s" parameter for path "%s"', paramName, pattern) : (0, _invariant2.default)(false) : void 0;
|
|
|
|
if (paramValue == null) {
|
|
if (parenCount) {
|
|
parenHistory[parenCount - 1] = '';
|
|
|
|
var curTokenIdx = tokens.indexOf(token);
|
|
var tokensSubset = tokens.slice(curTokenIdx, tokens.length);
|
|
var nextParenIdx = -1;
|
|
|
|
for (var _i = 0; _i < tokensSubset.length; _i++) {
|
|
if (tokensSubset[_i] == ')') {
|
|
nextParenIdx = _i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
!(nextParenIdx > 0) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Path "%s" is missing end paren at segment "%s"', pattern, tokensSubset.join('')) : (0, _invariant2.default)(false) : void 0;
|
|
|
|
// jump to ending paren
|
|
i = curTokenIdx + nextParenIdx - 1;
|
|
}
|
|
} else if (parenCount) parenHistory[parenCount - 1] += encodeURIComponent(paramValue);else pathname += encodeURIComponent(paramValue);
|
|
} else {
|
|
if (parenCount) parenHistory[parenCount - 1] += token;else pathname += token;
|
|
}
|
|
}
|
|
|
|
!(parenCount <= 0) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Path "%s" is missing end paren', pattern) : (0, _invariant2.default)(false) : void 0;
|
|
|
|
return pathname.replace(/\/+/g, '/');
|
|
}
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 27 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = routerWarning;
|
|
exports._resetWarned = _resetWarned;
|
|
|
|
var _warning = __webpack_require__(19);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var warned = {};
|
|
|
|
function routerWarning(falseToWarn, message) {
|
|
// Only issue deprecation warnings once.
|
|
if (message.indexOf('deprecated') !== -1) {
|
|
if (warned[message]) {
|
|
return;
|
|
}
|
|
|
|
warned[message] = true;
|
|
}
|
|
|
|
message = '[react-router] ' + message;
|
|
|
|
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
args[_key - 2] = arguments[_key];
|
|
}
|
|
|
|
_warning2.default.apply(undefined, [falseToWarn, message].concat(args));
|
|
}
|
|
|
|
function _resetWarned() {
|
|
warned = {};
|
|
}
|
|
|
|
/***/ }),
|
|
/* 28 */,
|
|
/* 29 */,
|
|
/* 30 */,
|
|
/* 31 */,
|
|
/* 32 */,
|
|
/* 33 */,
|
|
/* 34 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.routes = exports.route = exports.components = exports.component = exports.history = undefined;
|
|
exports.falsy = falsy;
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var func = _react.PropTypes.func,
|
|
object = _react.PropTypes.object,
|
|
arrayOf = _react.PropTypes.arrayOf,
|
|
oneOfType = _react.PropTypes.oneOfType,
|
|
element = _react.PropTypes.element,
|
|
shape = _react.PropTypes.shape,
|
|
string = _react.PropTypes.string;
|
|
|
|
function falsy(props, propName, componentName) {
|
|
if (props[propName]) return new Error('<' + componentName + '> should not have a "' + propName + '" prop');
|
|
}
|
|
|
|
var history = exports.history = shape({
|
|
listen: func.isRequired,
|
|
push: func.isRequired,
|
|
replace: func.isRequired,
|
|
go: func.isRequired,
|
|
goBack: func.isRequired,
|
|
goForward: func.isRequired
|
|
});
|
|
|
|
var component = exports.component = oneOfType([func, string]);
|
|
var components = exports.components = oneOfType([component, object]);
|
|
var route = exports.route = oneOfType([object, element]);
|
|
var routes = exports.routes = oneOfType([route, arrayOf(route)]);
|
|
|
|
/***/ }),
|
|
/* 35 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.__esModule = true;
|
|
/**
|
|
* Indicates that navigation was caused by a call to history.push.
|
|
*/
|
|
var PUSH = exports.PUSH = 'PUSH';
|
|
|
|
/**
|
|
* Indicates that navigation was caused by a call to history.replace.
|
|
*/
|
|
var REPLACE = exports.REPLACE = 'REPLACE';
|
|
|
|
/**
|
|
* Indicates that navigation was caused by some other action such
|
|
* as using a browser's back/forward buttons and/or manually manipulating
|
|
* the URL in a browser's location bar. This is the default.
|
|
*
|
|
* See https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate
|
|
* for more information.
|
|
*/
|
|
var POP = exports.POP = 'POP';
|
|
|
|
/***/ }),
|
|
/* 36 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.__esModule = true;
|
|
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);
|
|
};
|
|
|
|
/**
|
|
* 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 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 browser fires popstate on hash change.
|
|
* IE10 and IE11 do not.
|
|
*/
|
|
var supportsPopstateOnHashchange = exports.supportsPopstateOnHashchange = function supportsPopstateOnHashchange() {
|
|
return window.navigator.userAgent.indexOf('Trident') === -1;
|
|
};
|
|
|
|
/***/ }),
|
|
/* 37 */,
|
|
/* 38 */,
|
|
/* 39 */,
|
|
/* 40 */,
|
|
/* 41 */,
|
|
/* 42 */,
|
|
/* 43 */,
|
|
/* 44 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
var utils = __webpack_require__(10);
|
|
var normalizeHeaderName = __webpack_require__(139);
|
|
|
|
var PROTECTION_PREFIX = /^\)\]\}',?\n/;
|
|
var DEFAULT_CONTENT_TYPE = {
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
};
|
|
|
|
function setContentTypeIfUnset(headers, value) {
|
|
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
|
headers['Content-Type'] = value;
|
|
}
|
|
}
|
|
|
|
function getDefaultAdapter() {
|
|
var adapter;
|
|
if (typeof XMLHttpRequest !== 'undefined') {
|
|
// For browsers use XHR adapter
|
|
adapter = __webpack_require__(76);
|
|
} else if (typeof process !== 'undefined') {
|
|
// For node use HTTP adapter
|
|
adapter = __webpack_require__(76);
|
|
}
|
|
return adapter;
|
|
}
|
|
|
|
var defaults = {
|
|
adapter: getDefaultAdapter(),
|
|
|
|
transformRequest: [function transformRequest(data, headers) {
|
|
normalizeHeaderName(headers, 'Content-Type');
|
|
if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
|
|
return data;
|
|
}
|
|
if (utils.isArrayBufferView(data)) {
|
|
return data.buffer;
|
|
}
|
|
if (utils.isURLSearchParams(data)) {
|
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
return data.toString();
|
|
}
|
|
if (utils.isObject(data)) {
|
|
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
|
|
return JSON.stringify(data);
|
|
}
|
|
return data;
|
|
}],
|
|
|
|
transformResponse: [function transformResponse(data) {
|
|
/*eslint no-param-reassign:0*/
|
|
if (typeof data === 'string') {
|
|
data = data.replace(PROTECTION_PREFIX, '');
|
|
try {
|
|
data = JSON.parse(data);
|
|
} catch (e) {/* Ignore */}
|
|
}
|
|
return data;
|
|
}],
|
|
|
|
timeout: 0,
|
|
|
|
xsrfCookieName: 'XSRF-TOKEN',
|
|
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
|
|
maxContentLength: -1,
|
|
|
|
validateStatus: function validateStatus(status) {
|
|
return status >= 200 && status < 300;
|
|
}
|
|
};
|
|
|
|
defaults.headers = {
|
|
common: {
|
|
'Accept': 'application/json, text/plain, */*'
|
|
}
|
|
};
|
|
|
|
utils.forEach(['delete', 'get', 'head'], function forEachMehtodNoData(method) {
|
|
defaults.headers[method] = {};
|
|
});
|
|
|
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
});
|
|
|
|
module.exports = defaults;
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 45 */,
|
|
/* 46 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.__esModule = true;
|
|
exports.go = exports.replaceLocation = exports.pushLocation = exports.startListener = exports.getUserConfirmation = exports.getCurrentLocation = undefined;
|
|
|
|
var _LocationUtils = __webpack_require__(23);
|
|
|
|
var _DOMUtils = __webpack_require__(36);
|
|
|
|
var _DOMStateStorage = __webpack_require__(84);
|
|
|
|
var _PathUtils = __webpack_require__(16);
|
|
|
|
var _ExecutionEnvironment = __webpack_require__(47);
|
|
|
|
var PopStateEvent = 'popstate';
|
|
var HashChangeEvent = 'hashchange';
|
|
|
|
var needsHashchangeListener = _ExecutionEnvironment.canUseDOM && !(0, _DOMUtils.supportsPopstateOnHashchange)();
|
|
|
|
var _createLocation = function _createLocation(historyState) {
|
|
var key = historyState && historyState.key;
|
|
|
|
return (0, _LocationUtils.createLocation)({
|
|
pathname: window.location.pathname,
|
|
search: window.location.search,
|
|
hash: window.location.hash,
|
|
state: key ? (0, _DOMStateStorage.readState)(key) : undefined
|
|
}, undefined, key);
|
|
};
|
|
|
|
var getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation() {
|
|
var historyState = void 0;
|
|
try {
|
|
historyState = window.history.state || {};
|
|
} catch (error) {
|
|
// IE 11 sometimes throws when accessing window.history.state
|
|
// See https://github.com/ReactTraining/history/pull/289
|
|
historyState = {};
|
|
}
|
|
|
|
return _createLocation(historyState);
|
|
};
|
|
|
|
var getUserConfirmation = exports.getUserConfirmation = function getUserConfirmation(message, callback) {
|
|
return callback(window.confirm(message));
|
|
}; // eslint-disable-line no-alert
|
|
|
|
var startListener = exports.startListener = function startListener(listener) {
|
|
var handlePopState = function handlePopState(event) {
|
|
if (event.state !== undefined) // Ignore extraneous popstate events in WebKit
|
|
listener(_createLocation(event.state));
|
|
};
|
|
|
|
(0, _DOMUtils.addEventListener)(window, PopStateEvent, handlePopState);
|
|
|
|
var handleUnpoppedHashChange = function handleUnpoppedHashChange() {
|
|
return listener(getCurrentLocation());
|
|
};
|
|
|
|
if (needsHashchangeListener) {
|
|
(0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleUnpoppedHashChange);
|
|
}
|
|
|
|
return function () {
|
|
(0, _DOMUtils.removeEventListener)(window, PopStateEvent, handlePopState);
|
|
|
|
if (needsHashchangeListener) {
|
|
(0, _DOMUtils.removeEventListener)(window, HashChangeEvent, handleUnpoppedHashChange);
|
|
}
|
|
};
|
|
};
|
|
|
|
var updateLocation = function updateLocation(location, updateState) {
|
|
var state = location.state;
|
|
var key = location.key;
|
|
|
|
if (state !== undefined) (0, _DOMStateStorage.saveState)(key, state);
|
|
|
|
updateState({ key: key }, (0, _PathUtils.createPath)(location));
|
|
};
|
|
|
|
var pushLocation = exports.pushLocation = function pushLocation(location) {
|
|
return updateLocation(location, function (state, path) {
|
|
return window.history.pushState(state, null, path);
|
|
});
|
|
};
|
|
|
|
var replaceLocation = exports.replaceLocation = function replaceLocation(location) {
|
|
return updateLocation(location, function (state, path) {
|
|
return window.history.replaceState(state, null, path);
|
|
});
|
|
};
|
|
|
|
var go = exports.go = function go(n) {
|
|
if (n) window.history.go(n);
|
|
};
|
|
|
|
/***/ }),
|
|
/* 47 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.__esModule = true;
|
|
var canUseDOM = exports.canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
|
|
/***/ }),
|
|
/* 48 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _AsyncUtils = __webpack_require__(156);
|
|
|
|
var _PathUtils = __webpack_require__(16);
|
|
|
|
var _runTransitionHook = __webpack_require__(49);
|
|
|
|
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
|
|
|
|
var _Actions = __webpack_require__(35);
|
|
|
|
var _LocationUtils = __webpack_require__(23);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
var createHistory = function createHistory() {
|
|
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
|
var getCurrentLocation = options.getCurrentLocation;
|
|
var getUserConfirmation = options.getUserConfirmation;
|
|
var pushLocation = options.pushLocation;
|
|
var replaceLocation = options.replaceLocation;
|
|
var go = options.go;
|
|
var keyLength = options.keyLength;
|
|
|
|
var currentLocation = void 0;
|
|
var pendingLocation = void 0;
|
|
var beforeListeners = [];
|
|
var listeners = [];
|
|
var allKeys = [];
|
|
|
|
var getCurrentIndex = function getCurrentIndex() {
|
|
if (pendingLocation && pendingLocation.action === _Actions.POP) return allKeys.indexOf(pendingLocation.key);
|
|
|
|
if (currentLocation) return allKeys.indexOf(currentLocation.key);
|
|
|
|
return -1;
|
|
};
|
|
|
|
var updateLocation = function updateLocation(nextLocation) {
|
|
var currentIndex = getCurrentIndex();
|
|
|
|
currentLocation = nextLocation;
|
|
|
|
if (currentLocation.action === _Actions.PUSH) {
|
|
allKeys = [].concat(allKeys.slice(0, currentIndex + 1), [currentLocation.key]);
|
|
} else if (currentLocation.action === _Actions.REPLACE) {
|
|
allKeys[currentIndex] = currentLocation.key;
|
|
}
|
|
|
|
listeners.forEach(function (listener) {
|
|
return listener(currentLocation);
|
|
});
|
|
};
|
|
|
|
var listenBefore = function listenBefore(listener) {
|
|
beforeListeners.push(listener);
|
|
|
|
return function () {
|
|
return beforeListeners = beforeListeners.filter(function (item) {
|
|
return item !== listener;
|
|
});
|
|
};
|
|
};
|
|
|
|
var listen = function listen(listener) {
|
|
listeners.push(listener);
|
|
|
|
return function () {
|
|
return listeners = listeners.filter(function (item) {
|
|
return item !== listener;
|
|
});
|
|
};
|
|
};
|
|
|
|
var confirmTransitionTo = function confirmTransitionTo(location, callback) {
|
|
(0, _AsyncUtils.loopAsync)(beforeListeners.length, function (index, next, done) {
|
|
(0, _runTransitionHook2.default)(beforeListeners[index], location, function (result) {
|
|
return result != null ? done(result) : next();
|
|
});
|
|
}, function (message) {
|
|
if (getUserConfirmation && typeof message === 'string') {
|
|
getUserConfirmation(message, function (ok) {
|
|
return callback(ok !== false);
|
|
});
|
|
} else {
|
|
callback(message !== false);
|
|
}
|
|
});
|
|
};
|
|
|
|
var transitionTo = function transitionTo(nextLocation) {
|
|
if (currentLocation && (0, _LocationUtils.locationsAreEqual)(currentLocation, nextLocation) || pendingLocation && (0, _LocationUtils.locationsAreEqual)(pendingLocation, nextLocation)) return; // Nothing to do
|
|
|
|
pendingLocation = nextLocation;
|
|
|
|
confirmTransitionTo(nextLocation, function (ok) {
|
|
if (pendingLocation !== nextLocation) return; // Transition was interrupted during confirmation
|
|
|
|
pendingLocation = null;
|
|
|
|
if (ok) {
|
|
// Treat PUSH to same path like REPLACE to be consistent with browsers
|
|
if (nextLocation.action === _Actions.PUSH) {
|
|
var prevPath = (0, _PathUtils.createPath)(currentLocation);
|
|
var nextPath = (0, _PathUtils.createPath)(nextLocation);
|
|
|
|
if (nextPath === prevPath && (0, _LocationUtils.statesAreEqual)(currentLocation.state, nextLocation.state)) nextLocation.action = _Actions.REPLACE;
|
|
}
|
|
|
|
if (nextLocation.action === _Actions.POP) {
|
|
updateLocation(nextLocation);
|
|
} else if (nextLocation.action === _Actions.PUSH) {
|
|
if (pushLocation(nextLocation) !== false) updateLocation(nextLocation);
|
|
} else if (nextLocation.action === _Actions.REPLACE) {
|
|
if (replaceLocation(nextLocation) !== false) updateLocation(nextLocation);
|
|
}
|
|
} else if (currentLocation && nextLocation.action === _Actions.POP) {
|
|
var prevIndex = allKeys.indexOf(currentLocation.key);
|
|
var nextIndex = allKeys.indexOf(nextLocation.key);
|
|
|
|
if (prevIndex !== -1 && nextIndex !== -1) go(prevIndex - nextIndex); // Restore the URL
|
|
}
|
|
});
|
|
};
|
|
|
|
var push = function push(input) {
|
|
return transitionTo(createLocation(input, _Actions.PUSH));
|
|
};
|
|
|
|
var replace = function replace(input) {
|
|
return transitionTo(createLocation(input, _Actions.REPLACE));
|
|
};
|
|
|
|
var goBack = function goBack() {
|
|
return go(-1);
|
|
};
|
|
|
|
var goForward = function goForward() {
|
|
return go(1);
|
|
};
|
|
|
|
var createKey = function createKey() {
|
|
return Math.random().toString(36).substr(2, keyLength || 6);
|
|
};
|
|
|
|
var createHref = function createHref(location) {
|
|
return (0, _PathUtils.createPath)(location);
|
|
};
|
|
|
|
var createLocation = function createLocation(location, action) {
|
|
var key = arguments.length <= 2 || arguments[2] === undefined ? createKey() : arguments[2];
|
|
return (0, _LocationUtils.createLocation)(location, action, key);
|
|
};
|
|
|
|
return {
|
|
getCurrentLocation: getCurrentLocation,
|
|
listenBefore: listenBefore,
|
|
listen: listen,
|
|
transitionTo: transitionTo,
|
|
push: push,
|
|
replace: replace,
|
|
go: go,
|
|
goBack: goBack,
|
|
goForward: goForward,
|
|
createKey: createKey,
|
|
createPath: _PathUtils.createPath,
|
|
createHref: createHref,
|
|
createLocation: createLocation
|
|
};
|
|
};
|
|
|
|
exports.default = createHistory;
|
|
|
|
/***/ }),
|
|
/* 49 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _warning = __webpack_require__(19);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
var runTransitionHook = function runTransitionHook(hook, location, callback) {
|
|
var result = hook(location, callback);
|
|
|
|
if (hook.length < 2) {
|
|
// Assume the hook runs synchronously and automatically
|
|
// call the callback with the return value.
|
|
callback(result);
|
|
} else {
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(result === undefined, 'You should not "return" in a transition hook with a callback argument; ' + 'call the callback instead') : void 0;
|
|
}
|
|
};
|
|
|
|
exports.default = runTransitionHook;
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 50 */,
|
|
/* 51 */,
|
|
/* 52 */,
|
|
/* 53 */,
|
|
/* 54 */,
|
|
/* 55 */,
|
|
/* 56 */,
|
|
/* 57 */,
|
|
/* 58 */,
|
|
/* 59 */,
|
|
/* 60 */,
|
|
/* 61 */,
|
|
/* 62 */,
|
|
/* 63 */,
|
|
/* 64 */,
|
|
/* 65 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.loopAsync = loopAsync;
|
|
exports.mapAsync = mapAsync;
|
|
function loopAsync(turns, work, callback) {
|
|
var currentTurn = 0,
|
|
isDone = false;
|
|
var sync = false,
|
|
hasNext = false,
|
|
doneArgs = void 0;
|
|
|
|
function done() {
|
|
isDone = true;
|
|
if (sync) {
|
|
// Iterate instead of recursing if possible.
|
|
doneArgs = [].concat(Array.prototype.slice.call(arguments));
|
|
return;
|
|
}
|
|
|
|
callback.apply(this, arguments);
|
|
}
|
|
|
|
function next() {
|
|
if (isDone) {
|
|
return;
|
|
}
|
|
|
|
hasNext = true;
|
|
if (sync) {
|
|
// Iterate instead of recursing if possible.
|
|
return;
|
|
}
|
|
|
|
sync = true;
|
|
|
|
while (!isDone && currentTurn < turns && hasNext) {
|
|
hasNext = false;
|
|
work.call(this, currentTurn++, next, done);
|
|
}
|
|
|
|
sync = false;
|
|
|
|
if (isDone) {
|
|
// This means the loop finished synchronously.
|
|
callback.apply(this, doneArgs);
|
|
return;
|
|
}
|
|
|
|
if (currentTurn >= turns && hasNext) {
|
|
isDone = true;
|
|
callback();
|
|
}
|
|
}
|
|
|
|
next();
|
|
}
|
|
|
|
function mapAsync(array, work, callback) {
|
|
var length = array.length;
|
|
var values = [];
|
|
|
|
if (length === 0) return callback(null, values);
|
|
|
|
var isDone = false,
|
|
doneCount = 0;
|
|
|
|
function done(index, error, value) {
|
|
if (isDone) return;
|
|
|
|
if (error) {
|
|
isDone = true;
|
|
callback(error);
|
|
} else {
|
|
values[index] = value;
|
|
|
|
isDone = ++doneCount === length;
|
|
|
|
if (isDone) callback(null, values);
|
|
}
|
|
}
|
|
|
|
array.forEach(function (item, index) {
|
|
work(item, index, function (error, value) {
|
|
done(index, error, value);
|
|
});
|
|
});
|
|
}
|
|
|
|
/***/ }),
|
|
/* 66 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.ContextProvider = ContextProvider;
|
|
exports.ContextSubscriber = ContextSubscriber;
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
// Works around issues with context updates failing to propagate.
|
|
// Caveat: the context value is expected to never change its identity.
|
|
// https://github.com/facebook/react/issues/2517
|
|
// https://github.com/reactjs/react-router/issues/470
|
|
|
|
var contextProviderShape = _react.PropTypes.shape({
|
|
subscribe: _react.PropTypes.func.isRequired,
|
|
eventIndex: _react.PropTypes.number.isRequired
|
|
});
|
|
|
|
function makeContextName(name) {
|
|
return '@@contextSubscriber/' + name;
|
|
}
|
|
|
|
function ContextProvider(name) {
|
|
var _childContextTypes, _ref2;
|
|
|
|
var contextName = makeContextName(name);
|
|
var listenersKey = contextName + '/listeners';
|
|
var eventIndexKey = contextName + '/eventIndex';
|
|
var subscribeKey = contextName + '/subscribe';
|
|
|
|
return _ref2 = {
|
|
childContextTypes: (_childContextTypes = {}, _childContextTypes[contextName] = contextProviderShape.isRequired, _childContextTypes),
|
|
|
|
getChildContext: function getChildContext() {
|
|
var _ref;
|
|
|
|
return _ref = {}, _ref[contextName] = {
|
|
eventIndex: this[eventIndexKey],
|
|
subscribe: this[subscribeKey]
|
|
}, _ref;
|
|
},
|
|
componentWillMount: function componentWillMount() {
|
|
this[listenersKey] = [];
|
|
this[eventIndexKey] = 0;
|
|
},
|
|
componentWillReceiveProps: function componentWillReceiveProps() {
|
|
this[eventIndexKey]++;
|
|
},
|
|
componentDidUpdate: function componentDidUpdate() {
|
|
var _this = this;
|
|
|
|
this[listenersKey].forEach(function (listener) {
|
|
return listener(_this[eventIndexKey]);
|
|
});
|
|
}
|
|
}, _ref2[subscribeKey] = function (listener) {
|
|
var _this2 = this;
|
|
|
|
// No need to immediately call listener here.
|
|
this[listenersKey].push(listener);
|
|
|
|
return function () {
|
|
_this2[listenersKey] = _this2[listenersKey].filter(function (item) {
|
|
return item !== listener;
|
|
});
|
|
};
|
|
}, _ref2;
|
|
}
|
|
|
|
function ContextSubscriber(name) {
|
|
var _contextTypes, _ref4;
|
|
|
|
var contextName = makeContextName(name);
|
|
var lastRenderedEventIndexKey = contextName + '/lastRenderedEventIndex';
|
|
var handleContextUpdateKey = contextName + '/handleContextUpdate';
|
|
var unsubscribeKey = contextName + '/unsubscribe';
|
|
|
|
return _ref4 = {
|
|
contextTypes: (_contextTypes = {}, _contextTypes[contextName] = contextProviderShape, _contextTypes),
|
|
|
|
getInitialState: function getInitialState() {
|
|
var _ref3;
|
|
|
|
if (!this.context[contextName]) {
|
|
return {};
|
|
}
|
|
|
|
return _ref3 = {}, _ref3[lastRenderedEventIndexKey] = this.context[contextName].eventIndex, _ref3;
|
|
},
|
|
componentDidMount: function componentDidMount() {
|
|
if (!this.context[contextName]) {
|
|
return;
|
|
}
|
|
|
|
this[unsubscribeKey] = this.context[contextName].subscribe(this[handleContextUpdateKey]);
|
|
},
|
|
componentWillReceiveProps: function componentWillReceiveProps() {
|
|
var _setState;
|
|
|
|
if (!this.context[contextName]) {
|
|
return;
|
|
}
|
|
|
|
this.setState((_setState = {}, _setState[lastRenderedEventIndexKey] = this.context[contextName].eventIndex, _setState));
|
|
},
|
|
componentWillUnmount: function componentWillUnmount() {
|
|
if (!this[unsubscribeKey]) {
|
|
return;
|
|
}
|
|
|
|
this[unsubscribeKey]();
|
|
this[unsubscribeKey] = null;
|
|
}
|
|
}, _ref4[handleContextUpdateKey] = function (eventIndex) {
|
|
if (eventIndex !== this.state[lastRenderedEventIndexKey]) {
|
|
var _setState2;
|
|
|
|
this.setState((_setState2 = {}, _setState2[lastRenderedEventIndexKey] = eventIndex, _setState2));
|
|
}
|
|
}, _ref4;
|
|
}
|
|
|
|
/***/ }),
|
|
/* 67 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.locationShape = exports.routerShape = undefined;
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var func = _react.PropTypes.func,
|
|
object = _react.PropTypes.object,
|
|
shape = _react.PropTypes.shape,
|
|
string = _react.PropTypes.string;
|
|
|
|
var routerShape = exports.routerShape = shape({
|
|
push: func.isRequired,
|
|
replace: func.isRequired,
|
|
go: func.isRequired,
|
|
goBack: func.isRequired,
|
|
goForward: func.isRequired,
|
|
setRouteLeaveHook: func.isRequired,
|
|
isActive: func.isRequired
|
|
});
|
|
|
|
var locationShape = exports.locationShape = shape({
|
|
pathname: string.isRequired,
|
|
search: string.isRequired,
|
|
state: object,
|
|
action: string.isRequired,
|
|
key: string
|
|
});
|
|
|
|
/***/ }),
|
|
/* 68 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _typeof2 = 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 _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _getRouteParams = __webpack_require__(246);
|
|
|
|
var _getRouteParams2 = _interopRequireDefault(_getRouteParams);
|
|
|
|
var _ContextUtils = __webpack_require__(66);
|
|
|
|
var _RouteUtils = __webpack_require__(18);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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 _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
|
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
|
|
} : function (obj) {
|
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
|
|
};
|
|
|
|
var _React$PropTypes = _react2.default.PropTypes,
|
|
array = _React$PropTypes.array,
|
|
func = _React$PropTypes.func,
|
|
object = _React$PropTypes.object;
|
|
|
|
/**
|
|
* A <RouterContext> renders the component tree for a given router state
|
|
* and sets the history object and the current location in context.
|
|
*/
|
|
|
|
var RouterContext = _react2.default.createClass({
|
|
displayName: 'RouterContext',
|
|
|
|
mixins: [(0, _ContextUtils.ContextProvider)('router')],
|
|
|
|
propTypes: {
|
|
router: object.isRequired,
|
|
location: object.isRequired,
|
|
routes: array.isRequired,
|
|
params: object.isRequired,
|
|
components: array.isRequired,
|
|
createElement: func.isRequired
|
|
},
|
|
|
|
getDefaultProps: function getDefaultProps() {
|
|
return {
|
|
createElement: _react2.default.createElement
|
|
};
|
|
},
|
|
|
|
childContextTypes: {
|
|
router: object.isRequired
|
|
},
|
|
|
|
getChildContext: function getChildContext() {
|
|
return {
|
|
router: this.props.router
|
|
};
|
|
},
|
|
createElement: function createElement(component, props) {
|
|
return component == null ? null : this.props.createElement(component, props);
|
|
},
|
|
render: function render() {
|
|
var _this = this;
|
|
|
|
var _props = this.props,
|
|
location = _props.location,
|
|
routes = _props.routes,
|
|
params = _props.params,
|
|
components = _props.components,
|
|
router = _props.router;
|
|
|
|
var element = null;
|
|
|
|
if (components) {
|
|
element = components.reduceRight(function (element, components, index) {
|
|
if (components == null) return element; // Don't create new children; use the grandchildren.
|
|
|
|
var route = routes[index];
|
|
var routeParams = (0, _getRouteParams2.default)(route, params);
|
|
var props = {
|
|
location: location,
|
|
params: params,
|
|
route: route,
|
|
router: router,
|
|
routeParams: routeParams,
|
|
routes: routes
|
|
};
|
|
|
|
if ((0, _RouteUtils.isReactChildren)(element)) {
|
|
props.children = element;
|
|
} else if (element) {
|
|
for (var prop in element) {
|
|
if (Object.prototype.hasOwnProperty.call(element, prop)) props[prop] = element[prop];
|
|
}
|
|
}
|
|
|
|
if ((typeof components === 'undefined' ? 'undefined' : _typeof(components)) === 'object') {
|
|
var elements = {};
|
|
|
|
for (var key in components) {
|
|
if (Object.prototype.hasOwnProperty.call(components, key)) {
|
|
// Pass through the key as a prop to createElement to allow
|
|
// custom createElement functions to know which named component
|
|
// they're rendering, for e.g. matching up to fetched data.
|
|
elements[key] = _this.createElement(components[key], _extends({
|
|
key: key }, props));
|
|
}
|
|
}
|
|
|
|
return elements;
|
|
}
|
|
|
|
return _this.createElement(components, props);
|
|
}, element);
|
|
}
|
|
|
|
!(element === null || element === false || _react2.default.isValidElement(element)) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'The root route must render a single element') : (0, _invariant2.default)(false) : void 0;
|
|
|
|
return element;
|
|
}
|
|
});
|
|
|
|
exports.default = RouterContext;
|
|
module.exports = exports["default"];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 69 */,
|
|
/* 70 */,
|
|
/* 71 */,
|
|
/* 72 */,
|
|
/* 73 */,
|
|
/* 74 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.createMemoryHistory = exports.hashHistory = exports.browserHistory = exports.applyRouterMiddleware = exports.formatPattern = exports.useRouterHistory = exports.match = exports.routerShape = exports.locationShape = exports.RouterContext = exports.createRoutes = exports.Route = exports.Redirect = exports.IndexRoute = exports.IndexRedirect = exports.withRouter = exports.IndexLink = exports.Link = exports.Router = undefined;
|
|
|
|
var _RouteUtils = __webpack_require__(18);
|
|
|
|
Object.defineProperty(exports, 'createRoutes', {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return _RouteUtils.createRoutes;
|
|
}
|
|
});
|
|
|
|
var _PropTypes = __webpack_require__(67);
|
|
|
|
Object.defineProperty(exports, 'locationShape', {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return _PropTypes.locationShape;
|
|
}
|
|
});
|
|
Object.defineProperty(exports, 'routerShape', {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return _PropTypes.routerShape;
|
|
}
|
|
});
|
|
|
|
var _PatternUtils = __webpack_require__(26);
|
|
|
|
Object.defineProperty(exports, 'formatPattern', {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return _PatternUtils.formatPattern;
|
|
}
|
|
});
|
|
|
|
var _Router2 = __webpack_require__(240);
|
|
|
|
var _Router3 = _interopRequireDefault(_Router2);
|
|
|
|
var _Link2 = __webpack_require__(108);
|
|
|
|
var _Link3 = _interopRequireDefault(_Link2);
|
|
|
|
var _IndexLink2 = __webpack_require__(236);
|
|
|
|
var _IndexLink3 = _interopRequireDefault(_IndexLink2);
|
|
|
|
var _withRouter2 = __webpack_require__(251);
|
|
|
|
var _withRouter3 = _interopRequireDefault(_withRouter2);
|
|
|
|
var _IndexRedirect2 = __webpack_require__(237);
|
|
|
|
var _IndexRedirect3 = _interopRequireDefault(_IndexRedirect2);
|
|
|
|
var _IndexRoute2 = __webpack_require__(238);
|
|
|
|
var _IndexRoute3 = _interopRequireDefault(_IndexRoute2);
|
|
|
|
var _Redirect2 = __webpack_require__(110);
|
|
|
|
var _Redirect3 = _interopRequireDefault(_Redirect2);
|
|
|
|
var _Route2 = __webpack_require__(239);
|
|
|
|
var _Route3 = _interopRequireDefault(_Route2);
|
|
|
|
var _RouterContext2 = __webpack_require__(68);
|
|
|
|
var _RouterContext3 = _interopRequireDefault(_RouterContext2);
|
|
|
|
var _match2 = __webpack_require__(249);
|
|
|
|
var _match3 = _interopRequireDefault(_match2);
|
|
|
|
var _useRouterHistory2 = __webpack_require__(115);
|
|
|
|
var _useRouterHistory3 = _interopRequireDefault(_useRouterHistory2);
|
|
|
|
var _applyRouterMiddleware2 = __webpack_require__(242);
|
|
|
|
var _applyRouterMiddleware3 = _interopRequireDefault(_applyRouterMiddleware2);
|
|
|
|
var _browserHistory2 = __webpack_require__(243);
|
|
|
|
var _browserHistory3 = _interopRequireDefault(_browserHistory2);
|
|
|
|
var _hashHistory2 = __webpack_require__(247);
|
|
|
|
var _hashHistory3 = _interopRequireDefault(_hashHistory2);
|
|
|
|
var _createMemoryHistory2 = __webpack_require__(112);
|
|
|
|
var _createMemoryHistory3 = _interopRequireDefault(_createMemoryHistory2);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.Router = _Router3.default; /* components */
|
|
|
|
exports.Link = _Link3.default;
|
|
exports.IndexLink = _IndexLink3.default;
|
|
exports.withRouter = _withRouter3.default;
|
|
|
|
/* components (configuration) */
|
|
|
|
exports.IndexRedirect = _IndexRedirect3.default;
|
|
exports.IndexRoute = _IndexRoute3.default;
|
|
exports.Redirect = _Redirect3.default;
|
|
exports.Route = _Route3.default;
|
|
|
|
/* utils */
|
|
|
|
exports.RouterContext = _RouterContext3.default;
|
|
exports.match = _match3.default;
|
|
exports.useRouterHistory = _useRouterHistory3.default;
|
|
exports.applyRouterMiddleware = _applyRouterMiddleware3.default;
|
|
|
|
/* histories */
|
|
|
|
exports.browserHistory = _browserHistory3.default;
|
|
exports.hashHistory = _hashHistory3.default;
|
|
exports.createMemoryHistory = _createMemoryHistory3.default;
|
|
|
|
/***/ }),
|
|
/* 75 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
module.exports = __webpack_require__(125);
|
|
|
|
/***/ }),
|
|
/* 76 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
var utils = __webpack_require__(10);
|
|
var settle = __webpack_require__(131);
|
|
var buildURL = __webpack_require__(134);
|
|
var parseHeaders = __webpack_require__(140);
|
|
var isURLSameOrigin = __webpack_require__(138);
|
|
var createError = __webpack_require__(79);
|
|
var btoa = typeof window !== 'undefined' && window.btoa && window.btoa.bind(window) || __webpack_require__(133);
|
|
|
|
module.exports = function xhrAdapter(config) {
|
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
var requestData = config.data;
|
|
var requestHeaders = config.headers;
|
|
|
|
if (utils.isFormData(requestData)) {
|
|
delete requestHeaders['Content-Type']; // Let the browser set it
|
|
}
|
|
|
|
var request = new XMLHttpRequest();
|
|
var loadEvent = 'onreadystatechange';
|
|
var xDomain = false;
|
|
|
|
// For IE 8/9 CORS support
|
|
// Only supports POST and GET calls and doesn't returns the response headers.
|
|
// DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
|
|
if (process.env.NODE_ENV !== 'test' && typeof window !== 'undefined' && window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {
|
|
request = new window.XDomainRequest();
|
|
loadEvent = 'onload';
|
|
xDomain = true;
|
|
request.onprogress = function handleProgress() {};
|
|
request.ontimeout = function handleTimeout() {};
|
|
}
|
|
|
|
// HTTP basic authentication
|
|
if (config.auth) {
|
|
var username = config.auth.username || '';
|
|
var password = config.auth.password || '';
|
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
|
}
|
|
|
|
request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
|
|
|
|
// Set the request timeout in MS
|
|
request.timeout = config.timeout;
|
|
|
|
// Listen for ready state
|
|
request[loadEvent] = function handleLoad() {
|
|
if (!request || request.readyState !== 4 && !xDomain) {
|
|
return;
|
|
}
|
|
|
|
// The request errored out and we didn't get a response, this will be
|
|
// handled by onerror instead
|
|
// With one exception: request that using file: protocol, most browsers
|
|
// will return status as 0 even though it's a successful request
|
|
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
return;
|
|
}
|
|
|
|
// Prepare the response
|
|
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
|
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
|
|
var response = {
|
|
data: responseData,
|
|
// IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
|
|
status: request.status === 1223 ? 204 : request.status,
|
|
statusText: request.status === 1223 ? 'No Content' : request.statusText,
|
|
headers: responseHeaders,
|
|
config: config,
|
|
request: request
|
|
};
|
|
|
|
settle(resolve, reject, response);
|
|
|
|
// Clean up request
|
|
request = null;
|
|
};
|
|
|
|
// Handle low level network errors
|
|
request.onerror = function handleError() {
|
|
// Real errors are hidden from us by the browser
|
|
// onerror should only fire if it's a network error
|
|
reject(createError('Network Error', config));
|
|
|
|
// Clean up request
|
|
request = null;
|
|
};
|
|
|
|
// Handle timeout
|
|
request.ontimeout = function handleTimeout() {
|
|
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));
|
|
|
|
// Clean up request
|
|
request = null;
|
|
};
|
|
|
|
// Add xsrf header
|
|
// This is only done if running in a standard browser environment.
|
|
// Specifically not if we're in a web worker, or react-native.
|
|
if (utils.isStandardBrowserEnv()) {
|
|
var cookies = __webpack_require__(136);
|
|
|
|
// Add xsrf header
|
|
var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : undefined;
|
|
|
|
if (xsrfValue) {
|
|
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
|
}
|
|
}
|
|
|
|
// Add headers to the request
|
|
if ('setRequestHeader' in request) {
|
|
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
|
// Remove Content-Type if data is undefined
|
|
delete requestHeaders[key];
|
|
} else {
|
|
// Otherwise add header to the request
|
|
request.setRequestHeader(key, val);
|
|
}
|
|
});
|
|
}
|
|
|
|
// Add withCredentials to request if needed
|
|
if (config.withCredentials) {
|
|
request.withCredentials = true;
|
|
}
|
|
|
|
// Add responseType to request if needed
|
|
if (config.responseType) {
|
|
try {
|
|
request.responseType = config.responseType;
|
|
} catch (e) {
|
|
if (request.responseType !== 'json') {
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Handle progress if needed
|
|
if (typeof config.onDownloadProgress === 'function') {
|
|
request.addEventListener('progress', config.onDownloadProgress);
|
|
}
|
|
|
|
// Not all browsers support upload events
|
|
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
|
}
|
|
|
|
if (config.cancelToken) {
|
|
// Handle cancellation
|
|
config.cancelToken.promise.then(function onCanceled(cancel) {
|
|
if (!request) {
|
|
return;
|
|
}
|
|
|
|
request.abort();
|
|
reject(cancel);
|
|
// Clean up request
|
|
request = null;
|
|
});
|
|
}
|
|
|
|
if (requestData === undefined) {
|
|
requestData = null;
|
|
}
|
|
|
|
// Send the request
|
|
request.send(requestData);
|
|
});
|
|
};
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 77 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
/**
|
|
* A `Cancel` is an object that is thrown when an operation is canceled.
|
|
*
|
|
* @class
|
|
* @param {string=} message The message.
|
|
*/
|
|
|
|
function Cancel(message) {
|
|
this.message = message;
|
|
}
|
|
|
|
Cancel.prototype.toString = function toString() {
|
|
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
|
};
|
|
|
|
Cancel.prototype.__CANCEL__ = true;
|
|
|
|
module.exports = Cancel;
|
|
|
|
/***/ }),
|
|
/* 78 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
module.exports = function isCancel(value) {
|
|
return !!(value && value.__CANCEL__);
|
|
};
|
|
|
|
/***/ }),
|
|
/* 79 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var enhanceError = __webpack_require__(130);
|
|
|
|
/**
|
|
* Create an Error with the specified message, config, error code, and response.
|
|
*
|
|
* @param {string} message The error message.
|
|
* @param {Object} config The config.
|
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
@ @param {Object} [response] The response.
|
|
* @returns {Error} The created error.
|
|
*/
|
|
module.exports = function createError(message, config, code, response) {
|
|
var error = new Error(message);
|
|
return enhanceError(error, config, code, response);
|
|
};
|
|
|
|
/***/ }),
|
|
/* 80 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
module.exports = function bind(fn, thisArg) {
|
|
return function wrap() {
|
|
var args = new Array(arguments.length);
|
|
for (var i = 0; i < args.length; i++) {
|
|
args[i] = arguments[i];
|
|
}
|
|
return fn.apply(thisArg, args);
|
|
};
|
|
};
|
|
|
|
/***/ }),
|
|
/* 81 */,
|
|
/* 82 */,
|
|
/* 83 */,
|
|
/* 84 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
exports.__esModule = true;
|
|
exports.readState = exports.saveState = undefined;
|
|
|
|
var _warning = __webpack_require__(19);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
var QuotaExceededErrors = {
|
|
QuotaExceededError: true,
|
|
QUOTA_EXCEEDED_ERR: true
|
|
};
|
|
|
|
var SecurityErrors = {
|
|
SecurityError: true
|
|
};
|
|
|
|
var KeyPrefix = '@@History/';
|
|
|
|
var createKey = function createKey(key) {
|
|
return KeyPrefix + key;
|
|
};
|
|
|
|
var saveState = exports.saveState = function saveState(key, state) {
|
|
if (!window.sessionStorage) {
|
|
// Session storage is not available or hidden.
|
|
// sessionStorage is undefined in Internet Explorer when served via file protocol.
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, '[history] Unable to save state; sessionStorage is not available') : void 0;
|
|
|
|
return;
|
|
}
|
|
|
|
try {
|
|
if (state == null) {
|
|
window.sessionStorage.removeItem(createKey(key));
|
|
} else {
|
|
window.sessionStorage.setItem(createKey(key), JSON.stringify(state));
|
|
}
|
|
} catch (error) {
|
|
if (SecurityErrors[error.name]) {
|
|
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
|
|
// attempt to access window.sessionStorage.
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, '[history] Unable to save state; sessionStorage is not available due to security settings') : void 0;
|
|
|
|
return;
|
|
}
|
|
|
|
if (QuotaExceededErrors[error.name] && window.sessionStorage.length === 0) {
|
|
// Safari "private mode" throws QuotaExceededError.
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : void 0;
|
|
|
|
return;
|
|
}
|
|
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
var readState = exports.readState = function readState(key) {
|
|
var json = void 0;
|
|
try {
|
|
json = window.sessionStorage.getItem(createKey(key));
|
|
} catch (error) {
|
|
if (SecurityErrors[error.name]) {
|
|
// Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any
|
|
// attempt to access window.sessionStorage.
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, '[history] Unable to read state; sessionStorage is not available due to security settings') : void 0;
|
|
|
|
return undefined;
|
|
}
|
|
}
|
|
|
|
if (json) {
|
|
try {
|
|
return JSON.parse(json);
|
|
} catch (error) {
|
|
// Ignore invalid JSON.
|
|
}
|
|
}
|
|
|
|
return undefined;
|
|
};
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 85 */
|
|
/***/ (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 _runTransitionHook = __webpack_require__(49);
|
|
|
|
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
|
|
|
|
var _PathUtils = __webpack_require__(16);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
var useBasename = function useBasename(createHistory) {
|
|
return function () {
|
|
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
|
|
|
var history = createHistory(options);
|
|
var basename = options.basename;
|
|
|
|
var addBasename = function addBasename(location) {
|
|
if (!location) return location;
|
|
|
|
if (basename && location.basename == null) {
|
|
if (location.pathname.indexOf(basename) === 0) {
|
|
location.pathname = location.pathname.substring(basename.length);
|
|
location.basename = basename;
|
|
|
|
if (location.pathname === '') location.pathname = '/';
|
|
} else {
|
|
location.basename = '';
|
|
}
|
|
}
|
|
|
|
return location;
|
|
};
|
|
|
|
var prependBasename = function prependBasename(location) {
|
|
if (!basename) return location;
|
|
|
|
var object = typeof location === 'string' ? (0, _PathUtils.parsePath)(location) : location;
|
|
var pname = object.pathname;
|
|
var normalizedBasename = basename.slice(-1) === '/' ? basename : basename + '/';
|
|
var normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname;
|
|
var pathname = normalizedBasename + normalizedPathname;
|
|
|
|
return _extends({}, object, {
|
|
pathname: pathname
|
|
});
|
|
};
|
|
|
|
// Override all read methods with basename-aware versions.
|
|
var getCurrentLocation = function getCurrentLocation() {
|
|
return addBasename(history.getCurrentLocation());
|
|
};
|
|
|
|
var listenBefore = function listenBefore(hook) {
|
|
return history.listenBefore(function (location, callback) {
|
|
return (0, _runTransitionHook2.default)(hook, addBasename(location), callback);
|
|
});
|
|
};
|
|
|
|
var listen = function listen(listener) {
|
|
return history.listen(function (location) {
|
|
return listener(addBasename(location));
|
|
});
|
|
};
|
|
|
|
// Override all write methods with basename-aware versions.
|
|
var push = function push(location) {
|
|
return history.push(prependBasename(location));
|
|
};
|
|
|
|
var replace = function replace(location) {
|
|
return history.replace(prependBasename(location));
|
|
};
|
|
|
|
var createPath = function createPath(location) {
|
|
return history.createPath(prependBasename(location));
|
|
};
|
|
|
|
var createHref = function createHref(location) {
|
|
return history.createHref(prependBasename(location));
|
|
};
|
|
|
|
var createLocation = function createLocation(location) {
|
|
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
args[_key - 1] = arguments[_key];
|
|
}
|
|
|
|
return addBasename(history.createLocation.apply(history, [prependBasename(location)].concat(args)));
|
|
};
|
|
|
|
return _extends({}, history, {
|
|
getCurrentLocation: getCurrentLocation,
|
|
listenBefore: listenBefore,
|
|
listen: listen,
|
|
push: push,
|
|
replace: replace,
|
|
createPath: createPath,
|
|
createHref: createHref,
|
|
createLocation: createLocation
|
|
});
|
|
};
|
|
};
|
|
|
|
exports.default = useBasename;
|
|
|
|
/***/ }),
|
|
/* 86 */
|
|
/***/ (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 _queryString = __webpack_require__(163);
|
|
|
|
var _runTransitionHook = __webpack_require__(49);
|
|
|
|
var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook);
|
|
|
|
var _LocationUtils = __webpack_require__(23);
|
|
|
|
var _PathUtils = __webpack_require__(16);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
var defaultStringifyQuery = function defaultStringifyQuery(query) {
|
|
return (0, _queryString.stringify)(query).replace(/%20/g, '+');
|
|
};
|
|
|
|
var defaultParseQueryString = _queryString.parse;
|
|
|
|
/**
|
|
* Returns a new createHistory function that may be used to create
|
|
* history objects that know how to handle URL queries.
|
|
*/
|
|
var useQueries = function useQueries(createHistory) {
|
|
return function () {
|
|
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
|
|
|
var history = createHistory(options);
|
|
var stringifyQuery = options.stringifyQuery;
|
|
var parseQueryString = options.parseQueryString;
|
|
|
|
if (typeof stringifyQuery !== 'function') stringifyQuery = defaultStringifyQuery;
|
|
|
|
if (typeof parseQueryString !== 'function') parseQueryString = defaultParseQueryString;
|
|
|
|
var decodeQuery = function decodeQuery(location) {
|
|
if (!location) return location;
|
|
|
|
if (location.query == null) location.query = parseQueryString(location.search.substring(1));
|
|
|
|
return location;
|
|
};
|
|
|
|
var encodeQuery = function encodeQuery(location, query) {
|
|
if (query == null) return location;
|
|
|
|
var object = typeof location === 'string' ? (0, _PathUtils.parsePath)(location) : location;
|
|
var queryString = stringifyQuery(query);
|
|
var search = queryString ? '?' + queryString : '';
|
|
|
|
return _extends({}, object, {
|
|
search: search
|
|
});
|
|
};
|
|
|
|
// Override all read methods with query-aware versions.
|
|
var getCurrentLocation = function getCurrentLocation() {
|
|
return decodeQuery(history.getCurrentLocation());
|
|
};
|
|
|
|
var listenBefore = function listenBefore(hook) {
|
|
return history.listenBefore(function (location, callback) {
|
|
return (0, _runTransitionHook2.default)(hook, decodeQuery(location), callback);
|
|
});
|
|
};
|
|
|
|
var listen = function listen(listener) {
|
|
return history.listen(function (location) {
|
|
return listener(decodeQuery(location));
|
|
});
|
|
};
|
|
|
|
// Override all write methods with query-aware versions.
|
|
var push = function push(location) {
|
|
return history.push(encodeQuery(location, location.query));
|
|
};
|
|
|
|
var replace = function replace(location) {
|
|
return history.replace(encodeQuery(location, location.query));
|
|
};
|
|
|
|
var createPath = function createPath(location) {
|
|
return history.createPath(encodeQuery(location, location.query));
|
|
};
|
|
|
|
var createHref = function createHref(location) {
|
|
return history.createHref(encodeQuery(location, location.query));
|
|
};
|
|
|
|
var createLocation = function createLocation(location) {
|
|
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
args[_key - 1] = arguments[_key];
|
|
}
|
|
|
|
var newLocation = history.createLocation.apply(history, [encodeQuery(location, location.query)].concat(args));
|
|
|
|
if (location.query) newLocation.query = (0, _LocationUtils.createQuery)(location.query);
|
|
|
|
return decodeQuery(newLocation);
|
|
};
|
|
|
|
return _extends({}, history, {
|
|
getCurrentLocation: getCurrentLocation,
|
|
listenBefore: listenBefore,
|
|
listen: listen,
|
|
push: push,
|
|
replace: replace,
|
|
createPath: createPath,
|
|
createHref: createHref,
|
|
createLocation: createLocation
|
|
});
|
|
};
|
|
};
|
|
|
|
exports.default = useQueries;
|
|
|
|
/***/ }),
|
|
/* 87 */,
|
|
/* 88 */,
|
|
/* 89 */,
|
|
/* 90 */,
|
|
/* 91 */,
|
|
/* 92 */,
|
|
/* 93 */,
|
|
/* 94 */,
|
|
/* 95 */,
|
|
/* 96 */,
|
|
/* 97 */,
|
|
/* 98 */,
|
|
/* 99 */,
|
|
/* 100 */,
|
|
/* 101 */,
|
|
/* 102 */,
|
|
/* 103 */,
|
|
/* 104 */,
|
|
/* 105 */,
|
|
/* 106 */,
|
|
/* 107 */,
|
|
/* 108 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _PropTypes = __webpack_require__(67);
|
|
|
|
var _ContextUtils = __webpack_require__(66);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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;
|
|
};
|
|
|
|
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;
|
|
}
|
|
|
|
var _React$PropTypes = _react2.default.PropTypes,
|
|
bool = _React$PropTypes.bool,
|
|
object = _React$PropTypes.object,
|
|
string = _React$PropTypes.string,
|
|
func = _React$PropTypes.func,
|
|
oneOfType = _React$PropTypes.oneOfType;
|
|
|
|
function isLeftClickEvent(event) {
|
|
return event.button === 0;
|
|
}
|
|
|
|
function isModifiedEvent(event) {
|
|
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
}
|
|
|
|
// TODO: De-duplicate against hasAnyProperties in createTransitionManager.
|
|
function isEmptyObject(object) {
|
|
for (var p in object) {
|
|
if (Object.prototype.hasOwnProperty.call(object, p)) return false;
|
|
}return true;
|
|
}
|
|
|
|
function resolveToLocation(to, router) {
|
|
return typeof to === 'function' ? to(router.location) : to;
|
|
}
|
|
|
|
/**
|
|
* A <Link> is used to create an <a> element that links to a route.
|
|
* When that route is active, the link gets the value of its
|
|
* activeClassName prop.
|
|
*
|
|
* For example, assuming you have the following route:
|
|
*
|
|
* <Route path="/posts/:postID" component={Post} />
|
|
*
|
|
* You could use the following component to link to that route:
|
|
*
|
|
* <Link to={`/posts/${post.id}`} />
|
|
*
|
|
* Links may pass along location state and/or query string parameters
|
|
* in the state/query props, respectively.
|
|
*
|
|
* <Link ... query={{ show: true }} state={{ the: 'state' }} />
|
|
*/
|
|
var Link = _react2.default.createClass({
|
|
displayName: 'Link',
|
|
|
|
mixins: [(0, _ContextUtils.ContextSubscriber)('router')],
|
|
|
|
contextTypes: {
|
|
router: _PropTypes.routerShape
|
|
},
|
|
|
|
propTypes: {
|
|
to: oneOfType([string, object, func]),
|
|
query: object,
|
|
hash: string,
|
|
state: object,
|
|
activeStyle: object,
|
|
activeClassName: string,
|
|
onlyActiveOnIndex: bool.isRequired,
|
|
onClick: func,
|
|
target: string
|
|
},
|
|
|
|
getDefaultProps: function getDefaultProps() {
|
|
return {
|
|
onlyActiveOnIndex: false,
|
|
style: {}
|
|
};
|
|
},
|
|
handleClick: function handleClick(event) {
|
|
if (this.props.onClick) this.props.onClick(event);
|
|
|
|
if (event.defaultPrevented) return;
|
|
|
|
var router = this.context.router;
|
|
|
|
!router ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<Link>s rendered outside of a router context cannot navigate.') : (0, _invariant2.default)(false) : void 0;
|
|
|
|
if (isModifiedEvent(event) || !isLeftClickEvent(event)) return;
|
|
|
|
// If target prop is set (e.g. to "_blank"), let browser handle link.
|
|
/* istanbul ignore if: untestable with Karma */
|
|
if (this.props.target) return;
|
|
|
|
event.preventDefault();
|
|
|
|
router.push(resolveToLocation(this.props.to, router));
|
|
},
|
|
render: function render() {
|
|
var _props = this.props,
|
|
to = _props.to,
|
|
activeClassName = _props.activeClassName,
|
|
activeStyle = _props.activeStyle,
|
|
onlyActiveOnIndex = _props.onlyActiveOnIndex,
|
|
props = _objectWithoutProperties(_props, ['to', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex']);
|
|
|
|
// Ignore if rendered outside the context of router to simplify unit testing.
|
|
|
|
|
|
var router = this.context.router;
|
|
|
|
if (router) {
|
|
// If user does not specify a `to` prop, return an empty anchor tag.
|
|
if (!to) {
|
|
return _react2.default.createElement('a', props);
|
|
}
|
|
|
|
var toLocation = resolveToLocation(to, router);
|
|
props.href = router.createHref(toLocation);
|
|
|
|
if (activeClassName || activeStyle != null && !isEmptyObject(activeStyle)) {
|
|
if (router.isActive(toLocation, onlyActiveOnIndex)) {
|
|
if (activeClassName) {
|
|
if (props.className) {
|
|
props.className += ' ' + activeClassName;
|
|
} else {
|
|
props.className = activeClassName;
|
|
}
|
|
}
|
|
|
|
if (activeStyle) props.style = _extends({}, props.style, activeStyle);
|
|
}
|
|
}
|
|
}
|
|
|
|
return _react2.default.createElement('a', _extends({}, props, { onClick: this.handleClick }));
|
|
}
|
|
});
|
|
|
|
exports.default = Link;
|
|
module.exports = exports['default'];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 109 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.isPromise = isPromise;
|
|
function isPromise(obj) {
|
|
return obj && typeof obj.then === 'function';
|
|
}
|
|
|
|
/***/ }),
|
|
/* 110 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _RouteUtils = __webpack_require__(18);
|
|
|
|
var _PatternUtils = __webpack_require__(26);
|
|
|
|
var _InternalPropTypes = __webpack_require__(34);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var _React$PropTypes = _react2.default.PropTypes,
|
|
string = _React$PropTypes.string,
|
|
object = _React$PropTypes.object;
|
|
|
|
/**
|
|
* A <Redirect> is used to declare another URL path a client should
|
|
* be sent to when they request a given URL.
|
|
*
|
|
* Redirects are placed alongside routes in the route configuration
|
|
* and are traversed in the same manner.
|
|
*/
|
|
/* eslint-disable react/require-render-return */
|
|
|
|
var Redirect = _react2.default.createClass({
|
|
displayName: 'Redirect',
|
|
|
|
statics: {
|
|
createRouteFromReactElement: function createRouteFromReactElement(element) {
|
|
var route = (0, _RouteUtils.createRouteFromReactElement)(element);
|
|
|
|
if (route.from) route.path = route.from;
|
|
|
|
route.onEnter = function (nextState, replace) {
|
|
var location = nextState.location,
|
|
params = nextState.params;
|
|
|
|
var pathname = void 0;
|
|
if (route.to.charAt(0) === '/') {
|
|
pathname = (0, _PatternUtils.formatPattern)(route.to, params);
|
|
} else if (!route.to) {
|
|
pathname = location.pathname;
|
|
} else {
|
|
var routeIndex = nextState.routes.indexOf(route);
|
|
var parentPattern = Redirect.getRoutePattern(nextState.routes, routeIndex - 1);
|
|
var pattern = parentPattern.replace(/\/*$/, '/') + route.to;
|
|
pathname = (0, _PatternUtils.formatPattern)(pattern, params);
|
|
}
|
|
|
|
replace({
|
|
pathname: pathname,
|
|
query: route.query || location.query,
|
|
state: route.state || location.state
|
|
});
|
|
};
|
|
|
|
return route;
|
|
},
|
|
getRoutePattern: function getRoutePattern(routes, routeIndex) {
|
|
var parentPattern = '';
|
|
|
|
for (var i = routeIndex; i >= 0; i--) {
|
|
var route = routes[i];
|
|
var pattern = route.path || '';
|
|
|
|
parentPattern = pattern.replace(/\/*$/, '/') + parentPattern;
|
|
|
|
if (pattern.indexOf('/') === 0) break;
|
|
}
|
|
|
|
return '/' + parentPattern;
|
|
}
|
|
},
|
|
|
|
propTypes: {
|
|
path: string,
|
|
from: string, // Alias for path
|
|
to: string.isRequired,
|
|
query: object,
|
|
state: object,
|
|
onEnter: _InternalPropTypes.falsy,
|
|
children: _InternalPropTypes.falsy
|
|
},
|
|
|
|
/* istanbul ignore next: sanity check */
|
|
render: function render() {
|
|
true ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<Redirect> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
|
|
}
|
|
});
|
|
|
|
exports.default = Redirect;
|
|
module.exports = exports['default'];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 111 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.createRouterObject = createRouterObject;
|
|
exports.assignRouterState = assignRouterState;
|
|
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 createRouterObject(history, transitionManager, state) {
|
|
var router = _extends({}, history, {
|
|
setRouteLeaveHook: transitionManager.listenBeforeLeavingRoute,
|
|
isActive: transitionManager.isActive
|
|
});
|
|
|
|
return assignRouterState(router, state);
|
|
}
|
|
|
|
function assignRouterState(router, _ref) {
|
|
var location = _ref.location,
|
|
params = _ref.params,
|
|
routes = _ref.routes;
|
|
|
|
router.location = location;
|
|
router.params = params;
|
|
router.routes = routes;
|
|
|
|
return router;
|
|
}
|
|
|
|
/***/ }),
|
|
/* 112 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = createMemoryHistory;
|
|
|
|
var _useQueries = __webpack_require__(86);
|
|
|
|
var _useQueries2 = _interopRequireDefault(_useQueries);
|
|
|
|
var _useBasename = __webpack_require__(85);
|
|
|
|
var _useBasename2 = _interopRequireDefault(_useBasename);
|
|
|
|
var _createMemoryHistory = __webpack_require__(161);
|
|
|
|
var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function createMemoryHistory(options) {
|
|
// signatures and type checking differ between `useQueries` and
|
|
// `createMemoryHistory`, have to create `memoryHistory` first because
|
|
// `useQueries` doesn't understand the signature
|
|
var memoryHistory = (0, _createMemoryHistory2.default)(options);
|
|
var createHistory = function createHistory() {
|
|
return memoryHistory;
|
|
};
|
|
var history = (0, _useQueries2.default)((0, _useBasename2.default)(createHistory))(options);
|
|
return history;
|
|
}
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 113 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
exports.default = function (createHistory) {
|
|
var history = void 0;
|
|
if (canUseDOM) history = (0, _useRouterHistory2.default)(createHistory)();
|
|
return history;
|
|
};
|
|
|
|
var _useRouterHistory = __webpack_require__(115);
|
|
|
|
var _useRouterHistory2 = _interopRequireDefault(_useRouterHistory);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 114 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = createTransitionManager;
|
|
|
|
var _routerWarning = __webpack_require__(27);
|
|
|
|
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
|
|
|
var _computeChangedRoutes2 = __webpack_require__(244);
|
|
|
|
var _computeChangedRoutes3 = _interopRequireDefault(_computeChangedRoutes2);
|
|
|
|
var _TransitionUtils = __webpack_require__(241);
|
|
|
|
var _isActive2 = __webpack_require__(248);
|
|
|
|
var _isActive3 = _interopRequireDefault(_isActive2);
|
|
|
|
var _getComponents = __webpack_require__(245);
|
|
|
|
var _getComponents2 = _interopRequireDefault(_getComponents);
|
|
|
|
var _matchRoutes = __webpack_require__(250);
|
|
|
|
var _matchRoutes2 = _interopRequireDefault(_matchRoutes);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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;
|
|
};
|
|
|
|
function hasAnyProperties(object) {
|
|
for (var p in object) {
|
|
if (Object.prototype.hasOwnProperty.call(object, p)) return true;
|
|
}return false;
|
|
}
|
|
|
|
function createTransitionManager(history, routes) {
|
|
var state = {};
|
|
|
|
// Signature should be (location, indexOnly), but needs to support (path,
|
|
// query, indexOnly)
|
|
function isActive(location, indexOnly) {
|
|
location = history.createLocation(location);
|
|
|
|
return (0, _isActive3.default)(location, indexOnly, state.location, state.routes, state.params);
|
|
}
|
|
|
|
var partialNextState = void 0;
|
|
|
|
function match(location, callback) {
|
|
if (partialNextState && partialNextState.location === location) {
|
|
// Continue from where we left off.
|
|
finishMatch(partialNextState, callback);
|
|
} else {
|
|
(0, _matchRoutes2.default)(routes, location, function (error, nextState) {
|
|
if (error) {
|
|
callback(error);
|
|
} else if (nextState) {
|
|
finishMatch(_extends({}, nextState, { location: location }), callback);
|
|
} else {
|
|
callback();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function finishMatch(nextState, callback) {
|
|
var _computeChangedRoutes = (0, _computeChangedRoutes3.default)(state, nextState),
|
|
leaveRoutes = _computeChangedRoutes.leaveRoutes,
|
|
changeRoutes = _computeChangedRoutes.changeRoutes,
|
|
enterRoutes = _computeChangedRoutes.enterRoutes;
|
|
|
|
(0, _TransitionUtils.runLeaveHooks)(leaveRoutes, state);
|
|
|
|
// Tear down confirmation hooks for left routes
|
|
leaveRoutes.filter(function (route) {
|
|
return enterRoutes.indexOf(route) === -1;
|
|
}).forEach(removeListenBeforeHooksForRoute);
|
|
|
|
// change and enter hooks are run in series
|
|
(0, _TransitionUtils.runChangeHooks)(changeRoutes, state, nextState, function (error, redirectInfo) {
|
|
if (error || redirectInfo) return handleErrorOrRedirect(error, redirectInfo);
|
|
|
|
(0, _TransitionUtils.runEnterHooks)(enterRoutes, nextState, finishEnterHooks);
|
|
});
|
|
|
|
function finishEnterHooks(error, redirectInfo) {
|
|
if (error || redirectInfo) return handleErrorOrRedirect(error, redirectInfo);
|
|
|
|
// TODO: Fetch components after state is updated.
|
|
(0, _getComponents2.default)(nextState, function (error, components) {
|
|
if (error) {
|
|
callback(error);
|
|
} else {
|
|
// TODO: Make match a pure function and have some other API
|
|
// for "match and update state".
|
|
callback(null, null, state = _extends({}, nextState, { components: components }));
|
|
}
|
|
});
|
|
}
|
|
|
|
function handleErrorOrRedirect(error, redirectInfo) {
|
|
if (error) callback(error);else callback(null, redirectInfo);
|
|
}
|
|
}
|
|
|
|
var RouteGuid = 1;
|
|
|
|
function getRouteID(route) {
|
|
var create = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
|
|
return route.__id__ || create && (route.__id__ = RouteGuid++);
|
|
}
|
|
|
|
var RouteHooks = Object.create(null);
|
|
|
|
function getRouteHooksForRoutes(routes) {
|
|
return routes.map(function (route) {
|
|
return RouteHooks[getRouteID(route)];
|
|
}).filter(function (hook) {
|
|
return hook;
|
|
});
|
|
}
|
|
|
|
function transitionHook(location, callback) {
|
|
(0, _matchRoutes2.default)(routes, location, function (error, nextState) {
|
|
if (nextState == null) {
|
|
// TODO: We didn't actually match anything, but hang
|
|
// onto error/nextState so we don't have to matchRoutes
|
|
// again in the listen callback.
|
|
callback();
|
|
return;
|
|
}
|
|
|
|
// Cache some state here so we don't have to
|
|
// matchRoutes() again in the listen callback.
|
|
partialNextState = _extends({}, nextState, { location: location });
|
|
|
|
var hooks = getRouteHooksForRoutes((0, _computeChangedRoutes3.default)(state, partialNextState).leaveRoutes);
|
|
|
|
var result = void 0;
|
|
for (var i = 0, len = hooks.length; result == null && i < len; ++i) {
|
|
// Passing the location arg here indicates to
|
|
// the user that this is a transition hook.
|
|
result = hooks[i](location);
|
|
}
|
|
|
|
callback(result);
|
|
});
|
|
}
|
|
|
|
/* istanbul ignore next: untestable with Karma */
|
|
function beforeUnloadHook() {
|
|
// Synchronously check to see if any route hooks want
|
|
// to prevent the current window/tab from closing.
|
|
if (state.routes) {
|
|
var hooks = getRouteHooksForRoutes(state.routes);
|
|
|
|
var message = void 0;
|
|
for (var i = 0, len = hooks.length; typeof message !== 'string' && i < len; ++i) {
|
|
// Passing no args indicates to the user that this is a
|
|
// beforeunload hook. We don't know the next location.
|
|
message = hooks[i]();
|
|
}
|
|
|
|
return message;
|
|
}
|
|
}
|
|
|
|
var unlistenBefore = void 0,
|
|
unlistenBeforeUnload = void 0;
|
|
|
|
function removeListenBeforeHooksForRoute(route) {
|
|
var routeID = getRouteID(route);
|
|
if (!routeID) {
|
|
return;
|
|
}
|
|
|
|
delete RouteHooks[routeID];
|
|
|
|
if (!hasAnyProperties(RouteHooks)) {
|
|
// teardown transition & beforeunload hooks
|
|
if (unlistenBefore) {
|
|
unlistenBefore();
|
|
unlistenBefore = null;
|
|
}
|
|
|
|
if (unlistenBeforeUnload) {
|
|
unlistenBeforeUnload();
|
|
unlistenBeforeUnload = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Registers the given hook function to run before leaving the given route.
|
|
*
|
|
* During a normal transition, the hook function receives the next location
|
|
* as its only argument and can return either a prompt message (string) to show the user,
|
|
* to make sure they want to leave the page; or `false`, to prevent the transition.
|
|
* Any other return value will have no effect.
|
|
*
|
|
* During the beforeunload event (in browsers) the hook receives no arguments.
|
|
* In this case it must return a prompt message to prevent the transition.
|
|
*
|
|
* Returns a function that may be used to unbind the listener.
|
|
*/
|
|
function listenBeforeLeavingRoute(route, hook) {
|
|
var thereWereNoRouteHooks = !hasAnyProperties(RouteHooks);
|
|
var routeID = getRouteID(route, true);
|
|
|
|
RouteHooks[routeID] = hook;
|
|
|
|
if (thereWereNoRouteHooks) {
|
|
// setup transition & beforeunload hooks
|
|
unlistenBefore = history.listenBefore(transitionHook);
|
|
|
|
if (history.listenBeforeUnload) unlistenBeforeUnload = history.listenBeforeUnload(beforeUnloadHook);
|
|
}
|
|
|
|
return function () {
|
|
removeListenBeforeHooksForRoute(route);
|
|
};
|
|
}
|
|
|
|
/**
|
|
* This is the API for stateful environments. As the location
|
|
* changes, we update state and call the listener. We can also
|
|
* gracefully handle errors and redirects.
|
|
*/
|
|
function listen(listener) {
|
|
function historyListener(location) {
|
|
if (state.location === location) {
|
|
listener(null, state);
|
|
} else {
|
|
match(location, function (error, redirectLocation, nextState) {
|
|
if (error) {
|
|
listener(error);
|
|
} else if (redirectLocation) {
|
|
history.replace(redirectLocation);
|
|
} else if (nextState) {
|
|
listener(null, nextState);
|
|
} else {
|
|
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'Location "%s" did not match any routes', location.pathname + location.search + location.hash) : void 0;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
// TODO: Only use a single history listener. Otherwise we'll end up with
|
|
// multiple concurrent calls to match.
|
|
|
|
// Set up the history listener first in case the initial match redirects.
|
|
var unsubscribe = history.listen(historyListener);
|
|
|
|
if (state.location) {
|
|
// Picking up on a matchContext.
|
|
listener(null, state);
|
|
} else {
|
|
historyListener(history.getCurrentLocation());
|
|
}
|
|
|
|
return unsubscribe;
|
|
}
|
|
|
|
return {
|
|
isActive: isActive,
|
|
match: match,
|
|
listenBeforeLeavingRoute: listenBeforeLeavingRoute,
|
|
listen: listen
|
|
};
|
|
}
|
|
module.exports = exports['default'];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 115 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = useRouterHistory;
|
|
|
|
var _useQueries = __webpack_require__(86);
|
|
|
|
var _useQueries2 = _interopRequireDefault(_useQueries);
|
|
|
|
var _useBasename = __webpack_require__(85);
|
|
|
|
var _useBasename2 = _interopRequireDefault(_useBasename);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function useRouterHistory(createHistory) {
|
|
return function (options) {
|
|
var history = (0, _useQueries2.default)((0, _useBasename2.default)(createHistory))(options);
|
|
return history;
|
|
};
|
|
}
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 116 */,
|
|
/* 117 */,
|
|
/* 118 */,
|
|
/* 119 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _Navbar = __webpack_require__(123);
|
|
|
|
var _Navbar2 = _interopRequireDefault(_Navbar);
|
|
|
|
__webpack_require__(270);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
//styling
|
|
|
|
|
|
var Wrapper = function (_React$Component) {
|
|
_inherits(Wrapper, _React$Component);
|
|
|
|
function Wrapper() {
|
|
_classCallCheck(this, Wrapper);
|
|
|
|
return _possibleConstructorReturn(this, (Wrapper.__proto__ || Object.getPrototypeOf(Wrapper)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(Wrapper, [{
|
|
key: 'render',
|
|
value: function render() {
|
|
return _react2.default.createElement(
|
|
'div',
|
|
null,
|
|
_react2.default.createElement(_Navbar2.default, null),
|
|
_react2.default.createElement(
|
|
'div',
|
|
null,
|
|
this.props.children
|
|
)
|
|
);
|
|
}
|
|
}]);
|
|
|
|
return Wrapper;
|
|
}(_react2.default.Component);
|
|
|
|
exports.default = Wrapper;
|
|
|
|
|
|
Wrapper.propTypes = {
|
|
children: _react2.default.PropTypes.node
|
|
};
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 120 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
__webpack_require__(266);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
var Home = function (_React$Component) {
|
|
_inherits(Home, _React$Component);
|
|
|
|
function Home() {
|
|
_classCallCheck(this, Home);
|
|
|
|
return _possibleConstructorReturn(this, (Home.__proto__ || Object.getPrototypeOf(Home)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(Home, [{
|
|
key: 'render',
|
|
value: function render() {
|
|
return _react2.default.createElement(
|
|
'div',
|
|
{ className: 'Home' },
|
|
_react2.default.createElement(
|
|
'div',
|
|
{ className: 'Card' },
|
|
_react2.default.createElement(
|
|
'div',
|
|
{ className: 'Card__header' },
|
|
'GoBot Early Access Pre Pre Alpha'
|
|
),
|
|
_react2.default.createElement(
|
|
'p',
|
|
null,
|
|
'This application is a work in progress.'
|
|
),
|
|
_react2.default.createElement(
|
|
'p',
|
|
null,
|
|
'Check out the source code on',
|
|
_react2.default.createElement(
|
|
'a',
|
|
{ href: 'https://github.com/mgerb/GoBot', target: '_blank' },
|
|
' GitHub',
|
|
_react2.default.createElement('i', { className: 'fa fa-github', 'aria-hidden': 'true' })
|
|
)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
}]);
|
|
|
|
return Home;
|
|
}(_react2.default.Component);
|
|
|
|
exports.default = Home;
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 121 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
__webpack_require__(267);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
var Default = function (_React$Component) {
|
|
_inherits(Default, _React$Component);
|
|
|
|
function Default() {
|
|
_classCallCheck(this, Default);
|
|
|
|
return _possibleConstructorReturn(this, (Default.__proto__ || Object.getPrototypeOf(Default)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(Default, [{
|
|
key: 'render',
|
|
value: function render() {
|
|
return _react2.default.createElement(
|
|
'div',
|
|
{ className: 'NotFound' },
|
|
'404 Not Found'
|
|
);
|
|
}
|
|
}]);
|
|
|
|
return Default;
|
|
}(_react2.default.Component);
|
|
|
|
exports.default = Default;
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 122 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _reactDropzone = __webpack_require__(235);
|
|
|
|
var _reactDropzone2 = _interopRequireDefault(_reactDropzone);
|
|
|
|
var _axios = __webpack_require__(75);
|
|
|
|
var _axios2 = _interopRequireDefault(_axios);
|
|
|
|
var _SoundList = __webpack_require__(124);
|
|
|
|
var _SoundList2 = _interopRequireDefault(_SoundList);
|
|
|
|
__webpack_require__(269);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
var self = void 0;
|
|
|
|
var Soundboard = function (_React$Component) {
|
|
_inherits(Soundboard, _React$Component);
|
|
|
|
function Soundboard() {
|
|
_classCallCheck(this, Soundboard);
|
|
|
|
var _this = _possibleConstructorReturn(this, (Soundboard.__proto__ || Object.getPrototypeOf(Soundboard)).call(this));
|
|
|
|
_this.state = {
|
|
percentCompleted: 0,
|
|
password: "",
|
|
uploaded: false,
|
|
uploadError: " "
|
|
};
|
|
self = _this;
|
|
return _this;
|
|
}
|
|
|
|
_createClass(Soundboard, [{
|
|
key: 'componentDidMount',
|
|
value: function componentDidMount() {
|
|
var _this2 = this;
|
|
|
|
this.config = {
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data'
|
|
},
|
|
onUploadProgress: function onUploadProgress(progressEvent) {
|
|
_this2.setState({
|
|
percentCompleted: Math.round(progressEvent.loaded * 100 / progressEvent.total)
|
|
});
|
|
}
|
|
};
|
|
}
|
|
}, {
|
|
key: 'onDrop',
|
|
value: function onDrop(acceptedFiles, rejectedFiles) {
|
|
if (acceptedFiles.length > 0) {
|
|
self.uploadFile(acceptedFiles[0]);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'uploadFile',
|
|
value: function uploadFile(file) {
|
|
var _this3 = this;
|
|
|
|
var formData = new FormData();
|
|
formData.append("name", file.name);
|
|
formData.append("file", file);
|
|
formData.append("password", this.state.password);
|
|
|
|
_axios2.default.put("/upload", formData, this.config).then(function (response) {
|
|
_this3.setState({
|
|
password: "",
|
|
percentCompleted: 0,
|
|
uploaded: true,
|
|
uploadError: " "
|
|
});
|
|
}).catch(function (err) {
|
|
_this3.setState({
|
|
percentCompleted: 0,
|
|
uploaded: false,
|
|
uploadError: err.response.data
|
|
});
|
|
});
|
|
}
|
|
}, {
|
|
key: 'passwordOnChange',
|
|
value: function passwordOnChange(event) {
|
|
this.setState({
|
|
password: event.target.value
|
|
});
|
|
}
|
|
}, {
|
|
key: 'render',
|
|
value: function render() {
|
|
return _react2.default.createElement(
|
|
'div',
|
|
{ className: 'Soundboard' },
|
|
_react2.default.createElement(
|
|
'div',
|
|
{ className: 'column' },
|
|
_react2.default.createElement(_SoundList2.default, null)
|
|
),
|
|
_react2.default.createElement(
|
|
'div',
|
|
{ className: 'column' },
|
|
_react2.default.createElement(
|
|
'div',
|
|
null,
|
|
_react2.default.createElement(
|
|
_reactDropzone2.default,
|
|
{ className: 'Dropzone',
|
|
activeClassName: 'Dropzone--active',
|
|
onDrop: this.onDrop,
|
|
multiple: false,
|
|
disableClick: true,
|
|
maxSize: 10000000000,
|
|
accept: "audio/*" },
|
|
_react2.default.createElement('input', { className: 'Soundboard__input',
|
|
type: 'password',
|
|
placeholder: 'Password',
|
|
value: this.state.password,
|
|
onChange: this.passwordOnChange.bind(this) }),
|
|
_react2.default.createElement(
|
|
'div',
|
|
{ style: { fontSize: "20px" } },
|
|
'Drop file here to upload.'
|
|
),
|
|
this.state.percentCompleted > 0 ? _react2.default.createElement(
|
|
'div',
|
|
null,
|
|
'Uploading: ',
|
|
this.state.percentCompleted
|
|
) : "",
|
|
this.state.uploaded ? _react2.default.createElement(
|
|
'div',
|
|
{ style: { color: 'green' } },
|
|
'File uploded!'
|
|
) : "",
|
|
_react2.default.createElement(
|
|
'div',
|
|
{ style: { color: '#f95f59' } },
|
|
this.state.uploadError
|
|
)
|
|
)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
}]);
|
|
|
|
return Soundboard;
|
|
}(_react2.default.Component);
|
|
|
|
exports.default = Soundboard;
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 123 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _reactRouter = __webpack_require__(74);
|
|
|
|
__webpack_require__(265);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
var Navbar = function (_React$Component) {
|
|
_inherits(Navbar, _React$Component);
|
|
|
|
function Navbar() {
|
|
_classCallCheck(this, Navbar);
|
|
|
|
return _possibleConstructorReturn(this, (Navbar.__proto__ || Object.getPrototypeOf(Navbar)).apply(this, arguments));
|
|
}
|
|
|
|
_createClass(Navbar, [{
|
|
key: 'render',
|
|
value: function render() {
|
|
return _react2.default.createElement(
|
|
'div',
|
|
{ className: 'Navbar' },
|
|
_react2.default.createElement(
|
|
'div',
|
|
{ className: 'Navbar__header' },
|
|
'GoBot'
|
|
),
|
|
_react2.default.createElement(
|
|
_reactRouter.Link,
|
|
{ to: '/', className: 'Navbar__item', onlyActiveOnIndex: true, activeClassName: 'Navbar__item--active' },
|
|
'Home'
|
|
),
|
|
_react2.default.createElement(
|
|
_reactRouter.Link,
|
|
{ to: '/soundboard', className: 'Navbar__item', activeClassName: 'Navbar__item--active' },
|
|
'Soundboard'
|
|
),
|
|
_react2.default.createElement(
|
|
'div',
|
|
{ className: 'link' },
|
|
_react2.default.createElement(
|
|
'a',
|
|
{ href: 'https://discordapp.com/invite/0Z2tzxKECEj2BHwj', target: '_blank' },
|
|
'Join the discord'
|
|
)
|
|
)
|
|
);
|
|
}
|
|
}]);
|
|
|
|
return Navbar;
|
|
}(_react2.default.Component);
|
|
|
|
exports.default = Navbar;
|
|
|
|
|
|
Navbar.propTypes = {
|
|
children: _react2.default.PropTypes.node
|
|
};
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 124 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _axios = __webpack_require__(75);
|
|
|
|
var _axios2 = _interopRequireDefault(_axios);
|
|
|
|
__webpack_require__(268);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
var soundListCache = void 0;
|
|
|
|
var SoundList = function (_React$Component) {
|
|
_inherits(SoundList, _React$Component);
|
|
|
|
function SoundList() {
|
|
_classCallCheck(this, SoundList);
|
|
|
|
var _this = _possibleConstructorReturn(this, (SoundList.__proto__ || Object.getPrototypeOf(SoundList)).call(this));
|
|
|
|
_this.state = {
|
|
soundList: []
|
|
};
|
|
return _this;
|
|
}
|
|
|
|
_createClass(SoundList, [{
|
|
key: 'componentDidMount',
|
|
value: function componentDidMount() {
|
|
this.getSoundList();
|
|
}
|
|
}, {
|
|
key: 'getSoundList',
|
|
value: function getSoundList() {
|
|
var _this2 = this;
|
|
|
|
if (!soundListCache) {
|
|
_axios2.default.get("/soundlist").then(function (response) {
|
|
soundListCache = response.data;
|
|
_this2.setState({
|
|
soundList: response.data
|
|
});
|
|
}).catch(function (error) {
|
|
console.warn(error.response.data);
|
|
});
|
|
} else {
|
|
this.setState({
|
|
soundList: soundListCache
|
|
});
|
|
}
|
|
}
|
|
}, {
|
|
key: 'checkExtension',
|
|
value: function checkExtension(extension) {
|
|
console.log(extension);
|
|
switch (extension) {
|
|
case "wav":
|
|
return true;
|
|
case "mp3":
|
|
return true;
|
|
case "mpeg":
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
}, {
|
|
key: 'render',
|
|
value: function render() {
|
|
var _this3 = this;
|
|
|
|
return _react2.default.createElement(
|
|
'div',
|
|
{ className: 'Card' },
|
|
_react2.default.createElement(
|
|
'div',
|
|
{ className: 'Card__header' },
|
|
'Sounds',
|
|
_react2.default.createElement('i', { className: 'fa fa fa-volume-up', 'aria-hidden': 'true' })
|
|
),
|
|
this.state.soundList.length > 0 ? this.state.soundList.map(function (sound, index) {
|
|
return _react2.default.createElement(
|
|
'div',
|
|
{ key: index, className: 'SoundList__item' },
|
|
_react2.default.createElement(
|
|
'div',
|
|
null,
|
|
sound.prefix + sound.name
|
|
),
|
|
_this3.checkExtension(sound.extension) ? _react2.default.createElement('audio', { controls: true, src: "/sounds/" + sound.name + "." + sound.extension,
|
|
type: "audio/" + sound.extension,
|
|
style: { width: "100px" } }) : null
|
|
);
|
|
}) : null
|
|
);
|
|
}
|
|
}]);
|
|
|
|
return SoundList;
|
|
}(_react2.default.Component);
|
|
|
|
exports.default = SoundList;
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 125 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var utils = __webpack_require__(10);
|
|
var bind = __webpack_require__(80);
|
|
var Axios = __webpack_require__(127);
|
|
var defaults = __webpack_require__(44);
|
|
|
|
/**
|
|
* Create an instance of Axios
|
|
*
|
|
* @param {Object} defaultConfig The default config for the instance
|
|
* @return {Axios} A new instance of Axios
|
|
*/
|
|
function createInstance(defaultConfig) {
|
|
var context = new Axios(defaultConfig);
|
|
var instance = bind(Axios.prototype.request, context);
|
|
|
|
// Copy axios.prototype to instance
|
|
utils.extend(instance, Axios.prototype, context);
|
|
|
|
// Copy context to instance
|
|
utils.extend(instance, context);
|
|
|
|
return instance;
|
|
}
|
|
|
|
// Create the default instance to be exported
|
|
var axios = createInstance(defaults);
|
|
|
|
// Expose Axios class to allow class inheritance
|
|
axios.Axios = Axios;
|
|
|
|
// Factory for creating new instances
|
|
axios.create = function create(instanceConfig) {
|
|
return createInstance(utils.merge(defaults, instanceConfig));
|
|
};
|
|
|
|
// Expose Cancel & CancelToken
|
|
axios.Cancel = __webpack_require__(77);
|
|
axios.CancelToken = __webpack_require__(126);
|
|
axios.isCancel = __webpack_require__(78);
|
|
|
|
// Expose all/spread
|
|
axios.all = function all(promises) {
|
|
return Promise.all(promises);
|
|
};
|
|
axios.spread = __webpack_require__(141);
|
|
|
|
module.exports = axios;
|
|
|
|
// Allow use of default import syntax in TypeScript
|
|
module.exports.default = axios;
|
|
|
|
/***/ }),
|
|
/* 126 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var Cancel = __webpack_require__(77);
|
|
|
|
/**
|
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
*
|
|
* @class
|
|
* @param {Function} executor The executor function.
|
|
*/
|
|
function CancelToken(executor) {
|
|
if (typeof executor !== 'function') {
|
|
throw new TypeError('executor must be a function.');
|
|
}
|
|
|
|
var resolvePromise;
|
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
resolvePromise = resolve;
|
|
});
|
|
|
|
var token = this;
|
|
executor(function cancel(message) {
|
|
if (token.reason) {
|
|
// Cancellation has already been requested
|
|
return;
|
|
}
|
|
|
|
token.reason = new Cancel(message);
|
|
resolvePromise(token.reason);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Throws a `Cancel` if cancellation has been requested.
|
|
*/
|
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
if (this.reason) {
|
|
throw this.reason;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
* cancels the `CancelToken`.
|
|
*/
|
|
CancelToken.source = function source() {
|
|
var cancel;
|
|
var token = new CancelToken(function executor(c) {
|
|
cancel = c;
|
|
});
|
|
return {
|
|
token: token,
|
|
cancel: cancel
|
|
};
|
|
};
|
|
|
|
module.exports = CancelToken;
|
|
|
|
/***/ }),
|
|
/* 127 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var defaults = __webpack_require__(44);
|
|
var utils = __webpack_require__(10);
|
|
var InterceptorManager = __webpack_require__(128);
|
|
var dispatchRequest = __webpack_require__(129);
|
|
var isAbsoluteURL = __webpack_require__(137);
|
|
var combineURLs = __webpack_require__(135);
|
|
|
|
/**
|
|
* Create a new instance of Axios
|
|
*
|
|
* @param {Object} instanceConfig The default config for the instance
|
|
*/
|
|
function Axios(instanceConfig) {
|
|
this.defaults = instanceConfig;
|
|
this.interceptors = {
|
|
request: new InterceptorManager(),
|
|
response: new InterceptorManager()
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Dispatch a request
|
|
*
|
|
* @param {Object} config The config specific for this request (merged with this.defaults)
|
|
*/
|
|
Axios.prototype.request = function request(config) {
|
|
/*eslint no-param-reassign:0*/
|
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
if (typeof config === 'string') {
|
|
config = utils.merge({
|
|
url: arguments[0]
|
|
}, arguments[1]);
|
|
}
|
|
|
|
config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
|
|
|
|
// Support baseURL config
|
|
if (config.baseURL && !isAbsoluteURL(config.url)) {
|
|
config.url = combineURLs(config.baseURL, config.url);
|
|
}
|
|
|
|
// Hook up interceptors middleware
|
|
var chain = [dispatchRequest, undefined];
|
|
var promise = Promise.resolve(config);
|
|
|
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
chain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
});
|
|
|
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
chain.push(interceptor.fulfilled, interceptor.rejected);
|
|
});
|
|
|
|
while (chain.length) {
|
|
promise = promise.then(chain.shift(), chain.shift());
|
|
}
|
|
|
|
return promise;
|
|
};
|
|
|
|
// Provide aliases for supported request methods
|
|
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
/*eslint func-names:0*/
|
|
Axios.prototype[method] = function (url, config) {
|
|
return this.request(utils.merge(config || {}, {
|
|
method: method,
|
|
url: url
|
|
}));
|
|
};
|
|
});
|
|
|
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
/*eslint func-names:0*/
|
|
Axios.prototype[method] = function (url, data, config) {
|
|
return this.request(utils.merge(config || {}, {
|
|
method: method,
|
|
url: url,
|
|
data: data
|
|
}));
|
|
};
|
|
});
|
|
|
|
module.exports = Axios;
|
|
|
|
/***/ }),
|
|
/* 128 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var utils = __webpack_require__(10);
|
|
|
|
function InterceptorManager() {
|
|
this.handlers = [];
|
|
}
|
|
|
|
/**
|
|
* Add a new interceptor to the stack
|
|
*
|
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
*
|
|
* @return {Number} An ID used to remove interceptor later
|
|
*/
|
|
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
|
this.handlers.push({
|
|
fulfilled: fulfilled,
|
|
rejected: rejected
|
|
});
|
|
return this.handlers.length - 1;
|
|
};
|
|
|
|
/**
|
|
* Remove an interceptor from the stack
|
|
*
|
|
* @param {Number} id The ID that was returned by `use`
|
|
*/
|
|
InterceptorManager.prototype.eject = function eject(id) {
|
|
if (this.handlers[id]) {
|
|
this.handlers[id] = null;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Iterate over all the registered interceptors
|
|
*
|
|
* This method is particularly useful for skipping over any
|
|
* interceptors that may have become `null` calling `eject`.
|
|
*
|
|
* @param {Function} fn The function to call for each interceptor
|
|
*/
|
|
InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
if (h !== null) {
|
|
fn(h);
|
|
}
|
|
});
|
|
};
|
|
|
|
module.exports = InterceptorManager;
|
|
|
|
/***/ }),
|
|
/* 129 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var utils = __webpack_require__(10);
|
|
var transformData = __webpack_require__(132);
|
|
var isCancel = __webpack_require__(78);
|
|
var defaults = __webpack_require__(44);
|
|
|
|
/**
|
|
* Throws a `Cancel` if cancellation has been requested.
|
|
*/
|
|
function throwIfCancellationRequested(config) {
|
|
if (config.cancelToken) {
|
|
config.cancelToken.throwIfRequested();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Dispatch a request to the server using the configured adapter.
|
|
*
|
|
* @param {object} config The config that is to be used for the request
|
|
* @returns {Promise} The Promise to be fulfilled
|
|
*/
|
|
module.exports = function dispatchRequest(config) {
|
|
throwIfCancellationRequested(config);
|
|
|
|
// Ensure headers exist
|
|
config.headers = config.headers || {};
|
|
|
|
// Transform request data
|
|
config.data = transformData(config.data, config.headers, config.transformRequest);
|
|
|
|
// Flatten headers
|
|
config.headers = utils.merge(config.headers.common || {}, config.headers[config.method] || {}, config.headers || {});
|
|
|
|
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) {
|
|
delete config.headers[method];
|
|
});
|
|
|
|
var adapter = config.adapter || defaults.adapter;
|
|
|
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
throwIfCancellationRequested(config);
|
|
|
|
// Transform response data
|
|
response.data = transformData(response.data, response.headers, config.transformResponse);
|
|
|
|
return response;
|
|
}, function onAdapterRejection(reason) {
|
|
if (!isCancel(reason)) {
|
|
throwIfCancellationRequested(config);
|
|
|
|
// Transform response data
|
|
if (reason && reason.response) {
|
|
reason.response.data = transformData(reason.response.data, reason.response.headers, config.transformResponse);
|
|
}
|
|
}
|
|
|
|
return Promise.reject(reason);
|
|
});
|
|
};
|
|
|
|
/***/ }),
|
|
/* 130 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
/**
|
|
* Update an Error with the specified config, error code, and response.
|
|
*
|
|
* @param {Error} error The error to update.
|
|
* @param {Object} config The config.
|
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
@ @param {Object} [response] The response.
|
|
* @returns {Error} The error.
|
|
*/
|
|
|
|
module.exports = function enhanceError(error, config, code, response) {
|
|
error.config = config;
|
|
if (code) {
|
|
error.code = code;
|
|
}
|
|
error.response = response;
|
|
return error;
|
|
};
|
|
|
|
/***/ }),
|
|
/* 131 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var createError = __webpack_require__(79);
|
|
|
|
/**
|
|
* Resolve or reject a Promise based on response status.
|
|
*
|
|
* @param {Function} resolve A function that resolves the promise.
|
|
* @param {Function} reject A function that rejects the promise.
|
|
* @param {object} response The response.
|
|
*/
|
|
module.exports = function settle(resolve, reject, response) {
|
|
var validateStatus = response.config.validateStatus;
|
|
// Note: status is not exposed by XDomainRequest
|
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
resolve(response);
|
|
} else {
|
|
reject(createError('Request failed with status code ' + response.status, response.config, null, response));
|
|
}
|
|
};
|
|
|
|
/***/ }),
|
|
/* 132 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var utils = __webpack_require__(10);
|
|
|
|
/**
|
|
* Transform the data for a request or a response
|
|
*
|
|
* @param {Object|String} data The data to be transformed
|
|
* @param {Array} headers The headers for the request or response
|
|
* @param {Array|Function} fns A single function or Array of functions
|
|
* @returns {*} The resulting transformed data
|
|
*/
|
|
module.exports = function transformData(data, headers, fns) {
|
|
/*eslint no-param-reassign:0*/
|
|
utils.forEach(fns, function transform(fn) {
|
|
data = fn(data, headers);
|
|
});
|
|
|
|
return data;
|
|
};
|
|
|
|
/***/ }),
|
|
/* 133 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
|
|
|
|
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
|
|
function E() {
|
|
this.message = 'String contains an invalid character';
|
|
}
|
|
E.prototype = new Error();
|
|
E.prototype.code = 5;
|
|
E.prototype.name = 'InvalidCharacterError';
|
|
|
|
function btoa(input) {
|
|
var str = String(input);
|
|
var output = '';
|
|
for (
|
|
// initialize result and counter
|
|
var block, charCode, idx = 0, map = chars;
|
|
// if the next str index does not exist:
|
|
// change the mapping table to "="
|
|
// check if d has no fractional digits
|
|
str.charAt(idx | 0) || (map = '=', idx % 1);
|
|
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
|
|
output += map.charAt(63 & block >> 8 - idx % 1 * 8)) {
|
|
charCode = str.charCodeAt(idx += 3 / 4);
|
|
if (charCode > 0xFF) {
|
|
throw new E();
|
|
}
|
|
block = block << 8 | charCode;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
module.exports = btoa;
|
|
|
|
/***/ }),
|
|
/* 134 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var utils = __webpack_require__(10);
|
|
|
|
function encode(val) {
|
|
return encodeURIComponent(val).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
|
}
|
|
|
|
/**
|
|
* Build a URL by appending params to the end
|
|
*
|
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
* @param {object} [params] The params to be appended
|
|
* @returns {string} The formatted url
|
|
*/
|
|
module.exports = function buildURL(url, params, paramsSerializer) {
|
|
/*eslint no-param-reassign:0*/
|
|
if (!params) {
|
|
return url;
|
|
}
|
|
|
|
var serializedParams;
|
|
if (paramsSerializer) {
|
|
serializedParams = paramsSerializer(params);
|
|
} else if (utils.isURLSearchParams(params)) {
|
|
serializedParams = params.toString();
|
|
} else {
|
|
var parts = [];
|
|
|
|
utils.forEach(params, function serialize(val, key) {
|
|
if (val === null || typeof val === 'undefined') {
|
|
return;
|
|
}
|
|
|
|
if (utils.isArray(val)) {
|
|
key = key + '[]';
|
|
}
|
|
|
|
if (!utils.isArray(val)) {
|
|
val = [val];
|
|
}
|
|
|
|
utils.forEach(val, function parseValue(v) {
|
|
if (utils.isDate(v)) {
|
|
v = v.toISOString();
|
|
} else if (utils.isObject(v)) {
|
|
v = JSON.stringify(v);
|
|
}
|
|
parts.push(encode(key) + '=' + encode(v));
|
|
});
|
|
});
|
|
|
|
serializedParams = parts.join('&');
|
|
}
|
|
|
|
if (serializedParams) {
|
|
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
}
|
|
|
|
return url;
|
|
};
|
|
|
|
/***/ }),
|
|
/* 135 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
/**
|
|
* Creates a new URL by combining the specified URLs
|
|
*
|
|
* @param {string} baseURL The base URL
|
|
* @param {string} relativeURL The relative URL
|
|
* @returns {string} The combined URL
|
|
*/
|
|
|
|
module.exports = function combineURLs(baseURL, relativeURL) {
|
|
return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '');
|
|
};
|
|
|
|
/***/ }),
|
|
/* 136 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var utils = __webpack_require__(10);
|
|
|
|
module.exports = utils.isStandardBrowserEnv() ?
|
|
|
|
// Standard browser envs support document.cookie
|
|
function standardBrowserEnv() {
|
|
return {
|
|
write: function write(name, value, expires, path, domain, secure) {
|
|
var cookie = [];
|
|
cookie.push(name + '=' + encodeURIComponent(value));
|
|
|
|
if (utils.isNumber(expires)) {
|
|
cookie.push('expires=' + new Date(expires).toGMTString());
|
|
}
|
|
|
|
if (utils.isString(path)) {
|
|
cookie.push('path=' + path);
|
|
}
|
|
|
|
if (utils.isString(domain)) {
|
|
cookie.push('domain=' + domain);
|
|
}
|
|
|
|
if (secure === true) {
|
|
cookie.push('secure');
|
|
}
|
|
|
|
document.cookie = cookie.join('; ');
|
|
},
|
|
|
|
read: function read(name) {
|
|
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
return match ? decodeURIComponent(match[3]) : null;
|
|
},
|
|
|
|
remove: function remove(name) {
|
|
this.write(name, '', Date.now() - 86400000);
|
|
}
|
|
};
|
|
}() :
|
|
|
|
// Non standard browser env (web workers, react-native) lack needed support.
|
|
function nonStandardBrowserEnv() {
|
|
return {
|
|
write: function write() {},
|
|
read: function read() {
|
|
return null;
|
|
},
|
|
remove: function remove() {}
|
|
};
|
|
}();
|
|
|
|
/***/ }),
|
|
/* 137 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
/**
|
|
* Determines whether the specified URL is absolute
|
|
*
|
|
* @param {string} url The URL to test
|
|
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
*/
|
|
|
|
module.exports = function isAbsoluteURL(url) {
|
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
return (/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url)
|
|
);
|
|
};
|
|
|
|
/***/ }),
|
|
/* 138 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var utils = __webpack_require__(10);
|
|
|
|
module.exports = utils.isStandardBrowserEnv() ?
|
|
|
|
// Standard browser envs have full support of the APIs needed to test
|
|
// whether the request URL is of the same origin as current location.
|
|
function standardBrowserEnv() {
|
|
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
var urlParsingNode = document.createElement('a');
|
|
var originURL;
|
|
|
|
/**
|
|
* Parse a URL to discover it's components
|
|
*
|
|
* @param {String} url The URL to be parsed
|
|
* @returns {Object}
|
|
*/
|
|
function resolveURL(url) {
|
|
var href = url;
|
|
|
|
if (msie) {
|
|
// IE needs attribute set twice to normalize properties
|
|
urlParsingNode.setAttribute('href', href);
|
|
href = urlParsingNode.href;
|
|
}
|
|
|
|
urlParsingNode.setAttribute('href', href);
|
|
|
|
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
|
return {
|
|
href: urlParsingNode.href,
|
|
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
host: urlParsingNode.host,
|
|
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
hostname: urlParsingNode.hostname,
|
|
port: urlParsingNode.port,
|
|
pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
|
|
};
|
|
}
|
|
|
|
originURL = resolveURL(window.location.href);
|
|
|
|
/**
|
|
* Determine if a URL shares the same origin as the current location
|
|
*
|
|
* @param {String} requestURL The URL to test
|
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
*/
|
|
return function isURLSameOrigin(requestURL) {
|
|
var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
};
|
|
}() :
|
|
|
|
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
function nonStandardBrowserEnv() {
|
|
return function isURLSameOrigin() {
|
|
return true;
|
|
};
|
|
}();
|
|
|
|
/***/ }),
|
|
/* 139 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var utils = __webpack_require__(10);
|
|
|
|
module.exports = function normalizeHeaderName(headers, normalizedName) {
|
|
utils.forEach(headers, function processHeader(value, name) {
|
|
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
headers[normalizedName] = value;
|
|
delete headers[name];
|
|
}
|
|
});
|
|
};
|
|
|
|
/***/ }),
|
|
/* 140 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var utils = __webpack_require__(10);
|
|
|
|
/**
|
|
* Parse headers into an object
|
|
*
|
|
* ```
|
|
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
* Content-Type: application/json
|
|
* Connection: keep-alive
|
|
* Transfer-Encoding: chunked
|
|
* ```
|
|
*
|
|
* @param {String} headers Headers needing to be parsed
|
|
* @returns {Object} Headers parsed into an object
|
|
*/
|
|
module.exports = function parseHeaders(headers) {
|
|
var parsed = {};
|
|
var key;
|
|
var val;
|
|
var i;
|
|
|
|
if (!headers) {
|
|
return parsed;
|
|
}
|
|
|
|
utils.forEach(headers.split('\n'), function parser(line) {
|
|
i = line.indexOf(':');
|
|
key = utils.trim(line.substr(0, i)).toLowerCase();
|
|
val = utils.trim(line.substr(i + 1));
|
|
|
|
if (key) {
|
|
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
}
|
|
});
|
|
|
|
return parsed;
|
|
};
|
|
|
|
/***/ }),
|
|
/* 141 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
/**
|
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
*
|
|
* Common use case would be to use `Function.prototype.apply`.
|
|
*
|
|
* ```js
|
|
* function f(x, y, z) {}
|
|
* var args = [1, 2, 3];
|
|
* f.apply(null, args);
|
|
* ```
|
|
*
|
|
* With `spread` this example can be re-written.
|
|
*
|
|
* ```js
|
|
* spread(function(x, y, z) {})([1, 2, 3]);
|
|
* ```
|
|
*
|
|
* @param {Function} callback
|
|
* @returns {Function}
|
|
*/
|
|
|
|
module.exports = function spread(callback) {
|
|
return function wrap(arr) {
|
|
return callback.apply(null, arr);
|
|
};
|
|
};
|
|
|
|
/***/ }),
|
|
/* 142 */,
|
|
/* 143 */,
|
|
/* 144 */,
|
|
/* 145 */,
|
|
/* 146 */,
|
|
/* 147 */,
|
|
/* 148 */,
|
|
/* 149 */,
|
|
/* 150 */,
|
|
/* 151 */,
|
|
/* 152 */,
|
|
/* 153 */,
|
|
/* 154 */,
|
|
/* 155 */,
|
|
/* 156 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.__esModule = true;
|
|
var loopAsync = exports.loopAsync = function loopAsync(turns, work, callback) {
|
|
var currentTurn = 0,
|
|
isDone = false;
|
|
var isSync = false,
|
|
hasNext = false,
|
|
doneArgs = void 0;
|
|
|
|
var done = function done() {
|
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
isDone = true;
|
|
|
|
if (isSync) {
|
|
// Iterate instead of recursing if possible.
|
|
doneArgs = args;
|
|
return;
|
|
}
|
|
|
|
callback.apply(undefined, args);
|
|
};
|
|
|
|
var next = function next() {
|
|
if (isDone) return;
|
|
|
|
hasNext = true;
|
|
|
|
if (isSync) return; // Iterate instead of recursing if possible.
|
|
|
|
isSync = true;
|
|
|
|
while (!isDone && currentTurn < turns && hasNext) {
|
|
hasNext = false;
|
|
work(currentTurn++, next, done);
|
|
}
|
|
|
|
isSync = false;
|
|
|
|
if (isDone) {
|
|
// This means the loop finished synchronously.
|
|
callback.apply(undefined, doneArgs);
|
|
return;
|
|
}
|
|
|
|
if (currentTurn >= turns && hasNext) {
|
|
isDone = true;
|
|
callback();
|
|
}
|
|
};
|
|
|
|
next();
|
|
};
|
|
|
|
/***/ }),
|
|
/* 157 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
exports.__esModule = true;
|
|
exports.replaceLocation = exports.pushLocation = exports.startListener = exports.getCurrentLocation = exports.go = exports.getUserConfirmation = undefined;
|
|
|
|
var _BrowserProtocol = __webpack_require__(46);
|
|
|
|
Object.defineProperty(exports, 'getUserConfirmation', {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return _BrowserProtocol.getUserConfirmation;
|
|
}
|
|
});
|
|
Object.defineProperty(exports, 'go', {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return _BrowserProtocol.go;
|
|
}
|
|
});
|
|
|
|
var _warning = __webpack_require__(19);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
var _LocationUtils = __webpack_require__(23);
|
|
|
|
var _DOMUtils = __webpack_require__(36);
|
|
|
|
var _DOMStateStorage = __webpack_require__(84);
|
|
|
|
var _PathUtils = __webpack_require__(16);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
var HashChangeEvent = 'hashchange';
|
|
|
|
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 getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation(pathCoder, queryKey) {
|
|
var path = pathCoder.decodePath(getHashPath());
|
|
var key = (0, _PathUtils.getQueryStringValueFromPath)(path, queryKey);
|
|
|
|
var state = void 0;
|
|
if (key) {
|
|
path = (0, _PathUtils.stripQueryStringValueFromPath)(path, queryKey);
|
|
state = (0, _DOMStateStorage.readState)(key);
|
|
}
|
|
|
|
var init = (0, _PathUtils.parsePath)(path);
|
|
init.state = state;
|
|
|
|
return (0, _LocationUtils.createLocation)(init, undefined, key);
|
|
};
|
|
|
|
var prevLocation = void 0;
|
|
|
|
var startListener = exports.startListener = function startListener(listener, pathCoder, queryKey) {
|
|
var handleHashChange = function handleHashChange() {
|
|
var path = getHashPath();
|
|
var encodedPath = pathCoder.encodePath(path);
|
|
|
|
if (path !== encodedPath) {
|
|
// Always be sure we have a properly-encoded hash.
|
|
replaceHashPath(encodedPath);
|
|
} else {
|
|
var currentLocation = getCurrentLocation(pathCoder, queryKey);
|
|
|
|
if (prevLocation && currentLocation.key && prevLocation.key === currentLocation.key) return; // Ignore extraneous hashchange events
|
|
|
|
prevLocation = currentLocation;
|
|
|
|
listener(currentLocation);
|
|
}
|
|
};
|
|
|
|
// Ensure the hash is encoded properly.
|
|
var path = getHashPath();
|
|
var encodedPath = pathCoder.encodePath(path);
|
|
|
|
if (path !== encodedPath) replaceHashPath(encodedPath);
|
|
|
|
(0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleHashChange);
|
|
|
|
return function () {
|
|
return (0, _DOMUtils.removeEventListener)(window, HashChangeEvent, handleHashChange);
|
|
};
|
|
};
|
|
|
|
var updateLocation = function updateLocation(location, pathCoder, queryKey, updateHash) {
|
|
var state = location.state;
|
|
var key = location.key;
|
|
|
|
var path = pathCoder.encodePath((0, _PathUtils.createPath)(location));
|
|
|
|
if (state !== undefined) {
|
|
path = (0, _PathUtils.addQueryStringValueToPath)(path, queryKey, key);
|
|
(0, _DOMStateStorage.saveState)(key, state);
|
|
}
|
|
|
|
prevLocation = location;
|
|
|
|
updateHash(path);
|
|
};
|
|
|
|
var pushLocation = exports.pushLocation = function pushLocation(location, pathCoder, queryKey) {
|
|
return updateLocation(location, pathCoder, queryKey, function (path) {
|
|
if (getHashPath() !== path) {
|
|
pushHashPath(path);
|
|
} else {
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, 'You cannot PUSH the same path using hash history') : void 0;
|
|
}
|
|
});
|
|
};
|
|
|
|
var replaceLocation = exports.replaceLocation = function replaceLocation(location, pathCoder, queryKey) {
|
|
return updateLocation(location, pathCoder, queryKey, function (path) {
|
|
if (getHashPath() !== path) replaceHashPath(path);
|
|
});
|
|
};
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 158 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.__esModule = true;
|
|
exports.replaceLocation = exports.pushLocation = exports.getCurrentLocation = exports.go = exports.getUserConfirmation = undefined;
|
|
|
|
var _BrowserProtocol = __webpack_require__(46);
|
|
|
|
Object.defineProperty(exports, 'getUserConfirmation', {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return _BrowserProtocol.getUserConfirmation;
|
|
}
|
|
});
|
|
Object.defineProperty(exports, 'go', {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return _BrowserProtocol.go;
|
|
}
|
|
});
|
|
|
|
var _LocationUtils = __webpack_require__(23);
|
|
|
|
var _PathUtils = __webpack_require__(16);
|
|
|
|
var getCurrentLocation = exports.getCurrentLocation = function getCurrentLocation() {
|
|
return (0, _LocationUtils.createLocation)(window.location);
|
|
};
|
|
|
|
var pushLocation = exports.pushLocation = function pushLocation(location) {
|
|
window.location.href = (0, _PathUtils.createPath)(location);
|
|
return false; // Don't update location
|
|
};
|
|
|
|
var replaceLocation = exports.replaceLocation = function replaceLocation(location) {
|
|
window.location.replace((0, _PathUtils.createPath)(location));
|
|
return false; // Don't update location
|
|
};
|
|
|
|
/***/ }),
|
|
/* 159 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
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 _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _ExecutionEnvironment = __webpack_require__(47);
|
|
|
|
var _BrowserProtocol = __webpack_require__(46);
|
|
|
|
var BrowserProtocol = _interopRequireWildcard(_BrowserProtocol);
|
|
|
|
var _RefreshProtocol = __webpack_require__(158);
|
|
|
|
var RefreshProtocol = _interopRequireWildcard(_RefreshProtocol);
|
|
|
|
var _DOMUtils = __webpack_require__(36);
|
|
|
|
var _createHistory = __webpack_require__(48);
|
|
|
|
var _createHistory2 = _interopRequireDefault(_createHistory);
|
|
|
|
function _interopRequireWildcard(obj) {
|
|
if (obj && obj.__esModule) {
|
|
return obj;
|
|
} else {
|
|
var newObj = {};if (obj != null) {
|
|
for (var key in obj) {
|
|
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
|
|
}
|
|
}newObj.default = obj;return newObj;
|
|
}
|
|
}
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
/**
|
|
* Creates and returns a history object that uses HTML5's history API
|
|
* (pushState, replaceState, and the popstate event) to manage history.
|
|
* This is the recommended method of managing history in browsers because
|
|
* it provides the cleanest URLs.
|
|
*
|
|
* Note: In browsers that do not support the HTML5 history API full
|
|
* page reloads will be used to preserve clean URLs. You can force this
|
|
* behavior using { forceRefresh: true } in options.
|
|
*/
|
|
var createBrowserHistory = function createBrowserHistory() {
|
|
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
|
|
|
!_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Browser history needs a DOM') : (0, _invariant2.default)(false) : void 0;
|
|
|
|
var useRefresh = options.forceRefresh || !(0, _DOMUtils.supportsHistory)();
|
|
var Protocol = useRefresh ? RefreshProtocol : BrowserProtocol;
|
|
|
|
var getUserConfirmation = Protocol.getUserConfirmation;
|
|
var getCurrentLocation = Protocol.getCurrentLocation;
|
|
var pushLocation = Protocol.pushLocation;
|
|
var replaceLocation = Protocol.replaceLocation;
|
|
var go = Protocol.go;
|
|
|
|
var history = (0, _createHistory2.default)(_extends({
|
|
getUserConfirmation: getUserConfirmation }, options, {
|
|
getCurrentLocation: getCurrentLocation,
|
|
pushLocation: pushLocation,
|
|
replaceLocation: replaceLocation,
|
|
go: go
|
|
}));
|
|
|
|
var listenerCount = 0,
|
|
stopListener = void 0;
|
|
|
|
var startListener = function startListener(listener, before) {
|
|
if (++listenerCount === 1) stopListener = BrowserProtocol.startListener(history.transitionTo);
|
|
|
|
var unlisten = before ? history.listenBefore(listener) : history.listen(listener);
|
|
|
|
return function () {
|
|
unlisten();
|
|
|
|
if (--listenerCount === 0) stopListener();
|
|
};
|
|
};
|
|
|
|
var listenBefore = function listenBefore(listener) {
|
|
return startListener(listener, true);
|
|
};
|
|
|
|
var listen = function listen(listener) {
|
|
return startListener(listener, false);
|
|
};
|
|
|
|
return _extends({}, history, {
|
|
listenBefore: listenBefore,
|
|
listen: listen
|
|
});
|
|
};
|
|
|
|
exports.default = createBrowserHistory;
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 160 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
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__(19);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _ExecutionEnvironment = __webpack_require__(47);
|
|
|
|
var _DOMUtils = __webpack_require__(36);
|
|
|
|
var _HashProtocol = __webpack_require__(157);
|
|
|
|
var HashProtocol = _interopRequireWildcard(_HashProtocol);
|
|
|
|
var _createHistory = __webpack_require__(48);
|
|
|
|
var _createHistory2 = _interopRequireDefault(_createHistory);
|
|
|
|
function _interopRequireWildcard(obj) {
|
|
if (obj && obj.__esModule) {
|
|
return obj;
|
|
} else {
|
|
var newObj = {};if (obj != null) {
|
|
for (var key in obj) {
|
|
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
|
|
}
|
|
}newObj.default = obj;return newObj;
|
|
}
|
|
}
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
var DefaultQueryKey = '_k';
|
|
|
|
var addLeadingSlash = function addLeadingSlash(path) {
|
|
return path.charAt(0) === '/' ? path : '/' + path;
|
|
};
|
|
|
|
var HashPathCoders = {
|
|
hashbang: {
|
|
encodePath: function encodePath(path) {
|
|
return path.charAt(0) === '!' ? path : '!' + path;
|
|
},
|
|
decodePath: function decodePath(path) {
|
|
return path.charAt(0) === '!' ? path.substring(1) : path;
|
|
}
|
|
},
|
|
noslash: {
|
|
encodePath: function encodePath(path) {
|
|
return path.charAt(0) === '/' ? path.substring(1) : path;
|
|
},
|
|
decodePath: addLeadingSlash
|
|
},
|
|
slash: {
|
|
encodePath: addLeadingSlash,
|
|
decodePath: addLeadingSlash
|
|
}
|
|
};
|
|
|
|
var createHashHistory = function createHashHistory() {
|
|
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
|
|
|
!_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Hash history needs a DOM') : (0, _invariant2.default)(false) : void 0;
|
|
|
|
var queryKey = options.queryKey;
|
|
var hashType = options.hashType;
|
|
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(queryKey !== false, 'Using { queryKey: false } no longer works. Instead, just don\'t ' + 'use location state if you don\'t want a key in your URL query string') : void 0;
|
|
|
|
if (typeof queryKey !== 'string') queryKey = DefaultQueryKey;
|
|
|
|
if (hashType == null) hashType = 'slash';
|
|
|
|
if (!(hashType in HashPathCoders)) {
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, 'Invalid hash type: %s', hashType) : void 0;
|
|
|
|
hashType = 'slash';
|
|
}
|
|
|
|
var pathCoder = HashPathCoders[hashType];
|
|
|
|
var getUserConfirmation = HashProtocol.getUserConfirmation;
|
|
|
|
var getCurrentLocation = function getCurrentLocation() {
|
|
return HashProtocol.getCurrentLocation(pathCoder, queryKey);
|
|
};
|
|
|
|
var pushLocation = function pushLocation(location) {
|
|
return HashProtocol.pushLocation(location, pathCoder, queryKey);
|
|
};
|
|
|
|
var replaceLocation = function replaceLocation(location) {
|
|
return HashProtocol.replaceLocation(location, pathCoder, queryKey);
|
|
};
|
|
|
|
var history = (0, _createHistory2.default)(_extends({
|
|
getUserConfirmation: getUserConfirmation }, options, {
|
|
getCurrentLocation: getCurrentLocation,
|
|
pushLocation: pushLocation,
|
|
replaceLocation: replaceLocation,
|
|
go: HashProtocol.go
|
|
}));
|
|
|
|
var listenerCount = 0,
|
|
stopListener = void 0;
|
|
|
|
var startListener = function startListener(listener, before) {
|
|
if (++listenerCount === 1) stopListener = HashProtocol.startListener(history.transitionTo, pathCoder, queryKey);
|
|
|
|
var unlisten = before ? history.listenBefore(listener) : history.listen(listener);
|
|
|
|
return function () {
|
|
unlisten();
|
|
|
|
if (--listenerCount === 0) stopListener();
|
|
};
|
|
};
|
|
|
|
var listenBefore = function listenBefore(listener) {
|
|
return startListener(listener, true);
|
|
};
|
|
|
|
var listen = function listen(listener) {
|
|
return startListener(listener, false);
|
|
};
|
|
|
|
var goIsSupportedWithoutReload = (0, _DOMUtils.supportsGoWithoutReloadUsingHash)();
|
|
|
|
var go = function go(n) {
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(goIsSupportedWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : void 0;
|
|
|
|
history.go(n);
|
|
};
|
|
|
|
var createHref = function createHref(path) {
|
|
return '#' + pathCoder.encodePath(history.createHref(path));
|
|
};
|
|
|
|
return _extends({}, history, {
|
|
listenBefore: listenBefore,
|
|
listen: listen,
|
|
go: go,
|
|
createHref: createHref
|
|
});
|
|
};
|
|
|
|
exports.default = createHashHistory;
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 161 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
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__(19);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _LocationUtils = __webpack_require__(23);
|
|
|
|
var _PathUtils = __webpack_require__(16);
|
|
|
|
var _createHistory = __webpack_require__(48);
|
|
|
|
var _createHistory2 = _interopRequireDefault(_createHistory);
|
|
|
|
var _Actions = __webpack_require__(35);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
var createStateStorage = function createStateStorage(entries) {
|
|
return entries.filter(function (entry) {
|
|
return entry.state;
|
|
}).reduce(function (memo, entry) {
|
|
memo[entry.key] = entry.state;
|
|
return memo;
|
|
}, {});
|
|
};
|
|
|
|
var createMemoryHistory = function createMemoryHistory() {
|
|
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
|
|
|
if (Array.isArray(options)) {
|
|
options = { entries: options };
|
|
} else if (typeof options === 'string') {
|
|
options = { entries: [options] };
|
|
}
|
|
|
|
var getCurrentLocation = function getCurrentLocation() {
|
|
var entry = entries[current];
|
|
var path = (0, _PathUtils.createPath)(entry);
|
|
|
|
var key = void 0,
|
|
state = void 0;
|
|
if (entry.key) {
|
|
key = entry.key;
|
|
state = readState(key);
|
|
}
|
|
|
|
var init = (0, _PathUtils.parsePath)(path);
|
|
|
|
return (0, _LocationUtils.createLocation)(_extends({}, init, { state: state }), undefined, key);
|
|
};
|
|
|
|
var canGo = function canGo(n) {
|
|
var index = current + n;
|
|
return index >= 0 && index < entries.length;
|
|
};
|
|
|
|
var go = function go(n) {
|
|
if (!n) return;
|
|
|
|
if (!canGo(n)) {
|
|
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, 'Cannot go(%s) there is not enough history', n) : void 0;
|
|
|
|
return;
|
|
}
|
|
|
|
current += n;
|
|
var currentLocation = getCurrentLocation();
|
|
|
|
// Change action to POP
|
|
history.transitionTo(_extends({}, currentLocation, { action: _Actions.POP }));
|
|
};
|
|
|
|
var pushLocation = function pushLocation(location) {
|
|
current += 1;
|
|
|
|
if (current < entries.length) entries.splice(current);
|
|
|
|
entries.push(location);
|
|
|
|
saveState(location.key, location.state);
|
|
};
|
|
|
|
var replaceLocation = function replaceLocation(location) {
|
|
entries[current] = location;
|
|
saveState(location.key, location.state);
|
|
};
|
|
|
|
var history = (0, _createHistory2.default)(_extends({}, options, {
|
|
getCurrentLocation: getCurrentLocation,
|
|
pushLocation: pushLocation,
|
|
replaceLocation: replaceLocation,
|
|
go: go
|
|
}));
|
|
|
|
var _options = options;
|
|
var entries = _options.entries;
|
|
var current = _options.current;
|
|
|
|
if (typeof entries === 'string') {
|
|
entries = [entries];
|
|
} else if (!Array.isArray(entries)) {
|
|
entries = ['/'];
|
|
}
|
|
|
|
entries = entries.map(function (entry) {
|
|
return (0, _LocationUtils.createLocation)(entry);
|
|
});
|
|
|
|
if (current == null) {
|
|
current = entries.length - 1;
|
|
} else {
|
|
!(current >= 0 && current < entries.length) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Current index must be >= 0 and < %s, was %s', entries.length, current) : (0, _invariant2.default)(false) : void 0;
|
|
}
|
|
|
|
var storage = createStateStorage(entries);
|
|
|
|
var saveState = function saveState(key, state) {
|
|
return storage[key] = state;
|
|
};
|
|
|
|
var readState = function readState(key) {
|
|
return storage[key];
|
|
};
|
|
|
|
return _extends({}, history, {
|
|
canGo: canGo
|
|
});
|
|
};
|
|
|
|
exports.default = createMemoryHistory;
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 162 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/**
|
|
* Copyright 2015, Yahoo! Inc.
|
|
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
*/
|
|
|
|
|
|
var REACT_STATICS = {
|
|
childContextTypes: true,
|
|
contextTypes: true,
|
|
defaultProps: true,
|
|
displayName: true,
|
|
getDefaultProps: true,
|
|
mixins: true,
|
|
propTypes: true,
|
|
type: true
|
|
};
|
|
|
|
var KNOWN_STATICS = {
|
|
name: true,
|
|
length: true,
|
|
prototype: true,
|
|
caller: true,
|
|
arguments: true,
|
|
arity: true
|
|
};
|
|
|
|
var isGetOwnPropertySymbolsAvailable = typeof Object.getOwnPropertySymbols === 'function';
|
|
|
|
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, customStatics) {
|
|
if (typeof sourceComponent !== 'string') {
|
|
// don't hoist over string (html) components
|
|
var keys = Object.getOwnPropertyNames(sourceComponent);
|
|
|
|
/* istanbul ignore else */
|
|
if (isGetOwnPropertySymbolsAvailable) {
|
|
keys = keys.concat(Object.getOwnPropertySymbols(sourceComponent));
|
|
}
|
|
|
|
for (var i = 0; i < keys.length; ++i) {
|
|
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]] && (!customStatics || !customStatics[keys[i]])) {
|
|
try {
|
|
targetComponent[keys[i]] = sourceComponent[keys[i]];
|
|
} catch (error) {}
|
|
}
|
|
}
|
|
}
|
|
|
|
return targetComponent;
|
|
};
|
|
|
|
/***/ }),
|
|
/* 163 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
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 strictUriEncode = __webpack_require__(263);
|
|
var objectAssign = __webpack_require__(5);
|
|
|
|
function encoderForArrayFormat(opts) {
|
|
switch (opts.arrayFormat) {
|
|
case 'index':
|
|
return function (key, value, index) {
|
|
return value === null ? [encode(key, opts), '[', index, ']'].join('') : [encode(key, opts), '[', encode(index, opts), ']=', encode(value, opts)].join('');
|
|
};
|
|
|
|
case 'bracket':
|
|
return function (key, value) {
|
|
return value === null ? encode(key, opts) : [encode(key, opts), '[]=', encode(value, opts)].join('');
|
|
};
|
|
|
|
default:
|
|
return function (key, value) {
|
|
return value === null ? encode(key, opts) : [encode(key, opts), '=', encode(value, opts)].join('');
|
|
};
|
|
}
|
|
}
|
|
|
|
function parserForArrayFormat(opts) {
|
|
var result;
|
|
|
|
switch (opts.arrayFormat) {
|
|
case 'index':
|
|
return function (key, value, accumulator) {
|
|
result = /\[(\d*)]$/.exec(key);
|
|
|
|
key = key.replace(/\[\d*]$/, '');
|
|
|
|
if (!result) {
|
|
accumulator[key] = value;
|
|
return;
|
|
}
|
|
|
|
if (accumulator[key] === undefined) {
|
|
accumulator[key] = {};
|
|
}
|
|
|
|
accumulator[key][result[1]] = value;
|
|
};
|
|
|
|
case 'bracket':
|
|
return function (key, value, accumulator) {
|
|
result = /(\[])$/.exec(key);
|
|
|
|
key = key.replace(/\[]$/, '');
|
|
|
|
if (!result || accumulator[key] === undefined) {
|
|
accumulator[key] = value;
|
|
return;
|
|
}
|
|
|
|
accumulator[key] = [].concat(accumulator[key], value);
|
|
};
|
|
|
|
default:
|
|
return function (key, value, accumulator) {
|
|
if (accumulator[key] === undefined) {
|
|
accumulator[key] = value;
|
|
return;
|
|
}
|
|
|
|
accumulator[key] = [].concat(accumulator[key], value);
|
|
};
|
|
}
|
|
}
|
|
|
|
function encode(value, opts) {
|
|
if (opts.encode) {
|
|
return opts.strict ? strictUriEncode(value) : encodeURIComponent(value);
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
function keysSorter(input) {
|
|
if (Array.isArray(input)) {
|
|
return input.sort();
|
|
} else if ((typeof input === 'undefined' ? 'undefined' : _typeof(input)) === 'object') {
|
|
return keysSorter(Object.keys(input)).sort(function (a, b) {
|
|
return Number(a) - Number(b);
|
|
}).map(function (key) {
|
|
return input[key];
|
|
});
|
|
}
|
|
|
|
return input;
|
|
}
|
|
|
|
exports.extract = function (str) {
|
|
return str.split('?')[1] || '';
|
|
};
|
|
|
|
exports.parse = function (str, opts) {
|
|
opts = objectAssign({ arrayFormat: 'none' }, opts);
|
|
|
|
var formatter = parserForArrayFormat(opts);
|
|
|
|
// Create an object with no prototype
|
|
// https://github.com/sindresorhus/query-string/issues/47
|
|
var ret = Object.create(null);
|
|
|
|
if (typeof str !== 'string') {
|
|
return ret;
|
|
}
|
|
|
|
str = str.trim().replace(/^(\?|#|&)/, '');
|
|
|
|
if (!str) {
|
|
return ret;
|
|
}
|
|
|
|
str.split('&').forEach(function (param) {
|
|
var parts = param.replace(/\+/g, ' ').split('=');
|
|
// Firefox (pre 40) decodes `%3D` to `=`
|
|
// https://github.com/sindresorhus/query-string/pull/37
|
|
var key = parts.shift();
|
|
var val = parts.length > 0 ? parts.join('=') : undefined;
|
|
|
|
// missing `=` should be `null`:
|
|
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
|
val = val === undefined ? null : decodeURIComponent(val);
|
|
|
|
formatter(decodeURIComponent(key), val, ret);
|
|
});
|
|
|
|
return Object.keys(ret).sort().reduce(function (result, key) {
|
|
var val = ret[key];
|
|
if (Boolean(val) && (typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object' && !Array.isArray(val)) {
|
|
// Sort object keys, not values
|
|
result[key] = keysSorter(val);
|
|
} else {
|
|
result[key] = val;
|
|
}
|
|
|
|
return result;
|
|
}, Object.create(null));
|
|
};
|
|
|
|
exports.stringify = function (obj, opts) {
|
|
var defaults = {
|
|
encode: true,
|
|
strict: true,
|
|
arrayFormat: 'none'
|
|
};
|
|
|
|
opts = objectAssign(defaults, opts);
|
|
|
|
var formatter = encoderForArrayFormat(opts);
|
|
|
|
return obj ? Object.keys(obj).sort().map(function (key) {
|
|
var val = obj[key];
|
|
|
|
if (val === undefined) {
|
|
return '';
|
|
}
|
|
|
|
if (val === null) {
|
|
return encode(key, opts);
|
|
}
|
|
|
|
if (Array.isArray(val)) {
|
|
var result = [];
|
|
|
|
val.slice().forEach(function (val2) {
|
|
if (val2 === undefined) {
|
|
return;
|
|
}
|
|
|
|
result.push(formatter(key, val2, result.length));
|
|
});
|
|
|
|
return result.join('&');
|
|
}
|
|
|
|
return encode(key, opts) + '=' + encode(val, opts);
|
|
}).filter(function (x) {
|
|
return x.length > 0;
|
|
}).join('&') : '';
|
|
};
|
|
|
|
/***/ }),
|
|
/* 164 */,
|
|
/* 165 */,
|
|
/* 166 */,
|
|
/* 167 */,
|
|
/* 168 */,
|
|
/* 169 */,
|
|
/* 170 */,
|
|
/* 171 */,
|
|
/* 172 */,
|
|
/* 173 */,
|
|
/* 174 */,
|
|
/* 175 */,
|
|
/* 176 */,
|
|
/* 177 */,
|
|
/* 178 */,
|
|
/* 179 */,
|
|
/* 180 */,
|
|
/* 181 */,
|
|
/* 182 */,
|
|
/* 183 */,
|
|
/* 184 */,
|
|
/* 185 */,
|
|
/* 186 */,
|
|
/* 187 */,
|
|
/* 188 */,
|
|
/* 189 */,
|
|
/* 190 */,
|
|
/* 191 */,
|
|
/* 192 */,
|
|
/* 193 */,
|
|
/* 194 */,
|
|
/* 195 */,
|
|
/* 196 */,
|
|
/* 197 */,
|
|
/* 198 */,
|
|
/* 199 */,
|
|
/* 200 */,
|
|
/* 201 */,
|
|
/* 202 */,
|
|
/* 203 */,
|
|
/* 204 */,
|
|
/* 205 */,
|
|
/* 206 */,
|
|
/* 207 */,
|
|
/* 208 */,
|
|
/* 209 */,
|
|
/* 210 */,
|
|
/* 211 */,
|
|
/* 212 */,
|
|
/* 213 */,
|
|
/* 214 */,
|
|
/* 215 */,
|
|
/* 216 */,
|
|
/* 217 */,
|
|
/* 218 */,
|
|
/* 219 */,
|
|
/* 220 */,
|
|
/* 221 */,
|
|
/* 222 */,
|
|
/* 223 */,
|
|
/* 224 */,
|
|
/* 225 */,
|
|
/* 226 */,
|
|
/* 227 */,
|
|
/* 228 */,
|
|
/* 229 */,
|
|
/* 230 */,
|
|
/* 231 */,
|
|
/* 232 */,
|
|
/* 233 */,
|
|
/* 234 */,
|
|
/* 235 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
|
|
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
|
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
if (( false ? 'undefined' : _typeof(exports)) === 'object' && ( false ? 'undefined' : _typeof(module)) === 'object') module.exports = factory(__webpack_require__(4));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') exports["Dropzone"] = factory(require("react"));else root["Dropzone"] = factory(root["react"]);
|
|
})(undefined, function (__WEBPACK_EXTERNAL_MODULE_1__) {
|
|
return (/******/function (modules) {
|
|
// webpackBootstrap
|
|
/******/ // The module cache
|
|
/******/var installedModules = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/function __webpack_require__(moduleId) {
|
|
/******/
|
|
/******/ // Check if module is in cache
|
|
/******/if (installedModules[moduleId])
|
|
/******/return installedModules[moduleId].exports;
|
|
/******/
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/var module = installedModules[moduleId] = {
|
|
/******/exports: {},
|
|
/******/id: moduleId,
|
|
/******/loaded: false
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
/******/
|
|
/******/ // Flag the module as loaded
|
|
/******/module.loaded = true;
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/return module.exports;
|
|
/******/
|
|
}
|
|
/******/
|
|
/******/
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
/******/__webpack_require__.m = modules;
|
|
/******/
|
|
/******/ // expose the module cache
|
|
/******/__webpack_require__.c = installedModules;
|
|
/******/
|
|
/******/ // __webpack_public_path__
|
|
/******/__webpack_require__.p = "";
|
|
/******/
|
|
/******/ // Load entry module and return exports
|
|
/******/return __webpack_require__(0);
|
|
/******/
|
|
}(
|
|
/************************************************************************/
|
|
/******/[
|
|
/* 0 */
|
|
/***/function (module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: 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 _createClass = function () {
|
|
function defineProperties(target, props) {
|
|
for (var i = 0; i < props.length; i++) {
|
|
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
|
|
}
|
|
}return function (Constructor, protoProps, staticProps) {
|
|
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
|
|
};
|
|
}();
|
|
|
|
var _react = __webpack_require__(1);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _attrAccept = __webpack_require__(2);
|
|
|
|
var _attrAccept2 = _interopRequireDefault(_attrAccept);
|
|
|
|
var _getDataTransferItems = __webpack_require__(3);
|
|
|
|
var _getDataTransferItems2 = _interopRequireDefault(_getDataTransferItems);
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
}
|
|
|
|
function _objectWithoutProperties(obj, keys) {
|
|
var target = {};for (var i in obj) {
|
|
if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i];
|
|
}return target;
|
|
}
|
|
|
|
function _classCallCheck(instance, Constructor) {
|
|
if (!(instance instanceof Constructor)) {
|
|
throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
}
|
|
|
|
function _possibleConstructorReturn(self, call) {
|
|
if (!self) {
|
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
}return call && ((typeof call === 'undefined' ? 'undefined' : _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 === 'undefined' ? 'undefined' : _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;
|
|
} /* eslint prefer-template: 0 */
|
|
|
|
var supportMultiple = typeof document !== 'undefined' && document && document.createElement ? 'multiple' in document.createElement('input') : true;
|
|
|
|
var Dropzone = function (_React$Component) {
|
|
_inherits(Dropzone, _React$Component);
|
|
|
|
function Dropzone(props, context) {
|
|
_classCallCheck(this, Dropzone);
|
|
|
|
var _this = _possibleConstructorReturn(this, (Dropzone.__proto__ || Object.getPrototypeOf(Dropzone)).call(this, props, context));
|
|
|
|
_this.onClick = _this.onClick.bind(_this);
|
|
_this.onDragStart = _this.onDragStart.bind(_this);
|
|
_this.onDragEnter = _this.onDragEnter.bind(_this);
|
|
_this.onDragLeave = _this.onDragLeave.bind(_this);
|
|
_this.onDragOver = _this.onDragOver.bind(_this);
|
|
_this.onDrop = _this.onDrop.bind(_this);
|
|
_this.onFileDialogCancel = _this.onFileDialogCancel.bind(_this);
|
|
_this.fileAccepted = _this.fileAccepted.bind(_this);
|
|
_this.isFileDialogActive = false;
|
|
_this.state = {
|
|
isDragActive: false
|
|
};
|
|
return _this;
|
|
}
|
|
|
|
_createClass(Dropzone, [{
|
|
key: 'componentDidMount',
|
|
value: function componentDidMount() {
|
|
this.enterCounter = 0;
|
|
// Tried implementing addEventListener, but didn't work out
|
|
document.body.onfocus = this.onFileDialogCancel;
|
|
}
|
|
}, {
|
|
key: 'componentWillUnmount',
|
|
value: function componentWillUnmount() {
|
|
// Can be replaced with removeEventListener, if addEventListener works
|
|
document.body.onfocus = null;
|
|
}
|
|
}, {
|
|
key: 'onDragStart',
|
|
value: function onDragStart(e) {
|
|
if (this.props.onDragStart) {
|
|
this.props.onDragStart.call(this, e);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'onDragEnter',
|
|
value: function onDragEnter(e) {
|
|
e.preventDefault();
|
|
|
|
// Count the dropzone and any children that are entered.
|
|
++this.enterCounter;
|
|
|
|
var allFilesAccepted = this.allFilesAccepted((0, _getDataTransferItems2.default)(e, this.props.multiple));
|
|
|
|
this.setState({
|
|
isDragActive: allFilesAccepted,
|
|
isDragReject: !allFilesAccepted
|
|
});
|
|
|
|
if (this.props.onDragEnter) {
|
|
this.props.onDragEnter.call(this, e);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'onDragOver',
|
|
value: function onDragOver(e) {
|
|
// eslint-disable-line class-methods-use-this
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
try {
|
|
e.dataTransfer.dropEffect = 'copy'; // eslint-disable-line no-param-reassign
|
|
} catch (err) {
|
|
// continue regardless of error
|
|
}
|
|
|
|
if (this.props.onDragOver) {
|
|
this.props.onDragOver.call(this, e);
|
|
}
|
|
return false;
|
|
}
|
|
}, {
|
|
key: 'onDragLeave',
|
|
value: function onDragLeave(e) {
|
|
e.preventDefault();
|
|
|
|
// Only deactivate once the dropzone and all children was left.
|
|
if (--this.enterCounter > 0) {
|
|
return;
|
|
}
|
|
|
|
this.setState({
|
|
isDragActive: false,
|
|
isDragReject: false
|
|
});
|
|
|
|
if (this.props.onDragLeave) {
|
|
this.props.onDragLeave.call(this, e);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'onDrop',
|
|
value: function onDrop(e) {
|
|
var _this2 = this;
|
|
|
|
var _props = this.props,
|
|
onDrop = _props.onDrop,
|
|
onDropAccepted = _props.onDropAccepted,
|
|
onDropRejected = _props.onDropRejected,
|
|
multiple = _props.multiple,
|
|
disablePreview = _props.disablePreview;
|
|
|
|
var fileList = (0, _getDataTransferItems2.default)(e, multiple);
|
|
var acceptedFiles = [];
|
|
var rejectedFiles = [];
|
|
|
|
// Stop default browser behavior
|
|
e.preventDefault();
|
|
|
|
// Reset the counter along with the drag on a drop.
|
|
this.enterCounter = 0;
|
|
this.isFileDialogActive = false;
|
|
|
|
fileList.forEach(function (file) {
|
|
if (!disablePreview) {
|
|
file.preview = window.URL.createObjectURL(file); // eslint-disable-line no-param-reassign
|
|
}
|
|
|
|
if (_this2.fileAccepted(file) && _this2.fileMatchSize(file)) {
|
|
acceptedFiles.push(file);
|
|
} else {
|
|
rejectedFiles.push(file);
|
|
}
|
|
});
|
|
|
|
if (onDrop) {
|
|
onDrop.call(this, acceptedFiles, rejectedFiles, e);
|
|
}
|
|
|
|
if (rejectedFiles.length > 0 && onDropRejected) {
|
|
onDropRejected.call(this, rejectedFiles, e);
|
|
}
|
|
|
|
if (acceptedFiles.length > 0 && onDropAccepted) {
|
|
onDropAccepted.call(this, acceptedFiles, e);
|
|
}
|
|
|
|
// Reset drag state
|
|
this.setState({
|
|
isDragActive: false,
|
|
isDragReject: false
|
|
});
|
|
}
|
|
}, {
|
|
key: 'onClick',
|
|
value: function onClick(e) {
|
|
var _props2 = this.props,
|
|
onClick = _props2.onClick,
|
|
disableClick = _props2.disableClick;
|
|
|
|
if (!disableClick) {
|
|
e.stopPropagation();
|
|
this.open();
|
|
if (onClick) {
|
|
onClick.call(this, e);
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: 'onFileDialogCancel',
|
|
value: function onFileDialogCancel() {
|
|
// timeout will not recognize context of this method
|
|
var onFileDialogCancel = this.props.onFileDialogCancel;
|
|
var fileInputEl = this.fileInputEl;
|
|
var isFileDialogActive = this.isFileDialogActive;
|
|
// execute the timeout only if the onFileDialogCancel is defined and FileDialog
|
|
// is opened in the browser
|
|
|
|
if (onFileDialogCancel && isFileDialogActive) {
|
|
setTimeout(function () {
|
|
// Returns an object as FileList
|
|
var FileList = fileInputEl.files;
|
|
if (!FileList.length) {
|
|
isFileDialogActive = false;
|
|
onFileDialogCancel();
|
|
}
|
|
}, 300);
|
|
}
|
|
}
|
|
}, {
|
|
key: 'fileAccepted',
|
|
value: function fileAccepted(file) {
|
|
return (0, _attrAccept2.default)(file, this.props.accept);
|
|
}
|
|
}, {
|
|
key: 'fileMatchSize',
|
|
value: function fileMatchSize(file) {
|
|
return file.size <= this.props.maxSize && file.size >= this.props.minSize;
|
|
}
|
|
}, {
|
|
key: 'allFilesAccepted',
|
|
value: function allFilesAccepted(files) {
|
|
return files.every(this.fileAccepted);
|
|
}
|
|
}, {
|
|
key: 'open',
|
|
value: function open() {
|
|
this.isFileDialogActive = true;
|
|
this.fileInputEl.value = null;
|
|
this.fileInputEl.click();
|
|
}
|
|
}, {
|
|
key: 'render',
|
|
value: function render() {
|
|
var _this3 = this;
|
|
|
|
var _props3 = this.props,
|
|
accept = _props3.accept,
|
|
activeClassName = _props3.activeClassName,
|
|
inputProps = _props3.inputProps,
|
|
multiple = _props3.multiple,
|
|
name = _props3.name,
|
|
rejectClassName = _props3.rejectClassName,
|
|
rest = _objectWithoutProperties(_props3, ['accept', 'activeClassName', 'inputProps', 'multiple', 'name', 'rejectClassName']);
|
|
|
|
var activeStyle = rest.activeStyle,
|
|
className = rest.className,
|
|
rejectStyle = rest.rejectStyle,
|
|
style = rest.style,
|
|
props = _objectWithoutProperties(rest, ['activeStyle', 'className', 'rejectStyle', 'style']);
|
|
|
|
var _state = this.state,
|
|
isDragActive = _state.isDragActive,
|
|
isDragReject = _state.isDragReject;
|
|
|
|
className = className || '';
|
|
|
|
if (isDragActive && activeClassName) {
|
|
className += ' ' + activeClassName;
|
|
}
|
|
if (isDragReject && rejectClassName) {
|
|
className += ' ' + rejectClassName;
|
|
}
|
|
|
|
if (!className && !style && !activeStyle && !rejectStyle) {
|
|
style = {
|
|
width: 200,
|
|
height: 200,
|
|
borderWidth: 2,
|
|
borderColor: '#666',
|
|
borderStyle: 'dashed',
|
|
borderRadius: 5
|
|
};
|
|
activeStyle = {
|
|
borderStyle: 'solid',
|
|
backgroundColor: '#eee'
|
|
};
|
|
rejectStyle = {
|
|
borderStyle: 'solid',
|
|
backgroundColor: '#ffdddd'
|
|
};
|
|
}
|
|
|
|
var appliedStyle = void 0;
|
|
if (activeStyle && isDragActive) {
|
|
appliedStyle = _extends({}, style, activeStyle);
|
|
} else if (rejectStyle && isDragReject) {
|
|
appliedStyle = _extends({}, style, rejectStyle);
|
|
} else {
|
|
appliedStyle = _extends({}, style);
|
|
}
|
|
|
|
var inputAttributes = {
|
|
accept: accept,
|
|
type: 'file',
|
|
style: { display: 'none' },
|
|
multiple: supportMultiple && multiple,
|
|
ref: function ref(el) {
|
|
return _this3.fileInputEl = el;
|
|
}, // eslint-disable-line
|
|
onChange: this.onDrop
|
|
};
|
|
|
|
if (name && name.length) {
|
|
inputAttributes.name = name;
|
|
}
|
|
|
|
// Remove custom properties before passing them to the wrapper div element
|
|
var customProps = ['acceptedFiles', 'disablePreview', 'disableClick', 'onDropAccepted', 'onDropRejected', 'onFileDialogCancel', 'maxSize', 'minSize'];
|
|
var divProps = _extends({}, props);
|
|
customProps.forEach(function (prop) {
|
|
return delete divProps[prop];
|
|
});
|
|
|
|
return _react2.default.createElement('div', _extends({
|
|
className: className,
|
|
style: appliedStyle
|
|
}, divProps /* expand user provided props first so event handlers are never overridden */, {
|
|
onClick: this.onClick,
|
|
onDragStart: this.onDragStart,
|
|
onDragEnter: this.onDragEnter,
|
|
onDragOver: this.onDragOver,
|
|
onDragLeave: this.onDragLeave,
|
|
onDrop: this.onDrop
|
|
}), this.props.children, _react2.default.createElement('input', _extends({}, inputProps /* expand user provided inputProps first so inputAttributes override them */, inputAttributes)));
|
|
}
|
|
}]);
|
|
|
|
return Dropzone;
|
|
}(_react2.default.Component);
|
|
|
|
Dropzone.defaultProps = {
|
|
disablePreview: false,
|
|
disableClick: false,
|
|
multiple: true,
|
|
maxSize: Infinity,
|
|
minSize: 0
|
|
};
|
|
|
|
Dropzone.propTypes = {
|
|
onClick: _react2.default.PropTypes.func,
|
|
onDrop: _react2.default.PropTypes.func,
|
|
onDropAccepted: _react2.default.PropTypes.func,
|
|
onDropRejected: _react2.default.PropTypes.func,
|
|
onDragStart: _react2.default.PropTypes.func,
|
|
onDragEnter: _react2.default.PropTypes.func,
|
|
onDragOver: _react2.default.PropTypes.func,
|
|
onDragLeave: _react2.default.PropTypes.func,
|
|
|
|
children: _react2.default.PropTypes.node, // Contents of the dropzone
|
|
style: _react2.default.PropTypes.object, // CSS styles to apply
|
|
activeStyle: _react2.default.PropTypes.object, // CSS styles to apply when drop will be accepted
|
|
rejectStyle: _react2.default.PropTypes.object, // CSS styles to apply when drop will be rejected
|
|
className: _react2.default.PropTypes.string, // Optional className
|
|
activeClassName: _react2.default.PropTypes.string, // className for accepted state
|
|
rejectClassName: _react2.default.PropTypes.string, // className for rejected state
|
|
|
|
disablePreview: _react2.default.PropTypes.bool, // Enable/disable preview generation
|
|
disableClick: _react2.default.PropTypes.bool, // Disallow clicking on the dropzone container to open file dialog
|
|
onFileDialogCancel: _react2.default.PropTypes.func, // Provide a callback on clicking the cancel button of the file dialog
|
|
|
|
inputProps: _react2.default.PropTypes.object, // Pass additional attributes to the <input type="file"/> tag
|
|
multiple: _react2.default.PropTypes.bool, // Allow dropping multiple files
|
|
accept: _react2.default.PropTypes.string, // Allow specific types of files. See https://github.com/okonet/attr-accept for more information
|
|
name: _react2.default.PropTypes.string, // name attribute for the input tag
|
|
maxSize: _react2.default.PropTypes.number,
|
|
minSize: _react2.default.PropTypes.number
|
|
};
|
|
|
|
exports.default = Dropzone;
|
|
module.exports = exports['default'];
|
|
|
|
/***/
|
|
},
|
|
/* 1 */
|
|
/***/function (module, exports) {
|
|
|
|
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
|
|
|
|
/***/
|
|
},
|
|
/* 2 */
|
|
/***/function (module, exports) {
|
|
|
|
module.exports = function (t) {
|
|
function n(e) {
|
|
if (r[e]) return r[e].exports;var o = r[e] = { exports: {}, id: e, loaded: !1 };return t[e].call(o.exports, o, o.exports, n), o.loaded = !0, o.exports;
|
|
}var r = {};return n.m = t, n.c = r, n.p = "", n(0);
|
|
}([function (t, n, r) {
|
|
"use strict";
|
|
n.__esModule = !0, r(8), r(9), n["default"] = function (t, n) {
|
|
if (t && n) {
|
|
var r = function () {
|
|
var r = Array.isArray(n) ? n : n.split(","),
|
|
e = t.name || "",
|
|
o = t.type || "",
|
|
i = o.replace(/\/.*$/, "");return { v: r.some(function (t) {
|
|
var n = t.trim();return "." === n.charAt(0) ? e.toLowerCase().endsWith(n.toLowerCase()) : /\/\*$/.test(n) ? i === n.replace(/\/.*$/, "") : o === n;
|
|
}) };
|
|
}();if ("object" == (typeof r === 'undefined' ? 'undefined' : _typeof(r))) return r.v;
|
|
}return !0;
|
|
}, t.exports = n["default"];
|
|
}, function (t, n) {
|
|
var r = t.exports = { version: "1.2.2" };"number" == typeof __e && (__e = r);
|
|
}, function (t, n) {
|
|
var r = t.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();"number" == typeof __g && (__g = r);
|
|
}, function (t, n, r) {
|
|
var e = r(2),
|
|
o = r(1),
|
|
i = r(4),
|
|
u = r(19),
|
|
c = "prototype",
|
|
f = function f(t, n) {
|
|
return function () {
|
|
return t.apply(n, arguments);
|
|
};
|
|
},
|
|
s = function s(t, n, r) {
|
|
var a,
|
|
p,
|
|
l,
|
|
y,
|
|
d = t & s.G,
|
|
h = t & s.P,
|
|
v = d ? e : t & s.S ? e[n] || (e[n] = {}) : (e[n] || {})[c],
|
|
x = d ? o : o[n] || (o[n] = {});d && (r = n);for (a in r) {
|
|
p = !(t & s.F) && v && a in v, l = (p ? v : r)[a], y = t & s.B && p ? f(l, e) : h && "function" == typeof l ? f(Function.call, l) : l, v && !p && u(v, a, l), x[a] != l && i(x, a, y), h && ((x[c] || (x[c] = {}))[a] = l);
|
|
}
|
|
};e.core = o, s.F = 1, s.G = 2, s.S = 4, s.P = 8, s.B = 16, s.W = 32, t.exports = s;
|
|
}, function (t, n, r) {
|
|
var e = r(5),
|
|
o = r(18);t.exports = r(22) ? function (t, n, r) {
|
|
return e.setDesc(t, n, o(1, r));
|
|
} : function (t, n, r) {
|
|
return t[n] = r, t;
|
|
};
|
|
}, function (t, n) {
|
|
var r = Object;t.exports = { create: r.create, getProto: r.getPrototypeOf, isEnum: {}.propertyIsEnumerable, getDesc: r.getOwnPropertyDescriptor, setDesc: r.defineProperty, setDescs: r.defineProperties, getKeys: r.keys, getNames: r.getOwnPropertyNames, getSymbols: r.getOwnPropertySymbols, each: [].forEach };
|
|
}, function (t, n) {
|
|
var r = 0,
|
|
e = Math.random();t.exports = function (t) {
|
|
return "Symbol(".concat(void 0 === t ? "" : t, ")_", (++r + e).toString(36));
|
|
};
|
|
}, function (t, n, r) {
|
|
var e = r(20)("wks"),
|
|
o = r(2).Symbol;t.exports = function (t) {
|
|
return e[t] || (e[t] = o && o[t] || (o || r(6))("Symbol." + t));
|
|
};
|
|
}, function (t, n, r) {
|
|
r(26), t.exports = r(1).Array.some;
|
|
}, function (t, n, r) {
|
|
r(25), t.exports = r(1).String.endsWith;
|
|
}, function (t, n) {
|
|
t.exports = function (t) {
|
|
if ("function" != typeof t) throw TypeError(t + " is not a function!");return t;
|
|
};
|
|
}, function (t, n) {
|
|
var r = {}.toString;t.exports = function (t) {
|
|
return r.call(t).slice(8, -1);
|
|
};
|
|
}, function (t, n, r) {
|
|
var e = r(10);t.exports = function (t, n, r) {
|
|
if (e(t), void 0 === n) return t;switch (r) {case 1:
|
|
return function (r) {
|
|
return t.call(n, r);
|
|
};case 2:
|
|
return function (r, e) {
|
|
return t.call(n, r, e);
|
|
};case 3:
|
|
return function (r, e, o) {
|
|
return t.call(n, r, e, o);
|
|
};}return function () {
|
|
return t.apply(n, arguments);
|
|
};
|
|
};
|
|
}, function (t, n) {
|
|
t.exports = function (t) {
|
|
if (void 0 == t) throw TypeError("Can't call method on " + t);return t;
|
|
};
|
|
}, function (t, n, r) {
|
|
t.exports = function (t) {
|
|
var n = /./;try {
|
|
"/./"[t](n);
|
|
} catch (e) {
|
|
try {
|
|
return n[r(7)("match")] = !1, !"/./"[t](n);
|
|
} catch (o) {}
|
|
}return !0;
|
|
};
|
|
}, function (t, n) {
|
|
t.exports = function (t) {
|
|
try {
|
|
return !!t();
|
|
} catch (n) {
|
|
return !0;
|
|
}
|
|
};
|
|
}, function (t, n) {
|
|
t.exports = function (t) {
|
|
return "object" == (typeof t === 'undefined' ? 'undefined' : _typeof(t)) ? null !== t : "function" == typeof t;
|
|
};
|
|
}, function (t, n, r) {
|
|
var e = r(16),
|
|
o = r(11),
|
|
i = r(7)("match");t.exports = function (t) {
|
|
var n;return e(t) && (void 0 !== (n = t[i]) ? !!n : "RegExp" == o(t));
|
|
};
|
|
}, function (t, n) {
|
|
t.exports = function (t, n) {
|
|
return { enumerable: !(1 & t), configurable: !(2 & t), writable: !(4 & t), value: n };
|
|
};
|
|
}, function (t, n, r) {
|
|
var e = r(2),
|
|
o = r(4),
|
|
i = r(6)("src"),
|
|
u = "toString",
|
|
c = Function[u],
|
|
f = ("" + c).split(u);r(1).inspectSource = function (t) {
|
|
return c.call(t);
|
|
}, (t.exports = function (t, n, r, u) {
|
|
"function" == typeof r && (o(r, i, t[n] ? "" + t[n] : f.join(String(n))), "name" in r || (r.name = n)), t === e ? t[n] = r : (u || delete t[n], o(t, n, r));
|
|
})(Function.prototype, u, function () {
|
|
return "function" == typeof this && this[i] || c.call(this);
|
|
});
|
|
}, function (t, n, r) {
|
|
var e = r(2),
|
|
o = "__core-js_shared__",
|
|
i = e[o] || (e[o] = {});t.exports = function (t) {
|
|
return i[t] || (i[t] = {});
|
|
};
|
|
}, function (t, n, r) {
|
|
var e = r(17),
|
|
o = r(13);t.exports = function (t, n, r) {
|
|
if (e(n)) throw TypeError("String#" + r + " doesn't accept regex!");return String(o(t));
|
|
};
|
|
}, function (t, n, r) {
|
|
t.exports = !r(15)(function () {
|
|
return 7 != Object.defineProperty({}, "a", { get: function get() {
|
|
return 7;
|
|
} }).a;
|
|
});
|
|
}, function (t, n) {
|
|
var r = Math.ceil,
|
|
e = Math.floor;t.exports = function (t) {
|
|
return isNaN(t = +t) ? 0 : (t > 0 ? e : r)(t);
|
|
};
|
|
}, function (t, n, r) {
|
|
var e = r(23),
|
|
o = Math.min;t.exports = function (t) {
|
|
return t > 0 ? o(e(t), 9007199254740991) : 0;
|
|
};
|
|
}, function (t, n, r) {
|
|
"use strict";
|
|
var e = r(3),
|
|
o = r(24),
|
|
i = r(21),
|
|
u = "endsWith",
|
|
c = ""[u];e(e.P + e.F * r(14)(u), "String", { endsWith: function endsWith(t) {
|
|
var n = i(this, t, u),
|
|
r = arguments,
|
|
e = r.length > 1 ? r[1] : void 0,
|
|
f = o(n.length),
|
|
s = void 0 === e ? f : Math.min(o(e), f),
|
|
a = String(t);return c ? c.call(n, a, s) : n.slice(s - a.length, s) === a;
|
|
} });
|
|
}, function (t, n, r) {
|
|
var e = r(5),
|
|
o = r(3),
|
|
i = r(1).Array || Array,
|
|
u = {},
|
|
c = function c(t, n) {
|
|
e.each.call(t.split(","), function (t) {
|
|
void 0 == n && t in i ? u[t] = i[t] : t in [] && (u[t] = r(12)(Function.call, [][t], n));
|
|
});
|
|
};c("pop,reverse,shift,keys,values,entries", 1), c("indexOf,every,some,forEach,map,filter,find,findIndex,includes", 3), c("join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill"), o(o.S, "Array", u);
|
|
}]);
|
|
|
|
/***/
|
|
},
|
|
/* 3 */
|
|
/***/function (module, exports) {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = getDataTransferFiles;
|
|
function getDataTransferFiles(event) {
|
|
var isMultipleAllowed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
|
|
var dataTransferItemsList = [];
|
|
if (event.dataTransfer) {
|
|
var dt = event.dataTransfer;
|
|
if (dt.files && dt.files.length) {
|
|
dataTransferItemsList = dt.files;
|
|
} else if (dt.items && dt.items.length) {
|
|
// During the drag even the dataTransfer.files is null
|
|
// but Chrome implements some drag store, which is accesible via dataTransfer.items
|
|
dataTransferItemsList = dt.items;
|
|
}
|
|
} else if (event.target && event.target.files) {
|
|
dataTransferItemsList = event.target.files;
|
|
}
|
|
|
|
if (dataTransferItemsList.length > 0) {
|
|
dataTransferItemsList = isMultipleAllowed ? dataTransferItemsList : [dataTransferItemsList[0]];
|
|
}
|
|
|
|
// Convert from DataTransferItemsList to the native Array
|
|
return Array.prototype.slice.call(dataTransferItemsList);
|
|
}
|
|
module.exports = exports["default"];
|
|
|
|
/***/
|
|
}
|
|
/******/])
|
|
);
|
|
});
|
|
;
|
|
//# sourceMappingURL=index.js.map
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(264)(module)))
|
|
|
|
/***/ }),
|
|
/* 236 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _Link = __webpack_require__(108);
|
|
|
|
var _Link2 = _interopRequireDefault(_Link);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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;
|
|
};
|
|
|
|
/**
|
|
* An <IndexLink> is used to link to an <IndexRoute>.
|
|
*/
|
|
var IndexLink = _react2.default.createClass({
|
|
displayName: 'IndexLink',
|
|
render: function render() {
|
|
return _react2.default.createElement(_Link2.default, _extends({}, this.props, { onlyActiveOnIndex: true }));
|
|
}
|
|
});
|
|
|
|
exports.default = IndexLink;
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 237 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _routerWarning = __webpack_require__(27);
|
|
|
|
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _Redirect = __webpack_require__(110);
|
|
|
|
var _Redirect2 = _interopRequireDefault(_Redirect);
|
|
|
|
var _InternalPropTypes = __webpack_require__(34);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var _React$PropTypes = _react2.default.PropTypes,
|
|
string = _React$PropTypes.string,
|
|
object = _React$PropTypes.object;
|
|
|
|
/**
|
|
* An <IndexRedirect> is used to redirect from an indexRoute.
|
|
*/
|
|
/* eslint-disable react/require-render-return */
|
|
|
|
var IndexRedirect = _react2.default.createClass({
|
|
displayName: 'IndexRedirect',
|
|
|
|
statics: {
|
|
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
|
|
/* istanbul ignore else: sanity check */
|
|
if (parentRoute) {
|
|
parentRoute.indexRoute = _Redirect2.default.createRouteFromReactElement(element);
|
|
} else {
|
|
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'An <IndexRedirect> does not make sense at the root of your route config') : void 0;
|
|
}
|
|
}
|
|
},
|
|
|
|
propTypes: {
|
|
to: string.isRequired,
|
|
query: object,
|
|
state: object,
|
|
onEnter: _InternalPropTypes.falsy,
|
|
children: _InternalPropTypes.falsy
|
|
},
|
|
|
|
/* istanbul ignore next: sanity check */
|
|
render: function render() {
|
|
true ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<IndexRedirect> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
|
|
}
|
|
});
|
|
|
|
exports.default = IndexRedirect;
|
|
module.exports = exports['default'];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 238 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _routerWarning = __webpack_require__(27);
|
|
|
|
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _RouteUtils = __webpack_require__(18);
|
|
|
|
var _InternalPropTypes = __webpack_require__(34);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var func = _react2.default.PropTypes.func;
|
|
|
|
/**
|
|
* An <IndexRoute> is used to specify its parent's <Route indexRoute> in
|
|
* a JSX route config.
|
|
*/
|
|
/* eslint-disable react/require-render-return */
|
|
|
|
var IndexRoute = _react2.default.createClass({
|
|
displayName: 'IndexRoute',
|
|
|
|
statics: {
|
|
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
|
|
/* istanbul ignore else: sanity check */
|
|
if (parentRoute) {
|
|
parentRoute.indexRoute = (0, _RouteUtils.createRouteFromReactElement)(element);
|
|
} else {
|
|
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(false, 'An <IndexRoute> does not make sense at the root of your route config') : void 0;
|
|
}
|
|
}
|
|
},
|
|
|
|
propTypes: {
|
|
path: _InternalPropTypes.falsy,
|
|
component: _InternalPropTypes.component,
|
|
components: _InternalPropTypes.components,
|
|
getComponent: func,
|
|
getComponents: func
|
|
},
|
|
|
|
/* istanbul ignore next: sanity check */
|
|
render: function render() {
|
|
true ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<IndexRoute> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
|
|
}
|
|
});
|
|
|
|
exports.default = IndexRoute;
|
|
module.exports = exports['default'];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 239 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _RouteUtils = __webpack_require__(18);
|
|
|
|
var _InternalPropTypes = __webpack_require__(34);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var _React$PropTypes = _react2.default.PropTypes,
|
|
string = _React$PropTypes.string,
|
|
func = _React$PropTypes.func;
|
|
|
|
/**
|
|
* A <Route> is used to declare which components are rendered to the
|
|
* page when the URL matches a given pattern.
|
|
*
|
|
* Routes are arranged in a nested tree structure. When a new URL is
|
|
* requested, the tree is searched depth-first to find a route whose
|
|
* path matches the URL. When one is found, all routes in the tree
|
|
* that lead to it are considered "active" and their components are
|
|
* rendered into the DOM, nested in the same order as in the tree.
|
|
*/
|
|
/* eslint-disable react/require-render-return */
|
|
|
|
var Route = _react2.default.createClass({
|
|
displayName: 'Route',
|
|
|
|
statics: {
|
|
createRouteFromReactElement: _RouteUtils.createRouteFromReactElement
|
|
},
|
|
|
|
propTypes: {
|
|
path: string,
|
|
component: _InternalPropTypes.component,
|
|
components: _InternalPropTypes.components,
|
|
getComponent: func,
|
|
getComponents: func
|
|
},
|
|
|
|
/* istanbul ignore next: sanity check */
|
|
render: function render() {
|
|
true ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, '<Route> elements are for router configuration only and should not be rendered') : (0, _invariant2.default)(false) : void 0;
|
|
}
|
|
});
|
|
|
|
exports.default = Route;
|
|
module.exports = exports['default'];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 240 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _createTransitionManager2 = __webpack_require__(114);
|
|
|
|
var _createTransitionManager3 = _interopRequireDefault(_createTransitionManager2);
|
|
|
|
var _InternalPropTypes = __webpack_require__(34);
|
|
|
|
var _RouterContext = __webpack_require__(68);
|
|
|
|
var _RouterContext2 = _interopRequireDefault(_RouterContext);
|
|
|
|
var _RouteUtils = __webpack_require__(18);
|
|
|
|
var _RouterUtils = __webpack_require__(111);
|
|
|
|
var _routerWarning = __webpack_require__(27);
|
|
|
|
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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;
|
|
};
|
|
|
|
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;
|
|
}
|
|
|
|
var _React$PropTypes = _react2.default.PropTypes,
|
|
func = _React$PropTypes.func,
|
|
object = _React$PropTypes.object;
|
|
|
|
/**
|
|
* A <Router> is a high-level API for automatically setting up
|
|
* a router that renders a <RouterContext> with all the props
|
|
* it needs each time the URL changes.
|
|
*/
|
|
|
|
var Router = _react2.default.createClass({
|
|
displayName: 'Router',
|
|
|
|
propTypes: {
|
|
history: object,
|
|
children: _InternalPropTypes.routes,
|
|
routes: _InternalPropTypes.routes, // alias for children
|
|
render: func,
|
|
createElement: func,
|
|
onError: func,
|
|
onUpdate: func,
|
|
|
|
// PRIVATE: For client-side rehydration of server match.
|
|
matchContext: object
|
|
},
|
|
|
|
getDefaultProps: function getDefaultProps() {
|
|
return {
|
|
render: function render(props) {
|
|
return _react2.default.createElement(_RouterContext2.default, props);
|
|
}
|
|
};
|
|
},
|
|
getInitialState: function getInitialState() {
|
|
return {
|
|
location: null,
|
|
routes: null,
|
|
params: null,
|
|
components: null
|
|
};
|
|
},
|
|
handleError: function handleError(error) {
|
|
if (this.props.onError) {
|
|
this.props.onError.call(this, error);
|
|
} else {
|
|
// Throw errors by default so we don't silently swallow them!
|
|
throw error; // This error probably occurred in getChildRoutes or getComponents.
|
|
}
|
|
},
|
|
createRouterObject: function createRouterObject(state) {
|
|
var matchContext = this.props.matchContext;
|
|
|
|
if (matchContext) {
|
|
return matchContext.router;
|
|
}
|
|
|
|
var history = this.props.history;
|
|
|
|
return (0, _RouterUtils.createRouterObject)(history, this.transitionManager, state);
|
|
},
|
|
createTransitionManager: function createTransitionManager() {
|
|
var matchContext = this.props.matchContext;
|
|
|
|
if (matchContext) {
|
|
return matchContext.transitionManager;
|
|
}
|
|
|
|
var history = this.props.history;
|
|
var _props = this.props,
|
|
routes = _props.routes,
|
|
children = _props.children;
|
|
|
|
!history.getCurrentLocation ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'You have provided a history object created with history v4.x or v2.x ' + 'and earlier. This version of React Router is only compatible with v3 ' + 'history objects. Please change to history v3.x.') : (0, _invariant2.default)(false) : void 0;
|
|
|
|
return (0, _createTransitionManager3.default)(history, (0, _RouteUtils.createRoutes)(routes || children));
|
|
},
|
|
componentWillMount: function componentWillMount() {
|
|
var _this = this;
|
|
|
|
this.transitionManager = this.createTransitionManager();
|
|
this.router = this.createRouterObject(this.state);
|
|
|
|
this._unlisten = this.transitionManager.listen(function (error, state) {
|
|
if (error) {
|
|
_this.handleError(error);
|
|
} else {
|
|
// Keep the identity of this.router because of a caveat in ContextUtils:
|
|
// they only work if the object identity is preserved.
|
|
(0, _RouterUtils.assignRouterState)(_this.router, state);
|
|
_this.setState(state, _this.props.onUpdate);
|
|
}
|
|
});
|
|
},
|
|
|
|
/* istanbul ignore next: sanity check */
|
|
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
|
|
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(nextProps.history === this.props.history, 'You cannot change <Router history>; it will be ignored') : void 0;
|
|
|
|
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)((nextProps.routes || nextProps.children) === (this.props.routes || this.props.children), 'You cannot change <Router routes>; it will be ignored') : void 0;
|
|
},
|
|
componentWillUnmount: function componentWillUnmount() {
|
|
if (this._unlisten) this._unlisten();
|
|
},
|
|
render: function render() {
|
|
var _state = this.state,
|
|
location = _state.location,
|
|
routes = _state.routes,
|
|
params = _state.params,
|
|
components = _state.components;
|
|
|
|
var _props2 = this.props,
|
|
createElement = _props2.createElement,
|
|
render = _props2.render,
|
|
props = _objectWithoutProperties(_props2, ['createElement', 'render']);
|
|
|
|
if (location == null) return null; // Async match
|
|
|
|
// Only forward non-Router-specific props to routing context, as those are
|
|
// the only ones that might be custom routing context props.
|
|
Object.keys(Router.propTypes).forEach(function (propType) {
|
|
return delete props[propType];
|
|
});
|
|
|
|
return render(_extends({}, props, {
|
|
router: this.router,
|
|
location: location,
|
|
routes: routes,
|
|
params: params,
|
|
components: components,
|
|
createElement: createElement
|
|
}));
|
|
}
|
|
});
|
|
|
|
exports.default = Router;
|
|
module.exports = exports['default'];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 241 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.runEnterHooks = runEnterHooks;
|
|
exports.runChangeHooks = runChangeHooks;
|
|
exports.runLeaveHooks = runLeaveHooks;
|
|
|
|
var _AsyncUtils = __webpack_require__(65);
|
|
|
|
function _classCallCheck(instance, Constructor) {
|
|
if (!(instance instanceof Constructor)) {
|
|
throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
}
|
|
|
|
var PendingHooks = function PendingHooks() {
|
|
var _this = this;
|
|
|
|
_classCallCheck(this, PendingHooks);
|
|
|
|
this.hooks = [];
|
|
|
|
this.add = function (hook) {
|
|
return _this.hooks.push(hook);
|
|
};
|
|
|
|
this.remove = function (hook) {
|
|
return _this.hooks = _this.hooks.filter(function (h) {
|
|
return h !== hook;
|
|
});
|
|
};
|
|
|
|
this.has = function (hook) {
|
|
return _this.hooks.indexOf(hook) !== -1;
|
|
};
|
|
|
|
this.clear = function () {
|
|
return _this.hooks = [];
|
|
};
|
|
};
|
|
|
|
var enterHooks = new PendingHooks();
|
|
var changeHooks = new PendingHooks();
|
|
|
|
function createTransitionHook(hook, route, asyncArity, pendingHooks) {
|
|
var isSync = hook.length < asyncArity;
|
|
|
|
var transitionHook = function transitionHook() {
|
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
hook.apply(route, args);
|
|
|
|
if (isSync) {
|
|
var callback = args[args.length - 1];
|
|
// Assume hook executes synchronously and
|
|
// automatically call the callback.
|
|
callback();
|
|
}
|
|
};
|
|
|
|
pendingHooks.add(transitionHook);
|
|
|
|
return transitionHook;
|
|
}
|
|
|
|
function getEnterHooks(routes) {
|
|
return routes.reduce(function (hooks, route) {
|
|
if (route.onEnter) hooks.push(createTransitionHook(route.onEnter, route, 3, enterHooks));
|
|
return hooks;
|
|
}, []);
|
|
}
|
|
|
|
function getChangeHooks(routes) {
|
|
return routes.reduce(function (hooks, route) {
|
|
if (route.onChange) hooks.push(createTransitionHook(route.onChange, route, 4, changeHooks));
|
|
return hooks;
|
|
}, []);
|
|
}
|
|
|
|
function runTransitionHooks(length, iter, callback) {
|
|
if (!length) {
|
|
callback();
|
|
return;
|
|
}
|
|
|
|
var redirectInfo = void 0;
|
|
function replace(location) {
|
|
redirectInfo = location;
|
|
}
|
|
|
|
(0, _AsyncUtils.loopAsync)(length, function (index, next, done) {
|
|
iter(index, replace, function (error) {
|
|
if (error || redirectInfo) {
|
|
done(error, redirectInfo); // No need to continue.
|
|
} else {
|
|
next();
|
|
}
|
|
});
|
|
}, callback);
|
|
}
|
|
|
|
/**
|
|
* Runs all onEnter hooks in the given array of routes in order
|
|
* with onEnter(nextState, replace, callback) and calls
|
|
* callback(error, redirectInfo) when finished. The first hook
|
|
* to use replace short-circuits the loop.
|
|
*
|
|
* If a hook needs to run asynchronously, it may use the callback
|
|
* function. However, doing so will cause the transition to pause,
|
|
* which could lead to a non-responsive UI if the hook is slow.
|
|
*/
|
|
function runEnterHooks(routes, nextState, callback) {
|
|
enterHooks.clear();
|
|
var hooks = getEnterHooks(routes);
|
|
return runTransitionHooks(hooks.length, function (index, replace, next) {
|
|
var wrappedNext = function wrappedNext() {
|
|
if (enterHooks.has(hooks[index])) {
|
|
next.apply(undefined, arguments);
|
|
enterHooks.remove(hooks[index]);
|
|
}
|
|
};
|
|
hooks[index](nextState, replace, wrappedNext);
|
|
}, callback);
|
|
}
|
|
|
|
/**
|
|
* Runs all onChange hooks in the given array of routes in order
|
|
* with onChange(prevState, nextState, replace, callback) and calls
|
|
* callback(error, redirectInfo) when finished. The first hook
|
|
* to use replace short-circuits the loop.
|
|
*
|
|
* If a hook needs to run asynchronously, it may use the callback
|
|
* function. However, doing so will cause the transition to pause,
|
|
* which could lead to a non-responsive UI if the hook is slow.
|
|
*/
|
|
function runChangeHooks(routes, state, nextState, callback) {
|
|
changeHooks.clear();
|
|
var hooks = getChangeHooks(routes);
|
|
return runTransitionHooks(hooks.length, function (index, replace, next) {
|
|
var wrappedNext = function wrappedNext() {
|
|
if (changeHooks.has(hooks[index])) {
|
|
next.apply(undefined, arguments);
|
|
changeHooks.remove(hooks[index]);
|
|
}
|
|
};
|
|
hooks[index](state, nextState, replace, wrappedNext);
|
|
}, callback);
|
|
}
|
|
|
|
/**
|
|
* Runs all onLeave hooks in the given array of routes in order.
|
|
*/
|
|
function runLeaveHooks(routes, prevState) {
|
|
for (var i = 0, len = routes.length; i < len; ++i) {
|
|
if (routes[i].onLeave) routes[i].onLeave.call(routes[i], prevState);
|
|
}
|
|
}
|
|
|
|
/***/ }),
|
|
/* 242 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _RouterContext = __webpack_require__(68);
|
|
|
|
var _RouterContext2 = _interopRequireDefault(_RouterContext);
|
|
|
|
var _routerWarning = __webpack_require__(27);
|
|
|
|
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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;
|
|
};
|
|
|
|
exports.default = function () {
|
|
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
|
|
middlewares[_key] = arguments[_key];
|
|
}
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
middlewares.forEach(function (middleware, index) {
|
|
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(middleware.renderRouterContext || middleware.renderRouteComponent, 'The middleware specified at index ' + index + ' does not appear to be ' + 'a valid React Router middleware.') : void 0;
|
|
});
|
|
}
|
|
|
|
var withContext = middlewares.map(function (middleware) {
|
|
return middleware.renderRouterContext;
|
|
}).filter(Boolean);
|
|
var withComponent = middlewares.map(function (middleware) {
|
|
return middleware.renderRouteComponent;
|
|
}).filter(Boolean);
|
|
|
|
var makeCreateElement = function makeCreateElement() {
|
|
var baseCreateElement = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _react.createElement;
|
|
return function (Component, props) {
|
|
return withComponent.reduceRight(function (previous, renderRouteComponent) {
|
|
return renderRouteComponent(previous, props);
|
|
}, baseCreateElement(Component, props));
|
|
};
|
|
};
|
|
|
|
return function (renderProps) {
|
|
return withContext.reduceRight(function (previous, renderRouterContext) {
|
|
return renderRouterContext(previous, renderProps);
|
|
}, _react2.default.createElement(_RouterContext2.default, _extends({}, renderProps, {
|
|
createElement: makeCreateElement(renderProps.createElement)
|
|
})));
|
|
};
|
|
};
|
|
|
|
module.exports = exports['default'];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 243 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createBrowserHistory = __webpack_require__(159);
|
|
|
|
var _createBrowserHistory2 = _interopRequireDefault(_createBrowserHistory);
|
|
|
|
var _createRouterHistory = __webpack_require__(113);
|
|
|
|
var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = (0, _createRouterHistory2.default)(_createBrowserHistory2.default);
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 244 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _PatternUtils = __webpack_require__(26);
|
|
|
|
function routeParamsChanged(route, prevState, nextState) {
|
|
if (!route.path) return false;
|
|
|
|
var paramNames = (0, _PatternUtils.getParamNames)(route.path);
|
|
|
|
return paramNames.some(function (paramName) {
|
|
return prevState.params[paramName] !== nextState.params[paramName];
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Returns an object of { leaveRoutes, changeRoutes, enterRoutes } determined by
|
|
* the change from prevState to nextState. We leave routes if either
|
|
* 1) they are not in the next state or 2) they are in the next state
|
|
* but their params have changed (i.e. /users/123 => /users/456).
|
|
*
|
|
* leaveRoutes are ordered starting at the leaf route of the tree
|
|
* we're leaving up to the common parent route. enterRoutes are ordered
|
|
* from the top of the tree we're entering down to the leaf route.
|
|
*
|
|
* changeRoutes are any routes that didn't leave or enter during
|
|
* the transition.
|
|
*/
|
|
function computeChangedRoutes(prevState, nextState) {
|
|
var prevRoutes = prevState && prevState.routes;
|
|
var nextRoutes = nextState.routes;
|
|
|
|
var leaveRoutes = void 0,
|
|
changeRoutes = void 0,
|
|
enterRoutes = void 0;
|
|
if (prevRoutes) {
|
|
(function () {
|
|
var parentIsLeaving = false;
|
|
leaveRoutes = prevRoutes.filter(function (route) {
|
|
if (parentIsLeaving) {
|
|
return true;
|
|
} else {
|
|
var isLeaving = nextRoutes.indexOf(route) === -1 || routeParamsChanged(route, prevState, nextState);
|
|
if (isLeaving) parentIsLeaving = true;
|
|
return isLeaving;
|
|
}
|
|
});
|
|
|
|
// onLeave hooks start at the leaf route.
|
|
leaveRoutes.reverse();
|
|
|
|
enterRoutes = [];
|
|
changeRoutes = [];
|
|
|
|
nextRoutes.forEach(function (route) {
|
|
var isNew = prevRoutes.indexOf(route) === -1;
|
|
var paramsChanged = leaveRoutes.indexOf(route) !== -1;
|
|
|
|
if (isNew || paramsChanged) enterRoutes.push(route);else changeRoutes.push(route);
|
|
});
|
|
})();
|
|
} else {
|
|
leaveRoutes = [];
|
|
changeRoutes = [];
|
|
enterRoutes = nextRoutes;
|
|
}
|
|
|
|
return {
|
|
leaveRoutes: leaveRoutes,
|
|
changeRoutes: changeRoutes,
|
|
enterRoutes: enterRoutes
|
|
};
|
|
}
|
|
|
|
exports.default = computeChangedRoutes;
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 245 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _AsyncUtils = __webpack_require__(65);
|
|
|
|
var _PromiseUtils = __webpack_require__(109);
|
|
|
|
function getComponentsForRoute(nextState, route, callback) {
|
|
if (route.component || route.components) {
|
|
callback(null, route.component || route.components);
|
|
return;
|
|
}
|
|
|
|
var getComponent = route.getComponent || route.getComponents;
|
|
if (getComponent) {
|
|
var componentReturn = getComponent.call(route, nextState, callback);
|
|
if ((0, _PromiseUtils.isPromise)(componentReturn)) componentReturn.then(function (component) {
|
|
return callback(null, component);
|
|
}, callback);
|
|
} else {
|
|
callback();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Asynchronously fetches all components needed for the given router
|
|
* state and calls callback(error, components) when finished.
|
|
*
|
|
* Note: This operation may finish synchronously if no routes have an
|
|
* asynchronous getComponents method.
|
|
*/
|
|
function getComponents(nextState, callback) {
|
|
(0, _AsyncUtils.mapAsync)(nextState.routes, function (route, index, callback) {
|
|
getComponentsForRoute(nextState, route, callback);
|
|
}, callback);
|
|
}
|
|
|
|
exports.default = getComponents;
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 246 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _PatternUtils = __webpack_require__(26);
|
|
|
|
/**
|
|
* Extracts an object of params the given route cares about from
|
|
* the given params object.
|
|
*/
|
|
function getRouteParams(route, params) {
|
|
var routeParams = {};
|
|
|
|
if (!route.path) return routeParams;
|
|
|
|
(0, _PatternUtils.getParamNames)(route.path).forEach(function (p) {
|
|
if (Object.prototype.hasOwnProperty.call(params, p)) {
|
|
routeParams[p] = params[p];
|
|
}
|
|
});
|
|
|
|
return routeParams;
|
|
}
|
|
|
|
exports.default = getRouteParams;
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 247 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _createHashHistory = __webpack_require__(160);
|
|
|
|
var _createHashHistory2 = _interopRequireDefault(_createHashHistory);
|
|
|
|
var _createRouterHistory = __webpack_require__(113);
|
|
|
|
var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = (0, _createRouterHistory2.default)(_createHashHistory2.default);
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
/* 248 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _typeof2 = 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; };
|
|
|
|
exports.default = isActive;
|
|
|
|
var _PatternUtils = __webpack_require__(26);
|
|
|
|
var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
|
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
|
|
} : function (obj) {
|
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
|
|
};
|
|
|
|
function deepEqual(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 deepEqual(item, b[index]);
|
|
});
|
|
}
|
|
|
|
if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) === 'object') {
|
|
for (var p in a) {
|
|
if (!Object.prototype.hasOwnProperty.call(a, p)) {
|
|
continue;
|
|
}
|
|
|
|
if (a[p] === undefined) {
|
|
if (b[p] !== undefined) {
|
|
return false;
|
|
}
|
|
} else if (!Object.prototype.hasOwnProperty.call(b, p)) {
|
|
return false;
|
|
} else if (!deepEqual(a[p], b[p])) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
return String(a) === String(b);
|
|
}
|
|
|
|
/**
|
|
* Returns true if the current pathname matches the supplied one, net of
|
|
* leading and trailing slash normalization. This is sufficient for an
|
|
* indexOnly route match.
|
|
*/
|
|
function pathIsActive(pathname, currentPathname) {
|
|
// Normalize leading slash for consistency. Leading slash on pathname has
|
|
// already been normalized in isActive. See caveat there.
|
|
if (currentPathname.charAt(0) !== '/') {
|
|
currentPathname = '/' + currentPathname;
|
|
}
|
|
|
|
// Normalize the end of both path names too. Maybe `/foo/` shouldn't show
|
|
// `/foo` as active, but in this case, we would already have failed the
|
|
// match.
|
|
if (pathname.charAt(pathname.length - 1) !== '/') {
|
|
pathname += '/';
|
|
}
|
|
if (currentPathname.charAt(currentPathname.length - 1) !== '/') {
|
|
currentPathname += '/';
|
|
}
|
|
|
|
return currentPathname === pathname;
|
|
}
|
|
|
|
/**
|
|
* Returns true if the given pathname matches the active routes and params.
|
|
*/
|
|
function routeIsActive(pathname, routes, params) {
|
|
var remainingPathname = pathname,
|
|
paramNames = [],
|
|
paramValues = [];
|
|
|
|
// for...of would work here but it's probably slower post-transpilation.
|
|
for (var i = 0, len = routes.length; i < len; ++i) {
|
|
var route = routes[i];
|
|
var pattern = route.path || '';
|
|
|
|
if (pattern.charAt(0) === '/') {
|
|
remainingPathname = pathname;
|
|
paramNames = [];
|
|
paramValues = [];
|
|
}
|
|
|
|
if (remainingPathname !== null && pattern) {
|
|
var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);
|
|
if (matched) {
|
|
remainingPathname = matched.remainingPathname;
|
|
paramNames = [].concat(paramNames, matched.paramNames);
|
|
paramValues = [].concat(paramValues, matched.paramValues);
|
|
} else {
|
|
remainingPathname = null;
|
|
}
|
|
|
|
if (remainingPathname === '') {
|
|
// We have an exact match on the route. Just check that all the params
|
|
// match.
|
|
// FIXME: This doesn't work on repeated params.
|
|
return paramNames.every(function (paramName, index) {
|
|
return String(paramValues[index]) === String(params[paramName]);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Returns true if all key/value pairs in the given query are
|
|
* currently active.
|
|
*/
|
|
function queryIsActive(query, activeQuery) {
|
|
if (activeQuery == null) return query == null;
|
|
|
|
if (query == null) return true;
|
|
|
|
return deepEqual(query, activeQuery);
|
|
}
|
|
|
|
/**
|
|
* Returns true if a <Link> to the given pathname/query combination is
|
|
* currently active.
|
|
*/
|
|
function isActive(_ref, indexOnly, currentLocation, routes, params) {
|
|
var pathname = _ref.pathname,
|
|
query = _ref.query;
|
|
|
|
if (currentLocation == null) return false;
|
|
|
|
// TODO: This is a bit ugly. It keeps around support for treating pathnames
|
|
// without preceding slashes as absolute paths, but possibly also works
|
|
// around the same quirks with basenames as in matchRoutes.
|
|
if (pathname.charAt(0) !== '/') {
|
|
pathname = '/' + pathname;
|
|
}
|
|
|
|
if (!pathIsActive(pathname, currentLocation.pathname)) {
|
|
// The path check is necessary and sufficient for indexOnly, but otherwise
|
|
// we still need to check the routes.
|
|
if (indexOnly || !routeIsActive(pathname, routes, params)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return queryIsActive(query, currentLocation.query);
|
|
}
|
|
module.exports = exports["default"];
|
|
|
|
/***/ }),
|
|
/* 249 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _Actions = __webpack_require__(35);
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _createMemoryHistory = __webpack_require__(112);
|
|
|
|
var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
|
|
|
|
var _createTransitionManager = __webpack_require__(114);
|
|
|
|
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
|
|
|
|
var _RouteUtils = __webpack_require__(18);
|
|
|
|
var _RouterUtils = __webpack_require__(111);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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;
|
|
};
|
|
|
|
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 high-level API to be used for server-side rendering.
|
|
*
|
|
* This function matches a location to a set of routes and calls
|
|
* callback(error, redirectLocation, renderProps) when finished.
|
|
*
|
|
* Note: You probably don't want to use this in a browser unless you're using
|
|
* server-side rendering with async routes.
|
|
*/
|
|
function match(_ref, callback) {
|
|
var history = _ref.history,
|
|
routes = _ref.routes,
|
|
location = _ref.location,
|
|
options = _objectWithoutProperties(_ref, ['history', 'routes', 'location']);
|
|
|
|
!(history || location) ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'match needs a history or a location') : (0, _invariant2.default)(false) : void 0;
|
|
|
|
history = history ? history : (0, _createMemoryHistory2.default)(options);
|
|
var transitionManager = (0, _createTransitionManager2.default)(history, (0, _RouteUtils.createRoutes)(routes));
|
|
|
|
if (location) {
|
|
// Allow match({ location: '/the/path', ... })
|
|
location = history.createLocation(location);
|
|
} else {
|
|
location = history.getCurrentLocation();
|
|
}
|
|
|
|
transitionManager.match(location, function (error, redirectLocation, nextState) {
|
|
var renderProps = void 0;
|
|
|
|
if (nextState) {
|
|
var router = (0, _RouterUtils.createRouterObject)(history, transitionManager, nextState);
|
|
renderProps = _extends({}, nextState, {
|
|
router: router,
|
|
matchContext: { transitionManager: transitionManager, router: router }
|
|
});
|
|
}
|
|
|
|
callback(error, redirectLocation && history.createLocation(redirectLocation, _Actions.REPLACE), renderProps);
|
|
});
|
|
}
|
|
|
|
exports.default = match;
|
|
module.exports = exports['default'];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 250 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _typeof2 = 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; };
|
|
|
|
exports.default = matchRoutes;
|
|
|
|
var _AsyncUtils = __webpack_require__(65);
|
|
|
|
var _PromiseUtils = __webpack_require__(109);
|
|
|
|
var _PatternUtils = __webpack_require__(26);
|
|
|
|
var _routerWarning = __webpack_require__(27);
|
|
|
|
var _routerWarning2 = _interopRequireDefault(_routerWarning);
|
|
|
|
var _RouteUtils = __webpack_require__(18);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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 _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
|
|
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
|
|
} : function (obj) {
|
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
|
|
};
|
|
|
|
function getChildRoutes(route, location, paramNames, paramValues, callback) {
|
|
if (route.childRoutes) {
|
|
return [null, route.childRoutes];
|
|
}
|
|
if (!route.getChildRoutes) {
|
|
return [];
|
|
}
|
|
|
|
var sync = true,
|
|
result = void 0;
|
|
|
|
var partialNextState = {
|
|
location: location,
|
|
params: createParams(paramNames, paramValues)
|
|
};
|
|
|
|
var childRoutesReturn = route.getChildRoutes(partialNextState, function (error, childRoutes) {
|
|
childRoutes = !error && (0, _RouteUtils.createRoutes)(childRoutes);
|
|
if (sync) {
|
|
result = [error, childRoutes];
|
|
return;
|
|
}
|
|
|
|
callback(error, childRoutes);
|
|
});
|
|
|
|
if ((0, _PromiseUtils.isPromise)(childRoutesReturn)) childRoutesReturn.then(function (childRoutes) {
|
|
return callback(null, (0, _RouteUtils.createRoutes)(childRoutes));
|
|
}, callback);
|
|
|
|
sync = false;
|
|
return result; // Might be undefined.
|
|
}
|
|
|
|
function getIndexRoute(route, location, paramNames, paramValues, callback) {
|
|
if (route.indexRoute) {
|
|
callback(null, route.indexRoute);
|
|
} else if (route.getIndexRoute) {
|
|
var partialNextState = {
|
|
location: location,
|
|
params: createParams(paramNames, paramValues)
|
|
};
|
|
|
|
var indexRoutesReturn = route.getIndexRoute(partialNextState, function (error, indexRoute) {
|
|
callback(error, !error && (0, _RouteUtils.createRoutes)(indexRoute)[0]);
|
|
});
|
|
|
|
if ((0, _PromiseUtils.isPromise)(indexRoutesReturn)) indexRoutesReturn.then(function (indexRoute) {
|
|
return callback(null, (0, _RouteUtils.createRoutes)(indexRoute)[0]);
|
|
}, callback);
|
|
} else if (route.childRoutes || route.getChildRoutes) {
|
|
var onChildRoutes = function onChildRoutes(error, childRoutes) {
|
|
if (error) {
|
|
callback(error);
|
|
return;
|
|
}
|
|
|
|
var pathless = childRoutes.filter(function (childRoute) {
|
|
return !childRoute.path;
|
|
});
|
|
|
|
(0, _AsyncUtils.loopAsync)(pathless.length, function (index, next, done) {
|
|
getIndexRoute(pathless[index], location, paramNames, paramValues, function (error, indexRoute) {
|
|
if (error || indexRoute) {
|
|
var routes = [pathless[index]].concat(Array.isArray(indexRoute) ? indexRoute : [indexRoute]);
|
|
done(error, routes);
|
|
} else {
|
|
next();
|
|
}
|
|
});
|
|
}, function (err, routes) {
|
|
callback(null, routes);
|
|
});
|
|
};
|
|
|
|
var result = getChildRoutes(route, location, paramNames, paramValues, onChildRoutes);
|
|
if (result) {
|
|
onChildRoutes.apply(undefined, result);
|
|
}
|
|
} else {
|
|
callback();
|
|
}
|
|
}
|
|
|
|
function assignParams(params, paramNames, paramValues) {
|
|
return paramNames.reduce(function (params, paramName, index) {
|
|
var paramValue = paramValues && paramValues[index];
|
|
|
|
if (Array.isArray(params[paramName])) {
|
|
params[paramName].push(paramValue);
|
|
} else if (paramName in params) {
|
|
params[paramName] = [params[paramName], paramValue];
|
|
} else {
|
|
params[paramName] = paramValue;
|
|
}
|
|
|
|
return params;
|
|
}, params);
|
|
}
|
|
|
|
function createParams(paramNames, paramValues) {
|
|
return assignParams({}, paramNames, paramValues);
|
|
}
|
|
|
|
function matchRouteDeep(route, location, remainingPathname, paramNames, paramValues, callback) {
|
|
var pattern = route.path || '';
|
|
|
|
if (pattern.charAt(0) === '/') {
|
|
remainingPathname = location.pathname;
|
|
paramNames = [];
|
|
paramValues = [];
|
|
}
|
|
|
|
// Only try to match the path if the route actually has a pattern, and if
|
|
// we're not just searching for potential nested absolute paths.
|
|
if (remainingPathname !== null && pattern) {
|
|
try {
|
|
var matched = (0, _PatternUtils.matchPattern)(pattern, remainingPathname);
|
|
if (matched) {
|
|
remainingPathname = matched.remainingPathname;
|
|
paramNames = [].concat(paramNames, matched.paramNames);
|
|
paramValues = [].concat(paramValues, matched.paramValues);
|
|
} else {
|
|
remainingPathname = null;
|
|
}
|
|
} catch (error) {
|
|
callback(error);
|
|
}
|
|
|
|
// By assumption, pattern is non-empty here, which is the prerequisite for
|
|
// actually terminating a match.
|
|
if (remainingPathname === '') {
|
|
var _ret = function () {
|
|
var match = {
|
|
routes: [route],
|
|
params: createParams(paramNames, paramValues)
|
|
};
|
|
|
|
getIndexRoute(route, location, paramNames, paramValues, function (error, indexRoute) {
|
|
if (error) {
|
|
callback(error);
|
|
} else {
|
|
if (Array.isArray(indexRoute)) {
|
|
var _match$routes;
|
|
|
|
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(indexRoute.every(function (route) {
|
|
return !route.path;
|
|
}), 'Index routes should not have paths') : void 0;
|
|
(_match$routes = match.routes).push.apply(_match$routes, indexRoute);
|
|
} else if (indexRoute) {
|
|
process.env.NODE_ENV !== 'production' ? (0, _routerWarning2.default)(!indexRoute.path, 'Index routes should not have paths') : void 0;
|
|
match.routes.push(indexRoute);
|
|
}
|
|
|
|
callback(null, match);
|
|
}
|
|
});
|
|
|
|
return {
|
|
v: void 0
|
|
};
|
|
}();
|
|
|
|
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
|
|
}
|
|
}
|
|
|
|
if (remainingPathname != null || route.childRoutes) {
|
|
// Either a) this route matched at least some of the path or b)
|
|
// we don't have to load this route's children asynchronously. In
|
|
// either case continue checking for matches in the subtree.
|
|
var onChildRoutes = function onChildRoutes(error, childRoutes) {
|
|
if (error) {
|
|
callback(error);
|
|
} else if (childRoutes) {
|
|
// Check the child routes to see if any of them match.
|
|
matchRoutes(childRoutes, location, function (error, match) {
|
|
if (error) {
|
|
callback(error);
|
|
} else if (match) {
|
|
// A child route matched! Augment the match and pass it up the stack.
|
|
match.routes.unshift(route);
|
|
callback(null, match);
|
|
} else {
|
|
callback();
|
|
}
|
|
}, remainingPathname, paramNames, paramValues);
|
|
} else {
|
|
callback();
|
|
}
|
|
};
|
|
|
|
var result = getChildRoutes(route, location, paramNames, paramValues, onChildRoutes);
|
|
if (result) {
|
|
onChildRoutes.apply(undefined, result);
|
|
}
|
|
} else {
|
|
callback();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Asynchronously matches the given location to a set of routes and calls
|
|
* callback(error, state) when finished. The state object will have the
|
|
* following properties:
|
|
*
|
|
* - routes An array of routes that matched, in hierarchical order
|
|
* - params An object of URL parameters
|
|
*
|
|
* Note: This operation may finish synchronously if no routes have an
|
|
* asynchronous getChildRoutes method.
|
|
*/
|
|
function matchRoutes(routes, location, callback, remainingPathname) {
|
|
var paramNames = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
var paramValues = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
|
|
|
|
if (remainingPathname === undefined) {
|
|
// TODO: This is a little bit ugly, but it works around a quirk in history
|
|
// that strips the leading slash from pathnames when using basenames with
|
|
// trailing slashes.
|
|
if (location.pathname.charAt(0) !== '/') {
|
|
location = _extends({}, location, {
|
|
pathname: '/' + location.pathname
|
|
});
|
|
}
|
|
remainingPathname = location.pathname;
|
|
}
|
|
|
|
(0, _AsyncUtils.loopAsync)(routes.length, function (index, next, done) {
|
|
matchRouteDeep(routes[index], location, remainingPathname, paramNames, paramValues, function (error, match) {
|
|
if (error || match) {
|
|
done(error, match);
|
|
} else {
|
|
next();
|
|
}
|
|
});
|
|
}, callback);
|
|
}
|
|
module.exports = exports["default"];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 251 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* WEBPACK VAR INJECTION */(function(process) {
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = withRouter;
|
|
|
|
var _invariant = __webpack_require__(8);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _hoistNonReactStatics = __webpack_require__(162);
|
|
|
|
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
|
|
|
|
var _ContextUtils = __webpack_require__(66);
|
|
|
|
var _PropTypes = __webpack_require__(67);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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;
|
|
};
|
|
|
|
function getDisplayName(WrappedComponent) {
|
|
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
}
|
|
|
|
function withRouter(WrappedComponent, options) {
|
|
var withRef = options && options.withRef;
|
|
|
|
var WithRouter = _react2.default.createClass({
|
|
displayName: 'WithRouter',
|
|
|
|
mixins: [(0, _ContextUtils.ContextSubscriber)('router')],
|
|
|
|
contextTypes: { router: _PropTypes.routerShape },
|
|
propTypes: { router: _PropTypes.routerShape },
|
|
|
|
getWrappedInstance: function getWrappedInstance() {
|
|
!withRef ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'To access the wrapped instance, you need to specify ' + '`{ withRef: true }` as the second argument of the withRouter() call.') : (0, _invariant2.default)(false) : void 0;
|
|
|
|
return this.wrappedInstance;
|
|
},
|
|
render: function render() {
|
|
var _this = this;
|
|
|
|
var router = this.props.router || this.context.router;
|
|
if (!router) {
|
|
return _react2.default.createElement(WrappedComponent, this.props);
|
|
}
|
|
|
|
var params = router.params,
|
|
location = router.location,
|
|
routes = router.routes;
|
|
|
|
var props = _extends({}, this.props, { router: router, params: params, location: location, routes: routes });
|
|
|
|
if (withRef) {
|
|
props.ref = function (c) {
|
|
_this.wrappedInstance = c;
|
|
};
|
|
}
|
|
|
|
return _react2.default.createElement(WrappedComponent, props);
|
|
}
|
|
});
|
|
|
|
WithRouter.displayName = 'withRouter(' + getDisplayName(WrappedComponent) + ')';
|
|
WithRouter.WrappedComponent = WrappedComponent;
|
|
|
|
return (0, _hoistNonReactStatics2.default)(WithRouter, WrappedComponent);
|
|
}
|
|
module.exports = exports['default'];
|
|
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
|
|
|
/***/ }),
|
|
/* 252 */,
|
|
/* 253 */,
|
|
/* 254 */,
|
|
/* 255 */,
|
|
/* 256 */,
|
|
/* 257 */,
|
|
/* 258 */,
|
|
/* 259 */,
|
|
/* 260 */,
|
|
/* 261 */,
|
|
/* 262 */,
|
|
/* 263 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
module.exports = function (str) {
|
|
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
|
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
});
|
|
};
|
|
|
|
/***/ }),
|
|
/* 264 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
module.exports = function (module) {
|
|
if (!module.webpackPolyfill) {
|
|
module.deprecate = function () {};
|
|
module.paths = [];
|
|
// module.parent = undefined by default
|
|
if (!module.children) module.children = [];
|
|
Object.defineProperty(module, "loaded", {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return module.l;
|
|
}
|
|
});
|
|
Object.defineProperty(module, "id", {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return module.i;
|
|
}
|
|
});
|
|
module.webpackPolyfill = 1;
|
|
}
|
|
return module;
|
|
};
|
|
|
|
/***/ }),
|
|
/* 265 */
|
|
/***/ (function(module, exports) {
|
|
|
|
// removed by extract-text-webpack-plugin
|
|
|
|
/***/ }),
|
|
/* 266 */
|
|
/***/ (function(module, exports) {
|
|
|
|
// removed by extract-text-webpack-plugin
|
|
|
|
/***/ }),
|
|
/* 267 */
|
|
/***/ (function(module, exports) {
|
|
|
|
// removed by extract-text-webpack-plugin
|
|
|
|
/***/ }),
|
|
/* 268 */
|
|
/***/ (function(module, exports) {
|
|
|
|
// removed by extract-text-webpack-plugin
|
|
|
|
/***/ }),
|
|
/* 269 */
|
|
/***/ (function(module, exports) {
|
|
|
|
// removed by extract-text-webpack-plugin
|
|
|
|
/***/ }),
|
|
/* 270 */
|
|
/***/ (function(module, exports) {
|
|
|
|
// removed by extract-text-webpack-plugin
|
|
|
|
/***/ }),
|
|
/* 271 */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var _react = __webpack_require__(4);
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _reactDom = __webpack_require__(43);
|
|
|
|
var _reactDom2 = _interopRequireDefault(_reactDom);
|
|
|
|
var _reactRouter = __webpack_require__(74);
|
|
|
|
var _Wrapper = __webpack_require__(119);
|
|
|
|
var _Wrapper2 = _interopRequireDefault(_Wrapper);
|
|
|
|
var _Soundboard = __webpack_require__(122);
|
|
|
|
var _Soundboard2 = _interopRequireDefault(_Soundboard);
|
|
|
|
var _NotFound = __webpack_require__(121);
|
|
|
|
var _NotFound2 = _interopRequireDefault(_NotFound);
|
|
|
|
var _Home = __webpack_require__(120);
|
|
|
|
var _Home2 = _interopRequireDefault(_Home);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
_reactDom2.default.render(_react2.default.createElement(
|
|
_reactRouter.Router,
|
|
{ history: _reactRouter.browserHistory },
|
|
_react2.default.createElement(
|
|
_reactRouter.Route,
|
|
{ path: '/', component: _Wrapper2.default },
|
|
_react2.default.createElement(_reactRouter.IndexRoute, { component: _Home2.default }),
|
|
_react2.default.createElement(_reactRouter.Route, { path: '/soundboard', component: _Soundboard2.default }),
|
|
_react2.default.createElement(_reactRouter.Route, { path: '*', component: _NotFound2.default })
|
|
)
|
|
), document.getElementById('app'));
|
|
|
|
//pages
|
|
|
|
/***/ })
|
|
],[271]); |