target
stringlengths
5
300
feat_repo_name
stringlengths
6
76
text
stringlengths
26
1.05M
test/NavbarSpec.js
aabenoja/react-bootstrap
import React from 'react'; import ReactTestUtils from 'react/lib/ReactTestUtils'; import Navbar from '../src/Navbar'; import Nav from '../src/Nav'; describe('Nav', function () { it('Should create nav element', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar /> ); let nav = instance.getDOMNode(); assert.equal(nav.nodeName, 'NAV'); assert.ok(nav.className.match(/\bnavbar\b/)); assert.ok(nav.getAttribute('role'), 'navigation'); }); it('Should add fixedTop variation class', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar fixedTop /> ); assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-fixed-top')); }); it('Should add fixedBottom variation class', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar fixedBottom /> ); assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-fixed-bottom')); }); it('Should add staticTop variation class', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar staticTop /> ); assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-static-top')); }); it('Should add inverse variation class', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar inverse /> ); assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-inverse')); }); it('Should add fluid variation class', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar fluid /> ); assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'container-fluid')); }); it('Should override role attribute', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar role="banner"/> ); assert.ok(instance.getDOMNode().getAttribute('role'), 'banner'); }); it('Should override node class', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar componentClass={'header'}/> ); assert.ok(instance.getDOMNode().nodeName, 'HEADER'); }); it('Should add header with brand', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar brand="Brand" /> ); let header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header'); assert.ok(header); let brand = ReactTestUtils.findRenderedDOMComponentWithClass(header, 'navbar-brand'); assert.ok(brand); assert.equal(brand.getDOMNode().innerText, 'Brand'); }); it('Should add header with brand component', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar brand={<a>Brand</a>} /> ); let header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header'); assert.ok(header); let brand = ReactTestUtils.findRenderedDOMComponentWithClass(header, 'navbar-brand'); assert.ok(brand); assert.equal(brand.getDOMNode().nodeName, 'A'); assert.equal(brand.getDOMNode().innerText, 'Brand'); }); it('Should pass navbar prop to navs', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar brand="Brand"> <Nav /> </Navbar> ); let nav = ReactTestUtils.findRenderedComponentWithType(instance, Nav); assert.ok(nav.props.navbar); }); it('Should pass nav prop to ul', function () { let instance = ReactTestUtils.renderIntoDocument( <Nav /> ); let navNode = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'nav').getDOMNode(); assert.ok(navNode); assert.equal(navNode.nodeName, 'UL'); assert.equal(navNode.parentNode.nodeName, 'NAV'); instance.setProps({navbar: true}); navNode = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'nav').getDOMNode(); assert.ok(navNode); assert.equal(navNode.nodeName, 'UL'); assert.equal(navNode.parentNode.nodeName, 'DIV'); }); it('Should add header when toggleNavKey is 0', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar toggleNavKey={0}> <Nav eventKey={0} /> </Navbar> ); let header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header'); assert.ok(header); }); it('Should add header when toggleNavKey is 1', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar toggleNavKey={1}> <Nav eventKey={1} /> </Navbar> ); let header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header'); assert.ok(header); }); it('Should add header when toggleNavKey is string', function () { let instance = ReactTestUtils.renderIntoDocument( <Navbar toggleNavKey={'string'}> <Nav eventKey={'string'} /> </Navbar> ); let header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header'); assert.ok(header); }); });
node_modules/rc-slider/lib/common/Steps.js
maty21/statistisc
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty2 = require('babel-runtime/helpers/defineProperty'); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _classnames = require('classnames'); var _classnames2 = _interopRequireDefault(_classnames); var _warning = require('warning'); var _warning2 = _interopRequireDefault(_warning); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var calcPoints = function calcPoints(vertical, marks, dots, step, min, max) { (0, _warning2["default"])(dots ? step > 0 : true, '`Slider[step]` should be a positive number in order to make Slider[dots] work.'); var points = Object.keys(marks).map(parseFloat); if (dots) { for (var i = min; i <= max; i = i + step) { if (points.indexOf(i) >= 0) continue; points.push(i); } } return points; }; var Steps = function Steps(_ref) { var prefixCls = _ref.prefixCls, vertical = _ref.vertical, marks = _ref.marks, dots = _ref.dots, step = _ref.step, included = _ref.included, lowerBound = _ref.lowerBound, upperBound = _ref.upperBound, max = _ref.max, min = _ref.min; var range = max - min; var elements = calcPoints(vertical, marks, dots, step, min, max).map(function (point) { var _classNames; var offset = Math.abs(point - min) / range * 100 + '%'; var style = vertical ? { bottom: offset } : { left: offset }; var isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound; var pointClassName = (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, prefixCls + '-dot', true), (0, _defineProperty3["default"])(_classNames, prefixCls + '-dot-active', isActived), _classNames)); return _react2["default"].createElement('span', { className: pointClassName, style: style, key: point }); }); return _react2["default"].createElement( 'div', { className: prefixCls + '-step' }, elements ); }; exports["default"] = Steps; module.exports = exports['default'];
docs/app/Examples/views/Feed/Types/FeedExampleBasic.js
ben174/Semantic-UI-React
import React from 'react' import { Feed, Icon } from 'semantic-ui-react' const FeedExampleBasic = () => ( <Feed> <Feed.Event> <Feed.Label> <img src='http://semantic-ui.com/images/avatar/small/elliot.jpg' /> </Feed.Label> <Feed.Content> <Feed.Summary> <Feed.User>Elliot Fu</Feed.User> added you as a friend <Feed.Date>1 Hour Ago</Feed.Date> </Feed.Summary> <Feed.Meta> <Feed.Like> <Icon name='like' /> 4 Likes </Feed.Like> </Feed.Meta> </Feed.Content> </Feed.Event> <Feed.Event> <Feed.Label image='http://semantic-ui.com/images/avatar/small/helen.jpg' /> <Feed.Content> <Feed.Summary> <a>Helen Troy</a> added <a>2 new illustrations</a> <Feed.Date>4 days ago</Feed.Date> </Feed.Summary> <Feed.Extra images> <a><img src='http://semantic-ui.com/images/wireframe/image.png' /></a> <a><img src='http://semantic-ui.com/images/wireframe/image.png' /></a> </Feed.Extra> <Feed.Meta> <Feed.Like> <Icon name='like' /> 1 Like </Feed.Like> </Feed.Meta> </Feed.Content> </Feed.Event> <Feed.Event> <Feed.Label image='http://semantic-ui.com/images/avatar/small/jenny.jpg' /> <Feed.Content> <Feed.Summary date='2 Days Ago' user='Jenny Hess' content='add you as a friend' /> <Feed.Meta> <Feed.Like> <Icon name='like' /> 8 Likes </Feed.Like> </Feed.Meta> </Feed.Content> </Feed.Event> <Feed.Event> <Feed.Label image='http://semantic-ui.com/images/avatar/small/joe.jpg' /> <Feed.Content> <Feed.Summary> <a>Joe Henderson</a> posted on his page <Feed.Date>3 days ago</Feed.Date> </Feed.Summary> <Feed.Extra text> Ours is a life of constant reruns. We're always circling back to where we'd we started, then starting all over again. Even if we don't run extra laps that day, we surely will come back for more of the same another day soon. </Feed.Extra> <Feed.Meta> <Feed.Like> <Icon name='like' /> 5 Likes </Feed.Like> </Feed.Meta> </Feed.Content> </Feed.Event> <Feed.Event> <Feed.Label image='http://semantic-ui.com/images/avatar/small/justen.jpg' /> <Feed.Content> <Feed.Summary> <a>Justen Kitsune</a> added <a>2 new photos</a> of you <Feed.Date>4 days ago</Feed.Date> </Feed.Summary> <Feed.Extra images> <a><img src='http://semantic-ui.com/images/wireframe/image.png' /></a> <a><img src='http://semantic-ui.com/images/wireframe/image.png' /></a> </Feed.Extra> <Feed.Meta> <Feed.Like> <Icon name='like' /> 41 Likes </Feed.Like> </Feed.Meta> </Feed.Content> </Feed.Event> </Feed> ) export default FeedExampleBasic
ajax/libs/mobx-react/3.0.4/index.js
brix/cdnjs
(function() { function mrFactory(mobx, React, ReactDOM) { if (!mobx) throw new Error("mobx-react requires the MobX package") if (!React) throw new Error("mobx-react requires React to be available"); var isDevtoolsEnabled = false; // WeakMap<Node, Object>; var componentByNodeRegistery = typeof WeakMap !== "undefined" ? new WeakMap() : undefined; var renderReporter = new mobx.SimpleEventEmitter(); function findDOMNode(component) { if (ReactDOM) return ReactDOM.findDOMNode(component); return null; } function reportRendering(component) { var node = findDOMNode(component); if (node) componentByNodeRegistery.set(node, component); renderReporter.emit({ event: 'render', renderTime: component.__$mobRenderEnd - component.__$mobRenderStart, totalTime: Date.now() - component.__$mobRenderStart, component: component, node: node }); } var reactiveMixin = { componentWillMount: function() { // Generate friendly name for debugging var name = [ this.displayName || this.name || (this.constructor && (this.constructor.displayName || this.constructor.name)) || "<component>", "#", this._reactInternalInstance && this._reactInternalInstance._rootNodeID, ".render()" ].join(""); var baseRender = this.render.bind(this); var self = this; var reaction = null; var isRenderingPending = false; function initialRender() { reaction = new mobx.Reaction(name, function() { if (!isRenderingPending) { isRenderingPending = true; React.Component.prototype.forceUpdate.call(self) } }); reactiveRender.$mobx = reaction; self.render = reactiveRender; return reactiveRender(); } function reactiveRender() { isRenderingPending = false; var rendering; reaction.track(function() { if (isDevtoolsEnabled) self.__$mobRenderStart = Date.now(); rendering = mobx.extras.allowStateChanges(false, baseRender); if (isDevtoolsEnabled) self.__$mobRenderEnd = Date.now(); }); return rendering; } this.render = initialRender; }, componentWillUnmount: function() { this.render.$mobx && this.render.$mobx.dispose(); if (isDevtoolsEnabled) { var node = findDOMNode(this); if (node) { componentByNodeRegistery.delete(node); } renderReporter.emit({ event: 'destroy', component: this, node: node }); } }, componentDidMount: function() { if (isDevtoolsEnabled) reportRendering(this); }, componentDidUpdate: function() { if (isDevtoolsEnabled) reportRendering(this); }, shouldComponentUpdate: function(nextProps, nextState) { // TODO: if context changed, return true.., see #18 // if props or state did change, but a render was scheduled already, no additional render needs to be scheduled if (this.render.$mobx && this.render.$mobx.isScheduled() === true) return false; // update on any state changes (as is the default) if (this.state !== nextState) return true; // update if props are shallowly not equal, inspired by PureRenderMixin var keys = Object.keys(this.props); var key; if (keys.length !== Object.keys(nextProps).length) return true; for(var i = keys.length -1; i >= 0, key = keys[i]; i--) { var newValue = nextProps[key]; if (newValue !== this.props[key]) { return true; } else if (newValue && typeof newValue === "object" && !mobx.isObservable(newValue)) { /** * If the newValue is still the same object, but that object is not observable, * fallback to the default React behavior: update, because the object *might* have changed. * If you need the non default behavior, just use the React pure render mixin, as that one * will work fine with mobx as well, instead of the default implementation of * observer. */ return true; } } return false; } } function patch(target, funcName) { var base = target[funcName]; var mixinFunc = reactiveMixin[funcName]; target[funcName] = function() { base && base.apply(this, arguments); mixinFunc.apply(this, arguments); } } function observer(componentClass) { // If it is function but doesn't seem to be a react class constructor, // wrap it to a react class automatically if (typeof componentClass === "function" && !componentClass.prototype.render && !componentClass.isReactClass && !React.Component.isPrototypeOf(componentClass)) { return observer(React.createClass({ displayName: componentClass.displayName || componentClass.name, propTypes: componentClass.propTypes, contextTypes: componentClass.contextTypes, getDefaultProps: function() { return componentClass.defaultProps; }, render: function() { return componentClass.call(this, this.props, this.context); } })); } if (!componentClass) throw new Error("Please pass a valid component to 'observer'"); var target = componentClass.prototype || componentClass; [ "componentWillMount", "componentWillUnmount", "componentDidMount", "componentDidUpdate" ].forEach(function(funcName) { patch(target, funcName) }); if (!target.shouldComponentUpdate) target.shouldComponentUpdate = reactiveMixin.shouldComponentUpdate; componentClass.isMobXReactObserver = true; return componentClass; } function trackComponents() { if (typeof WeakMap === "undefined") throw new Error("[mobx-react] tracking components is not supported in this browser."); if (!isDevtoolsEnabled) isDevtoolsEnabled = true; } return ({ observer: observer, reactiveComponent: function() { console.warn("[mobx-react] `reactiveComponent` has been renamed to `observer` and will be removed in 1.1."); return observer.apply(null, arguments); }, renderReporter: renderReporter, componentByNodeRegistery: componentByNodeRegistery, trackComponents: trackComponents }); } // UMD if (typeof define === 'function' && define.amd) { define('mobx-react', ['mobx', 'react', 'react-dom'], mrFactory); } else if (typeof exports === 'object') { module.exports = mrFactory(require('mobx'), require('react'), require('react-dom')); } else { this.mobxReact = mrFactory(this['mobx'], this['React'], this['ReactDOM']); } })();
src/components/Editable.js
rsimmons/immersion-player
import React, { PureComponent } from 'react'; import './Editable.css'; export default class Editable extends PureComponent { constructor(props) { super(props); this.state = { editing: false, }; } componentDidUpdate() { if (this.inputElem) { this.inputElem.focus(); this.inputElem.select(); } } handleClickEdit = (e) => { e.preventDefault(); this.setState({editing: true}); } handleClickSet = (e) => { e.preventDefault(); this.props.onUpdate(this.inputElem.value); this.setState({editing: false}); } handleClickCancel = (e) => { e.preventDefault(); this.setState({editing: false}); } render() { const { value } = this.props; return ( <span className="Editable"> {this.state.editing ? ( <span> <input type="text" defaultValue={value} ref={el => { this.inputElem = el }}/> {' '}<button onClick={this.handleClickSet}>Set</button> <button onClick={this.handleClickCancel}>Cancel</button> </span> ) : ( <span>{value} <button onClick={this.handleClickEdit}>Edit</button></span> )} </span> ); } }
node_modules/react-router/es6/RouteContext.js
Starnes81/ReduxBlogTut
import warning from './routerWarning'; import React from 'react'; var object = React.PropTypes.object; /** * The RouteContext mixin provides a convenient way for route * components to set the route in context. This is needed for * routes that render elements that want to use the Lifecycle * mixin to prevent transitions. */ var RouteContext = { propTypes: { route: object.isRequired }, childContextTypes: { route: object.isRequired }, getChildContext: function getChildContext() { return { route: this.props.route }; }, componentWillMount: function componentWillMount() { process.env.NODE_ENV !== 'production' ? warning(false, 'The `RouteContext` mixin is deprecated. You can provide `this.props.route` on context with your own `contextTypes`. http://tiny.cc/router-routecontextmixin') : void 0; } }; export default RouteContext;
__tests__/index.android.js
HossamSamir/instagramClone
import 'react-native'; import React from 'react'; import Index from '../index.android.js'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; it('renders correctly', () => { const tree = renderer.create( <Index /> ); });
Tests/Components/RoundedButtonTest.js
friskipr/Ignite_MyApp
import 'react-native' import React from 'react' import RoundedButton from '../../App/Components/RoundedButton' import { shallow } from 'enzyme' import renderer from 'react-test-renderer' test('RoundedButton component renders correctly', () => { const tree = renderer.create(<RoundedButton onPress={() => {}} text='howdy' />).toJSON() expect(tree).toMatchSnapshot() }) test('RoundedButton component with children renders correctly', () => { const tree = renderer.create(<RoundedButton onPress={() => {}}>Howdy</RoundedButton>).toJSON() expect(tree).toMatchSnapshot() }) test('onPress', () => { let i = 0 // i guess i could have used sinon here too... less is more i guess const onPress = () => i++ const wrapperPress = shallow(<RoundedButton onPress={onPress} text='hi' />) expect(wrapperPress.prop('onPress')).toBe(onPress) // uses the right handler expect(i).toBe(0) wrapperPress.simulate('press') expect(i).toBe(1) })
ajax/libs/react-router/2.0.0-rc6/ReactRouter.js
CyrusSUEN/cdnjs
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react")); else if(typeof define === 'function' && define.amd) define(["react"], factory); else if(typeof exports === 'object') exports["ReactRouter"] = factory(require("react")); else root["ReactRouter"] = factory(root["React"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_2__) { 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__) { /* components */ 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _Router2 = __webpack_require__(36); var _Router3 = _interopRequireDefault(_Router2); exports.Router = _Router3['default']; var _Link2 = __webpack_require__(18); var _Link3 = _interopRequireDefault(_Link2); exports.Link = _Link3['default']; var _IndexLink2 = __webpack_require__(30); var _IndexLink3 = _interopRequireDefault(_IndexLink2); exports.IndexLink = _IndexLink3['default']; /* components (configuration) */ var _IndexRedirect2 = __webpack_require__(31); var _IndexRedirect3 = _interopRequireDefault(_IndexRedirect2); exports.IndexRedirect = _IndexRedirect3['default']; var _IndexRoute2 = __webpack_require__(32); var _IndexRoute3 = _interopRequireDefault(_IndexRoute2); exports.IndexRoute = _IndexRoute3['default']; var _Redirect2 = __webpack_require__(19); var _Redirect3 = _interopRequireDefault(_Redirect2); exports.Redirect = _Redirect3['default']; var _Route2 = __webpack_require__(34); var _Route3 = _interopRequireDefault(_Route2); exports.Route = _Route3['default']; /* mixins */ var _History2 = __webpack_require__(29); var _History3 = _interopRequireDefault(_History2); exports.History = _History3['default']; var _Lifecycle2 = __webpack_require__(33); var _Lifecycle3 = _interopRequireDefault(_Lifecycle2); exports.Lifecycle = _Lifecycle3['default']; var _RouteContext2 = __webpack_require__(35); var _RouteContext3 = _interopRequireDefault(_RouteContext2); exports.RouteContext = _RouteContext3['default']; /* utils */ var _useRoutes2 = __webpack_require__(47); var _useRoutes3 = _interopRequireDefault(_useRoutes2); exports.useRoutes = _useRoutes3['default']; var _RouteUtils = __webpack_require__(5); exports.createRoutes = _RouteUtils.createRoutes; var _RouterContext2 = __webpack_require__(13); var _RouterContext3 = _interopRequireDefault(_RouterContext2); exports.RouterContext = _RouterContext3['default']; var _RoutingContext2 = __webpack_require__(37); var _RoutingContext3 = _interopRequireDefault(_RoutingContext2); exports.RoutingContext = _RoutingContext3['default']; var _PropTypes2 = __webpack_require__(6); var _PropTypes3 = _interopRequireDefault(_PropTypes2); exports.PropTypes = _PropTypes3['default']; var _match2 = __webpack_require__(45); var _match3 = _interopRequireDefault(_match2); exports.match = _match3['default']; var _useRouterHistory2 = __webpack_require__(24); var _useRouterHistory3 = _interopRequireDefault(_useRouterHistory2); exports.useRouterHistory = _useRouterHistory3['default']; var _PatternUtils = __webpack_require__(8); exports.formatPattern = _PatternUtils.formatPattern; /* histories */ var _browserHistory2 = __webpack_require__(39); var _browserHistory3 = _interopRequireDefault(_browserHistory2); exports.browserHistory = _browserHistory3['default']; var _hashHistory2 = __webpack_require__(43); var _hashHistory3 = _interopRequireDefault(_hashHistory2); exports.hashHistory = _hashHistory3['default']; var _createMemoryHistory2 = __webpack_require__(21); var _createMemoryHistory3 = _interopRequireDefault(_createMemoryHistory2); exports.createMemoryHistory = _createMemoryHistory3['default']; /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports['default'] = routerWarning; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _warning = __webpack_require__(4); var _warning2 = _interopRequireDefault(_warning); function routerWarning(falseToWarn, message) { 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]; } false ? _warning2['default'].apply(undefined, [falseToWarn, message].concat(args)) : undefined; } module.exports = exports['default']; /***/ }, /* 2 */ /***/ function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_2__; /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ 'use strict'; /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ var invariant = function(condition, format, a, b, c, d, e, f) { if (false) { if (format === undefined) { throw new Error('invariant requires an error message argument'); } } if (!condition) { var error; if (format === undefined) { error = new Error( 'Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.' ); } else { var args = [a, b, c, d, e, f]; var argIndex = 0; error = new Error( format.replace(/%s/g, function() { return args[argIndex++]; }) ); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } }; module.exports = invariant; /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ 'use strict'; /** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ var warning = function() {}; if (false) { warning = function(condition, format, args) { var len = arguments.length; args = new Array(len > 2 ? len - 2 : 0); for (var key = 2; key < len; key++) { args[key - 2] = arguments[key]; } if (format === undefined) { throw new Error( '`warning(condition, format, ...args)` requires a warning ' + 'message argument' ); } if (format.length < 10 || (/^[s\W]*$/).test(format)) { throw new Error( 'The warning format should be able to uniquely identify this ' + 'warning. Please, use a more descriptive format than: ' + format ); } if (!condition) { var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function() { return args[argIndex++]; }); if (typeof console !== 'undefined') { console.error(message); } try { // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. throw new Error(message); } catch(x) {} } }; } module.exports = warning; /***/ }, /* 5 */ /***/ 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; }; exports.isReactChildren = isReactChildren; exports.createRouteFromReactElement = createRouteFromReactElement; exports.createRoutesFromReactChildren = createRoutesFromReactChildren; exports.createRoutes = createRoutes; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); function isValidChild(object) { return object == null || _react2['default'].isValidElement(object); } function isReactChildren(object) { return isValidChild(object) || Array.isArray(object) && object.every(isValidChild); } function checkPropTypes(componentName, propTypes, props) { componentName = componentName || 'UnknownComponent'; for (var propName in propTypes) { if (propTypes.hasOwnProperty(propName)) { var error = propTypes[propName](props, propName, componentName); /* istanbul ignore if: error logging */ if (error instanceof Error) false ? _routerWarning2['default'](false, error.message) : undefined; } } } function createRoute(defaultProps, props) { return _extends({}, defaultProps, props); } function createRouteFromReactElement(element) { var type = element.type; var route = createRoute(type.defaultProps, element.props); if (type.propTypes) checkPropTypes(type.displayName || type.name, type.propTypes, route); 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; } /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.falsy = falsy; var _react = __webpack_require__(2); var func = _react.PropTypes.func; var object = _react.PropTypes.object; var arrayOf = _react.PropTypes.arrayOf; var oneOfType = _react.PropTypes.oneOfType; var element = _react.PropTypes.element; var shape = _react.PropTypes.shape; var string = _react.PropTypes.string; function falsy(props, propName, componentName) { if (props[propName]) return new Error('<' + componentName + '> should not have a "' + propName + '" prop'); } var history = shape({ listen: func.isRequired, pushState: func.isRequired, replaceState: func.isRequired, go: func.isRequired }); exports.history = history; var location = shape({ pathname: string.isRequired, search: string.isRequired, state: object, action: string.isRequired, key: string }); exports.location = location; var component = oneOfType([func, string]); exports.component = component; var components = oneOfType([component, object]); exports.components = components; var route = oneOfType([object, element]); exports.route = route; var routes = oneOfType([route, arrayOf(route)]); exports.routes = routes; exports['default'] = { falsy: falsy, history: history, location: location, component: component, components: components, route: route }; /***/ }, /* 7 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.extractPath = extractPath; exports.parsePath = parsePath; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _warning = __webpack_require__(4); var _warning2 = _interopRequireDefault(_warning); function extractPath(string) { var match = string.match(/^https?:\/\/[^\/]*/); if (match == null) return string; return string.substring(match[0].length); } function parsePath(path) { var pathname = extractPath(path); var search = ''; var hash = ''; false ? _warning2['default'](path === pathname, 'A path must be pathname + search + hash only, not a fully qualified URL like "%s"', path) : undefined; 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 }; } /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.compilePattern = compilePattern; exports.matchPattern = matchPattern; exports.getParamNames = getParamNames; exports.getParams = getParams; exports.formatPattern = formatPattern; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); function escapeRegExp(string) { return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); } function escapeSource(string) { return escapeRegExp(string).replace(/\/+/g, '/+'); } function _compilePattern(pattern) { var regexpSource = ''; var paramNames = []; var tokens = []; var match = undefined, 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 += escapeSource(pattern.slice(lastIndex, match.index)); } if (match[1]) { regexpSource += '([^/?#]+)'; paramNames.push(match[1]); } else if (match[0] === '**') { regexpSource += '([\\s\\S]*)'; paramNames.push('splat'); } else if (match[0] === '*') { regexpSource += '([\\s\\S]*?)'; paramNames.push('splat'); } 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 += escapeSource(pattern.slice(lastIndex, pattern.length)); } return { pattern: pattern, regexpSource: regexpSource, paramNames: paramNames, tokens: tokens }; } var CompiledPatternsCache = {}; function compilePattern(pattern) { if (!(pattern in CompiledPatternsCache)) 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 return value is an object with the following properties: * * - remainingPathname * - paramNames * - paramValues */ function matchPattern(pattern, pathname) { // Make leading slashes consistent between pattern and pathname. if (pattern.charAt(0) !== '/') { pattern = '/' + pattern; } if (pathname.charAt(0) !== '/') { pathname = '/' + pathname; } var _compilePattern2 = compilePattern(pattern); var regexpSource = _compilePattern2.regexpSource; var paramNames = _compilePattern2.paramNames; var tokens = _compilePattern2.tokens; regexpSource += '/*'; // Capture path separators // Special-case patterns like '*' for catch-all routes. var captureRemaining = tokens[tokens.length - 1] !== '*'; if (captureRemaining) { // This will match newlines in the remaining path. regexpSource += '([\\s\\S]*?)'; } var match = pathname.match(new RegExp('^' + regexpSource + '$', 'i')); var remainingPathname = undefined, paramValues = undefined; if (match != null) { if (captureRemaining) { remainingPathname = match.pop(); var matchedPath = match[0].substr(0, match[0].length - remainingPathname.length); // If we didn't match the entire pathname, then make sure that the match // we did get ends at a path separator (potentially the one we added // above at the beginning of the path, if the actual match was empty). if (remainingPathname && matchedPath.charAt(matchedPath.length - 1) !== '/') { return { remainingPathname: null, paramNames: paramNames, paramValues: null }; } } else { // If this matched at all, then the match was the entire pathname. remainingPathname = ''; } paramValues = match.slice(1).map(function (v) { return v != null ? decodeURIComponent(v) : v; }); } else { remainingPathname = paramValues = null; } return { remainingPathname: remainingPathname, paramNames: paramNames, paramValues: paramValues }; } function getParamNames(pattern) { return compilePattern(pattern).paramNames; } function getParams(pattern, pathname) { var _matchPattern = matchPattern(pattern, pathname); var paramNames = _matchPattern.paramNames; var paramValues = _matchPattern.paramValues; if (paramValues != null) { return paramNames.reduce(function (memo, paramName, index) { memo[paramName] = paramValues[index]; return memo; }, {}); } return null; } /** * 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); var tokens = _compilePattern3.tokens; var parenCount = 0, pathname = '', splatIndex = 0; var token = undefined, paramName = undefined, paramValue = undefined; 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) ? false ? _invariant2['default'](false, 'Missing splat #%s for path "%s"', splatIndex, pattern) : _invariant2['default'](false) : undefined; if (paramValue != null) pathname += encodeURI(paramValue); } else if (token === '(') { parenCount += 1; } else if (token === ')') { parenCount -= 1; } else if (token.charAt(0) === ':') { paramName = token.substring(1); paramValue = params[paramName]; !(paramValue != null || parenCount > 0) ? false ? _invariant2['default'](false, 'Missing "%s" parameter for path "%s"', paramName, pattern) : _invariant2['default'](false) : undefined; if (paramValue != null) pathname += encodeURIComponent(paramValue); } else { pathname += token; } } return pathname.replace(/\/+/g, '/'); } /***/ }, /* 9 */ /***/ function(module, exports) { /** * Indicates that navigation was caused by a call to history.push. */ 'use strict'; exports.__esModule = true; var PUSH = 'PUSH'; exports.PUSH = PUSH; /** * Indicates that navigation was caused by a call to history.replace. */ var REPLACE = '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 = 'POP'; exports.POP = POP; exports['default'] = { PUSH: PUSH, REPLACE: REPLACE, POP: POP }; /***/ }, /* 10 */ /***/ function(module, exports) { 'use strict'; exports.__esModule = true; var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); exports.canUseDOM = canUseDOM; /***/ }, /* 11 */ /***/ 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; }; 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; } var _warning = __webpack_require__(4); var _warning2 = _interopRequireDefault(_warning); var _queryString = __webpack_require__(56); var _runTransitionHook = __webpack_require__(17); var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook); var _PathUtils = __webpack_require__(7); var _deprecate = __webpack_require__(16); var _deprecate2 = _interopRequireDefault(_deprecate); var SEARCH_BASE_KEY = '$searchBase'; function defaultStringifyQuery(query) { return _queryString.stringify(query).replace(/%20/g, '+'); } var defaultParseQueryString = _queryString.parse; function isNestedObject(object) { for (var p in object) { if (object.hasOwnProperty(p) && typeof object[p] === 'object' && !Array.isArray(object[p]) && object[p] !== null) return true; }return false; } /** * Returns a new createHistory function that may be used to create * history objects that know how to handle URL queries. */ function useQueries(createHistory) { return function () { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var stringifyQuery = options.stringifyQuery; var parseQueryString = options.parseQueryString; var historyOptions = _objectWithoutProperties(options, ['stringifyQuery', 'parseQueryString']); var history = createHistory(historyOptions); if (typeof stringifyQuery !== 'function') stringifyQuery = defaultStringifyQuery; if (typeof parseQueryString !== 'function') parseQueryString = defaultParseQueryString; function addQuery(location) { if (location.query == null) { var search = location.search; location.query = parseQueryString(search.substring(1)); location[SEARCH_BASE_KEY] = { search: search, searchBase: '' }; } // TODO: Instead of all the book-keeping here, this should just strip the // stringified query from the search. return location; } function appendQuery(location, query) { var _extends2; var searchBaseSpec = location[SEARCH_BASE_KEY]; var queryString = query ? stringifyQuery(query) : ''; if (!searchBaseSpec && !queryString) { return location; } false ? _warning2['default'](stringifyQuery !== defaultStringifyQuery || !isNestedObject(query), 'useQueries does not stringify nested query objects by default; ' + 'use a custom stringifyQuery function') : undefined; if (typeof location === 'string') location = _PathUtils.parsePath(location); var searchBase = undefined; if (searchBaseSpec && location.search === searchBaseSpec.search) { searchBase = searchBaseSpec.searchBase; } else { searchBase = location.search || ''; } var search = searchBase; if (queryString) { search += (search ? '&' : '?') + queryString; } return _extends({}, location, (_extends2 = { search: search }, _extends2[SEARCH_BASE_KEY] = { search: search, searchBase: searchBase }, _extends2)); } // Override all read methods with query-aware versions. function listenBefore(hook) { return history.listenBefore(function (location, callback) { _runTransitionHook2['default'](hook, addQuery(location), callback); }); } function listen(listener) { return history.listen(function (location) { listener(addQuery(location)); }); } // Override all write methods with query-aware versions. function push(location) { history.push(appendQuery(location, location.query)); } function replace(location) { history.replace(appendQuery(location, location.query)); } function createPath(location, query) { false ? _warning2['default'](!query, 'the query argument to createPath is deprecated; use a location descriptor instead') : undefined; return history.createPath(appendQuery(location, query || location.query)); } function createHref(location, query) { false ? _warning2['default'](!query, 'the query argument to createHref is deprecated; use a location descriptor instead') : undefined; return history.createHref(appendQuery(location, query || location.query)); } 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 fullLocation = history.createLocation.apply(history, [appendQuery(location, location.query)].concat(args)); if (location.query) { fullLocation.query = location.query; } return addQuery(fullLocation); } // deprecated function pushState(state, path, query) { if (typeof path === 'string') path = _PathUtils.parsePath(path); push(_extends({ state: state }, path, { query: query })); } // deprecated function replaceState(state, path, query) { if (typeof path === 'string') path = _PathUtils.parsePath(path); replace(_extends({ state: state }, path, { query: query })); } return _extends({}, history, { listenBefore: listenBefore, listen: listen, push: push, replace: replace, createPath: createPath, createHref: createHref, createLocation: createLocation, pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'), replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead') }); }; } exports['default'] = useQueries; module.exports = exports['default']; /***/ }, /* 12 */ /***/ function(module, exports) { "use strict"; exports.__esModule = true; var _slice = Array.prototype.slice; exports.loopAsync = loopAsync; exports.mapAsync = mapAsync; function loopAsync(turns, work, callback) { var currentTurn = 0, isDone = false; var sync = false, hasNext = false, doneArgs = undefined; function done() { isDone = true; if (sync) { // Iterate instead of recursing if possible. doneArgs = [].concat(_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); }); }); } /***/ }, /* 13 */ /***/ 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; }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _deprecateObjectProperties = __webpack_require__(23); var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties); var _getRouteParams = __webpack_require__(42); var _getRouteParams2 = _interopRequireDefault(_getRouteParams); var _RouteUtils = __webpack_require__(5); var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var _React$PropTypes = _react2['default'].PropTypes; var array = _React$PropTypes.array; var func = _React$PropTypes.func; var 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', propTypes: { history: object, 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: { history: object, location: object.isRequired, router: object.isRequired }, getChildContext: function getChildContext() { var _props = this.props; var router = _props.router; var history = _props.history; var location = _props.location; if (!router) { false ? _routerWarning2['default'](false, '`<RouterContext>` expects a `router` rather than a `history`') : undefined; router = _extends({}, history, { setRouteLeaveHook: history.listenBeforeLeavingRoute }); delete router.listenBeforeLeavingRoute; } if (false) { location = _deprecateObjectProperties2['default'](location, '`context.location` is deprecated, please use a route component\'s `props.location` instead. http://tiny.cc/router-accessinglocation'); } return { history: history, location: location, router: router }; }, createElement: function createElement(component, props) { return component == null ? null : this.props.createElement(component, props); }, render: function render() { var _this = this; var _props2 = this.props; var history = _props2.history; var location = _props2.location; var routes = _props2.routes; var params = _props2.params; var components = _props2.components; 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 = _getRouteParams2['default'](route, params); var props = { history: history, location: location, params: params, route: route, routeParams: routeParams, routes: routes }; if (_RouteUtils.isReactChildren(element)) { props.children = element; } else if (element) { for (var prop in element) { if (element.hasOwnProperty(prop)) props[prop] = element[prop]; } } if (typeof components === 'object') { var elements = {}; for (var key in components) { if (components.hasOwnProperty(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)) ? false ? _invariant2['default'](false, 'The root route must render a single element') : _invariant2['default'](false) : undefined; return element; } }); exports['default'] = RouterContext; module.exports = exports['default']; /***/ }, /* 14 */ /***/ 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; }; exports['default'] = createTransitionManager; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var _historyLibActions = __webpack_require__(9); var _computeChangedRoutes2 = __webpack_require__(40); var _computeChangedRoutes3 = _interopRequireDefault(_computeChangedRoutes2); var _TransitionUtils = __webpack_require__(38); var _isActive2 = __webpack_require__(44); var _isActive3 = _interopRequireDefault(_isActive2); var _getComponents = __webpack_require__(41); var _getComponents2 = _interopRequireDefault(_getComponents); var _matchRoutes = __webpack_require__(46); var _matchRoutes2 = _interopRequireDefault(_matchRoutes); function hasAnyProperties(object) { for (var p in object) { if (object.hasOwnProperty(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) { var indexOnlyOrDeprecatedQuery = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; var deprecatedIndexOnly = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; var indexOnly = undefined; if (indexOnlyOrDeprecatedQuery && indexOnlyOrDeprecatedQuery !== true || deprecatedIndexOnly !== null) { false ? _routerWarning2['default'](false, '`isActive(pathname, query, indexOnly) is deprecated; use `isActive(location, indexOnly)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : undefined; location = { pathname: location, query: indexOnlyOrDeprecatedQuery }; indexOnly = deprecatedIndexOnly || false; } else { location = history.createLocation(location); indexOnly = indexOnlyOrDeprecatedQuery; } return _isActive3['default'](location, indexOnly, state.location, state.routes, state.params); } function createLocationFromRedirectInfo(location) { return history.createLocation(location, _historyLibActions.REPLACE); } var partialNextState = undefined; function match(location, callback) { if (partialNextState && partialNextState.location === location) { // Continue from where we left off. finishMatch(partialNextState, callback); } else { _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 = _computeChangedRoutes3['default'](state, nextState); var leaveRoutes = _computeChangedRoutes.leaveRoutes; var enterRoutes = _computeChangedRoutes.enterRoutes; _TransitionUtils.runLeaveHooks(leaveRoutes); // Tear down confirmation hooks for left routes leaveRoutes.forEach(removeListenBeforeHooksForRoute); _TransitionUtils.runEnterHooks(enterRoutes, nextState, function (error, redirectInfo) { if (error) { callback(error); } else if (redirectInfo) { callback(null, createLocationFromRedirectInfo(redirectInfo)); } else { // TODO: Fetch components after state is updated. _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 })); } }); } }); } var RouteGuid = 1; function getRouteID(route) { var create = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; return route.__id__ || create && (route.__id__ = RouteGuid++); } var RouteHooks = {}; function getRouteHooksForRoutes(routes) { return routes.reduce(function (hooks, route) { hooks.push.apply(hooks, RouteHooks[getRouteID(route)]); return hooks; }, []); } function transitionHook(location, callback) { _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(_computeChangedRoutes3['default'](state, partialNextState).leaveRoutes); var result = undefined; 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 = undefined; 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 = undefined, unlistenBeforeUnload = undefined; function removeListenBeforeHooksForRoute(route) { var routeID = getRouteID(route, false); 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 must return either a) a prompt message to show * the user, to make sure they want to leave the page or b) false, to prevent * the transition. * * 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) { // TODO: Warn if they register for a route that isn't currently // active. They're probably doing something wrong, like re-creating // route objects on every location change. var routeID = getRouteID(route); var hooks = RouteHooks[routeID]; if (!hooks) { var thereWereNoRouteHooks = !hasAnyProperties(RouteHooks); RouteHooks[routeID] = [hook]; if (thereWereNoRouteHooks) { // setup transition & beforeunload hooks unlistenBefore = history.listenBefore(transitionHook); if (history.listenBeforeUnload) unlistenBeforeUnload = history.listenBeforeUnload(beforeUnloadHook); } } else { if (hooks.indexOf(hook) === -1) { false ? _routerWarning2['default'](false, 'adding multiple leave hooks for the same route is deprecated; manage multiple confirmations in your own code instead') : undefined; hooks.push(hook); } } return function () { var hooks = RouteHooks[routeID]; if (hooks) { var newHooks = hooks.filter(function (item) { return item !== hook; }); if (newHooks.length === 0) { removeListenBeforeHooksForRoute(route); } else { RouteHooks[routeID] = newHooks; } } }; } /** * 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) { // TODO: Only use a single history listener. Otherwise we'll // end up with multiple concurrent calls to match. return history.listen(function (location) { if (state.location === location) { listener(null, state); } else { match(location, function (error, redirectLocation, nextState) { if (error) { listener(error); } else if (redirectLocation) { history.transitionTo(redirectLocation); } else if (nextState) { listener(null, nextState); } else { false ? _routerWarning2['default'](false, 'Location "%s" did not match any routes', location.pathname + location.search + location.hash) : undefined; } }); } }); } return { isActive: isActive, match: match, listenBeforeLeavingRoute: listenBeforeLeavingRoute, listen: listen }; } //export default useRoutes module.exports = exports['default']; /***/ }, /* 15 */ /***/ function(module, exports) { 'use strict'; exports.__esModule = true; exports.addEventListener = addEventListener; exports.removeEventListener = removeEventListener; exports.getHashPath = getHashPath; exports.replaceHashPath = replaceHashPath; exports.getWindowPath = getWindowPath; exports.go = go; exports.getUserConfirmation = getUserConfirmation; exports.supportsHistory = supportsHistory; exports.supportsGoWithoutReloadUsingHash = supportsGoWithoutReloadUsingHash; function addEventListener(node, event, listener) { if (node.addEventListener) { node.addEventListener(event, listener, false); } else { node.attachEvent('on' + event, listener); } } function removeEventListener(node, event, listener) { if (node.removeEventListener) { node.removeEventListener(event, listener, false); } else { node.detachEvent('on' + event, listener); } } function getHashPath() { // We can't use window.location.hash here because it's not // consistent across browsers - Firefox will pre-decode it! return window.location.href.split('#')[1] || ''; } function replaceHashPath(path) { window.location.replace(window.location.pathname + window.location.search + '#' + path); } function getWindowPath() { return window.location.pathname + window.location.search + window.location.hash; } function go(n) { if (n) window.history.go(n); } function getUserConfirmation(message, callback) { callback(window.confirm(message)); } /** * 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/rackt/react-router/issues/586 */ function supportsHistory() { var ua = 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. */ function supportsGoWithoutReloadUsingHash() { var ua = navigator.userAgent; return ua.indexOf('Firefox') === -1; } /***/ }, /* 16 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _warning = __webpack_require__(4); var _warning2 = _interopRequireDefault(_warning); function deprecate(fn, message) { return function () { false ? _warning2['default'](false, '[history] ' + message) : undefined; return fn.apply(this, arguments); }; } exports['default'] = deprecate; module.exports = exports['default']; /***/ }, /* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _warning = __webpack_require__(4); var _warning2 = _interopRequireDefault(_warning); 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 { false ? _warning2['default'](result === undefined, 'You should not "return" in a transition hook with a callback argument; call the callback instead') : undefined; } } exports['default'] = runTransitionHook; module.exports = exports['default']; /***/ }, /* 18 */ /***/ 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; }; 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; } var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var _React$PropTypes = _react2['default'].PropTypes; var bool = _React$PropTypes.bool; var object = _React$PropTypes.object; var string = _React$PropTypes.string; var func = _React$PropTypes.func; var oneOfType = _React$PropTypes.oneOfType; function isLeftClickEvent(event) { return event.button === 0; } function isModifiedEvent(event) { return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); } function isEmptyObject(object) { for (var p in object) { if (object.hasOwnProperty(p)) return false; }return true; } function createLocationDescriptor(to, _ref) { var query = _ref.query; var hash = _ref.hash; var state = _ref.state; if (query || hash || state) { return { pathname: to, query: query, hash: hash, state: state }; } return 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', contextTypes: { router: object }, propTypes: { to: oneOfType([string, object]).isRequired, query: object, hash: string, state: object, activeStyle: object, activeClassName: string, onlyActiveOnIndex: bool.isRequired, onClick: func }, getDefaultProps: function getDefaultProps() { return { onlyActiveOnIndex: false, className: '', style: {} }; }, handleClick: function handleClick(event) { var allowTransition = true; if (this.props.onClick) this.props.onClick(event); if (isModifiedEvent(event) || !isLeftClickEvent(event)) return; if (event.defaultPrevented === true) allowTransition = false; // If target prop is set (e.g. to "_blank") let browser handle link. /* istanbul ignore if: untestable with Karma */ if (this.props.target) { if (!allowTransition) event.preventDefault(); return; } event.preventDefault(); if (allowTransition) { var _props = this.props; var to = _props.to; var query = _props.query; var hash = _props.hash; var state = _props.state; var _location = createLocationDescriptor(to, { query: query, hash: hash, state: state }); this.context.router.push(_location); } }, render: function render() { var _props2 = this.props; var to = _props2.to; var query = _props2.query; var hash = _props2.hash; var state = _props2.state; var activeClassName = _props2.activeClassName; var activeStyle = _props2.activeStyle; var onlyActiveOnIndex = _props2.onlyActiveOnIndex; var props = _objectWithoutProperties(_props2, ['to', 'query', 'hash', 'state', 'activeClassName', 'activeStyle', 'onlyActiveOnIndex']); false ? _routerWarning2['default'](!(query || hash || state), 'the `query`, `hash`, and `state` props on `<Link>` are deprecated, use `<Link to={{ pathname, query, hash, state }}/>. http://tiny.cc/router-isActivedeprecated') : undefined; // Ignore if rendered outside the context of router, simplifies unit testing. var router = this.context.router; if (router) { var _location2 = createLocationDescriptor(to, { query: query, hash: hash, state: state }); props.href = router.createHref(_location2); if (activeClassName || activeStyle != null && !isEmptyObject(activeStyle)) { if (router.isActive(_location2, onlyActiveOnIndex)) { if (activeClassName) props.className += props.className === '' ? activeClassName : ' ' + 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']; /***/ }, /* 19 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var _RouteUtils = __webpack_require__(5); var _PatternUtils = __webpack_require__(8); var _PropTypes = __webpack_require__(6); var _React$PropTypes = _react2['default'].PropTypes; var string = _React$PropTypes.string; var 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. */ var Redirect = _react2['default'].createClass({ displayName: 'Redirect', statics: { createRouteFromReactElement: function createRouteFromReactElement(element) { var route = _RouteUtils.createRouteFromReactElement(element); if (route.from) route.path = route.from; route.onEnter = function (nextState, replace) { var location = nextState.location; var params = nextState.params; var pathname = undefined; if (route.to.charAt(0) === '/') { pathname = _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 = _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: _PropTypes.falsy, children: _PropTypes.falsy }, /* istanbul ignore next: sanity check */ render: function render() { true ? false ? _invariant2['default'](false, '<Redirect> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined; } }); exports['default'] = Redirect; module.exports = exports['default']; /***/ }, /* 20 */ /***/ 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; }; exports.createRouterObject = createRouterObject; exports.createRoutingHistory = createRoutingHistory; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _deprecateObjectProperties = __webpack_require__(23); var _deprecateObjectProperties2 = _interopRequireDefault(_deprecateObjectProperties); function createRouterObject(history, transitionManager) { return _extends({}, history, { setRouteLeaveHook: transitionManager.listenBeforeLeavingRoute, isActive: transitionManager.isActive }); } // deprecated function createRoutingHistory(history, transitionManager) { history = _extends({}, history, transitionManager); if (false) { history = _deprecateObjectProperties2['default'](history, '`props.history` and `context.history` are deprecated. Please use `context.router`. http://tiny.cc/router-contextchanges'); } return history; } /***/ }, /* 21 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports['default'] = createMemoryHistory; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _historyLibUseQueries = __webpack_require__(11); var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries); var _historyLibCreateMemoryHistory = __webpack_require__(54); var _historyLibCreateMemoryHistory2 = _interopRequireDefault(_historyLibCreateMemoryHistory); function createMemoryHistory(options) { // signatures and type checking differ between `useRoutes` and // `createMemoryHistory`, have to create `memoryHistory` first because // `useQueries` doesn't understand the signature var memoryHistory = _historyLibCreateMemoryHistory2['default'](options); var createHistory = function createHistory() { return memoryHistory; }; var history = _historyLibUseQueries2['default'](createHistory)(options); history.__v2_compatible__ = true; return history; } module.exports = exports['default']; /***/ }, /* 22 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _useRouterHistory = __webpack_require__(24); var _useRouterHistory2 = _interopRequireDefault(_useRouterHistory); var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); exports['default'] = function (createHistory) { var history = undefined; if (canUseDOM) history = _useRouterHistory2['default'](createHistory)(); return history; }; module.exports = exports['default']; /***/ }, /* 23 */ /***/ function(module, exports, __webpack_require__) { /*eslint no-empty: 0*/ 'use strict'; exports.__esModule = true; exports['default'] = deprecateObjectProperties; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var useMembrane = false; if (false) { try { if (Object.defineProperty({}, 'x', { get: function get() { return true; } }).x) { useMembrane = true; } } catch (e) {} } // wraps an object in a membrane to warn about deprecated property access function deprecateObjectProperties(object, message) { if (!useMembrane) return object; var membrane = {}; var _loop = function (prop) { if (typeof object[prop] === 'function') { membrane[prop] = function () { false ? _routerWarning2['default'](false, message) : undefined; return object[prop].apply(object, arguments); }; } else { Object.defineProperty(membrane, prop, { configurable: false, enumerable: false, get: function get() { false ? _routerWarning2['default'](false, message) : undefined; return object[prop]; } }); } }; for (var prop in object) { _loop(prop); } return membrane; } module.exports = exports['default']; /***/ }, /* 24 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports['default'] = useRouterHistory; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _historyLibUseQueries = __webpack_require__(11); var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries); var _historyLibUseBasename = __webpack_require__(55); var _historyLibUseBasename2 = _interopRequireDefault(_historyLibUseBasename); function useRouterHistory(createHistory) { return function (options) { var history = _historyLibUseQueries2['default'](_historyLibUseBasename2['default'](createHistory))(options); history.__v2_compatible__ = true; return history; }; } module.exports = exports['default']; /***/ }, /* 25 */ /***/ function(module, exports, __webpack_require__) { /*eslint-disable no-empty */ 'use strict'; exports.__esModule = true; exports.saveState = saveState; exports.readState = readState; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _warning = __webpack_require__(4); var _warning2 = _interopRequireDefault(_warning); var KeyPrefix = '@@History/'; var QuotaExceededErrors = ['QuotaExceededError', 'QUOTA_EXCEEDED_ERR']; var SecurityError = 'SecurityError'; function createKey(key) { return KeyPrefix + key; } function saveState(key, state) { try { if (state == null) { window.sessionStorage.removeItem(createKey(key)); } else { window.sessionStorage.setItem(createKey(key), JSON.stringify(state)); } } catch (error) { if (error.name === SecurityError) { // Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any // attempt to access window.sessionStorage. false ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available due to security settings') : undefined; return; } if (QuotaExceededErrors.indexOf(error.name) >= 0 && window.sessionStorage.length === 0) { // Safari "private mode" throws QuotaExceededError. false ? _warning2['default'](false, '[history] Unable to save state; sessionStorage is not available in Safari private mode') : undefined; return; } throw error; } } function readState(key) { var json = undefined; try { json = window.sessionStorage.getItem(createKey(key)); } catch (error) { if (error.name === SecurityError) { // Blocking cookies in Chrome/Firefox/Safari throws SecurityError on any // attempt to access window.sessionStorage. false ? _warning2['default'](false, '[history] Unable to read state; sessionStorage is not available due to security settings') : undefined; return null; } } if (json) { try { return JSON.parse(json); } catch (error) { // Ignore invalid JSON. } } return null; } /***/ }, /* 26 */ /***/ 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; }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var _ExecutionEnvironment = __webpack_require__(10); var _DOMUtils = __webpack_require__(15); var _createHistory = __webpack_require__(28); var _createHistory2 = _interopRequireDefault(_createHistory); function createDOMHistory(options) { var history = _createHistory2['default'](_extends({ getUserConfirmation: _DOMUtils.getUserConfirmation }, options, { go: _DOMUtils.go })); function listen(listener) { !_ExecutionEnvironment.canUseDOM ? false ? _invariant2['default'](false, 'DOM history needs a DOM') : _invariant2['default'](false) : undefined; return history.listen(listener); } return _extends({}, history, { listen: listen }); } exports['default'] = createDOMHistory; module.exports = exports['default']; /***/ }, /* 27 */ /***/ 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; }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _warning = __webpack_require__(4); var _warning2 = _interopRequireDefault(_warning); var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var _Actions = __webpack_require__(9); var _PathUtils = __webpack_require__(7); var _ExecutionEnvironment = __webpack_require__(10); var _DOMUtils = __webpack_require__(15); var _DOMStateStorage = __webpack_require__(25); var _createDOMHistory = __webpack_require__(26); var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory); function isAbsolutePath(path) { return typeof path === 'string' && path.charAt(0) === '/'; } function ensureSlash() { var path = _DOMUtils.getHashPath(); if (isAbsolutePath(path)) return true; _DOMUtils.replaceHashPath('/' + path); return false; } function addQueryStringValueToPath(path, key, value) { return path + (path.indexOf('?') === -1 ? '?' : '&') + (key + '=' + value); } function stripQueryStringValueFromPath(path, key) { return path.replace(new RegExp('[?&]?' + key + '=[a-zA-Z0-9]+'), ''); } function getQueryStringValueFromPath(path, key) { var match = path.match(new RegExp('\\?.*?\\b' + key + '=(.+?)\\b')); return match && match[1]; } var DefaultQueryKey = '_k'; function createHashHistory() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; !_ExecutionEnvironment.canUseDOM ? false ? _invariant2['default'](false, 'Hash history needs a DOM') : _invariant2['default'](false) : undefined; var queryKey = options.queryKey; if (queryKey === undefined || !!queryKey) queryKey = typeof queryKey === 'string' ? queryKey : DefaultQueryKey; function getCurrentLocation() { var path = _DOMUtils.getHashPath(); var key = undefined, state = undefined; if (queryKey) { key = getQueryStringValueFromPath(path, queryKey); path = stripQueryStringValueFromPath(path, queryKey); if (key) { state = _DOMStateStorage.readState(key); } else { state = null; key = history.createKey(); _DOMUtils.replaceHashPath(addQueryStringValueToPath(path, queryKey, key)); } } else { key = state = null; } var location = _PathUtils.parsePath(path); return history.createLocation(_extends({}, location, { state: state }), undefined, key); } function startHashChangeListener(_ref) { var transitionTo = _ref.transitionTo; function hashChangeListener() { if (!ensureSlash()) return; // Always make sure hashes are preceeded with a /. transitionTo(getCurrentLocation()); } ensureSlash(); _DOMUtils.addEventListener(window, 'hashchange', hashChangeListener); return function () { _DOMUtils.removeEventListener(window, 'hashchange', hashChangeListener); }; } function finishTransition(location) { var basename = location.basename; var pathname = location.pathname; var search = location.search; var state = location.state; var action = location.action; var key = location.key; if (action === _Actions.POP) return; // Nothing to do. var path = (basename || '') + pathname + search; if (queryKey) { path = addQueryStringValueToPath(path, queryKey, key); _DOMStateStorage.saveState(key, state); } else { // Drop key and state. location.key = location.state = null; } var currentHash = _DOMUtils.getHashPath(); if (action === _Actions.PUSH) { if (currentHash !== path) { window.location.hash = path; } else { false ? _warning2['default'](false, 'You cannot PUSH the same path using hash history') : undefined; } } else if (currentHash !== path) { // REPLACE _DOMUtils.replaceHashPath(path); } } var history = _createDOMHistory2['default'](_extends({}, options, { getCurrentLocation: getCurrentLocation, finishTransition: finishTransition, saveState: _DOMStateStorage.saveState })); var listenerCount = 0, stopHashChangeListener = undefined; function listenBefore(listener) { if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history); var unlisten = history.listenBefore(listener); return function () { unlisten(); if (--listenerCount === 0) stopHashChangeListener(); }; } function listen(listener) { if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history); var unlisten = history.listen(listener); return function () { unlisten(); if (--listenerCount === 0) stopHashChangeListener(); }; } function push(location) { false ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined; history.push(location); } function replace(location) { false ? _warning2['default'](queryKey || location.state == null, 'You cannot use state without a queryKey it will be dropped') : undefined; history.replace(location); } var goIsSupportedWithoutReload = _DOMUtils.supportsGoWithoutReloadUsingHash(); function go(n) { false ? _warning2['default'](goIsSupportedWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : undefined; history.go(n); } function createHref(path) { return '#' + history.createHref(path); } // deprecated function registerTransitionHook(hook) { if (++listenerCount === 1) stopHashChangeListener = startHashChangeListener(history); history.registerTransitionHook(hook); } // deprecated function unregisterTransitionHook(hook) { history.unregisterTransitionHook(hook); if (--listenerCount === 0) stopHashChangeListener(); } // deprecated function pushState(state, path) { false ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined; history.pushState(state, path); } // deprecated function replaceState(state, path) { false ? _warning2['default'](queryKey || state == null, 'You cannot use state without a queryKey it will be dropped') : undefined; history.replaceState(state, path); } return _extends({}, history, { listenBefore: listenBefore, listen: listen, push: push, replace: replace, go: go, createHref: createHref, registerTransitionHook: registerTransitionHook, // deprecated - warning is in createHistory unregisterTransitionHook: unregisterTransitionHook, // deprecated - warning is in createHistory pushState: pushState, // deprecated - warning is in createHistory replaceState: replaceState // deprecated - warning is in createHistory }); } exports['default'] = createHashHistory; module.exports = exports['default']; /***/ }, /* 28 */ /***/ 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; }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _warning = __webpack_require__(4); var _warning2 = _interopRequireDefault(_warning); var _deepEqual = __webpack_require__(48); var _deepEqual2 = _interopRequireDefault(_deepEqual); var _PathUtils = __webpack_require__(7); var _AsyncUtils = __webpack_require__(51); var _Actions = __webpack_require__(9); var _createLocation2 = __webpack_require__(53); var _createLocation3 = _interopRequireDefault(_createLocation2); var _runTransitionHook = __webpack_require__(17); var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook); var _deprecate = __webpack_require__(16); var _deprecate2 = _interopRequireDefault(_deprecate); function createRandomKey(length) { return Math.random().toString(36).substr(2, length); } function locationsAreEqual(a, b) { return a.pathname === b.pathname && a.search === b.search && //a.action === b.action && // Different action !== location change. a.key === b.key && _deepEqual2['default'](a.state, b.state); } var DefaultKeyLength = 6; function createHistory() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var getCurrentLocation = options.getCurrentLocation; var finishTransition = options.finishTransition; var saveState = options.saveState; var go = options.go; var keyLength = options.keyLength; var getUserConfirmation = options.getUserConfirmation; if (typeof keyLength !== 'number') keyLength = DefaultKeyLength; var transitionHooks = []; function listenBefore(hook) { transitionHooks.push(hook); return function () { transitionHooks = transitionHooks.filter(function (item) { return item !== hook; }); }; } var allKeys = []; var changeListeners = []; var location = undefined; function getCurrent() { if (pendingLocation && pendingLocation.action === _Actions.POP) { return allKeys.indexOf(pendingLocation.key); } else if (location) { return allKeys.indexOf(location.key); } else { return -1; } } function updateLocation(newLocation) { var current = getCurrent(); location = newLocation; if (location.action === _Actions.PUSH) { allKeys = [].concat(allKeys.slice(0, current + 1), [location.key]); } else if (location.action === _Actions.REPLACE) { allKeys[current] = location.key; } changeListeners.forEach(function (listener) { listener(location); }); } function listen(listener) { changeListeners.push(listener); if (location) { listener(location); } else { var _location = getCurrentLocation(); allKeys = [_location.key]; updateLocation(_location); } return function () { changeListeners = changeListeners.filter(function (item) { return item !== listener; }); }; } function confirmTransitionTo(location, callback) { _AsyncUtils.loopAsync(transitionHooks.length, function (index, next, done) { _runTransitionHook2['default'](transitionHooks[index], location, function (result) { if (result != null) { done(result); } else { next(); } }); }, function (message) { if (getUserConfirmation && typeof message === 'string') { getUserConfirmation(message, function (ok) { callback(ok !== false); }); } else { callback(message !== false); } }); } var pendingLocation = undefined; function transitionTo(nextLocation) { if (location && locationsAreEqual(location, nextLocation)) return; // Nothing to do. pendingLocation = nextLocation; confirmTransitionTo(nextLocation, function (ok) { if (pendingLocation !== nextLocation) return; // Transition was interrupted. if (ok) { // treat PUSH to current path like REPLACE to be consistent with browsers if (nextLocation.action === _Actions.PUSH) { var prevPath = createPath(location); var nextPath = createPath(nextLocation); if (nextPath === prevPath && _deepEqual2['default'](location.state, nextLocation.state)) nextLocation.action = _Actions.REPLACE; } if (finishTransition(nextLocation) !== false) updateLocation(nextLocation); } else if (location && nextLocation.action === _Actions.POP) { var prevIndex = allKeys.indexOf(location.key); var nextIndex = allKeys.indexOf(nextLocation.key); if (prevIndex !== -1 && nextIndex !== -1) go(prevIndex - nextIndex); // Restore the URL. } }); } function push(location) { transitionTo(createLocation(location, _Actions.PUSH, createKey())); } function replace(location) { transitionTo(createLocation(location, _Actions.REPLACE, createKey())); } function goBack() { go(-1); } function goForward() { go(1); } function createKey() { return createRandomKey(keyLength); } function createPath(location) { if (location == null || typeof location === 'string') return location; var pathname = location.pathname; var search = location.search; var hash = location.hash; var result = pathname; if (search) result += search; if (hash) result += hash; return result; } function createHref(location) { return createPath(location); } function createLocation(location, action) { var key = arguments.length <= 2 || arguments[2] === undefined ? createKey() : arguments[2]; if (typeof action === 'object') { false ? _warning2['default'](false, 'The state (2nd) argument to history.createLocation is deprecated; use a ' + 'location descriptor instead') : undefined; if (typeof location === 'string') location = _PathUtils.parsePath(location); location = _extends({}, location, { state: action }); action = key; key = arguments[3] || createKey(); } return _createLocation3['default'](location, action, key); } // deprecated function setState(state) { if (location) { updateLocationState(location, state); updateLocation(location); } else { updateLocationState(getCurrentLocation(), state); } } function updateLocationState(location, state) { location.state = _extends({}, location.state, state); saveState(location.key, location.state); } // deprecated function registerTransitionHook(hook) { if (transitionHooks.indexOf(hook) === -1) transitionHooks.push(hook); } // deprecated function unregisterTransitionHook(hook) { transitionHooks = transitionHooks.filter(function (item) { return item !== hook; }); } // deprecated function pushState(state, path) { if (typeof path === 'string') path = _PathUtils.parsePath(path); push(_extends({ state: state }, path)); } // deprecated function replaceState(state, path) { if (typeof path === 'string') path = _PathUtils.parsePath(path); replace(_extends({ state: state }, path)); } return { listenBefore: listenBefore, listen: listen, transitionTo: transitionTo, push: push, replace: replace, go: go, goBack: goBack, goForward: goForward, createKey: createKey, createPath: createPath, createHref: createHref, createLocation: createLocation, setState: _deprecate2['default'](setState, 'setState is deprecated; use location.key to save state instead'), registerTransitionHook: _deprecate2['default'](registerTransitionHook, 'registerTransitionHook is deprecated; use listenBefore instead'), unregisterTransitionHook: _deprecate2['default'](unregisterTransitionHook, 'unregisterTransitionHook is deprecated; use the callback returned from listenBefore instead'), pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'), replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead') }; } exports['default'] = createHistory; module.exports = exports['default']; /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var _PropTypes = __webpack_require__(6); /** * A mixin that adds the "history" instance variable to components. */ var History = { contextTypes: { history: _PropTypes.history }, componentWillMount: function componentWillMount() { false ? _routerWarning2['default'](false, 'the `History` mixin is deprecated, please access `context.router` with your own `contextTypes`. http://tiny.cc/router-historymixin') : undefined; this.history = this.context.history; } }; exports['default'] = History; module.exports = exports['default']; /***/ }, /* 30 */ /***/ 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; }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _Link = __webpack_require__(18); var _Link2 = _interopRequireDefault(_Link); /** * 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']; /***/ }, /* 31 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var _Redirect = __webpack_require__(19); var _Redirect2 = _interopRequireDefault(_Redirect); var _PropTypes = __webpack_require__(6); var _React$PropTypes = _react2['default'].PropTypes; var string = _React$PropTypes.string; var object = _React$PropTypes.object; /** * An <IndexRedirect> is used to redirect from an indexRoute. */ 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 { false ? _routerWarning2['default'](false, 'An <IndexRedirect> does not make sense at the root of your route config') : undefined; } } }, propTypes: { to: string.isRequired, query: object, state: object, onEnter: _PropTypes.falsy, children: _PropTypes.falsy }, /* istanbul ignore next: sanity check */ render: function render() { true ? false ? _invariant2['default'](false, '<IndexRedirect> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined; } }); exports['default'] = IndexRedirect; module.exports = exports['default']; /***/ }, /* 32 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var _RouteUtils = __webpack_require__(5); var _PropTypes = __webpack_require__(6); var func = _react2['default'].PropTypes.func; /** * An <IndexRoute> is used to specify its parent's <Route indexRoute> in * a JSX route config. */ var IndexRoute = _react2['default'].createClass({ displayName: 'IndexRoute', statics: { createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) { /* istanbul ignore else: sanity check */ if (parentRoute) { parentRoute.indexRoute = _RouteUtils.createRouteFromReactElement(element); } else { false ? _routerWarning2['default'](false, 'An <IndexRoute> does not make sense at the root of your route config') : undefined; } } }, propTypes: { path: _PropTypes.falsy, component: _PropTypes.component, components: _PropTypes.components, getComponent: func, getComponents: func }, /* istanbul ignore next: sanity check */ render: function render() { true ? false ? _invariant2['default'](false, '<IndexRoute> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined; } }); exports['default'] = IndexRoute; module.exports = exports['default']; /***/ }, /* 33 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var object = _react2['default'].PropTypes.object; /** * The Lifecycle mixin adds the routerWillLeave lifecycle method to a * component that may be used to cancel a transition or prompt the user * for confirmation. * * On standard transitions, routerWillLeave receives a single argument: the * location we're transitioning to. To cancel the transition, return false. * To prompt the user for confirmation, return a prompt message (string). * * During the beforeunload event (assuming you're using the useBeforeUnload * history enhancer), routerWillLeave does not receive a location object * because it isn't possible for us to know the location we're transitioning * to. In this case routerWillLeave must return a prompt message to prevent * the user from closing the window/tab. */ var Lifecycle = { contextTypes: { history: object.isRequired, // Nested children receive the route as context, either // set by the route component using the RouteContext mixin // or by some other ancestor. route: object }, propTypes: { // Route components receive the route object as a prop. route: object }, componentDidMount: function componentDidMount() { false ? _routerWarning2['default'](false, 'the `Lifecycle` mixin is deprecated, please use `context.router.setRouteLeaveHook(route, hook)`. http://tiny.cc/router-lifecyclemixin') : undefined; !this.routerWillLeave ? false ? _invariant2['default'](false, 'The Lifecycle mixin requires you to define a routerWillLeave method') : _invariant2['default'](false) : undefined; var route = this.props.route || this.context.route; !route ? false ? _invariant2['default'](false, 'The Lifecycle mixin must be used on either a) a <Route component> or ' + 'b) a descendant of a <Route component> that uses the RouteContext mixin') : _invariant2['default'](false) : undefined; this._unlistenBeforeLeavingRoute = this.context.history.listenBeforeLeavingRoute(route, this.routerWillLeave); }, componentWillUnmount: function componentWillUnmount() { if (this._unlistenBeforeLeavingRoute) this._unlistenBeforeLeavingRoute(); } }; exports['default'] = Lifecycle; module.exports = exports['default']; /***/ }, /* 34 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var _RouteUtils = __webpack_require__(5); var _PropTypes = __webpack_require__(6); var _React$PropTypes = _react2['default'].PropTypes; var string = _React$PropTypes.string; var 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. */ var Route = _react2['default'].createClass({ displayName: 'Route', statics: { createRouteFromReactElement: _RouteUtils.createRouteFromReactElement }, propTypes: { path: string, component: _PropTypes.component, components: _PropTypes.components, getComponent: func, getComponents: func }, /* istanbul ignore next: sanity check */ render: function render() { true ? false ? _invariant2['default'](false, '<Route> elements are for router configuration only and should not be rendered') : _invariant2['default'](false) : undefined; } }); exports['default'] = Route; module.exports = exports['default']; /***/ }, /* 35 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var object = _react2['default'].PropTypes.object; /** * The RouteContext mixin provides a convenient way for route * components to set the route in context. This is needed for * routes that render elements that want to use the Lifecycle * mixin to prevent transitions. */ var RouteContext = { propTypes: { route: object.isRequired }, childContextTypes: { route: object.isRequired }, getChildContext: function getChildContext() { return { route: this.props.route }; }, componentWillMount: function componentWillMount() { false ? _routerWarning2['default'](false, 'The `RouteContext` mixin is deprecated. You can provide `this.props.route` on context with your own `contextTypes`. http://tiny.cc/router-routecontextmixin') : undefined; } }; exports['default'] = RouteContext; module.exports = exports['default']; /***/ }, /* 36 */ /***/ 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; }; 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; } var _historyLibCreateHashHistory = __webpack_require__(27); var _historyLibCreateHashHistory2 = _interopRequireDefault(_historyLibCreateHashHistory); var _historyLibUseQueries = __webpack_require__(11); var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries); var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _createTransitionManager = __webpack_require__(14); var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); var _PropTypes = __webpack_require__(6); var _RouterContext = __webpack_require__(13); var _RouterContext2 = _interopRequireDefault(_RouterContext); var _RouteUtils = __webpack_require__(5); var _RouterUtils = __webpack_require__(20); var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); function isDeprecatedHistory(history) { return !history || !history.__v2_compatible__; } var _React$PropTypes = _react2['default'].PropTypes; var func = _React$PropTypes.func; var 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: _PropTypes.routes, routes: _PropTypes.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. } }, componentWillMount: function componentWillMount() { var _this = this; var _props = this.props; var parseQueryString = _props.parseQueryString; var stringifyQuery = _props.stringifyQuery; false ? _routerWarning2['default'](!(parseQueryString || stringifyQuery), '`parseQueryString` and `stringifyQuery` are deprecated. Please create a custom history. http://tiny.cc/router-customquerystring') : undefined; var _createRouterObjects = this.createRouterObjects(); var history = _createRouterObjects.history; var transitionManager = _createRouterObjects.transitionManager; var router = _createRouterObjects.router; this._unlisten = transitionManager.listen(function (error, state) { if (error) { _this.handleError(error); } else { _this.setState(state, _this.props.onUpdate); } }); this.history = history; this.router = router; }, createRouterObjects: function createRouterObjects() { var matchContext = this.props.matchContext; if (matchContext) { return matchContext; } var history = this.props.history; var _props2 = this.props; var routes = _props2.routes; var children = _props2.children; if (isDeprecatedHistory(history)) { history = this.wrapDeprecatedHistory(history); } var transitionManager = _createTransitionManager2['default'](history, _RouteUtils.createRoutes(routes || children)); var router = _RouterUtils.createRouterObject(history, transitionManager); var routingHistory = _RouterUtils.createRoutingHistory(history, transitionManager); return { history: routingHistory, transitionManager: transitionManager, router: router }; }, wrapDeprecatedHistory: function wrapDeprecatedHistory(history) { var _props3 = this.props; var parseQueryString = _props3.parseQueryString; var stringifyQuery = _props3.stringifyQuery; var createHistory = undefined; if (history) { false ? _routerWarning2['default'](false, 'It appears you have provided a deprecated history object to `<Router/>`, please use a history provided by ' + 'React Router with `import { browserHistory } from \'react-router\'` or `import { hashHistory } from \'react-router\'`. ' + 'If you are using a custom history please create it with `useRouterHistory`, see http://tiny.cc/router-usinghistory for details.') : undefined; createHistory = function () { return history; }; } else { false ? _routerWarning2['default'](false, '`Router` no longer defaults the history prop to hash history. Please use the `hashHistory` singleton instead. http://tiny.cc/router-defaulthistory') : undefined; createHistory = _historyLibCreateHashHistory2['default']; } return _historyLibUseQueries2['default'](createHistory)({ parseQueryString: parseQueryString, stringifyQuery: stringifyQuery }); }, /* istanbul ignore next: sanity check */ componentWillReceiveProps: function componentWillReceiveProps(nextProps) { false ? _routerWarning2['default'](nextProps.history === this.props.history, 'You cannot change <Router history>; it will be ignored') : undefined; false ? _routerWarning2['default']((nextProps.routes || nextProps.children) === (this.props.routes || this.props.children), 'You cannot change <Router routes>; it will be ignored') : undefined; }, componentWillUnmount: function componentWillUnmount() { if (this._unlisten) this._unlisten(); }, render: function render() { var _state = this.state; var location = _state.location; var routes = _state.routes; var params = _state.params; var components = _state.components; var _props4 = this.props; var createElement = _props4.createElement; var render = _props4.render; var props = _objectWithoutProperties(_props4, ['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, { history: this.history, router: this.router, location: location, routes: routes, params: params, components: components, createElement: createElement })); } }); exports['default'] = Router; module.exports = exports['default']; /***/ }, /* 37 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _RouterContext = __webpack_require__(13); var _RouterContext2 = _interopRequireDefault(_RouterContext); var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var RoutingContext = _react2['default'].createClass({ displayName: 'RoutingContext', componentWillMount: function componentWillMount() { false ? _routerWarning2['default'](false, '`RoutingContext` has been renamed to `RouterContext`. Please use `import { RouterContext } from \'react-router\'`. http://tiny.cc/router-routercontext') : undefined; }, render: function render() { return _react2['default'].createElement(_RouterContext2['default'], this.props); } }); exports['default'] = RoutingContext; module.exports = exports['default']; /***/ }, /* 38 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.runEnterHooks = runEnterHooks; exports.runLeaveHooks = runLeaveHooks; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _AsyncUtils = __webpack_require__(12); var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); function createEnterHook(hook, route) { return function (a, b, callback) { hook.apply(route, arguments); if (hook.length < 3) { // Assume hook executes synchronously and // automatically call the callback. callback(); } }; } function getEnterHooks(routes) { return routes.reduce(function (hooks, route) { if (route.onEnter) hooks.push(createEnterHook(route.onEnter, route)); return hooks; }, []); } /** * 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) { var hooks = getEnterHooks(routes); if (!hooks.length) { callback(); return; } var redirectInfo = undefined; function replace(location, deprecatedPathname, deprecatedQuery) { if (deprecatedPathname) { false ? _routerWarning2['default'](false, '`replaceState(state, pathname, query) is deprecated; use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated') : undefined; redirectInfo = { pathname: deprecatedPathname, query: deprecatedQuery, state: location }; return; } redirectInfo = location; } _AsyncUtils.loopAsync(hooks.length, function (index, next, done) { hooks[index](nextState, replace, function (error) { if (error || redirectInfo) { done(error, redirectInfo); // No need to continue. } else { next(); } }); }, callback); } /** * Runs all onLeave hooks in the given array of routes in order. */ function runLeaveHooks(routes) { for (var i = 0, len = routes.length; i < len; ++i) { if (routes[i].onLeave) routes[i].onLeave.call(routes[i]); } } /***/ }, /* 39 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _historyLibCreateBrowserHistory = __webpack_require__(52); var _historyLibCreateBrowserHistory2 = _interopRequireDefault(_historyLibCreateBrowserHistory); var _createRouterHistory = __webpack_require__(22); var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory); exports['default'] = _createRouterHistory2['default'](_historyLibCreateBrowserHistory2['default']); module.exports = exports['default']; /***/ }, /* 40 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _PatternUtils = __webpack_require__(8); function routeParamsChanged(route, prevState, nextState) { if (!route.path) return false; var paramNames = _PatternUtils.getParamNames(route.path); return paramNames.some(function (paramName) { return prevState.params[paramName] !== nextState.params[paramName]; }); } /** * Returns an object of { leaveRoutes, 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. */ function computeChangedRoutes(prevState, nextState) { var prevRoutes = prevState && prevState.routes; var nextRoutes = nextState.routes; var leaveRoutes = undefined, enterRoutes = undefined; if (prevRoutes) { leaveRoutes = prevRoutes.filter(function (route) { return nextRoutes.indexOf(route) === -1 || routeParamsChanged(route, prevState, nextState); }); // onLeave hooks start at the leaf route. leaveRoutes.reverse(); enterRoutes = nextRoutes.filter(function (route) { return prevRoutes.indexOf(route) === -1 || leaveRoutes.indexOf(route) !== -1; }); } else { leaveRoutes = []; enterRoutes = nextRoutes; } return { leaveRoutes: leaveRoutes, enterRoutes: enterRoutes }; } exports['default'] = computeChangedRoutes; module.exports = exports['default']; /***/ }, /* 41 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _AsyncUtils = __webpack_require__(12); function getComponentsForRoute(location, route, callback) { if (route.component || route.components) { callback(null, route.component || route.components); } else if (route.getComponent) { route.getComponent(location, callback); } else if (route.getComponents) { route.getComponents(location, 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) { _AsyncUtils.mapAsync(nextState.routes, function (route, index, callback) { getComponentsForRoute(nextState.location, route, callback); }, callback); } exports['default'] = getComponents; module.exports = exports['default']; /***/ }, /* 42 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _PatternUtils = __webpack_require__(8); /** * 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; var paramNames = _PatternUtils.getParamNames(route.path); for (var p in params) { if (params.hasOwnProperty(p) && paramNames.indexOf(p) !== -1) routeParams[p] = params[p]; }return routeParams; } exports['default'] = getRouteParams; module.exports = exports['default']; /***/ }, /* 43 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _historyLibCreateHashHistory = __webpack_require__(27); var _historyLibCreateHashHistory2 = _interopRequireDefault(_historyLibCreateHashHistory); var _createRouterHistory = __webpack_require__(22); var _createRouterHistory2 = _interopRequireDefault(_createRouterHistory); exports['default'] = _createRouterHistory2['default'](_historyLibCreateHashHistory2['default']); module.exports = exports['default']; /***/ }, /* 44 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports['default'] = isActive; var _PatternUtils = __webpack_require__(8); 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 === 'object') { for (var p in a) { if (!a.hasOwnProperty(p)) { continue; } if (a[p] === undefined) { if (b[p] !== undefined) { return false; } } else if (!b.hasOwnProperty(p)) { return false; } else if (!deepEqual(a[p], b[p])) { return false; } } return true; } return String(a) === String(b); } function paramsAreActive(paramNames, paramValues, activeParams) { // FIXME: This doesn't work on repeated params in activeParams. return paramNames.every(function (paramName, index) { return String(paramValues[index]) === String(activeParams[paramName]); }); } function getMatchingRouteIndex(pathname, activeRoutes, activeParams) { var remainingPathname = pathname, paramNames = [], paramValues = []; for (var i = 0, len = activeRoutes.length; i < len; ++i) { var route = activeRoutes[i]; var pattern = route.path || ''; if (pattern.charAt(0) === '/') { remainingPathname = pathname; paramNames = []; paramValues = []; } if (remainingPathname !== null) { var matched = _PatternUtils.matchPattern(pattern, remainingPathname); remainingPathname = matched.remainingPathname; paramNames = [].concat(paramNames, matched.paramNames); paramValues = [].concat(paramValues, matched.paramValues); } if (remainingPathname === '' && route.path && paramsAreActive(paramNames, paramValues, activeParams)) return i; } return null; } /** * Returns true if the given pathname matches the active routes * and params. */ function routeIsActive(pathname, routes, params, indexOnly) { var i = getMatchingRouteIndex(pathname, routes, params); if (i === null) { // No match. return false; } else if (!indexOnly) { // Any match is good enough. return true; } // If any remaining routes past the match index have paths, then we can't // be on the index route. return routes.slice(i + 1).every(function (route) { return !route.path; }); } /** * 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; var query = _ref.query; if (currentLocation == null) return false; if (!routeIsActive(pathname, routes, params, indexOnly)) return false; return queryIsActive(query, currentLocation.query); } module.exports = exports['default']; /***/ }, /* 45 */ /***/ 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; }; 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; } var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var _createMemoryHistory = __webpack_require__(21); var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory); var _createTransitionManager = __webpack_require__(14); var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); var _RouteUtils = __webpack_require__(5); var _RouterUtils = __webpack_require__(20); /** * 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; var routes = _ref.routes; var location = _ref.location; var options = _objectWithoutProperties(_ref, ['history', 'routes', 'location']); !(history || location) ? false ? _invariant2['default'](false, 'match needs a history or a location') : _invariant2['default'](false) : undefined; history = history ? history : _createMemoryHistory2['default'](options); var transitionManager = _createTransitionManager2['default'](history, _RouteUtils.createRoutes(routes)); var unlisten = undefined; if (location) { // Allow match({ location: '/the/path', ... }) location = history.createLocation(location); } else { // Pick up the location from the history via synchronous history.listen // call if needed. unlisten = history.listen(function (historyLocation) { location = historyLocation; }); } var router = _RouterUtils.createRouterObject(history, transitionManager); history = _RouterUtils.createRoutingHistory(history, transitionManager); transitionManager.match(location, function (error, redirectLocation, nextState) { callback(error, redirectLocation, nextState && _extends({}, nextState, { history: history, router: router, matchContext: { history: history, transitionManager: transitionManager, router: router } })); // Defer removing the listener to here to prevent DOM histories from having // to unwind DOM event listeners unnecessarily, in case callback renders a // <Router> and attaches another history listener. if (unlisten) { unlisten(); } }); } exports['default'] = match; module.exports = exports['default']; /***/ }, /* 46 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); var _AsyncUtils = __webpack_require__(12); var _PatternUtils = __webpack_require__(8); var _RouteUtils = __webpack_require__(5); function getChildRoutes(route, location, callback) { if (route.childRoutes) { return [null, route.childRoutes]; } if (!route.getChildRoutes) { return []; } var sync = true, result = undefined; route.getChildRoutes(location, function (error, childRoutes) { childRoutes = !error && _RouteUtils.createRoutes(childRoutes); if (sync) { result = [error, childRoutes]; return; } callback(error, childRoutes); }); sync = false; return result; // Might be undefined. } function getIndexRoute(route, location, callback) { if (route.indexRoute) { callback(null, route.indexRoute); } else if (route.getIndexRoute) { route.getIndexRoute(location, function (error, indexRoute) { callback(error, !error && _RouteUtils.createRoutes(indexRoute)[0]); }); } else if (route.childRoutes) { (function () { var pathless = route.childRoutes.filter(function (obj) { return !obj.hasOwnProperty('path'); }); _AsyncUtils.loopAsync(pathless.length, function (index, next, done) { getIndexRoute(pathless[index], location, 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); }); })(); } 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 = []; } if (remainingPathname !== null) { var matched = _PatternUtils.matchPattern(pattern, remainingPathname); remainingPathname = matched.remainingPathname; paramNames = [].concat(paramNames, matched.paramNames); paramValues = [].concat(paramValues, matched.paramValues); if (remainingPathname === '' && route.path) { var _ret2 = (function () { var match = { routes: [route], params: createParams(paramNames, paramValues) }; getIndexRoute(route, location, function (error, indexRoute) { if (error) { callback(error); } else { if (Array.isArray(indexRoute)) { var _match$routes; false ? _routerWarning2['default'](indexRoute.every(function (route) { return !route.path; }), 'Index routes should not have paths') : undefined; (_match$routes = match.routes).push.apply(_match$routes, indexRoute); } else if (indexRoute) { false ? _routerWarning2['default'](!indexRoute.path, 'Index routes should not have paths') : undefined; match.routes.push(indexRoute); } callback(null, match); } }); return { v: undefined }; })(); if (typeof _ret2 === 'object') return _ret2.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, 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) { var remainingPathname = arguments.length <= 3 || arguments[3] === undefined ? location.pathname : arguments[3]; var paramNames = arguments.length <= 4 || arguments[4] === undefined ? [] : arguments[4]; var paramValues = arguments.length <= 5 || arguments[5] === undefined ? [] : arguments[5]; return (function () { _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); })(); } exports['default'] = matchRoutes; module.exports = exports['default']; /***/ }, /* 47 */ /***/ 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; }; 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; } var _historyLibUseQueries = __webpack_require__(11); var _historyLibUseQueries2 = _interopRequireDefault(_historyLibUseQueries); var _createTransitionManager = __webpack_require__(14); var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager); var _routerWarning = __webpack_require__(1); var _routerWarning2 = _interopRequireDefault(_routerWarning); /** * Returns a new createHistory function that may be used to create * history objects that know about routing. * * Enhances history objects with the following methods: * * - listen((error, nextState) => {}) * - listenBeforeLeavingRoute(route, (nextLocation) => {}) * - match(location, (error, redirectLocation, nextState) => {}) * - isActive(pathname, query, indexOnly=false) */ function useRoutes(createHistory) { false ? _routerWarning2['default'](false, '`useRoutes` is deprecated. Please use `createTransitionManager` instead.') : undefined; return function () { var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var routes = _ref.routes; var options = _objectWithoutProperties(_ref, ['routes']); var history = _historyLibUseQueries2['default'](createHistory)(options); var transitionManager = _createTransitionManager2['default'](history, routes); return _extends({}, history, transitionManager); }; } exports['default'] = useRoutes; module.exports = exports['default']; /***/ }, /* 48 */ /***/ function(module, exports, __webpack_require__) { var pSlice = Array.prototype.slice; var objectKeys = __webpack_require__(50); var isArguments = __webpack_require__(49); var deepEqual = module.exports = function (actual, expected, opts) { if (!opts) opts = {}; // 7.1. All identical values are equivalent, as determined by ===. if (actual === expected) { return true; } else if (actual instanceof Date && expected instanceof Date) { return actual.getTime() === expected.getTime(); // 7.3. Other pairs that do not both pass typeof value == 'object', // equivalence is determined by ==. } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') { return opts.strict ? actual === expected : actual == expected; // 7.4. For all other Object pairs, including Array objects, equivalence is // determined by having the same number of owned properties (as verified // with Object.prototype.hasOwnProperty.call), the same set of keys // (although not necessarily the same order), equivalent values for every // corresponding key, and an identical 'prototype' property. Note: this // accounts for both named and indexed properties on Arrays. } else { return objEquiv(actual, expected, opts); } } function isUndefinedOrNull(value) { return value === null || value === undefined; } function isBuffer (x) { if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false; if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { return false; } if (x.length > 0 && typeof x[0] !== 'number') return false; return true; } function objEquiv(a, b, opts) { var i, key; if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) return false; // an identical 'prototype' property. if (a.prototype !== b.prototype) return false; //~~~I've managed to break Object.keys through screwy arguments passing. // Converting to array solves the problem. if (isArguments(a)) { if (!isArguments(b)) { return false; } a = pSlice.call(a); b = pSlice.call(b); return deepEqual(a, b, opts); } if (isBuffer(a)) { if (!isBuffer(b)) { return false; } if (a.length !== b.length) return false; for (i = 0; i < a.length; i++) { if (a[i] !== b[i]) return false; } return true; } try { var ka = objectKeys(a), kb = objectKeys(b); } catch (e) {//happens when one is a string literal and the other isn't return false; } // having the same number of owned properties (keys incorporates // hasOwnProperty) if (ka.length != kb.length) return false; //the same set of keys (although not necessarily the same order), ka.sort(); kb.sort(); //~~~cheap key test for (i = ka.length - 1; i >= 0; i--) { if (ka[i] != kb[i]) return false; } //equivalent values for every corresponding key, and //~~~possibly expensive deep test for (i = ka.length - 1; i >= 0; i--) { key = ka[i]; if (!deepEqual(a[key], b[key], opts)) return false; } return typeof a === typeof b; } /***/ }, /* 49 */ /***/ function(module, exports) { var supportsArgumentsClass = (function(){ return Object.prototype.toString.call(arguments) })() == '[object Arguments]'; exports = module.exports = supportsArgumentsClass ? supported : unsupported; exports.supported = supported; function supported(object) { return Object.prototype.toString.call(object) == '[object Arguments]'; }; exports.unsupported = unsupported; function unsupported(object){ return object && typeof object == 'object' && typeof object.length == 'number' && Object.prototype.hasOwnProperty.call(object, 'callee') && !Object.prototype.propertyIsEnumerable.call(object, 'callee') || false; }; /***/ }, /* 50 */ /***/ function(module, exports) { exports = module.exports = typeof Object.keys === 'function' ? Object.keys : shim; exports.shim = shim; function shim (obj) { var keys = []; for (var key in obj) keys.push(key); return keys; } /***/ }, /* 51 */ /***/ function(module, exports) { "use strict"; exports.__esModule = true; exports.loopAsync = loopAsync; function loopAsync(turns, work, callback) { var currentTurn = 0; var isDone = false; function done() { isDone = true; callback.apply(this, arguments); } function next() { if (isDone) return; if (currentTurn < turns) { work.call(this, currentTurn++, next, done); } else { done.apply(this, arguments); } } next(); } /***/ }, /* 52 */ /***/ 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; }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var _Actions = __webpack_require__(9); var _PathUtils = __webpack_require__(7); var _ExecutionEnvironment = __webpack_require__(10); var _DOMUtils = __webpack_require__(15); var _DOMStateStorage = __webpack_require__(25); var _createDOMHistory = __webpack_require__(26); var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory); /** * 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 URLs. */ function createBrowserHistory() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; !_ExecutionEnvironment.canUseDOM ? false ? _invariant2['default'](false, 'Browser history needs a DOM') : _invariant2['default'](false) : undefined; var forceRefresh = options.forceRefresh; var isSupported = _DOMUtils.supportsHistory(); var useRefresh = !isSupported || forceRefresh; function getCurrentLocation(historyState) { historyState = historyState || window.history.state || {}; var path = _DOMUtils.getWindowPath(); var _historyState = historyState; var key = _historyState.key; var state = undefined; if (key) { state = _DOMStateStorage.readState(key); } else { state = null; key = history.createKey(); if (isSupported) window.history.replaceState(_extends({}, historyState, { key: key }), null, path); } var location = _PathUtils.parsePath(path); return history.createLocation(_extends({}, location, { state: state }), undefined, key); } function startPopStateListener(_ref) { var transitionTo = _ref.transitionTo; function popStateListener(event) { if (event.state === undefined) return; // Ignore extraneous popstate events in WebKit. transitionTo(getCurrentLocation(event.state)); } _DOMUtils.addEventListener(window, 'popstate', popStateListener); return function () { _DOMUtils.removeEventListener(window, 'popstate', popStateListener); }; } function finishTransition(location) { var basename = location.basename; var pathname = location.pathname; var search = location.search; var hash = location.hash; var state = location.state; var action = location.action; var key = location.key; if (action === _Actions.POP) return; // Nothing to do. _DOMStateStorage.saveState(key, state); var path = (basename || '') + pathname + search + hash; var historyState = { key: key }; if (action === _Actions.PUSH) { if (useRefresh) { window.location.href = path; return false; // Prevent location update. } else { window.history.pushState(historyState, null, path); } } else { // REPLACE if (useRefresh) { window.location.replace(path); return false; // Prevent location update. } else { window.history.replaceState(historyState, null, path); } } } var history = _createDOMHistory2['default'](_extends({}, options, { getCurrentLocation: getCurrentLocation, finishTransition: finishTransition, saveState: _DOMStateStorage.saveState })); var listenerCount = 0, stopPopStateListener = undefined; function listenBefore(listener) { if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history); var unlisten = history.listenBefore(listener); return function () { unlisten(); if (--listenerCount === 0) stopPopStateListener(); }; } function listen(listener) { if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history); var unlisten = history.listen(listener); return function () { unlisten(); if (--listenerCount === 0) stopPopStateListener(); }; } // deprecated function registerTransitionHook(hook) { if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history); history.registerTransitionHook(hook); } // deprecated function unregisterTransitionHook(hook) { history.unregisterTransitionHook(hook); if (--listenerCount === 0) stopPopStateListener(); } return _extends({}, history, { listenBefore: listenBefore, listen: listen, registerTransitionHook: registerTransitionHook, unregisterTransitionHook: unregisterTransitionHook }); } exports['default'] = createBrowserHistory; module.exports = exports['default']; /***/ }, /* 53 */ /***/ 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; }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _warning = __webpack_require__(4); var _warning2 = _interopRequireDefault(_warning); var _Actions = __webpack_require__(9); var _PathUtils = __webpack_require__(7); function createLocation() { var location = arguments.length <= 0 || arguments[0] === undefined ? '/' : arguments[0]; var action = arguments.length <= 1 || arguments[1] === undefined ? _Actions.POP : arguments[1]; var key = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; var _fourthArg = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; if (typeof location === 'string') location = _PathUtils.parsePath(location); if (typeof action === 'object') { false ? _warning2['default'](false, 'The state (2nd) argument to createLocation is deprecated; use a ' + 'location descriptor instead') : undefined; location = _extends({}, location, { state: action }); action = key || _Actions.POP; key = _fourthArg; } var pathname = location.pathname || '/'; var search = location.search || ''; var hash = location.hash || ''; var state = location.state || null; return { pathname: pathname, search: search, hash: hash, state: state, action: action, key: key }; } exports['default'] = createLocation; module.exports = exports['default']; /***/ }, /* 54 */ /***/ 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; }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _warning = __webpack_require__(4); var _warning2 = _interopRequireDefault(_warning); var _invariant = __webpack_require__(3); var _invariant2 = _interopRequireDefault(_invariant); var _PathUtils = __webpack_require__(7); var _Actions = __webpack_require__(9); var _createHistory = __webpack_require__(28); var _createHistory2 = _interopRequireDefault(_createHistory); function createStateStorage(entries) { return entries.filter(function (entry) { return entry.state; }).reduce(function (memo, entry) { memo[entry.key] = entry.state; return memo; }, {}); } 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 history = _createHistory2['default'](_extends({}, options, { getCurrentLocation: getCurrentLocation, finishTransition: finishTransition, saveState: saveState, 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) { var key = history.createKey(); if (typeof entry === 'string') return { pathname: entry, key: key }; if (typeof entry === 'object' && entry) return _extends({}, entry, { key: key }); true ? false ? _invariant2['default'](false, 'Unable to create history entry from %s', entry) : _invariant2['default'](false) : undefined; }); if (current == null) { current = entries.length - 1; } else { !(current >= 0 && current < entries.length) ? false ? _invariant2['default'](false, 'Current index must be >= 0 and < %s, was %s', entries.length, current) : _invariant2['default'](false) : undefined; } var storage = createStateStorage(entries); function saveState(key, state) { storage[key] = state; } function readState(key) { return storage[key]; } function getCurrentLocation() { var entry = entries[current]; var key = entry.key; var basename = entry.basename; var pathname = entry.pathname; var search = entry.search; var path = (basename || '') + pathname + (search || ''); var state = undefined; if (key) { state = readState(key); } else { state = null; key = history.createKey(); entry.key = key; } var location = _PathUtils.parsePath(path); return history.createLocation(_extends({}, location, { state: state }), undefined, key); } function canGo(n) { var index = current + n; return index >= 0 && index < entries.length; } function go(n) { if (n) { if (!canGo(n)) { false ? _warning2['default'](false, 'Cannot go(%s) there is not enough history', n) : undefined; return; } current += n; var currentLocation = getCurrentLocation(); // change action to POP history.transitionTo(_extends({}, currentLocation, { action: _Actions.POP })); } } function finishTransition(location) { switch (location.action) { case _Actions.PUSH: current += 1; // if we are not on the top of stack // remove rest and push new if (current < entries.length) entries.splice(current); entries.push(location); saveState(location.key, location.state); break; case _Actions.REPLACE: entries[current] = location; saveState(location.key, location.state); break; } } return history; } exports['default'] = createMemoryHistory; module.exports = exports['default']; /***/ }, /* 55 */ /***/ 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; }; 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; } var _ExecutionEnvironment = __webpack_require__(10); var _PathUtils = __webpack_require__(7); var _runTransitionHook = __webpack_require__(17); var _runTransitionHook2 = _interopRequireDefault(_runTransitionHook); var _deprecate = __webpack_require__(16); var _deprecate2 = _interopRequireDefault(_deprecate); function useBasename(createHistory) { return function () { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var basename = options.basename; var historyOptions = _objectWithoutProperties(options, ['basename']); var history = createHistory(historyOptions); // Automatically use the value of <base href> in HTML // documents as basename if it's not explicitly given. if (basename == null && _ExecutionEnvironment.canUseDOM) { var base = document.getElementsByTagName('base')[0]; if (base) basename = _PathUtils.extractPath(base.href); } function addBasename(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; } function prependBasename(location) { if (!basename) return location; if (typeof location === 'string') location = _PathUtils.parsePath(location); var pname = location.pathname; var normalizedBasename = basename.slice(-1) === '/' ? basename : basename + '/'; var normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname; var pathname = normalizedBasename + normalizedPathname; return _extends({}, location, { pathname: pathname }); } // Override all read methods with basename-aware versions. function listenBefore(hook) { return history.listenBefore(function (location, callback) { _runTransitionHook2['default'](hook, addBasename(location), callback); }); } function listen(listener) { return history.listen(function (location) { listener(addBasename(location)); }); } // Override all write methods with basename-aware versions. function push(location) { history.push(prependBasename(location)); } function replace(location) { history.replace(prependBasename(location)); } function createPath(location) { return history.createPath(prependBasename(location)); } function createHref(location) { return history.createHref(prependBasename(location)); } 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))); } // deprecated function pushState(state, path) { if (typeof path === 'string') path = _PathUtils.parsePath(path); push(_extends({ state: state }, path)); } // deprecated function replaceState(state, path) { if (typeof path === 'string') path = _PathUtils.parsePath(path); replace(_extends({ state: state }, path)); } return _extends({}, history, { listenBefore: listenBefore, listen: listen, push: push, replace: replace, createPath: createPath, createHref: createHref, createLocation: createLocation, pushState: _deprecate2['default'](pushState, 'pushState is deprecated; use push instead'), replaceState: _deprecate2['default'](replaceState, 'replaceState is deprecated; use replace instead') }); }; } exports['default'] = useBasename; module.exports = exports['default']; /***/ }, /* 56 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var strictUriEncode = __webpack_require__(57); exports.extract = function (str) { return str.split('?')[1] || ''; }; exports.parse = function (str) { if (typeof str !== 'string') { return {}; } str = str.trim().replace(/^(\?|#|&)/, ''); if (!str) { return {}; } return str.split('&').reduce(function (ret, 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; key = decodeURIComponent(key); // missing `=` should be `null`: // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters val = val === undefined ? null : decodeURIComponent(val); if (!ret.hasOwnProperty(key)) { ret[key] = val; } else if (Array.isArray(ret[key])) { ret[key].push(val); } else { ret[key] = [ret[key], val]; } return ret; }, {}); }; exports.stringify = function (obj) { return obj ? Object.keys(obj).sort().map(function (key) { var val = obj[key]; if (val === undefined) { return ''; } if (val === null) { return key; } if (Array.isArray(val)) { return val.sort().map(function (val2) { return strictUriEncode(key) + '=' + strictUriEncode(val2); }).join('&'); } return strictUriEncode(key) + '=' + strictUriEncode(val); }).filter(function (x) { return x.length > 0; }).join('&') : ''; }; /***/ }, /* 57 */ /***/ function(module, exports) { 'use strict'; module.exports = function (str) { return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { return '%' + c.charCodeAt(0).toString(16).toUpperCase(); }); }; /***/ } /******/ ]) }); ;
App/Components/DayToggle.js
infinitered/ChainReactApp
import React from 'react' import { View, Text, TouchableOpacity } from 'react-native' import LinearGradient from 'react-native-linear-gradient' import styles from './Styles/DayToggleStyle' const DayToggle = props => { const { activeDay, onPressIn } = props const dayStyle = (day) => activeDay === day ? styles.activeDay : styles.inactiveDay return ( <LinearGradient start={{x: 0, y: 0}} end={{x: 1, y: 1}} locations={[0.0, 0.38, 1.0]} colors={['#46114E', '#521655', '#571757']} style={styles.headerGradient}> <View style={styles.dayToggle}> <TouchableOpacity onPressIn={() => onPressIn(0)}> <Text style={dayStyle(0)}>Monday</Text> </TouchableOpacity> <TouchableOpacity onPressIn={() => onPressIn(1)}> <Text style={dayStyle(1)}>Tuesday</Text> </TouchableOpacity> </View> </LinearGradient> ) } export default DayToggle
src/modules/pages/components/AboutPage/AboutPage.js
cltk/cltk_frontend
import React from 'react'; import PageCover from '../PageCover'; import BackgroundImage from '../../../../components/common/cover/BackgroundImage'; import './AboutPage.css'; const AboutPage = props => { return ( <div > <PageCover title="About the CLTK Archive" backgroundImage={ <BackgroundImage src={'/images/colosseum.jpg'} /> } /> <section className="pageContent"> <p> The CLTK Archive is intended to be simple and extendable reading environment in progress that enables users to easily browse and discover classical texts maintained by multiple open source communities. </p> <p> Its goal is to provide a flexible interface for potential growth from multiple contributors in the future that may be able to continue to add texts or layer annotations onto the reading environment. </p> <p> Throughout the process of building and mainting this website, we create and extend many tools that are useful in other projects in the community of digital humanities and digital classics. For instance, the CLTK texts are loosely based on the <a href="http://cite-architecture.github.io/cts/" target="_blank" rel="noopener noreferrer">Canonical Text Services</a> standards created by Neel Smith (Holy Cross) and Christopher Blackwell (Furman) in association with the <a href="http://www.homermultitext.org/" target="_blank" rel="noopener noreferrer">Homer Multitext</a> project. </p> <p> Please read more about the current and past contributors so far here: <a href="https://github.com/cltk/cltk_frontend/graphs/contributors" target="_blank" rel="noreferrer noopener">Contributors</a>. </p> </section> </div> ); } export default AboutPage;
src/svg-icons/communication/stay-primary-portrait.js
ruifortes/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let CommunicationStayPrimaryPortrait = (props) => ( <SvgIcon {...props}> <path d="M17 1.01L7 1c-1.1 0-1.99.9-1.99 2v18c0 1.1.89 2 1.99 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14z"/> </SvgIcon> ); CommunicationStayPrimaryPortrait = pure(CommunicationStayPrimaryPortrait); CommunicationStayPrimaryPortrait.displayName = 'CommunicationStayPrimaryPortrait'; CommunicationStayPrimaryPortrait.muiName = 'SvgIcon'; export default CommunicationStayPrimaryPortrait;
jenkins-design-language/src/js/components/material-ui/svg-icons/av/mic.js
alvarolobato/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const AvMic = (props) => ( <SvgIcon {...props}> <path d="M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"/> </SvgIcon> ); AvMic.displayName = 'AvMic'; AvMic.muiName = 'SvgIcon'; export default AvMic;
frontend/src/components/eois/modals/compareApplications/compareApplicationsModal.js
unicef/un-partner-portal
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import ControlledModal from '../../../common/modals/controlledModal'; import CompareApplicationsContentContainer from './compareApplicationsContentContainer'; const messages = { title: 'Compare concept notes', }; class CompareApplicationsModal extends Component { render() { const { applications, dialogOpen, handleDialogClose } = this.props; return ( <div> <ControlledModal title={messages.title} trigger={dialogOpen} handleDialogClose={handleDialogClose} removeContentPadding buttons={{}} content={<CompareApplicationsContentContainer applications={applications} />} /> </div > ); } } CompareApplicationsModal.propTypes = { dialogOpen: PropTypes.bool, handleDialogClose: PropTypes.func, applications: PropTypes.array, }; export default CompareApplicationsModal;

AutoTrain Dataset for project: javascript-traing-1

Dataset Description

This dataset has been automatically processed by AutoTrain for project javascript-traing-1.

Languages

The BCP-47 code for the dataset's language is unk.

Dataset Structure

Data Instances

A sample from this dataset looks as follows:

[
  {
    "target": "test/NavbarSpec.js",
    "feat_repo_name": "aabenoja/react-bootstrap",
    "text": "import React from 'react';\nimport ReactTestUtils from 'react/lib/ReactTestUtils';\nimport Navbar from '../src/Navbar';\nimport Nav from '../src/Nav';\n\ndescribe('Nav', function () {\n\n  it('Should create nav element', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar />\n    );\n    let nav = instance.getDOMNode();\n    assert.equal(nav.nodeName, 'NAV');\n    assert.ok(nav.className.match(/\\bnavbar\\b/));\n    assert.ok(nav.getAttribute('role'), 'navigation');\n  });\n\n  it('Should add fixedTop variation class', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar fixedTop />\n    );\n    assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-fixed-top'));\n  });\n\n  it('Should add fixedBottom variation class', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar fixedBottom />\n    );\n    assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-fixed-bottom'));\n  });\n\n  it('Should add staticTop variation class', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar staticTop />\n    );\n    assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-static-top'));\n  });\n\n  it('Should add inverse variation class', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar inverse />\n    );\n    assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-inverse'));\n  });\n\n  it('Should add fluid variation class', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar fluid />\n    );\n    assert.ok(ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'container-fluid'));\n  });\n\n  it('Should override role attribute', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar role=\"banner\"/>\n    );\n    assert.ok(instance.getDOMNode().getAttribute('role'), 'banner');\n  });\n\n  it('Should override node class', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar componentClass={'header'}/>\n    );\n    assert.ok(instance.getDOMNode().nodeName, 'HEADER');\n  });\n\n  it('Should add header with brand', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar brand=\"Brand\" />\n    );\n\n    let header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header');\n\n    assert.ok(header);\n\n    let brand = ReactTestUtils.findRenderedDOMComponentWithClass(header, 'navbar-brand');\n\n    assert.ok(brand);\n    assert.equal(brand.getDOMNode().innerText, 'Brand');\n  });\n\n  it('Should add header with brand component', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar brand={<a>Brand</a>} />\n    );\n\n    let header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header');\n\n    assert.ok(header);\n\n    let brand = ReactTestUtils.findRenderedDOMComponentWithClass(header, 'navbar-brand');\n\n    assert.ok(brand);\n    assert.equal(brand.getDOMNode().nodeName, 'A');\n    assert.equal(brand.getDOMNode().innerText, 'Brand');\n  });\n\n  it('Should pass navbar prop to navs', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar brand=\"Brand\">\n        <Nav />\n      </Navbar>\n    );\n\n    let nav = ReactTestUtils.findRenderedComponentWithType(instance, Nav);\n\n    assert.ok(nav.props.navbar);\n  });\n\n  it('Should pass nav prop to ul', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Nav />\n    );\n\n    let navNode = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'nav').getDOMNode();\n    assert.ok(navNode);\n    assert.equal(navNode.nodeName, 'UL');\n    assert.equal(navNode.parentNode.nodeName, 'NAV');\n\n    instance.setProps({navbar: true});\n\n    navNode = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'nav').getDOMNode();\n    assert.ok(navNode);\n    assert.equal(navNode.nodeName, 'UL');\n    assert.equal(navNode.parentNode.nodeName, 'DIV');\n  });\n\n  it('Should add header when toggleNavKey is 0', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar toggleNavKey={0}>\n        <Nav eventKey={0} />\n      </Navbar>\n    );\n\n    let header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header');\n\n    assert.ok(header);\n  });\n\n  it('Should add header when toggleNavKey is 1', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar toggleNavKey={1}>\n        <Nav eventKey={1} />\n      </Navbar>\n    );\n\n    let header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header');\n\n    assert.ok(header);\n  });\n\n  it('Should add header when toggleNavKey is string', function () {\n    let instance = ReactTestUtils.renderIntoDocument(\n      <Navbar toggleNavKey={'string'}>\n        <Nav eventKey={'string'} />\n      </Navbar>\n    );\n\n    let header = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'navbar-header');\n\n    assert.ok(header);\n  });\n});\n"
  },
  {
    "target": "node_modules/rc-slider/lib/common/Steps.js",
    "feat_repo_name": "maty21/statistisc",
    "text": "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _defineProperty2 = require('babel-runtime/helpers/defineProperty');\n\nvar _defineProperty3 = _interopRequireDefault(_defineProperty2);\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _classnames = require('classnames');\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nvar _warning = require('warning');\n\nvar _warning2 = _interopRequireDefault(_warning);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nvar calcPoints = function calcPoints(vertical, marks, dots, step, min, max) {\n  (0, _warning2[\"default\"])(dots ? step > 0 : true, '`Slider[step]` should be a positive number in order to make Slider[dots] work.');\n  var points = Object.keys(marks).map(parseFloat);\n  if (dots) {\n    for (var i = min; i <= max; i = i + step) {\n      if (points.indexOf(i) >= 0) continue;\n      points.push(i);\n    }\n  }\n  return points;\n};\n\nvar Steps = function Steps(_ref) {\n  var prefixCls = _ref.prefixCls,\n      vertical = _ref.vertical,\n      marks = _ref.marks,\n      dots = _ref.dots,\n      step = _ref.step,\n      included = _ref.included,\n      lowerBound = _ref.lowerBound,\n      upperBound = _ref.upperBound,\n      max = _ref.max,\n      min = _ref.min;\n\n  var range = max - min;\n  var elements = calcPoints(vertical, marks, dots, step, min, max).map(function (point) {\n    var _classNames;\n\n    var offset = Math.abs(point - min) / range * 100 + '%';\n    var style = vertical ? { bottom: offset } : { left: offset };\n\n    var isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;\n    var pointClassName = (0, _classnames2[\"default\"])((_classNames = {}, (0, _defineProperty3[\"default\"])(_classNames, prefixCls + '-dot', true), (0, _defineProperty3[\"default\"])(_classNames, prefixCls + '-dot-active', isActived), _classNames));\n\n    return _react2[\"default\"].createElement('span', { className: pointClassName, style: style, key: point });\n  });\n\n  return _react2[\"default\"].createElement(\n    'div',\n    { className: prefixCls + '-step' },\n    elements\n  );\n};\n\nexports[\"default\"] = Steps;\nmodule.exports = exports['default'];"
  }
]

Dataset Fields

The dataset has the following fields (also called "features"):

{
  "target": "Value(dtype='string', id=None)",
  "feat_repo_name": "Value(dtype='string', id=None)",
  "text": "Value(dtype='string', id=None)"
}

Dataset Splits

This dataset is split into a train and validation split. The split sizes are as follow:

Split name Num samples
train 80000
valid 20000
Downloads last month
40