game-of-life/app.bundle.js
2020-05-26 17:38:33 +00:00

1 line
No EOL
27 KiB
JavaScript

!function(n){var e={};function t(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return n[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:r})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var i in n)t.d(r,i,function(e){return n[e]}.bind(null,i));return r},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=3)}([function(n,e,t){"use strict";var r,i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},o=function(){var n={};return function(e){if(void 0===n[e]){var t=document.querySelector(e);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(n){t=null}n[e]=t}return n[e]}}(),a=[];function c(n){for(var e=-1,t=0;t<a.length;t++)if(a[t].identifier===n){e=t;break}return e}function u(n,e){for(var t={},r=[],i=0;i<n.length;i++){var o=n[i],u=e.base?o[0]+e.base:o[0],l=t[u]||0,s="".concat(u," ").concat(l);t[u]=l+1;var f=c(s),d={css:o[1],media:o[2],sourceMap:o[3]};-1!==f?(a[f].references++,a[f].updater(d)):a.push({identifier:s,updater:m(d,e),references:1}),r.push(s)}return r}function l(n){var e=document.createElement("style"),r=n.attributes||{};if(void 0===r.nonce){var i=t.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(n){e.setAttribute(n,r[n])})),"function"==typeof n.insert)n.insert(e);else{var a=o(n.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(e)}return e}var s,f=(s=[],function(n,e){return s[n]=e,s.filter(Boolean).join("\n")});function d(n,e,t,r){var i=t?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(n.styleSheet)n.styleSheet.cssText=f(e,i);else{var o=document.createTextNode(i),a=n.childNodes;a[e]&&n.removeChild(a[e]),a.length?n.insertBefore(o,a[e]):n.appendChild(o)}}function p(n,e,t){var r=t.css,i=t.media,o=t.sourceMap;if(i?n.setAttribute("media",i):n.removeAttribute("media"),o&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),n.styleSheet)n.styleSheet.cssText=r;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(r))}}var h=null,b=0;function m(n,e){var t,r,i;if(e.singleton){var o=b++;t=h||(h=l(e)),r=d.bind(null,t,o,!1),i=d.bind(null,t,o,!0)}else t=l(e),r=p.bind(null,t,e),i=function(){!function(n){if(null===n.parentNode)return!1;n.parentNode.removeChild(n)}(t)};return r(n),function(e){if(e){if(e.css===n.css&&e.media===n.media&&e.sourceMap===n.sourceMap)return;r(n=e)}else i()}}n.exports=function(n,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=i());var t=u(n=n||[],e);return function(n){if(n=n||[],"[object Array]"===Object.prototype.toString.call(n)){for(var r=0;r<t.length;r++){var i=c(t[r]);a[i].references--}for(var o=u(n,e),l=0;l<t.length;l++){var s=c(t[l]);0===a[s].references&&(a[s].updater(),a.splice(s,1))}t=o}}}},function(n,e,t){"use strict";n.exports=function(n){var e=[];return e.toString=function(){return this.map((function(e){var t=function(n,e){var t=n[1]||"",r=n[3];if(!r)return t;if(e&&"function"==typeof btoa){var i=(a=r,c=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),u="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(c),"/*# ".concat(u," */")),o=r.sources.map((function(n){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(n," */")}));return[t].concat(o).concat([i]).join("\n")}var a,c,u;return[t].join("\n")}(e,n);return e[2]?"@media ".concat(e[2]," {").concat(t,"}"):t})).join("")},e.i=function(n,t,r){"string"==typeof n&&(n=[[null,n,""]]);var i={};if(r)for(var o=0;o<this.length;o++){var a=this[o][0];null!=a&&(i[a]=!0)}for(var c=0;c<n.length;c++){var u=[].concat(n[c]);r&&i[u[0]]||(t&&(u[2]?u[2]="".concat(t," and ").concat(u[2]):u[2]=t),e.push(u))}},e}},function(n,e){function t(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(n)))return;var t=[],r=!0,i=!1,o=void 0;try{for(var a,c=n[Symbol.iterator]();!(r=(a=c.next()).done)&&(t.push(a.value),!e||t.length!==e);r=!0);}catch(n){i=!0,o=n}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return t}(n,e)||function(n,e){if(!n)return;if("string"==typeof n)return r(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);"Object"===t&&n.constructor&&(t=n.constructor.name);if("Map"===t||"Set"===t)return Array.from(n);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(n,e)}(n,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function i(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}var o={method:"get"},a=function(){function n(e,t){!function(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),this.head=e,this.tail=t,this.memo=!1}var e,t,r;return e=n,(t=[{key:"next",get:function(){return this.memo||(this.tail=this.tail(),this.memo=!0),this.tail}}])&&i(e.prototype,t),r&&i(e,r),n}();n.exports={Stream:a,getNeighbors:function(n){var e=t(n.split(",").map((function(n){return parseInt(n)})),2),r=e[0],i=e[1];return[[r-1,i-1],[r-1,i],[r-1,i+1],[r,i-1],[r,i+1],[r+1,i-1],[r+1,i],[r+1,i+1]].map((function(n){return n.join(",")}))},getCalendar:function(n){return fetch("https://appkeychain.herokuapp.com/git/calendar/".concat(n),o).then((function(n){return n.json()})).catch((function(n){return n}))}}},function(n,e,t){"use strict";t.r(e);t(4),t(6);var r=t(8).fieldView,i=t(13).init;console.log("hello world!"),window.game=r([]),window.controls=i(game)},function(n,e,t){var r=t(0),i=t(5);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[n.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);n.exports=i.locals||{}},function(n,e,t){(e=t(1)(!1)).push([n.i,'/* http://meyerweb.com/eric/tools/css/reset/\n v2.0-modified | 20110126\n License: none (public domain)\n*/\n\n* {\n box-sizing: border-box;\n}\n\nhtml, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, big, cite, code,\ndel, dfn, em, img, ins, kbd, q, s, samp,\nsmall, strike, strong, sub, sup, tt, var,\nb, u, i, center,\ndl, dt, dd, ol, ul, li,\nfieldset, form, label, legend,\ntable, caption, tbody, tfoot, thead, tr, th, td,\narticle, aside, canvas, details, embed,\nfigure, figcaption, footer, header, hgroup,\nmenu, nav, output, ruby, section, summary,\ntime, mark, audio, video {\n margin: 0;\n\tpadding: 0;\n\tborder: 0;\n\tfont-size: 100%;\n\tfont: inherit;\n\tvertical-align: baseline;\n}\n\n/* HTML5 display-role reset for older browsers */\narticle, aside, details, figcaption, figure,\nfooter, header, hgroup, menu, nav, section {\n\tdisplay: block;\n}\n\nbody {\n\tline-height: 1;\n}\n\nol, ul {\n\tlist-style: none;\n}\n\nblockquote, q {\n\tquotes: none;\n}\n\nblockquote:before, blockquote:after,\nq:before, q:after {\n\tcontent: \'\';\n\tcontent: none;\n}\n\ntable {\n\tborder-collapse: collapse;\n\tborder-spacing: 0;\n}\n\ninput[type=search]::-webkit-search-cancel-button,\ninput[type=search]::-webkit-search-decoration,\ninput[type=search]::-webkit-search-results-button,\ninput[type=search]::-webkit-search-results-decoration {\n -webkit-appearance: none;\n -moz-appearance: none;\n}\n\ninput[type=search] {\n -webkit-appearance: none;\n -moz-appearance: none;\n -webkit-box-sizing: content-box;\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n}\n\ntextarea {\n overflow: auto;\n vertical-align: top;\n resize: vertical;\n}\n\n/**\n * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3.\n */\n\naudio,\ncanvas,\nvideo {\n display: inline-block;\n *display: inline;\n *zoom: 1;\n max-width: 100%;\n}\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\n\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n\n/**\n * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4.\n * Known issue: no IE 6 support.\n */\n\n[hidden] {\n display: none;\n}\n\n/**\n * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using\n * `em` units.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n * user zoom.\n */\n\nhtml {\n font-size: 100%; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -ms-text-size-adjust: 100%; /* 2 */\n}\n\n/**\n * Address `outline` inconsistency between Chrome and other browsers.\n */\n\na:focus {\n outline: thin dotted;\n}\n\n/**\n * Improve readability when focused and also mouse hovered in all browsers.\n */\n\na:active,\na:hover {\n outline: 0;\n}\n\n/**\n * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3.\n * 2. Improve image quality when scaled in IE 7.\n */\n\nimg {\n border: 0; /* 1 */\n -ms-interpolation-mode: bicubic; /* 2 */\n}\n\n/**\n * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11.\n */\n\nfigure {\n margin: 0;\n}\n\n/**\n * Correct margin displayed oddly in IE 6/7.\n */\n\n/**\n * Define consistent border, margin, and padding.\n */\n\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em;\n}\n\n/**\n * 1. Correct color not being inherited in IE 6/7/8/9.\n * 2. Correct text not wrapping in Firefox 3.\n * 3. Correct alignment displayed oddly in IE 6/7.\n */\n\nlegend {\n border: 0; /* 1 */\n padding: 0;\n white-space: normal; /* 2 */\n *margin-left: -7px; /* 3 */\n}\n\n/**\n * 1. Correct font size not being inherited in all browsers.\n * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5,\n * and Chrome.\n * 3. Improve appearance and consistency in all browsers.\n */\n\nbutton,\ninput,\nselect,\ntextarea {\n font-size: 100%; /* 1 */\n margin: 0; /* 2 */\n vertical-align: baseline; /* 3 */\n *vertical-align: middle; /* 3 */\n}\n\n/**\n * Address Firefox 3+ setting `line-height` on `input` using `!important` in\n * the UA stylesheet.\n */\n\nbutton,\ninput {\n line-height: normal;\n}\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+.\n * Correct `select` style inheritance in Firefox 4+ and Opera.\n */\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n * and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n * `input` and others.\n * 4. Remove inner spacing in IE 7 without affecting normal text inputs.\n * Known issue: inner spacing remains in IE 6.\n */\n\nbutton,\nhtml input[type="button"], /* 1 */\ninput[type="reset"],\ninput[type="submit"] {\n -webkit-appearance: button; /* 2 */\n cursor: pointer; /* 3 */\n *overflow: visible; /* 4 */\n}\n\n/**\n * Re-set default cursor for disabled elements.\n */\n\nbutton[disabled],\nhtml input[disabled] {\n cursor: default;\n}\n\n/**\n * 1. Address box sizing set to content-box in IE 8/9.\n * 2. Remove excess padding in IE 8/9.\n * 3. Remove excess padding in IE 7.\n * Known issue: excess padding remains in IE 6.\n */\n\ninput[type="checkbox"],\ninput[type="radio"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n *height: 13px; /* 3 */\n *width: 13px; /* 3 */\n}\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome\n * (include `-moz` to future-proof).\n */\n\ninput[type="search"] {\n -webkit-appearance: textfield; /* 1 */\n -moz-box-sizing: content-box;\n -webkit-box-sizing: content-box; /* 2 */\n box-sizing: content-box;\n}\n\n/**\n * Remove inner padding and search cancel button in Safari 5 and Chrome\n * on OS X.\n */\n\ninput[type="search"]::-webkit-search-cancel-button,\ninput[type="search"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * Remove inner padding and border in Firefox 3+.\n */\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n border: 0;\n padding: 0;\n}\n\n/**\n * 1. Remove default vertical scrollbar in IE 6/7/8/9.\n * 2. Improve readability and alignment in all browsers.\n */\n\ntextarea {\n overflow: auto; /* 1 */\n vertical-align: top; /* 2 */\n}\n\n/**\n * Remove most spacing between table cells.\n */\n\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\nhtml,\nbutton,\ninput,\nselect,\ntextarea {\n color: #222;\n}\n\n\n::-moz-selection {\n background: #b3d4fc;\n text-shadow: none;\n}\n\n::selection {\n background: #b3d4fc;\n text-shadow: none;\n}\n\nimg {\n vertical-align: middle;\n}\n\nfieldset {\n border: 0;\n margin: 0;\n padding: 0;\n}\n\ntextarea {\n resize: vertical;\n}\n\n.chromeframe {\n margin: 0.2em 0;\n background: #ccc;\n color: #000;\n padding: 0.2em 0;\n}\n',""]),n.exports=e},function(n,e,t){var r=t(0),i=t(7);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[n.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);n.exports=i.locals||{}},function(n,e,t){(e=t(1)(!1)).push([n.i,"* {\n background: #333;\n color: #eee;\n}\n\nbody {\n font-family: Verdana, Geneva, Tahoma, sans-serif;\n display: flex;\n flex-flow: column nowrap;\n align-items: center;\n}\n\nmain, aside {\n display: flex;\n flex-flow: column nowrap;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n}\nmain {\n overflow: scroll;\n}\n\nmain p {\n padding: 1em;\n}",""]),n.exports=e},function(n,e,t){function r(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(n)))return;var t=[],r=!0,i=!1,o=void 0;try{for(var a,c=n[Symbol.iterator]();!(r=(a=c.next()).done)&&(t.push(a.value),!e||t.length!==e);r=!0);}catch(n){i=!0,o=n}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return t}(n,e)||function(n,e){if(!n)return;if("string"==typeof n)return i(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);"Object"===t&&n.constructor&&(t=n.constructor.name);if("Map"===t||"Set"===t)return Array.from(n);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(n,e)}(n,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}t(9);var o=t(11).fieldStream,a=document.getElementById("game-field").getContext("2d");a.fillStyle="white";n.exports={fieldView:function n(e){e=function(n){return n&&Array.isArray(n)?{fieldArray:n}:n}(e);var t={draw:function(n,e){var t=this.dimension,r=t.scale,i=t.offset;a.fillRect(n*r+i,e*r+i,r,r)},dimension:{x0:0,y0:0,x1:500,y1:300,scale:6,offset:100},field:o(e),updateView:function(){var n=this;a.clearRect(0,0,this.dimension.x1,this.dimension.y1),Object.entries(this.field.map).filter((function(n){var e=r(n,2);e[0];return e[1].living})).map((function(n){return r(n,1)[0].split(",")})).forEach((function(e){var t=r(e,2),i=t[0],o=t[1];return n.draw(i,o)}))},clear:function(){return n({})},reset:function(){var t=n(e);return t.updateView(),t},seed:function(e){return n(e)},advance:function(){this.field=this.field.next.next,this.updateView()},toggleCell:function(e,t){var i=this.dimension,o=i.scale,a=i.offset;e=Math.floor((e-a)/o),t=Math.floor((t-a)/o);var c=Object.entries(this.field.map).map((function(n){var e=r(n,2);return[e[0],e[1].living]})).reduce((function(n,e){var t=r(e,2),i=t[0],o=t[1];return n[i]=[o],n}),{});return c["".concat(e,",").concat(t)]=c["".concat(e,",").concat(t)]?[!c["".concat(e,",").concat(t)][0]]:[!0],new n({fieldMap:c})}};return t.updateView(),t}}},function(n,e,t){var r=t(0),i=t(10);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[n.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);n.exports=i.locals||{}},function(n,e,t){(e=t(1)(!1)).push([n.i,"canvas {\n background: #222;\n color: white;\n border: 0.5vmin solid #aaa;\n fill: white;\n margin: 0 3em 3em 3em;\n}",""]),n.exports=e},function(n,e,t){function r(n){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function i(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function o(n,e){return(o=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n})(n,e)}function a(n){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(n){return!1}}();return function(){var t,r=u(n);if(e){var i=u(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return c(this,t)}}function c(n,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n):e}function u(n){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function l(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(n)))return;var t=[],r=!0,i=!1,o=void 0;try{for(var a,c=n[Symbol.iterator]();!(r=(a=c.next()).done)&&(t.push(a.value),!e||t.length!==e);r=!0);}catch(n){i=!0,o=n}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return t}(n,e)||function(n,e){if(!n)return;if("string"==typeof n)return s(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);"Object"===t&&n.constructor&&(t=n.constructor.name);if("Map"===t||"Set"===t)return Array.from(n);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return s(n,e)}(n,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function f(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}var d=t(12).cellStream,p=t(2),h=p.Stream,b=p.getNeighbors,m=function n(e){var t=this,r=e.fieldArray,i=void 0===r?[]:r,o=e.fieldMap,a=void 0===o?{}:o;f(this,n),this.map={},i.forEach((function(n,e){return n.forEach((function(n,r){n>0&&(t.map["".concat(e,",").concat(r)]=d(!0,0))}))})),Object.entries(a).forEach((function(n){var e=l(n,2),r=e[0],i=l(e[1],2),o=i[0],a=i[1];return t.map[r]=d(o,a)}))},v=function(n){!function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&o(n,e)}(u,n);var e,t,r,c=a(u);function u(n,e){return f(this,u),c.call(this,n,e)}return e=u,(t=[{key:"addLiveNeighbor",value:function(n){void 0===this.map[n]&&(this.map[n]=d(!1)),this.map[n].addLiveNeighbor()}},{key:"map",get:function(){return this.head.map}}])&&i(e.prototype,t),r&&i(e,r),u}(h),y=function(n,e){var t=l(e,2),r=t[0],i=t[1];return n[r]=i,n},g=function(n){var e=l(n,2);e[0];return!0===e[1].living},w=function(n){var e=l(n,2),t=e[0],r=e[1];return[t,[r.living,r.liveNeighbors]]},x=function(n){var e=l(n,2),t=e[0],r=e[1];return r.setLiving(),[t,[r.living,0]]};n.exports={GameField:m,fieldStream:function n(e){var t=e.fieldArray,r=e.fieldMap;return new v(new m({fieldArray:t,fieldMap:r}),(function(){var e;Object.entries(this.map).filter(g).forEach((e=this,function(n){var t=l(n,1)[0];return b(t).forEach((function(n){return e.addLiveNeighbor(n)}))}));var t=Object.entries(this.map).map(w).reduce(y,{});return new v(new m({fieldMap:t}),(function(){var e=Object.entries(this.map).map(x).reduce(y,{});return n({fieldMap:e})}))}))}}},function(n,e,t){function r(n){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function i(n,e){return(i=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n})(n,e)}function o(n){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(n){return!1}}();return function(){var t,r=c(n);if(e){var i=c(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return a(this,t)}}function a(n,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n):e}function c(n){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function u(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function l(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function s(n,e,t){return e&&l(n.prototype,e),t&&l(n,t),n}var f=t(2).Stream,d=function(){function n(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;u(this,n),this.living=e,this.liveNeighbors=t}return s(n,[{key:"toggleLiving",value:function(){this.living=!this.living}},{key:"addLiveNeighbor",value:function(){this.liveNeighbors++}},{key:"setLiving",value:function(){return this.living&&2!==this.liveNeighbors&&3!==this.liveNeighbors?(this.liveNeighbors=0,this.living=!1):3===this.liveNeighbors?(this.liveNeighbors=0,this.living=!0):void(this.liveNeighbors=0)}}]),n}(),p=function(n){!function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&i(n,e)}(t,n);var e=o(t);function t(n,r){return u(this,t),e.call(this,n,r)}return s(t,[{key:"addLiveNeighbor",value:function(){this.head.addLiveNeighbor()}},{key:"setLiving",value:function(){this.head.setLiving()}},{key:"toggleLiving",value:function(){this.head.toggleLiving()}},{key:"living",get:function(){return this.head.living}},{key:"liveNeighbors",get:function(){return this.head.liveNeighbors},set:function(n){this.head.liveNeighbors=n}}]),t}(f);n.exports={Cell:d,cellStream:function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new p(new d(n,e),(function(){return this.head.setLiving(),this}))}}},function(n,e,t){var r=t(14),i=(t(15),t(2).getCalendar);n.exports={init:function(n){document.getElementById("controls").innerHTML+=r;var e=document.getElementById("rate"),t=document.getElementById("forward"),o=document.getElementById("play"),a=document.getElementById("reset"),c=document.getElementById("clear"),u=document.getElementById("game-field"),l=document.getElementById("calendar-form"),s={interval:null,play:function(){this.interval=setInterval((function(){return n.advance()}),1e3/this.rate)},pause:function(){this.interval&&(clearInterval(this.interval),this.interval=null)},clear:function(){n=n.clear()},reset:function(){this.pause(),n=n.reset()},seed:function(e){e.length&&(n=n.seed(e))},forward:function(){n.advance()},rate:10,updateField:function(e,t){n=n.toggleCell(e,t)},updateRate:function(n){s.rate=n,this.interval&&(clearInterval(this.interval),this.play())}};return e.addEventListener("change",(function(n){n.preventDefault(),s.updateRate(n.target.value)})),t.addEventListener("click",(function(n){n.preventDefault(),s.forward()})),o.addEventListener("click",(function(n){if(n.preventDefault(),s.interval)return s.pause(),t.disabled=!1;s.play(),t.disabled=!0})),a.addEventListener("click",(function(n){n.preventDefault(),s.reset()})),c.addEventListener("click",(function(n){n.preventDefault(),s.clear()})),u.addEventListener("click",(function(n){if(n.preventDefault(),!s.interval){var e=n.offsetX,t=n.offsetY;s.updateField(e,t)}})),l.addEventListener("submit",(function(n){n.preventDefault();var e=n.target[0].value;i(e).then((function(n){return n.map((function(n){return n.contributionDays.map((function(n){return n.contributionCount}))}))})).then((function(n){return s.seed(n)})).catch((function(n){l.elements[0].value="enter valid handle"}))})),s}}},function(n,e){n.exports='<div class=playControls> <button id=clear>⏹️</button> <button id=reset>🔄️</button> <button id=play>⏯️</button> <button id=forward>⏩️</button> <input type=range id=rate min=1 max=20 value=10 /> </div> <form action=/ id=calendar-form> <input type=text value="GitHub handle"/> <input type=submit value=seed /> </form> '},function(n,e,t){var r=t(0),i=t(16);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[n.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);n.exports=i.locals||{}},function(n,e,t){(e=t(1)(!1)).push([n.i,'aside {\n background: #944;\n justify-content: space-evenly;\n display: flex;\n flex-flow: column nowrap;\n position: float;\n top: 0;\n border-bottom: solid 1em #522;\n}\n\naside * {\n background: inherit;\n color: #dff;\n}\n\nh1 {\n font-size: 130%;\n padding: 1em;\n\n}\n\ndiv.playControls {\n min-width: 30vw;\n display: grid;\n border-radius: 1vh;\n border: solid .5vh;\n grid-template-rows: 2fr 1fr;\n grid-template-columns: 1fr 1fr 1fr 1fr;\n gap: 1vh;\n grid-template-areas: "buttons buttons buttons buttons" "slider slider slider slider";\n padding: 1vh;\n}\n\nbutton {\n width: 100%;\n background: #ccc;\n border-radius: .5vh;\n}\n\nbutton:disabled {\n background: #999;\n}\n\ninput[type="range"] {\n grid-area: slider;\n}\n\nform {\n margin: 0.5em;\n padding: 0.5em\n}',""]),n.exports=e}]);