text: (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  var overArg=require("./_overArg"),nativeGetPrototype=Object.getPrototypeOf,getPrototype=overArg(nativeGetPrototype,Object);module.exports=getPrototype;
  },{"./_overArg":3}],2:[function(require,module,exports){
  function isHostObject(t){var o=!1;if(null!=t&&"function"!=typeof t.toString)try{o=!!(t+"")}catch(t){}return o}module.exports=isHostObject;
  },{}],3:[function(require,module,exports){
  function overArg(r,e){return function(n){return r(e(n))}}module.exports=overArg;
  },{}],4:[function(require,module,exports){
  function isObjectLike(e){return!!e&&"object"==typeof e}module.exports=isObjectLike;
  },{}],5:[function(require,module,exports){
  function isPlainObject(t){if(!isObjectLike(t)||objectToString.call(t)!=objectTag||isHostObject(t))return!1;var o=getPrototype(t);if(null===o)return!0;var e=hasOwnProperty.call(o,"constructor")&&o.constructor;return"function"==typeof e&&e instanceof e&&funcToString.call(e)==objectCtorString}var getPrototype=require("./_getPrototype"),isHostObject=require("./_isHostObject"),isObjectLike=require("./isObjectLike"),objectTag="[object Object]",objectProto=Object.prototype,funcToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objectCtorString=funcToString.call(Object),objectToString=objectProto.toString;module.exports=isPlainObject;
  },{"./_getPrototype":1,"./_isHostObject":2,"./isObjectLike":4}],6:[function(require,module,exports){
  function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(r){try{return cachedSetTimeout.call(null,e,0)}catch(r){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);try{return cachedClearTimeout(e)}catch(r){try{return cachedClearTimeout.call(null,e)}catch(r){return cachedClearTimeout.call(this,e)}}}function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var r=queue.length;r;){for(currentQueue=queue,queue=[];++queueIndex<r;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,r=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,r){this.fun=e,this.array=r}function noop(){}var process=module.exports={},cachedSetTimeout,cachedClearTimeout;!function(){try{cachedSetTimeout=setTimeout}catch(e){cachedSetTimeout=function(){throw new Error("setTimeout is not defined")}}try{cachedClearTimeout=clearTimeout}catch(e){cachedClearTimeout=function(){throw new Error("clearTimeout is not defined")}}}();var queue=[],draining=!1,currentQueue,queueIndex=-1;process.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var u=1;u<arguments.length;u++)r[u-1]=arguments[u];queue.push(new Item(e,r)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};
  },{}],7:[function(require,module,exports){
  "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function applyMiddleware(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return function(r,n,o){var a=e(r,n,o),u=a.dispatch,p=[],i={getState:a.getState,dispatch:function(e){return u(e)}};return p=t.map(function(e){return e(i)}),u=_compose2.default.apply(void 0,p)(a.dispatch),_extends({},a,{dispatch:u})}}}exports.__esModule=!0;var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};exports.default=applyMiddleware;var _compose=require("./compose"),_compose2=_interopRequireDefault(_compose);
  },{"./compose":10}],8:[function(require,module,exports){
  "use strict";function bindActionCreator(t,o){return function(){return o(t.apply(void 0,arguments))}}function bindActionCreators(t,o){if("function"==typeof t)return bindActionCreator(t,o);if("object"!=typeof t||null===t)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===t?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var r=Object.keys(t),n={},e=0;e<r.length;e++){var i=r[e],c=t[i];"function"==typeof c&&(n[i]=bindActionCreator(c,o))}return n}exports.__esModule=!0,exports.default=bindActionCreators;
  },{}],9:[function(require,module,exports){
  (function (process){
  "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function getUndefinedStateErrorMessage(e,t){var n=t&&t.type,r=n&&'"'+n.toString()+'"'||"an action";return"Given action "+r+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state.'}function getUnexpectedStateShapeWarningMessage(e,t,n){var r=Object.keys(t),i=n&&n.type===_createStore.ActionTypes.INIT?"initialState argument passed to createStore":"previous state received by the reducer";if(0===r.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!(0,_isPlainObject2.default)(e))return"The "+i+' has unexpected type of "'+{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1]+'". Expected argument to be an object with the following '+('keys: "'+r.join('", "')+'"');var a=Object.keys(e).filter(function(e){return!t.hasOwnProperty(e)});return a.length>0?"Unexpected "+(a.length>1?"keys":"key")+" "+('"'+a.join('", "')+'" found in '+i+". ")+"Expected to find one of the known reducer keys instead: "+('"'+r.join('", "')+'". Unexpected keys will be ignored.'):void 0}function assertReducerSanity(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:_createStore.ActionTypes.INIT});if("undefined"==typeof r)throw new Error('Reducer "'+t+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');var i="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof n(void 0,{type:i}))throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+_createStore.ActionTypes.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined.")})}function combineReducers(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var i=t[r];"function"==typeof e[i]&&(n[i]=e[i])}var a,o=Object.keys(n);try{assertReducerSanity(n)}catch(e){a=e}return function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];if(a)throw a;if("production"!==process.env.NODE_ENV){var r=getUnexpectedStateShapeWarningMessage(e,n,t);r&&(0,_warning2.default)(r)}for(var i=!1,u={},s=0;s<o.length;s++){var d=o[s],c=n[d],f=e[d],l=c(f,t);if("undefined"==typeof l){var h=getUndefinedStateErrorMessage(d,t);throw new Error(h)}u[d]=l,i=i||l!==f}return i?u:e}}exports.__esModule=!0,exports.default=combineReducers;var _createStore=require("./createStore"),_isPlainObject=require("lodash/isPlainObject"),_isPlainObject2=_interopRequireDefault(_isPlainObject),_warning=require("./utils/warning"),_warning2=_interopRequireDefault(_warning);
  }).call(this,require('_process'))
  
  },{"./createStore":11,"./utils/warning":13,"_process":6,"lodash/isPlainObject":5}],10:[function(require,module,exports){
  "use strict";function compose(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];if(0===r.length)return function(e){return e};var n=function(){var e=r[r.length-1],t=r.slice(0,-1);return{v:function(){return t.reduceRight(function(e,r){return r(e)},e.apply(void 0,arguments))}}}();return"object"==typeof n?n.v:void 0}exports.__esModule=!0,exports.default=compose;
  },{}],11:[function(require,module,exports){
  "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function createStore(e,t,r){function n(){l===b&&(l=b.slice())}function o(){return p}function i(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return n(),l.push(e),function(){if(t){t=!1,n();var r=l.indexOf(e);l.splice(r,1)}}}function c(e){if(!(0,_isPlainObject2.default)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(d)throw new Error("Reducers may not dispatch actions.");try{d=!0,p=a(p,e)}finally{d=!1}for(var t=b=l,r=0;r<t.length;r++)t[r]();return e}function u(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");a=e,c({type:ActionTypes.INIT})}function s(){var e,t=i;return e={subscribe:function(e){function r(){e.next&&e.next(o())}if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");r();var n=t(r);return{unsubscribe:n}}},e[_symbolObservable2.default]=function(){return this},e}var f;if("function"==typeof t&&"undefined"==typeof r&&(r=t,t=void 0),"undefined"!=typeof r){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(createStore)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var a=e,p=t,b=[],l=b,d=!1;return c({type:ActionTypes.INIT}),f={dispatch:c,subscribe:i,getState:o,replaceReducer:u},f[_symbolObservable2.default]=s,f}exports.__esModule=!0,exports.ActionTypes=void 0,exports.default=createStore;var _isPlainObject=require("lodash/isPlainObject"),_isPlainObject2=_interopRequireDefault(_isPlainObject),_symbolObservable=require("symbol-observable"),_symbolObservable2=_interopRequireDefault(_symbolObservable),ActionTypes=exports.ActionTypes={INIT:"@@redux/INIT"};
  },{"lodash/isPlainObject":5,"symbol-observable":14}],12:[function(require,module,exports){
  (function (process){
  "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function isCrushed(){}exports.__esModule=!0,exports.compose=exports.applyMiddleware=exports.bindActionCreators=exports.combineReducers=exports.createStore=void 0;var _createStore=require("./createStore"),_createStore2=_interopRequireDefault(_createStore),_combineReducers=require("./combineReducers"),_combineReducers2=_interopRequireDefault(_combineReducers),_bindActionCreators=require("./bindActionCreators"),_bindActionCreators2=_interopRequireDefault(_bindActionCreators),_applyMiddleware=require("./applyMiddleware"),_applyMiddleware2=_interopRequireDefault(_applyMiddleware),_compose=require("./compose"),_compose2=_interopRequireDefault(_compose),_warning=require("./utils/warning"),_warning2=_interopRequireDefault(_warning);"production"!==process.env.NODE_ENV&&"string"==typeof isCrushed.name&&"isCrushed"!==isCrushed.name&&(0,_warning2.default)("You are currently using minified code outside of NODE_ENV === 'production'. This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) to ensure you have the correct code for your production build."),exports.createStore=_createStore2.default,exports.combineReducers=_combineReducers2.default,exports.bindActionCreators=_bindActionCreators2.default,exports.applyMiddleware=_applyMiddleware2.default,exports.compose=_compose2.default;
  }).call(this,require('_process'))
  
  },{"./applyMiddleware":7,"./bindActionCreators":8,"./combineReducers":9,"./compose":10,"./createStore":11,"./utils/warning":13,"_process":6}],13:[function(require,module,exports){
  "use strict";function warning(o){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(o);try{throw new Error(o)}catch(o){}}exports.__esModule=!0,exports.default=warning;
  },{}],14:[function(require,module,exports){
  (function (global){
  "use strict";module.exports=require("./ponyfill")(global||window||this);
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  
  },{"./ponyfill":15}],15:[function(require,module,exports){
  "use strict";module.exports=function(e){var b,o=e.Symbol;return"function"==typeof o?o.observable?b=o.observable:(b=o("observable"),o.observable=b):b="@@observable",b};
  },{}],16:[function(require,module,exports){
  "use strict";function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),Canvas=function(){function e(t){return _classCallCheck(this,e),e.instance?e.instance:this instanceof e?(t=_extends({canvasElementOrId:null,width:window.innerWidth,height:window.innerHeight,parent:document.getElementsByTagName("body")[0],renderers:[]},t),t.canvasElementOrId&&(this.cvs=t.canvaselementOrId instanceof Element?t.canvasElementOrId:document.createElement("canvas")),this.cvs||(this.cvs=document.createElement("canvas")),this.cvs.width=t.width,this.cvs.height=t.height,this.cvs.style.width="100%",this.cvs.style.height="100%",this.ctx=this.cvs.getContext("2d"),this.renderers=[].concat(_toConsumableArray(t.renderers)),this.render(),t.parent.appendChild(this.cvs),void(e.instance=this)):new e(t)}return _createClass(e,[{key:"addRenderer",value:function(e){"function"==typeof e&&this.renderers.push(e)}},{key:"render",value:function(e){var t=this;this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.clearRect(0,0,this.cvs.width,this.cvs.height),this.ctx.imageSmoothingEnabled=!1,this.renderers.forEach(function(e){return e(t.ctx)}),Array.isArray(e)&&e.forEach(function(e){return e(t.ctx)})}}]),e}();Canvas.instance=null,exports.default=Canvas;
  },{}],17:[function(require,module,exports){
  "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Fence=exports.Grass=exports.Unoccupied=void 0;var _hex=require("./hex"),_hex2=_interopRequireDefault(_hex),Unoccupied=exports.Unoccupied=function(e){function t(e,r,n){_classCallCheck(this,t);var o=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r,n));return o.type="unoccupied",o.label="",o}return _inherits(t,e),t}(_hex2.default),Grass=exports.Grass=function(e){function t(e,r,n){_classCallCheck(this,t);var o=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r,n));return o.subtype="grass",o.fillStyle="#6c9023",o}return _inherits(t,e),t}(Unoccupied),Fence=exports.Fence=function(e){function t(e,r,n){_classCallCheck(this,t);var o=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r,n));return o.subtype="fence",o.fillStyle="#784315",o}return _inherits(t,e),t}(Unoccupied);
  },{"./hex":19}],18:[function(require,module,exports){
  "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}return function(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}}(),_hex=require("./hex"),_hex2=_interopRequireDefault(_hex),_ground=require("./ground"),sqrt3=1.7320508075688772,sqrt3_2=sqrt3/2,sqrt3_3=sqrt3/3,HexMap=function(){function e(r){_classCallCheck(this,e),this.radius=r;for(var n=-r;n<=r;++n)for(var t=Math.max(-r,-n-r);t<=Math.min(r,-n+r);++t)this.unoccupy(n,t)}return _createClass(e,[{key:"validCoordinates",value:function(r,n){return e.validCoordinates(this,r,n)}},{key:"forEach",value:function(r){return e.forEach(this,r)}},{key:"toArray",value:function(){return e.toArray(this)}},{key:"neighborhood",value:function(r,n){return e.neighborhood(this,r,n)}},{key:"unoccupy",value:function(r,n){e.unoccupy(this,r,n)}},{key:"render",value:function(r,n,t){return e.render(this,r,n,t)}},{key:"pixelToHex",value:function(r,n,t,u){return e.pixelToHex(this,r,n,t,u)}}],[{key:"validCoordinates",value:function(e,r,n){return e.radius>=Math.abs(r)&&e.radius>=Math.abs(n)}},{key:"forEach",value:function(e,r){if("function"==typeof r){var n=Object.keys(e);n.forEach(function(n){var t=e[n];t instanceof _hex2.default&&r(t)})}}},{key:"toArray",value:function(e){var r=[];return e.forEach(function(e){return r.push(e)}),r}},{key:"neighborhood",value:function(r,n){var t=arguments.length<=2||void 0===arguments[2]?1:arguments[2];if(!r instanceof e)return[];if(!n instanceof _hex2.default)return[];for(var u=[],o=-t;o<=t;++o)for(var a=-t;a<=t;++a){var i=r[_hex2.default.coords(n.q+o,n.r+a)];i&&u.push(i)}return u}},{key:"unoccupy",value:function(e,r,n){var t=new _ground.Grass(r,n,e);t.distance()===e.radius&&(t=new _ground.Fence(r,n,e)),e[t.coords()]=t}},{key:"render",value:function(e,r,n,t){e.forEach(function(e){e.render(r,n,t)})}},{key:"pixelToHex",value:function(e,r,n,t,u){n/=2;var o=.6666666666666666*(t-r.x)/n,a=(-(t-r.x)/3+sqrt3_3*(u-r.y))/n,i=_hex2.default.coords(Math.round(o,0),Math.round(a,0));return e[i]}}]),e}();exports.default=HexMap;
  },{"./ground":17,"./hex":19}],19:[function(require,module,exports){
  "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),_point=require("./point"),_point2=_interopRequireDefault(_point),rad2deg=Math.PI/180,sqrt3=1.7320508075688772,sqrt3_2=sqrt3/2,Hex=function(){function e(){var r=arguments.length<=0||void 0===arguments[0]?0:arguments[0],t=arguments.length<=1||void 0===arguments[1]?0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?null:arguments[2];_classCallCheck(this,e),this.q=r,this.r=t,this.hexMap=n,this.strokeStyle="#aaa"}return _createClass(e,[{key:"coords",value:function(){return e.coords(this)}},{key:"neighbor",value:function(r){return e.neighbor(this,r)}},{key:"neighborhood",value:function(r){return e.neighborhood(this,r)}},{key:"distance",value:function(r){return e.distance(this,r)}},{key:"render",value:function(r,t,n){return e.render(this,r,t,n)}}],[{key:"coords",value:function(r,t){return r instanceof e?r.q+","+r.r:r+","+t}},{key:"direction",value:function(e){var r=[{q:1,r:0},{q:1,r:-1},{q:0,r:-1},{q:-1,r:0},{q:-1,r:1},{q:0,r:1}],t=(0|e)%6;return r[t]}},{key:"isDirection",value:function(e,r){var t={"-1":{0:!0,1:!0},0:{"-1":!0,1:!0},1:{"-1":!0,0:!0}};return t[e]&&t[e][r]}},{key:"neighbor",value:function(r,t){r=r instanceof Object?r:{};var n=e.direction(t);return r.hexMap?r.hexMap[e.coords((0|r.q)+n.q,(0|r.r)+n.r)]:new e((0|r.q)+n.q,(0|r.r)+n.r)}},{key:"neighborhood",value:function(r,t){for(var n=r.q,i=r.r,o=t,a=[],u=r.coords(),s=-o;s<=o;++s)for(var l=-o;l<=o;++l){var c=new e(n+s,i+l),f=c.coords();if(f!==u&&r.distance(c)<=t)if(r.hexMap){var h=r.hexMap[f];h&&a.push(h)}else a.push(c)}return a}},{key:"distance",value:function(r,t){var n=r instanceof e?r:new e,i=t instanceof e?t:new e;return(Math.abs(n.q-i.q)+Math.abs(n.q+n.r-i.q-i.r)+Math.abs(n.r-i.r))/2}},{key:"corner",value:function(e,r,t){var n=arguments.length<=3||void 0===arguments[3]||arguments[3],i=60*(0|t)+(n?0:30),o=rad2deg*i;return new _point2.default(e.x+r/2*Math.cos(o),e.y+r/2*Math.sin(o))}},{key:"render",value:function(r,t,n,i){var o=new _point2.default(t.x+r.q*n.horiz,t.y+r.r*n.vert+n.vert/2*r.q),a=e.corner(o,n.size,0);i.beginPath(),i.fillStyle=r.fillStyle||"#888",i.strokeStyle=r.strokeStyle||"#888",i.lineWidth=r.lineWidth||.025*n.size,i.moveTo(a.x,a.y);for(var u=1;u<6;++u)a=e.corner(o,n.size,u),i.lineTo(a.x,a.y);i.closePath(),i.fill(),i.stroke();var s=r.label;if(s){var l=20;i.fillStyle=r.color||"#eee",i.font=l+"px serif",l=.66*l*n.size/i.measureText(s).width,i.font=l+"px serif",i.fillText(s,o.x-i.measureText(s).width/2,o.y+.25*l)}}},{key:"getDimensions",value:function(e){var r,t,n,i,o=arguments.length<=1||void 0===arguments[1]||arguments[1];return o?(r=e,t=r*sqrt3_2,n=.75*r,i=t):(t=e,r=t*sqrt3_2,i=.75*t,n=r),{size:e,width:r,height:t,horiz:n,vert:i}}}]),e}();exports.default=Hex;
  },{"./point":21}],20:[function(require,module,exports){
  "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function setupInputListeners(e){var t=document.body;t.addEventListener("mousemove",function(t){e.dispatch({type:"touchmove",x:t.clientX,y:t.clientY})}),t.addEventListener("mousedown",function(t){e.dispatch({type:"touchstart",x:t.clientX,y:t.clientY})}),t.addEventListener("mouseup",function(t){e.dispatch({type:"touchend",x:t.clientX,y:t.clientY})}),t.addEventListener("touchmove",function(t){e.dispatch({type:"touchmove",x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY})}),t.addEventListener("touchstart",function(t){e.dispatch({type:"touchstart",x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY})}),t.addEventListener("touchend",function(t){e.dispatch({type:"touchend",x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY})}),window.onresize=function(t){e.dispatch({type:"resize"})},document.getElementById("instructions").addEventListener("click",hideInstructions),document.getElementById("backdrop").addEventListener("click",hideInstructions)}function hideInstructions(){document.getElementById("instructions").style.display="none",document.getElementById("backdrop").style.display="none"}function render(){var e=store.getState();e.canvas.render(),renderScore(e),renderMap(e),5!==e.score.player1&&5!==e.score.player2||renderGameOver(e)}function renderMap(e){e.map.render(e.center,e.hexDimensions,e.canvas.ctx),renderValidHexes(e),renderMouseHover(e)}function renderValidHexes(e){var t=void 0;t=e.selectedHex?e.selectedHex.neighborhood(2).filter(function(t){return e.selectedHex.validMove(t)}):e.map.toArray().filter(function(e){return e.mayMove}),t.length&&t.forEach(function(t){var r=new _hex2.default(t.q,t.r);r.fillStyle="rgba(0,0,0,0)",r.strokeStyle="rgba(0,255,0,0.75)",r.render(e.center,e.hexDimensions,e.canvas.ctx)})}function renderMouseHover(e){if(e.hoverHex){var t=new _hex2.default(e.hoverHex.q,e.hoverHex.r);t.color=e.hoverHex.color,e.selectedHex.validMove(e.hoverHex)?(t.fillStyle="rgba(0,255,0,0.25)",t.strokeStyle="rgba(0,255,0,0.75)"):(t.fillStyle="rgba(255,0,0,0.25)",t.strokeStyle="rgba(255,0,0,0.75)"),t.render(e.center,e.hexDimensions,e.canvas.ctx)}}function renderScore(e){var t=e.canvas.ctx,r=20,n=void 0,i=void 0;n="(ツ)",t.fillStyle="#d00",t.font=r+"px serif",r=r*e.hexDimensions.width/t.measureText(n).width,t.font=r+"px serif",i=t.measureText(n).width,t.fillText(n,20,1.5*r),t.fillText(e.score.player1,20+i+r,1.5*r),n="(◔̯◔)",t.fillStyle="#00d";var s=r*e.hexDimensions.width/t.measureText(n).width;t.font=s+"px serif",t.fillText(n,20,3*r),t.font=r+"px serif",t.fillText(e.score.player2,20+i+r,3*r)}function renderGameOver(e){var t=e.canvas.ctx,r=e.canvas.cvs,n=30,i=void 0,s=void 0;e.score.player1>e.score.player2?(i="(ツ) WINS!",s="#d00"):(i="(◔̯◔) WINS!",s="#00d"),t.font=n+"px serif";var o=t.measureText(i).width,c=r.width-o;t.fillStyle="#fff",t.fillText(i,c/2+1.5,r.height/2+1.5),t.fillText(i,c/2+1.5,r.height/2+0),t.fillText(i,c/2+1.5,r.height/2-1.5),t.fillText(i,c/2+0,r.height/2+1.5),t.fillText(i,c/2+0,r.height/2-1.5),t.fillText(i,c/2-1.5,r.height/2+1.5),t.fillText(i,c/2-1.5,r.height/2+0),t.fillText(i,c/2-1.5,r.height/2-1.5),t.fillStyle=s,t.fillText(i,c/2+0,r.height/2+0)}var _reducer=require("./reducer"),_reducer2=_interopRequireDefault(_reducer),_redux=require("redux"),_hex=require("./hex"),_hex2=_interopRequireDefault(_hex),store=(0,_redux.createStore)(_reducer2.default);store.dispatch({type:"init",radius:5}),store.subscribe(function(){return window.requestAnimationFrame(render)}),setupInputListeners(store);var spritesheet=store.getState().spritesheet;spritesheet.src="./img/cat-herders-pieces.png",spritesheet.addEventListener("load",function(){return store.dispatch({type:"spritesheet",spritesheet:spritesheet})},!1),window.requestAnimationFrame(render);
  },{"./hex":19,"./reducer":22,"redux":12}],21:[function(require,module,exports){
  "use strict";function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(n,t,a){return t&&e(n.prototype,t),a&&e(n,a),n}}(),Point=function(){function e(){var n=arguments.length<=0||void 0===arguments[0]?0:arguments[0],t=arguments.length<=1||void 0===arguments[1]?0:arguments[1];return _classCallCheck(this,e),n instanceof e?new e(n.x,n.y):this instanceof e?(this.x=+n||0,void(this.y=+t||0)):new e(n,t)}return _createClass(e,[{key:"distance",value:function(n){return e.distance(this,n)}}],[{key:"distance",value:function(n,t){var a=n instanceof e?n:new e,r=t instanceof e?t:new e,i=r.x-a.x,o=r.y-a.y;return Math.sqrt(i*i+o*o)}}]),e}();exports.default=Point;
  },{}],22:[function(require,module,exports){
  "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function reducer(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=arguments[1];switch(r.type){case"init":return e.radius=r.radius,e.map=new _hexMap2.default(e.radius),e.canvas=new _canvas2.default,e.spritesheet=e.spritesheet||new Image,initGame(e),resize(e),e;case"spritesheet":return e.spritesheet=r.spritesheet,e;case"resize":return resize(e),e;case"touchmove":return e.selectedHex&&(e.hoverHex=e.map.pixelToHex(e.center,e.pxPerHex,r.x,r.y)),e;case"touchstart":if(!e.cats.length)return e.map=new _hexMap2.default(e.radius),initGame(e),resize(e),e;if(!e.selectedHex){var t=e.map.pixelToHex(e.center,e.pxPerHex,r.x,r.y);if(t&&(t.mayMove||"fence"===t.subtype))if("fence"===t.subtype){if(e.currentPlayer&&e[e.currentPlayer].length<15){var n=[{q:t.q,r:t.r}],a=void 0;a="player1"===e.currentPlayer?initPlayer1Tokens(n,e).pop():initPlayer2Tokens(n,e).pop(),e[e.currentPlayer].push(a),e.movedPlayerToken=e.selectedHex=a,initCatTurn(e),e.selectedHex=null,e.hoverHex=null}}else e.selectedHex=t,e.hoverHex=t;else e.selectedHex=null,e.hoverHex=null;e.t=performance.now()}return e;case"touchend":if(e.selectedHex&&performance.now()-(e.t||0)>150){var i=e.map.pixelToHex(e.center,e.pxPerHex,r.x,r.y);e.selectedHex.validMove(i)&&(e.selectedHex.moveTo(i),e.selectedHex.mayMove=!1,e.selectedHex instanceof _tokens.Player?(e.movedPlayerToken=e.selectedHex,initCatTurn(e)):e.selectedHex instanceof _tokens.Cat&&e.cats.every(function(e){return!e.mayMove})&&captureCats(e)),e.selectedHex=null,e.hoverHex=null}return e;default:return e}}function resize(e){e.canvas.cvs.width=window.innerWidth,e.canvas.cvs.height=window.innerHeight,e.center=new _point2.default(e.canvas.cvs.width/2,e.canvas.cvs.height/2),e.pxPerHex=Math.min(e.canvas.cvs.width,e.canvas.cvs.height)/e.map.radius/2,e.hexDimensions=_hex2.default.getDimensions(e.pxPerHex)}function initGame(e){e.score={player1:0,player2:0},e.movedPlayerToken=null;var r=[];e.cats=[],e.map.forEach(function(e){if("grass"===e.subtype){var t=~~(Math.random()*r.length+.5);t===r.length?r.push(e):(r.push(r[t]),r[t]=e)}});var t=void 0;t=r.splice(0,9).map(function(e){return{q:e.q,r:e.r}}),e.cats=initTokens(t,_tokens.Cat,e,{spritesheet:e.spritesheet,sx:170,sy:2,sw:160,sh:138}),t=[{q:0*e.map.radius,r:e.map.radius*-1},{q:1*e.map.radius,r:0*e.map.radius},{q:e.map.radius*-1,r:1*e.map.radius}],e.player1=initPlayer1Tokens(t,e),t=[{q:e.map.radius*-1,r:0*e.map.radius},{q:1*e.map.radius,r:e.map.radius*-1},{q:0*e.map.radius,r:1*e.map.radius}],e.player2=initPlayer2Tokens(t,e),initPlayerTurn("player1",e)}function initPlayer1Tokens(e,r){return initTokens(e,_tokens.Player1,r,{spritesheet:r.spritesheet,sx:336,sy:2,sw:160,sh:138})}function initPlayer2Tokens(e,r){return initTokens(e,_tokens.Player2,r,{spritesheet:r.spritesheet,sx:2,sy:2,sw:160,sh:138})}function initTokens(e,r,t,n){return e.map(function(e){var a=new r(e.q,e.r,t.map,n);return t.map[a.coords()]=a,a})}function initPlayerTurn(e,r){var t=void 0,n=void 0;"player1"===e?(t=r.player1,n=r.player2):(t=r.player2,n=r.player1),t.forEach(function(e){return e.mayMove=!0}),n.forEach(function(e){return e.mayMove=!1}),r.cats.forEach(function(e){return e.mayMove=!1}),r.movedPlayerToken=null,r.currentPlayer=e}function initCatTurn(e){e.player1.forEach(function(e){return e.mayMove=!1}),e.player2.forEach(function(e){return e.mayMove=!1}),e.cats.forEach(function(e){return e.mayMove=!1}),e.currentPlayer=null;var r=e.movedPlayerToken.neighborhood(1),t=r.filter(function(e){return"cat"===e.subtype});t.forEach(function(e){return e.mayMove=!0}),0===t.length&&captureCats(e)}function captureCats(e){var r=e.movedPlayerToken.subtype,t=e.cats.filter(function(e){var t=e.neighborhood(1).filter(function(e){return e.subtype===r});return t.length>=2});t.forEach(function(r){var t=e.cats.indexOf(r);~t&&e.cats.splice(t,1),e.map.unoccupy(r.q,r.r)}),e.score[r]+=t.length,togglePlayerTurn(e)}function togglePlayerTurn(e){var r=e.movedPlayerToken.subtype;r="player1"===r?"player2":"player1",initPlayerTurn(r,e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=reducer;var _hex=require("./hex"),_hex2=_interopRequireDefault(_hex),_hexMap=require("./hex-map"),_hexMap2=_interopRequireDefault(_hexMap),_canvas=require("./canvas"),_canvas2=_interopRequireDefault(_canvas),_point=require("./point"),_point2=_interopRequireDefault(_point),_tokens=require("./tokens"),_ground=require("./ground"),sqrt3=1.7320508075688772,sqrt3_2=sqrt3/2;
  },{"./canvas":16,"./ground":17,"./hex":19,"./hex-map":18,"./point":21,"./tokens":23}],23:[function(require,module,exports){
  "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Player2=exports.Player1=exports.Cat=exports.Player=exports.Token=void 0;var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),_get=function e(t,r,o){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,r);if(void 0===n){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,r,o)}if("value"in n)return n.value;var s=n.get;if(void 0!==s)return s.call(o)},_hex=require("./hex"),_hex2=_interopRequireDefault(_hex),_point=require("./point"),_point2=_interopRequireDefault(_point),Token=exports.Token=function(e){function t(e,r,o,n){_classCallCheck(this,t);var i=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r,o));return i.mayMove=!1,i.spritesheet=n.spritesheet,i.sx=n.sx,i.sy=n.sy,i.sw=n.sw,i.sh=n.sh,i}return _inherits(t,e),_createClass(t,[{key:"canMove",value:function(){var e=this,t=this.neighborhood(2);return t.some(function(t){return e.validMove(t)})}},{key:"moveTo",value:function(e,t){var r=void 0;e instanceof _hex2.default?(r=e.coords(),t=e.r,e=e.q):r=_hex2.default.coords(e,t),this.hexMap[r]=this,this.hexMap.unoccupy(this.q,this.r),this.q=e,this.r=t}},{key:"render",value:function(e,r,o){_get(Object.getPrototypeOf(t.prototype),"render",this).call(this,e,r,o),t.render(this,e,r,o)}}],[{key:"render",value:function(e,t,r,o){var n=new _point2.default(t.x+e.q*r.horiz-r.width/2,t.y+e.r*r.vert+r.vert/2*e.q-r.height/2);o.drawImage(e.spritesheet,e.sx,e.sy,e.sw,e.sh,n.x,n.y,r.width,r.height)}}]),t}(_hex2.default),Player=exports.Player=function(e){function t(e,r,o,n){_classCallCheck(this,t);var i=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r,o,n));return i.type="player",i.fillStyle="#888",i}return _inherits(t,e),_createClass(t,[{key:"validMove",value:function(e,t){var r=void 0;r=e instanceof _hex2.default?e.coords():_hex2.default.coords(e,t);var o=this.hexMap[r],n=null,i=null;if(o){n=o.q-this.q,i=o.r-this.r;var s=Math.abs(n),a=Math.abs(i),l=Math.max(s,a);l&&(n/=l),l&&(i/=l),console.log("("+o.q+","+o.r+")","("+s+","+a+")","("+n+","+i+")")}return o&&_hex2.default.isDirection(n,i)&&"unoccupied"===o.type&&o.distance(this)<=2}}]),t}(Token),Cat=exports.Cat=function(e){function t(e,r,o,n){_classCallCheck(this,t);var i=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r,o,n));return i.type="cat",i.subtype="cat",i.label=">^.^<",i.color="#fff",i.fillStyle="#6c9023",i}return _inherits(t,e),_createClass(t,[{key:"validMove",value:function(e,t){var r=void 0;r=e instanceof _hex2.default?e.coords():_hex2.default.coords(e,t);var o=this.hexMap[r];if(o&&"grass"===o.subtype&&1===o.distance(this)){var n=this.neighborhood(1).filter(function(e){return"grass"===e.subtype}).reduce(function(e,t){var r=t.neighborhood(1).filter(function(e){return"player"===e.type}).length;return!e[r]&&(e[r]=[]),e[r].push(t),e},{}),i=Math.min.apply(null,Object.keys(n)),s=n[i];return~s.indexOf(o)}}}]),t}(Token),Player1=exports.Player1=function(e){function t(e,r,o,n){_classCallCheck(this,t);var i=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r,o,n));return i.subtype="player1",i.label="(ツ)",i.color="#d00",i}return _inherits(t,e),t}(Player),Player2=exports.Player2=function(e){function t(e,r,o,n){_classCallCheck(this,t);var i=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r,o,n));return i.subtype="player2",i.label="(◔̯◔)",i.color="#00d",i}return _inherits(t,e),t}(Player);
  },{"./hex":19,"./point":21}]},{},[20])
  
  