text: Object.defineProperty(exports,"__esModule",{value:true});var _jsxFileName='src/SceneView.js';var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _react=require('react');var React=_interopRequireWildcard(_react);var _reactRouter=require('react-router');function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var SceneView=function(_React$Component){_inherits(SceneView,_React$Component);function SceneView(props){_classCallCheck(this,SceneView);var _this=_possibleConstructorReturn(this,(SceneView.__proto__||Object.getPrototypeOf(SceneView)).call(this,props));_initialiseProps.call(_this);var history=props.history,match=props.match;_this.state={match:match||null,location:history&&history.location};_this.unlisten=history&&history.listen(_this.onHistoryChange);return _this;}_createClass(SceneView,[{key:'componentWillUnmount',value:function componentWillUnmount(){if(this.unlisten)this.unlisten();}},{key:'shouldComponentUpdate',value:function shouldComponentUpdate(nextProps,nextState){return!!nextState.match;}},{key:'render',value:function render(){var _props=this.props,render=_props.render,children=_props.children,Component=_props.component,history=_props.history;var _state=this.state,match=_state.match,location=_state.location;if(!history||!location){return null;}var contextRouter={history:history,match:match,location:location};if(render){return render(contextRouter);}else if(children&&typeof children==='function'){return children(contextRouter);}else if(children&&React.Children.count(children)===0){return React.cloneElement(children,contextRouter);}else if(Component){return React.createElement(Component,{match:match,location:location,history:history,__source:{fileName:_jsxFileName,lineNumber:73}});}return null;}}]);return SceneView;}(React.Component);var _initialiseProps=function _initialiseProps(){var _this2=this;this.onHistoryChange=function(location){var _props2=_this2.props,routePath=_props2.routePath,path=_props2.path,exact=_props2.exact,strict=_props2.strict;var oldMatch=_this2.state.match;var minimalRoute={path:routePath||path,exact:exact,strict:strict};var minimalMatch=(0,_reactRouter.matchPath)(location.pathname,minimalRoute);var route={path:path,exact:exact,strict:strict};var match=(0,_reactRouter.matchPath)(location.pathname,route);if(match&&minimalMatch&&(!oldMatch||oldMatch.url!==match.url&&oldMatch.url.includes(minimalMatch.url))){_this2.setState({match:match,location:location});}else{_this2.setState({location:location});}};};exports.default=SceneView;