1
0
forked from sent/waves
waves-fork/public/assets/g/pacman/bundle.js
2025-04-09 17:11:14 -05:00

1 line
99 KiB
JavaScript

!function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=13)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();e.ANIMATION_VERTICAL=1,e.ANIMATION_HORIZONTAL=2,e.ANIMATION_ONCE=4,e.ANIMATION_CALLBACK=8,e.ANIMATION_PINGPONG=32;var o={imageURL:null,numberOfFrame:1,delta:0,refreshRate:30,type:0,offsetX:0,offsetY:0},s=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.keys(o).forEach((function(t){t in e&&(n[t]=e[t])}))}return i(t,[{key:"load",value:function(){var t=this;return this.img=new Image,this.img.src=this.imageURL,new Promise((function(e,n){t.img.addEventListener("load",e)}))}},{key:"isReady",value:function(){return this.img.complete}}]),t}();Object.assign(s.prototype,o),e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=n(6),r=(i=s)&&i.__esModule?i:{default:i};var a={width:60,height:60,step:10,speed:80,dir:null,preturn:!1},u={l:"left",r:"right",u:"up",d:"down"},l={l:"r",r:"l",u:"d",d:"u"},h=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return Object.keys(a).forEach((function(e){e in t&&(n[e]=t[e])})),n.pauseAnimation(),n.on("item:tile",(function(t){n._setNextAnimation()})),n._moving=!1,n._lastX=n.x,n._lastY=n.y,n._speed=n.speed,n._dir=null,n._nextAnimation=null,n._nextDirection=null,n._moving=!1,n._saveDefaults(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"_saveDefaults",value:function(){var t=this;this._defaults={},["x","y","_lastX","_lastY","dir","_dir","_nextAnimation","_nextDirection","_moving","mode","animation"].forEach((function(e){t._defaults[e]=t[e]}))}},{key:"reset",value:function(){Object.assign(this,this._defaults),this.transform(),this.setAnimation(this.animation),this.pauseAnimation()}},{key:"update",value:function(){var t=this.getTile();Math.abs(this.y-t.y)<1&&(this.y=t.y),Math.abs(this.x-t.x)<1&&(this.x=t.x),this._lastX!==this.x||this._lastY!=this.y?(this.setXYZ({x:this.x,y:this.y}),this._lastX=this.x,this._lastY=this.y,this._moving||(this.emit("item:move"),this.resumeAnimation(),this._moving=!0),this.emit("item:position",this._getPositionData())):this._moving&&(this.emit("item:stop"),this.pauseAnimation(),this._moving=!1),this._nextAnimation&&this.animation!==this._nextAnimation&&this.setAnimation(this._nextAnimation)}},{key:"_getPositionData",value:function(){return{x:this.x,y:this.y,tile:this.getTile(),dir:this.dir}}},{key:"move",value:function(t){if(t||(t=this.dir),t){var e,n=this.getTile(),i=this.getStep();if((t!=this.dir||this._preturn)&&this._canGo(t)){if((t!==this.dir&&t!==this._getOpDirection()||this._preturn)&&!this._isCentered()){if(this._isV(t)){var o=Math.abs(this.x-n.x);this.preturn?this._isCentered("x")?this._preturn=!1:(this.x>n.x?this.x-=this.getMin(o,i):this.x+=this.getMin(o,i),this._preturn=!0):e=this.getMin(o,i)}if(this._isH(t)){var s=Math.abs(this.y-n.y);this.preturn?this._isCentered("y")?this._preturn=!1:(this.y>n.y?this.y-=this.getMin(s,i):this.y+=this.getMin(s,i),this._preturn=!0):e=this.getMin(s,i)}}e||(this.dir=t,this._setNextAnimation())}e||(this._canGo(this.dir)?e=i:(this._isV(this.dir)&&(e=this.getMin(Math.abs(this.y-n.y),i)),this._isH(this.dir)&&(e=this.getMin(Math.abs(this.x-n.x),i)))),e&&("u"===this.dir&&(this.y-=e),"r"===this.dir&&(this.x+=e),"d"===this.dir&&(this.y+=e),"l"===this.dir&&(this.x-=e)),this.x<0&&(this.x=this.map.width*this.map.tileWidth),this.x>this.map.width*this.map.tileWidth&&(this.x=0),this.y<0&&(this.y=this.map.height*this.map.tileHeight),this.y>this.map.height*this.map.tileHeight&&(this.y=0),(n=this.getTile())!==this._lastTile&&(this._lastTile=n,this.emit("item:tile",n)),this.update()}}},{key:"getStep",value:function(){return this.step*(this._speed/100)}},{key:"_setNextAnimation",value:function(){this._nextAnimation=this.animations[u[this.dir]]}},{key:"_getOpDirection",value:function(t){return l[t||this.dir]}},{key:"_canGo",value:function(t){var e=this.getTile().get(t);return e&&!e.isHouse()&&!e.isWall()}},{key:"_isV",value:function(t){return"u"===t||"d"===t}},{key:"_isH",value:function(t){return"l"===t||"r"===t}},{key:"_isCentered",value:function(t){var e=this.getTile(),n=e.x===this.x,i=e.y===this.y;return"x"===t?n:("y"===t||n)&&i}},{key:"getMin",value:function(){for(var t=null,e=0,n=arguments.length;e<n;e++)(null===t||arguments[e]<t)&&(t=arguments[e]);return t}}]),e}(r.default);Object.assign(h.prototype,a),e.default=h},function(t,e,n){"use strict";e.__esModule=!0,e.View=e.Model=e.Emitter=void 0;var i=r(n(5)),o=r(n(38)),s=r(n(39));function r(t){return t&&t.__esModule?t:{default:t}}e.Emitter=i.default,e.Model=o.default,e.View=s.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(1)),s=a(n(4)),r=a(n(7));function a(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ghost=e}return i(t,[{key:"move",value:function(){this.exit()?this.onExit():o.default.prototype.move.call(this.ghost,this.ghost._dir)}},{key:"pause",value:function(){this._pauseTime=(0,s.default)()}},{key:"resume",value:function(){}},{key:"getNextDirection",value:function(){for(var t,e,n=this._getTarget(),i=this.ghost._dir||this.ghost.dir,o=this.ghost.getTile().get(i),s=["u","l","d","r"],a=0;a<4;a++){var u=s[a];if(u!==this.ghost._getOpDirection(i)&&this.canGo(u,o)){var l=o.get(u),h=(0,r.default)(l,n);(void 0===e||e>h)&&(t=u,e=h)}}return t}},{key:"_getTarget",value:function(){}},{key:"setAnimation",value:function(){o.default.prototype._setNextAnimation.call(this.ghost)}},{key:"canGo",value:function(t,e){e||(e=this.ghost.getTile());var n=e.get(t);return!!n&&(!n.isWall()&&!n.isHouse())}},{key:"exit",value:function(){return this.ghost.mode!=this.ghost.globalMode}},{key:"onExit",value:function(){this.ghost.getTile().isHouse()||(this.ghost._turnBack=!0),this.ghost.setMode()}}]),t}();e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return(new Date).getTime()/1e3}},function(t,e,n){"use strict";e.__esModule=!0;var i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.on=function(t,e){if("function"!=typeof e)throw TypeError("Listener must be a function");this.listeners||(this.listeners={}),this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},t.prototype.once=function(t,e){if("function"==typeof e){var n=this,i=e;e=function(){i.apply(void 0,arguments),n.off(t,e)}}this.on(t,e)},t.prototype.off=function(t,e){if(t)if(e){var n=this.listeners[t];if(n)n.slice().forEach((function(t,i){t===e&&n.splice(i,1)})),n.length||delete this.listeners[t]}else delete this.listeners[t];else this.listeners={}},t.prototype.emit=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];var o=this.listeners&&this.listeners[t];if(o&&o.length){var s=o.slice();s.forEach((function(t){t.apply(void 0,n)}))}},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=n(53);function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var u=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return t.map&&(n.map=t.map),n.offsetX=parseInt(n.width/2),n.offsetY=parseInt(n.height/2),n.render(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"getTile",value:function(){return this.map.getTile(this.x,this.y,!0)}},{key:"destroy",value:function(){(function t(e,n,i){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,n,i)}if("value"in o)return o.value;var r=o.get;return void 0!==r?r.call(i):void 0})(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this,{remove:!0})}},{key:"hide",value:function(){this.el.style.display="none"}},{key:"show",value:function(){this.el.style.display=""}}]),e}(((i=s)&&i.__esModule?i:{default:i}).default);e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){var n=t.x,i=e.x,o=t.y,s=e.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(o-s,2))}},function(t,e,n){t.exports=n.p+"./img/maze.png"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EVENT_KEY_DOWN=e.EVENT_KEY_UP=e.KEY_LEFT=e.KEY_DOWN=e.KEY_RIGHT=e.KEY_UP=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(2);e.KEY_UP=38,e.KEY_RIGHT=39,e.KEY_DOWN=40,e.KEY_LEFT=37;var s=e.EVENT_KEY_UP="keyup",r=e.EVENT_KEY_DOWN="keydown",a=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,{el:document&&document.body,...t}));return n.keys={},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"onKeyUp",value:function(t){this.keys[t.keyCode]=!1,this.emit(s,t)}},{key:"onKeyDown",value:function(t){this.keys[t.keyCode]=!0,this.emit(r,t)}},{key:"clear",value:function(){this.keys={}}}]),e}(o.View);a.prototype.events={keyup:"onKeyUp",keydown:"onKeyDown"},e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EVENT_SWIPE_LEFT=e.EVENT_SWIPE_DOWN=e.EVENT_SWIPE_RIGHT=e.EVENT_SWIPE_UP=e.EVENT_SWIPE=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(2);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var a=e.EVENT_SWIPE="swipe",u=e.EVENT_SWIPE_UP="swipe:up",l=e.EVENT_SWIPE_RIGHT="swipe:right",h=e.EVENT_SWIPE_DOWN="swipe:down",f=e.EVENT_SWIPE_LEFT="swipe:left",c={threshold:100,restraint:150,allowedTime:400},d=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,{...t,el:t.el||document&&document.body}));return Object.keys(c).forEach((function(e){e in t&&(n[e]=t[e])})),n.onTouchStart=n.onTouchStart.bind(n),n.onTouchEnd=n.onTouchEnd.bind(n),n.el.addEventListener("touchstart",n.onTouchStart,!1),n.el.addEventListener("touchend",n.onTouchEnd,!1),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"onDestroy",value:function(){this.el.removeEventListener("touchstart",this.onTouchStart),this.el.removeEventListener("touchend",this.onTouchEnd)}},{key:"onTouchStart",value:function(t){var e=t.changedTouches[0];this.startX=e.pageX,this.startY=e.pageY,this.startTime=new Date}},{key:"onTouchEnd",value:function(t){var e=null,n=t.changedTouches[0],i=n.pageX-this.startX,o=n.pageY-this.startY;new Date-this.startTime<=this.allowedTime&&(Math.abs(i)>=this.threshold&&Math.abs(o)<=this.restraint?e=i<0?f:l:Math.abs(o)>=this.threshold&&Math.abs(i)<=this.restraint&&(e=o<0?u:h),this.emit(a,e,t))}}]),e}(o.View);Object.assign(d.prototype,c),e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(0)),o=n(62),s=r(o);function r(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){return new s.default({animations:{...o.animations,default:new i.default({...o.animationBase,offsetX:60*t})},...e})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(0),s=a(o),r=a(n(1));function a(t){return t&&t.__esModule?t:{default:t}}var u={imageURL:"img/characters.png",numberOfFrame:4,delta:64,refreshRate:60,offsetY:60,type:o.ANIMATION_HORIZONTAL},l={animations:{right:new s.default({...u}),down:new s.default({...u,offsetX:256}),up:new s.default({...u,offsetX:512}),left:new s.default({...u,offsetX:768})},dir:"l",defaultAnimation:"left",preturn:!0,frightenedSpeed:null,frightenedDotSpeed:null,dotSpeed:null},h=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));Object.keys(l).forEach((function(e){e in t&&(n[e]=t[e])}));var i=t.addGameGhostEatEventListener,o=t.addGameGhostModeFrightenedEnter,s=t.addGameGhostModeFrightenedExit;return n._ghostFrightened=0,n.on("item:tile",(function(t){n._ghostFrightened?n._speed=n.frightenedSpeed:n._speed=n.speed,t.item&&(t.hasPill()?n.emit("item:eatpill",t):t.hasDot()&&(n.emit("item:eatdot",t),n._ghostFrightened?n._speed=n.frightenedDotSpeed:n._speed=n.dotSpeed),t.item.destroy(),t.item=null)})),i((function(t){n._eatenTurns=9,n.dir="r",n.pauseAnimation()})),o((function(){n._ghostFrightened++})),s((function(){n._ghostFrightened--})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"reset",value:function(){r.default.prototype.reset.apply(this),this._lastEatenTurnsTime=null}},{key:"move",value:function(){if(this._eatenTurns)if(this._eatenTurnsFrames)this._eatenTurnsFrames--;else{if(9===this._eatenTurns&&this.emit("item:die"),this._eatenTurns>2){var t={d:"l",l:"u",u:"r",r:"d"};this.dir=t[this.dir],this._setNextAnimation(),this.update(),this._eatenTurnsFrames=5}else this._eatenTurnsFrames=25;this._eatenTurns--,0===this._eatenTurns&&this.emit("item:life")}else r.default.prototype.move.apply(this,arguments)}}]),e}(r.default);Object.assign(h.prototype,l),e.default=h},function(t,e,n){t.exports=n(14)},function(t,e,n){"use strict";n(15),n(8),n(16),n(17),n(18),n(19),n(20),n(21),n(22),n(23),n(24),n(25),n(26),n(27);var i,o=n(36),s=(i=o)&&i.__esModule?i:{default:i};window.addEventListener("load",(function(t){document.querySelector(".js-pacman-container");var e=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),n=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);new(function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.el.style.left="50%",n.el.style.marginLeft="-"+n.el.offsetWidth/2+"px",n.el.style.top="50%",n.el.style.marginTop="-"+n.el.offsetHeight/2+"px",n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(s.default))({el:document.querySelector(".js-pacman-playground"),width:.9*e,height:.9*n})}))},function(t,e,n){t.exports=n.p+"./img/characters.png"},function(t,e,n){t.exports=n.p+"./img/misc.png"},function(t,e,n){t.exports=n.p+"./img/pills.png"},function(t,e,n){t.exports=n.p+"./audio/back.mp3"},function(t,e,n){t.exports=n.p+"./audio/bonus.mp3"},function(t,e,n){t.exports=n.p+"./audio/dead.mp3"},function(t,e,n){t.exports=n.p+"./audio/dot.mp3"},function(t,e,n){t.exports=n.p+"./audio/eat.mp3"},function(t,e,n){t.exports=n.p+"./audio/eaten.mp3"},function(t,e,n){t.exports=n.p+"./audio/frightened.mp3"},function(t,e,n){t.exports=n.p+"./audio/intro.mp3"},function(t,e,n){t.exports=n.p+"./audio/life.mp3"},function(t,e,n){var i=n(28);"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(34)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){var i=n(29);(t.exports=n(30)(!1)).push([t.i,"/* press-start-2p-regular - latin */\n@font-face {\n font-family: 'Press Start 2P';\n font-style: normal;\n font-weight: 400;\n src: local(''),\n url("+i(n(31))+") format('woff2'), \n url("+i(n(32))+") format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */\n}\n\nbody {\n background-color: #222;\n margin: 0;\n padding: 0;\n overflow: hidden;\n}\n\n.js-pacman-playground {\n position: absolute;\n color: #EFEFEF;\n font-family: 'Press Start 2P', cursive;\n font-size: 2em;\n background-color: #000;\n background-image: url("+i(n(8))+");\n background-size: 400% 200%;\n display: none;\n cursor: default;\n user-select: none;\n touch-action: none;\n}\n\n.js-pacman-playground.with-border {\n border-radius: 0.5em;\n border: 1em solid #000;\n}\n\n.js-pacman-playground.with-border.with-light {\n box-shadow: 0 0 1em 0.1em #EEE;\n}\n\n.js-pacman-playground.maze-1 {\n background-position: 0 0;\n}\n\n.js-pacman-playground.maze-2 {\n background-position: -100% 0;\n}\n\n.js-pacman-playground.maze-3 {\n background-position: -200% 0;\n}\n\n.js-pacman-playground.maze-4 {\n background-position: -300% 0;\n}\n\n.js-pacman-playground.maze-1.blink {\n background-position: 0 -100%;\n}\n\n.js-pacman-playground.maze-2.blink {\n background-position: -100% -100%;\n}\n\n.js-pacman-playground.maze-3.blink {\n background-position: -200% -100%;\n}\n\n.js-pacman-playground.maze-4.blink {\n background-position: -300% -100%;\n}\n\n.js-pacman-playground .splash {\n background-image: url("+i(n(33))+");\n background-size: 100% 100%;\n background-color: #000;\n text-align: center;\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n z-index: 1;\n}\n\n.js-pacman-playground .splash a {\n color: #DDDDDD;\n cursor: pointer;\n font-weight: bold;\n}\n\n.js-pacman-playground .splash a:hover {\n color: #FFF;\n}\n\n.js-pacman-playground .splash a.start {\n position: relative;\n top: 65%;\n text-transform: uppercase;\n font-size: 1.6em;\n}\n\n.js-pacman-playground .splash .title {\n position: absolute;\n top: 22.04%;\n left: 0;\n right: 0;\n text-align: center;\n color: #FCB644;\n}\n\n.js-pacman-playground .splash p.nerd {\n position: absolute;\n top: 33.15%;\n left: 35.26%;\n text-align: center;\n color: #FFF;\n}\n\n.js-pacman-playground .splash p span {\n color : #FFFF00;\n}\n\n.js-pacman-playground .splash .keys {\n position: absolute;\n top: 85%;\n left: 0;\n right: 0;\n text-align: center;\n color: #FFF;\n}\n\n.js-pacman-playground .splash .credits {\n font-family: 'Press Start 2P', cursive;\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n color: #FFF;\n padding: 0.1em;\n font-size: 0.6em;\n}\n\n.js-pacman-playground .splash .credits span {\n color: #FF3333;\n}\n\n.js-pacman-playground .splash .credits a {\n color: #FFFF00;\n}\n\n.js-pacman-playground .splash .credits a:hover {\n color: #FFFF4D;\n}\n\n.js-pacman-playground .loadbar {\n position: absolute;\n top: 65%;\n left: 22.32%;\n right: 22.32%;\n background: #FF0;\n height: 3.472%;\n overflow: visible;\n border: 2px solid #FFF;\n}\n\n.js-pacman-playground .loadbar .inner {\n position: relative;\n background: #FF0000;\n height: 100%;\n width: 0;\n}\n\n.js-pacman-playground .score {\n position: absolute;\n top: 0;\n right: 0.4464%;\n left: 0.4464%;\n text-align: center;\n z-index: 2\n}\n\n.js-pacman-playground .score .p1-score {\n position: absolute;\n width: 22%;\n top: 0;\n left: 0;\n}\n\n.js-pacman-playground .score .high-score {\n width: 40%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.js-pacman-playground .score .p2-score {\n position: absolute;\n width: 22%;\n top: 0;\n right: 0;\n}\n\n.js-pacman-playground .score span {\n text-align: right;\n display: block;\n}\n\n.js-pacman-playground .score .high-score span {\n text-align: center;\n}\n\n.js-pacman-playground .start-p1 {\n position: absolute;\n top: 38.71%;\n left: 0;\n right: 0;\n text-align: center;\n color: #5EE;\n}\n\n.js-pacman-playground .game-over,\n.js-pacman-playground .start-ready,\n.js-pacman-playground .sound-status,\n.js-pacman-playground .paused {\n position: absolute;\n top: 55.55%;\n left: 0;\n right: 0;\n text-align: center;\n color: #F00;\n}\n\n.js-pacman-playground .sound-status.on span.on,\n.js-pacman-playground .sound-status span.off {\n display : inline;\n}\n\n.js-pacman-playground .sound-status.on span.off,\n.js-pacman-playground .sound-status span.on {\n display : none;\n}\n\n.js-pacman-playground .sound-status .wrap,\n.js-pacman-playground .paused .wrap {\n background: #000;\n padding: 0.1em;\n}\n\n@media screen and (orientation: portrait) {\n /* body {\n background-color: #000;\n }\n\n .js-pacman-playground.with-border {\n border-radius: 0;\n box-shadow: none;\n border: none;\n } */\n}\n",""])},function(t,e){t.exports=function(t){return"string"!=typeof t?t:(/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),/["'() \t\n]/.test(t)?'"'+t.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"':t)}},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var o=(r=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),s=i.sources.map((function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"}));return[n].concat(s).concat([o]).join("\n")}var r;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var s=this[o][0];"number"==typeof s&&(i[s]=!0)}for(o=0;o<t.length;o++){var r=t[o];"number"==typeof r[0]&&i[r[0]]||(n&&!r[2]?r[2]=n:n&&(r[2]="("+r[2]+") and ("+n+")"),e.push(r))}},e}},function(t,e,n){t.exports=n.p+"./fonts/press-start-2p-v9-latin-regular.woff2"},function(t,e,n){t.exports=n.p+"./fonts/press-start-2p-v9-latin-regular.woff"},function(t,e,n){t.exports=n.p+"./img/start.png"},function(t,e,n){var i,o,s={},r=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),a=function(t){return document.querySelector(t)},u=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=a.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),l=null,h=0,f=[],c=n(35);function d(t,e){for(var n=0;n<t.length;n++){var i=t[n],o=s[i.id];if(o){o.refs++;for(var r=0;r<o.parts.length;r++)o.parts[r](i.parts[r]);for(;r<i.parts.length;r++)o.parts.push(b(i.parts[r],e))}else{var a=[];for(r=0;r<i.parts.length;r++)a.push(b(i.parts[r],e));s[i.id]={id:i.id,refs:1,parts:a}}}}function p(t,e){for(var n=[],i={},o=0;o<t.length;o++){var s=t[o],r=e.base?s[0]+e.base:s[0],a={css:s[1],media:s[2],sourceMap:s[3]};i[r]?i[r].parts.push(a):n.push(i[r]={id:r,parts:[a]})}return n}function m(t,e){var n=u(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=f[f.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),f.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=u(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function y(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=f.indexOf(t);e>=0&&f.splice(e,1)}function g(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),v(e,t.attrs),m(t,e),e}function v(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function b(t,e){var n,i,o,s;if(e.transform&&t.css){if(!(s=e.transform(t.css)))return function(){};t.css=s}if(e.singleton){var r=h++;n=l||(l=g(e)),i=O.bind(null,n,r,!1),o=O.bind(null,n,r,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",v(e,t.attrs),m(t,e),e}(e),i=E.bind(null,n,e),o=function(){y(n),n.href&&URL.revokeObjectURL(n.href)}):(n=g(e),i=k.bind(null,n),o=function(){y(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=p(t,e);return d(n,e),function(t){for(var i=[],o=0;o<n.length;o++){var r=n[o];(a=s[r.id]).refs--,i.push(a)}t&&d(p(t,e),e);for(o=0;o<i.length;o++){var a;if(0===(a=i[o]).refs){for(var u=0;u<a.parts.length;u++)a.parts[u]();delete s[a.id]}}}};var _,w=(_=[],function(t,e){return _[t]=e,_.filter(Boolean).join("\n")});function O(t,e,n,i){var o=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=w(e,o);else{var s=document.createTextNode(o),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(s,r[e]):t.appendChild(s)}}function k(t,e){var n=e.css,i=e.media;if(i&&t.setAttribute("media",i),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function E(t,e,n){var i=n.css,o=n.sourceMap,s=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||s)&&(i=c(i)),o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var r=new Blob([i],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(r),a&&URL.revokeObjectURL(a)}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,s=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(s)?t:(o=0===s.indexOf("//")?s:0===s.indexOf("/")?n+s:i+s.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function t(e,n,i){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,n,i)}if("value"in o)return o.value;var r=o.get;return void 0!==r?r.call(i):void 0},s=v(n(37)),r=v(n(41)),a=v(n(43)),u=v(n(45)),l=v(n(51)),h=v(n(60)),f=v(n(61)),c=v(n(11)),d=v(n(12)),p=v(n(63)),m=v(n(64)),y=n(9),g=n(10);function v(t){return t&&t.__esModule?t:{default:t}}function b(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var w=function(t){t.style.display=""},O=function(t){t.style.display="none"},k={width:448,height:576,originalWidth:896,originalHeight:1152,dotScore:10,pillScore:50,defaultLives:3,soundEnabled:!0,events:{"click .start":"startLevel"}},E=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};b(this,e);var n=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return Object.keys(k).forEach((function(e){e in t&&(n[e]=t[e])})),n.model=new u.default({lives:n.defaultLives}),n.model.fetch(),n.render(),n.elements={splash:n.$(".splash"),start:n.$(".start"),startP1:n.$(".start-p1"),startReady:n.$(".start-ready"),highScore:n.$(".high-score span"),score:n.$(".p1-score span"),gameOver:n.$(".game-over"),soundStatus:n.$(".sound-status"),paused:n.$(".paused"),load:n.$(".loadbar")},n.keyboard.on(y.EVENT_KEY_DOWN,n._onKeyDown.bind(n)),n.touch.on(g.EVENT_SWIPE,n._onSwipe.bind(n)),n.sound=new r.default({soundEnabled:n.soundEnabled,addSound:n.addSound.bind(n)}),n.lives=new p.default({lives:n.defaultLives+1,x:40,y:1124,model:n.model,factor:n.scaling.getFactor(),addSprite:n.addSprite.bind(n)}),n.bonuses=new m.default({level:n.model.level,x:860,y:1124,model:n.model,factor:n.scaling.getFactor(),addSprite:n.addSprite.bind(n)}),n._onGhostEaten=n._onGhostEaten.bind(n),n._onGhostEat=n._onGhostEat.bind(n),n.model.on("change:score",n._onChangeScore.bind(n)),n.model.on("change:highScore",n._onChangeHighScore.bind(n)),n.model.on("change:lives",n._onChangeLives.bind(n)),n.model.on("change:extraLives",n._onChangeExtraLives.bind(n)),n.model.on("change:mode",n._onChangeMode.bind(n)),n.makeLevel(),n.start((function(){O(n.elements.load),w(n.elements.start)})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"startLevel",value:function(){return this._win?(this.model.level++,this.reset(),void(this._win=!1)):this._gameOver?(this.model.level=1,this.reset(),this._gameOver=!1,O(this.elements.splash),void this.sound.play("intro")):(O(this.elements.splash),this.sound.play("intro"),void this.addCallback(this.mainLoop.bind(this)))}},{key:"reset",value:function(){this.model.mode=null,this.pinky.destroy(),this.blinky.destroy(),this.inky.destroy(),this.sue.destroy(),this.pacman.destroy(),this.map.destroyItems(),this.off("game:ghost:eaten",this._onGhostEaten),this.off("game:ghost:eat",this._onGhostEat),this._win||(this.model.lives=this.defaultLives+1,this.model.score=0),this.keyboard.clear(),this._inputDirection=null,this._lastSwipe=null,this.makeLevel()}},{key:"makeLevel",value:function(){var t=this;Object.assign(this,this.model.getSettings("game")),this.map=new a.default(this.map),this.el.classList.remove("maze-1"),this.el.classList.remove("maze-2"),this.el.classList.remove("maze-3"),this.el.classList.remove("maze-4"),this.el.classList.add(this.maze);var e="white";"maze-2"===this.maze&&(e="yellow"),"maze-3"===this.maze&&(e="red"),this._pauseFrames=80,this._destroyBonus=0,this._showBonus=500;for(var n=this.map.tiles.length,i=0;n--;){var o=this.map.tiles[n];if("."===o.code){var s=(0,h.default)({defaultAnimation:e,map:this.map,factor:this.scaling.getFactor(),normalizeRefrashRate:this.normalizeRefrashRate.bind(this),x:o.x,y:o.y});o.item=s,this.addSprite(s),i++}if("*"===o.code){var r=(0,f.default)({defaultAnimation:e,map:this.map,factor:this.scaling.getFactor(),normalizeRefrashRate:this.normalizeRefrashRate.bind(this),x:o.x,y:o.y});o.item=r,this.addSprite(r),i++}}this.totalItems=i,this.pacman=new d.default({preturn:!0,x:452,y:848,...this.model.getSettings("pacman"),map:this.map,factor:this.scaling.getFactor(),normalizeRefrashRate:this.normalizeRefrashRate.bind(this),addGameGhostEatEventListener:function(e){return t.on("game:ghost:eat",e)},addGameGhostModeFrightenedEnter:function(e){return t.on("game:ghost:modefrightened:enter",e)},addGameGhostModeFrightenedExit:function(e){return t.on("game:ghost:modefrightened:exit",e)}}),this.pacman.on("item:eatpill",(function(e){t._pauseFrames=2,t.model.addScore(t.pillScore),t.totalItems--,0===t.totalItems?t.win():t.sound.play("frightened")})),this.on("game:ghost:eaten",this._onGhostEaten),this.on("game:ghost:eat",this._onGhostEat),this.pacman.on("item:die",(function(e){t.sound.play("eaten")})),this.pacman.on("item:life",(function(){t.keyboard.clear(),t._inputDirection=null,t._lastSwipe=null,t.model.mode=null,t.pacman.reset(),t.pinky.reset(),t.blinky.reset(),t.inky.reset(),t.sue.reset(),t.bonus&&(t._destroyBonus=0,t._showBonus=250,t.bonus.reset(),t.bonus.hide()),t.showGhosts(),t.model.lives--,t._pacmanEaten=!1,t.model.lives?(w(t.elements.startReady),t._start=1,t._pauseFrames=40):t._pauseFrames=120})),this.pacman.on("item:eatdot",(function(e){t.model.addScore(t.dotScore),t.sound.play("dot"),t.totalItems--,0===t.totalItems&&t.win()})),this.addSprite(this.pacman),this.bonus&&this.bonus.destroy();var u=this.map.tunnels[this.map.tunnels.length-1];this.bonus=(0,c.default)(this.bonusIndex,{map:this.map,dir:"l",score:this.bonusScore,x:u.x,y:u.y,factor:this.scaling.getFactor(),normalizeRefrashRate:this.normalizeRefrashRate.bind(this),addPacmanPositionEventListener:function(e){return t.pacman.on("item:position",e)}}),this.bonus.on("item:destroy",(function(e){t.bonus.destroy(),t.bonus=null})),this.bonus.on("item:eaten",(function(e){t._showBonus||(t._pauseFrames=5,t._destroyBonus=25,t.model.addScore(parseInt(e.score)),t.sound.play("bonus"))})),this.addSprite(this.bonus);var p={...this.model.getSettings("ghost"),map:this.map,normalizeRefrashRate:this.normalizeRefrashRate.bind(this),factor:this.scaling.getFactor(),addGameGlobalModeEventListener:function(e){return t.on("game:globalmode",e)},addGameGhostEatenEventListener:function(e){return t.on("game:ghost:eaten",e)},addPacmanPositionEventListener:function(e){return t.pacman.on("item:position",e)},addPacmanEatPillEventListener:function(e){return t.pacman.on("item:eatpill",e)}},m=this.map.houseCenter.getR();this.pinky=(0,l.default)("pinky",{...p,x:m.x-this.map.tileWidth/2,y:m.y}),this.addEventListenersToGhost(this.pinky),this.addSprite(this.pinky);var y=this.map.house.getU().getR();this.blinky=(0,l.default)("blinky",{...p,x:y.x-this.map.tileWidth/2,y:y.y}),this.addEventListenersToGhost(this.blinky),this.addSprite(this.blinky);var g=this.map.houseCenter.getL();this.inky=(0,l.default)("inky",{...p,blinky:this.blinky,x:g.x-16,y:g.y}),this.addEventListenersToGhost(this.inky),this.addSprite(this.inky);var v=this.map.houseCenter.getR().getR();this.sue=(0,l.default)("sue",{...p,x:v.x+16,y:v.y}),this.addEventListenersToGhost(this.sue),this.addSprite(this.sue),w(this.elements.startReady),this._win?(this.bonus.hide(),this._start=1):(w(this.elements.startP1),this.hideGhosts(),this.pacman.hide(),this._start=2)}},{key:"addEventListenersToGhost",value:function(t){var e=this;t.on("item:eat",(function(){return e.emit("game:ghost:eat",t)})),t.on("item:eaten",(function(){return e.emit("game:ghost:eaten",t)})),t.on("item:modefrightened:enter",(function(){return e.emit("game:ghost:modefrightened:enter")})),t.on("item:modefrightened:exit",(function(){return e.emit("game:ghost:modefrightened:exit")}))}},{key:"mainLoop",value:function(){if(this.model.updateMode(),this._inputDirection=this._getInputDirection(),this._pauseFrames)this._pauseFrames--;else{if(2===this._start)return O(this.elements.startP1),this.showGhosts(),this.pacman.show(),this.model.lives=this.defaultLives,this._pauseFrames=60,void this._start--;if(1===this._start)return O(this.elements.startReady),void this._start--;if(this._win)return void this.startLevel();if(this._gameOver)return O(this.elements.gameOver),void w(this.elements.splash);this._showPacman&&(this.pacman.show(),this._showPacman=!1),this.pacman.move(this._inputDirection),this._pacmanEaten?this.hideGhosts():(this._soundBackPauseFrames?this._soundBackPauseFrames--:(this._isGhostDead()?this.sound.play("dead"):this._isGhostFrightened()||this.sound.play("back"),this._soundBackPauseFrames=5),this.pinky.move(),this.blinky.move(),this.inky.move(),this.sue.move(),this._destroyBonus?(1===this._destroyBonus&&(this.bonus.destroy(),delete this.bonus),this._destroyBonus--):this.bonus&&(this._showBonus?(1===this._showBonus&&this.bonus.show(),this._showBonus--):this.bonus.move()))}}},{key:"pause",value:function(){o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"pause",this).call(this),this.pinky.pause(),this.blinky.pause(),this.inky.pause(),this.sue.pause(),this.muteSound(!0),this.model.pause(),this.elements.paused.style.display=""}},{key:"resume",value:function(){o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"resume",this).call(this),this.pinky.resume(),this.blinky.resume(),this.inky.resume(),this.sue.resume(),this.muteSound(!!this._muted),this.model.resume(),O(this.elements.paused)}},{key:"win",value:function(){var t=this;this._pauseFrames=120,this._win=!0;var e=14;this.addCallback((function(){return e?(e--,t.el.classList.toggle("blink"),!1):(t.el.classList.remove("blink"),!0)}),8*this.refreshRate),this.hideGhosts(),this.map.hideItems(),this.pacman.pauseAnimation()}},{key:"hideGhosts",value:function(){this.pinky.hide(),this.blinky.hide(),this.inky.hide(),this.sue.hide(),this.bonus&&this.bonus.hide()}},{key:"showGhosts",value:function(){this.pinky.show(),this.blinky.show(),this.inky.show(),this.sue.show(),this.bonus&&!this._showBonus&&this.bonus.show()}},{key:"_isGhostFrightened",value:function(){return this.blinky.isFrightened()||this.inky.isFrightened()||this.pinky.isFrightened()||this.sue.isFrightened()}},{key:"_isGhostDead",value:function(){return this.blinky.isDead()||this.inky.isDead()||this.pinky.isDead()||this.sue.isDead()}},{key:"_getInputDirection",value:function(){var t=this.keyboard.keys,e=null;return t[y.KEY_UP]?e="u":t[y.KEY_RIGHT]?e="r":t[y.KEY_DOWN]?e="d":t[y.KEY_LEFT]&&(e="l"),e?this._lastSwipe=null:this._lastSwipe===g.EVENT_SWIPE_UP?e="u":this._lastSwipe===g.EVENT_SWIPE_RIGHT?e="r":this._lastSwipe===g.EVENT_SWIPE_DOWN?e="d":this._lastSwipe===g.EVENT_SWIPE_LEFT&&(e="l"),e}},{key:"onLoadProgress",value:function(t){this.elements.load.querySelector(".inner").style.width=t+"%"}},{key:"_onSwipe",value:function(t,e){this._lastSwipe=t}},{key:"_onKeyDown",value:function(t){if(83===t.keyCode){if(!this.soundEnabled)return;this._muted=!this._muted,this.muteSound(this._muted);var e=this.elements.soundStatus;this._muted?e.classList.remove("on"):e.classList.add("on"),w(e),this._hideSoundStatusTimeout&&clearTimeout(this._hideSoundStatusTimeout),this._hideSoundStatusTimeout=setTimeout((function(){O(e)}),2e3)}else 80===t.keyCode&&(this._paused=!this._paused,this._paused?this.pause():this.resume())}},{key:"_onChangeScore",value:function(t,e){this.elements.score.innerText=e||"00"}},{key:"_onChangeHighScore",value:function(t,e){this.elements.highScore.innerText=e||"00"}},{key:"_onChangeLives",value:function(t,e){0===e&&(this._gameOver=!0,w(this.elements.gameOver),this.hideGhosts(),this.pacman.hide(),this.model.save())}},{key:"_onChangeExtraLives",value:function(t,e){this.sound.play("life")}},{key:"_onChangeMode",value:function(t,e){this.emit("game:globalmode",e)}},{key:"_onGhostEaten",value:function(t){this.pacman.hide(),this._pauseFrames=15,this._showPacman=!0,this.model.addScore(parseInt(t.score)),this.sound.play("eat")}},{key:"_onGhostEat",value:function(){this._pauseFrames=40,this._pacmanEaten=!0}},{key:"template",value:function(t){return'\n <div class="score">\n <div class="p1-score">1UP<br /><span>00</span></div>\n <div class="high-score">HIGH SCORE<br /><span>'+(t.highScore||"00")+'</span></div>\n <div class="p2-score">2UP<br /><span>00</span></div>\n </div>\n <div class="start-p1" style="display: none">PLAYER ONE</div>\n <div class="start-ready" style="display: none">READY!</div>\n <div class="game-over" style="display: none">GAME OVER</div>\n <div class="sound-status on" style="display: none"><span class="wrap">SOUND: <span class="on">ON</span><span class="off">OFF</span></span></div>\n <div class="paused" style="display: none"><span class="wrap">PAUSED</span></div>\n <div class="splash">\n <span class="title">"JS PAC-MAN"</span>\n <p class="nerd">HTML - CSS<br><br><span>JAVASCRIPT</span></p>\n <a class="start" style="display: none">START</a>\n <div class="loadbar"><div class="inner"></div></div>\n <p class="keys"><span>&larr;&uarr;&darr;&rarr;</span>:MOVE <span>S</span>:SOUND <span>P</span>:PAUSE</p>\n <div class="credits">&#169; 2014-2020 <span>8</span>TENTACULOS <a href="https://github.com/8tentaculos/jsPacman">SOURCE+INFO</a></div>\n </div>\n '}}]),e}(s.default);Object.assign(E.prototype,k),e.default=E},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.STATE_PAUSED=e.STATE_RUNNING=e.STATE_NEW=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(2),s=u(n(9)),r=u(n(10)),a=u(n(40));function u(t){return t&&t.__esModule?t:{default:t}}var l=e.STATE_NEW=0,h=e.STATE_RUNNING=1,f=e.STATE_PAUSED=2,c={height:320,width:480,originalHeight:320,originalWidth:480,refreshRate:30,position:"absolute"},d=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return Object.keys(c).forEach((function(e){e in t&&(n[e]=t[e])})),n.sprites=n.children,n.sounds=[],n.callbacks=[],n.loadedSpritesIndex=0,n.loadedSoundsIndex=0,n.keyboard=new s.default,n.touch=new r.default,n.scaling=new a.default(n.originalWidth,n.originalHeight),n.scaling.resize(n.width,n.height),n.state=l,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"render",value:function(){return function t(e,n,i){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,n,i)}if("value"in o)return o.value;var r=o.get;return void 0!==r?r.call(i):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"render",this).call(this),Object.assign(this.el.style,{position:this.position,display:"block",overflow:"hidden",height:this.scaling.height+"px",width:this.scaling.width+"px",fontSize:2*this.scaling.getFactor()+"em"}),this.scenegraph=this.createElement("div",{style:"visibility: hidden;"}),this.el.appendChild(this.scenegraph),this}},{key:"onDestroy",value:function(){this.keyboard.destroy(),this.touch.destroy()}},{key:"preload",value:function(){for(var t=this.sprites.length-1;t>=this.loadedSpritesIndex;t--)this.sprites[t].load();for(var e=this.sounds.length-1;e>=this.loadedSoundsIndex;e--)this.sounds[e].load();this.waitForResources()}},{key:"waitForResources",value:function(){for(var t=0,e=this.loadedSpritesIndex;e<this.sprites.length;e++)this.sprites[e].isReady()&&t++;for(var n=0,i=this.loadedSoundsIndex;i<this.sounds.length;i++)this.sounds[i].isReady()&&n++;var o=this.sprites.length+this.sounds.length-this.loadedSpritesIndex-this.loadedSoundsIndex;if("function"==typeof this.onLoadProgress){var s=(t+n)/o*100;this.onLoadProgress(s)}t+n<o?setTimeout(this.waitForResources.bind(this),100):(this.loadedSpritesIndex=this.sprites.length,this.loadedSoundsIndex=this.sounds.length,this.state===l&&setInterval(this.refresh.bind(this),this.refreshRate),this.state=h,"function"==typeof this._onReadyCallback&&(this._onReadyCallback(),this._onReadyCallback=null),this.scenegraph.style.visibility="visible")}},{key:"addSprite",value:function(t){var e=this;return this.scenegraph.appendChild(this.addChild(t).el),this.state===h?t.load().then((function(){return e.loadedSpritesIndex++,Promise.resolve()})):Promise.resolve()}},{key:"addSound",value:function(t){var e=this;return this.sounds.push(t),this.state===h?t.load().then((function(){return e.loadedSoundsIndex++,Promise.resolve()})):Promise.resolve()}},{key:"addCallback",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.refreshRate;this.callbacks.push({fn:t,refreshRate:this.normalizeRefrashRate(e),idleCounter:0})}},{key:"refresh",value:function(){if(this.state===h){this.sprites.forEach((function(t){t.refresh()}));for(var t=[],e=this.callbacks.length-1;e>=0;e--){if(this.callbacks[e].idleCounter===this.callbacks[e].refreshRate-1){var n=this.callbacks[e].fn();"boolean"==typeof n?n&&t.push(e):"number"==typeof n&&(this.callbacks[e].refreshRate=this.normalizeRefrashRate(n),this.callbacks[e].idleCounter=0)}this.callbacks[e].idleCounter=(this.callbacks[e].idleCounter+1)%this.callbacks[e].refreshRate}for(e=t.length-1;e>=0;e--)this.callbacks.splice(t[e],1)}}},{key:"clear",value:function(t){this.destroyChildren(),this.loadedSpritesIndex=0,this.sounds=[],this.loadedSoundsIndex=0,t&&(this.callbacks=[]),this.scenegraph.innerHTML=""}},{key:"muteSound",value:function(t){for(var e=this.sounds.length-1;e>=0;e--)this.sounds[e].mute(t)}},{key:"start",value:function(t){"function"==typeof t&&(this._onReadyCallback=t),this.preload()}},{key:"pause",value:function(){this.state=f,this.scenegraph.style.visibility="hidden"}},{key:"resume",value:function(t){this.state===f&&("function"==typeof t&&(this._onReadyCallback=t),this.preload())}},{key:"normalizeRefrashRate",value:function(t){return Math.round(t/this.refreshRate)||1}}]),e}(o.View);Object.assign(d.prototype,c),e.default=d},function(t,e,n){"use strict";e.__esModule=!0;var i,o=n(5);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var a=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,e);var i=r(this,t.call(this));return i.attributes=Object.assign({},i.defaults||{},n),i.previous={},Object.keys(i.attributes).forEach(i.defineAttribute.bind(i)),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.defineAttribute=function(t){var e=this;Object.defineProperty(this,t,{get:function(){return e.get(t)},set:function(n){return e.set(t,n)}})},e.prototype.get=function(t){return this.attributes[t]},e.prototype.set=function(t,e){var n,i=this,o="object"==typeof t?t:((n={})[t]=e,n);return Object.keys(o).forEach((function(t){var e=t in i.attributes&&o[t]!==i.attributes[t];i.previous[t]=i.attributes[t],i.attributes[t]=o[t],e&&(i.emit("change",i,t,o[t]),i.emit("change:"+t,i,o[t]))})),this},e.prototype.toJSON=function(){return this.attributes},e}(((i=o)&&i.__esModule?i:{default:i}).default);e.default=a},function(t,e,n){"use strict";e.__esModule=!0;var i,o=n(5),s=(i=o)&&i.__esModule?i:{default:i};function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var u={el:!0,tag:!0,attributes:!0,events:!0,model:!0,template:!0,onDestroy:!0},l=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e);var i=a(this,t.call(this));return i.uid="uid"+ ++e.uid,i.delegatedEventListeners=[],i.children=[],Object.keys(n).forEach((function(t){u[t]&&(i[t]=n[t])})),i.ensureElement(),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.$=function(t){return this.el.querySelector(t)},e.prototype.$$=function(t){return this.el.querySelectorAll(t)},e.prototype.destroy=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.remove;this.destroyChildren(),this.undelegateEvents(),this.off(),e&&this.removeElement(),this.onDestroy()},e.prototype.onDestroy=function(){},e.prototype.addChild=function(t){return this.children.push(t),t},e.prototype.destroyChildren=function(){for(;this.children.length;)this.children.shift().destroy()},e.prototype.ensureElement=function(){this.el||(this.el=this.createElement(this.tag,this.attributes)),this.delegateEvents()},e.prototype.createElement=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.createElement(t);return Object.keys(e).forEach((function(t){return n.setAttribute(t,e[t])})),n},e.prototype.removeElement=function(){this.el.parentNode.removeChild(this.el)},e.prototype.delegateEvents=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.events;if(e){var n={};Object.keys(e).forEach((function(i){var o=i.split(" "),s=o[0],r=o[1],a=e[i];"string"==typeof a&&(a=t[a].bind(t)),n[s]||(n[s]=[]),n[s].push({selector:r,listener:a})}));var i=Array.prototype.indexOf;Object.keys(n).forEach((function(e){var o=t,s=function(t){n[e].forEach((function(e){var n=e.selector,s=e.listener;(!n&&o.el===t.target||i.call(o.el.querySelectorAll(n),t.target)>-1)&&s(t,o)}))};t.delegatedEventListeners.push({type:e,listener:s}),t.el.addEventListener(e,s)}))}},e.prototype.undelegateEvents=function(){var t=this;this.delegatedEventListeners.forEach((function(e){var n=e.type,i=e.listener;t.el.removeEventListener(n,i)})),this.delegatedEventListeners=[]},e.prototype.render=function(){return this.destroyChildren(),this.template&&(this.el.innerHTML=this.template(this.model)),this},e}(s.default);e.default=l,l.uid=0},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.originalWidth=this.width=e,this.originalHeight=this.height=n,this.widthToHeight=e/n}return i(t,[{key:"resize",value:function(t,e){t/e>this.widthToHeight?(this.width=e*this.widthToHeight,this.height=e):(this.height=t/this.widthToHeight,this.width=t)}},{key:"getFactor",value:function(){return this.width/this.originalWidth}}]),t}();e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=n(42),r=(i=s)&&i.__esModule?i:{default:i};var a=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.soundEnabled=!!e.soundEnabled,this.soundEnabled&&(this.sounds={intro:new r.default("audio/intro.mp3"),back:new r.default("audio/back.mp3"),dot:new r.default("audio/dot.mp3"),eaten:new r.default("audio/eaten.mp3"),eat:new r.default("audio/eat.mp3"),frightened:new r.default("audio/frightened.mp3"),dead:new r.default("audio/dead.mp3"),bonus:new r.default("audio/bonus.mp3"),life:new r.default("audio/life.mp3")},Object.keys(this.sounds).forEach((function(t){e.addSound(n.sounds[t])})))}return o(t,[{key:"play",value:function(t){this.soundEnabled&&this.sounds[t].play()}}]),t}();e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=void 0,s=void 0,r=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!o){var n=window.AudioContext||window.webkitAudioContext;o=new n,(s=o.createGain()).connect(o.destination)}this.url=e}return i(t,[{key:"load",value:function(){var t=this;fetch(this.url).then((function(t){return t.arrayBuffer()})).then((function(t){return function(t){return new Promise((function(e,n){o.decodeAudioData(t,e,n)}))}(t)})).then((function(e){return t.audioBuffer=e,Promise.resolve(e)}))}},{key:"play",value:function(){"suspended"===o.state&&o.resume();var t=o.createBufferSource();t.buffer=this.audioBuffer,t.connect(s),t.start()}},{key:"mute",value:function(t){this.muted=!1!==t,this.muted?s.gain.setValueAtTime(0,o.currentTime):s.gain.setValueAtTime(1,o.currentTime)}},{key:"isReady",value:function(){return!!this.audioBuffer}}]),t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=n(44),r=(i=s)&&i.__esModule?i:{default:i};var a=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.tiles=[],this.width=e[0].length,this.height=e.length,this.tunnels=[];for(var n=0;n<this.height;n++)for(var i=e[n],o=0;o<this.width;o++){var s=i.charAt(o),a=new r.default(s,o,n,this);this.tiles.push(a),a.isHouse()&&!this.house&&(this.house=a),!a.isTunnel()||0!==a.col&&a.col!==this.width-1||this.tunnels.push(a)}this.houseCenter=this.house.getD().getD(),this.tileWidth=this.tiles[0].width,this.tileHeight=this.tiles[0].height}return o(t,[{key:"getTile",value:function(t,e,n){n&&(t=parseInt(t/this.tileWidth),e=parseInt(e/this.tileHeight)),t>this.width-1&&(t=0),t<0&&(t=this.width-1),e>this.height-1&&(e=0),e<0&&(e=this.height-1);var i=e*this.width+t;return this.tiles[i]||null}},{key:"destroyItems",value:function(){for(var t=this.tiles.length;t--;){var e=this.tiles[t];e.item&&e.item.destroy()}}},{key:"hideItems",value:function(){for(var t=this.tiles.length;t--;){var e=this.tiles[t];e.item&&e.item.hide()}}}]),t}();e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e,n,i,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.code=e,this.col=n,this.row=i,this.map=o,this.width=32,this.height=32,this.x=this.col*this.width+this.width/2,this.y=this.row*this.height+this.height/2+4}return i(t,[{key:"isWall",value:function(){return"="===this.code}},{key:"isHouse",value:function(){return"h"===this.code}},{key:"isTunnel",value:function(){return"t"===this.code}},{key:"hasDot",value:function(){return this.item&&"."===this.code}},{key:"hasPill",value:function(){return this.item&&"*"===this.code}},{key:"get",value:function(t){return"u"===t?this.getU():"d"===t?this.getD():"l"===t?this.getL():"r"===t?this.getR():null}},{key:"getU",value:function(){return this.map.getTile(this.col,this.row-1)||null}},{key:"getD",value:function(){return this.map.getTile(this.col,this.row+1)||null}},{key:"getL",value:function(){return this.map.getTile(this.col-1,this.row)||null}},{key:"getR",value:function(){return this.map.getTile(this.col+1,this.row)||null}}]),t}();e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=h(n(46)),s=h(n(4)),r=h(n(47)),a=h(n(48)),u=h(n(49)),l=h(n(50));function h(t){return t&&t.__esModule?t:{default:t}}var f=[{mode:"scatter",time:7},{mode:"chase",time:20},{mode:"scatter",time:7},{mode:"chase",time:20},{mode:"scatter",time:5},{mode:"chase",time:20},{mode:"scatter",time:5},{mode:"chase",time:1e6}],c=[[f,0,"100","80","71","75","40","20","80","10","85","90","79","50","6","5",r.default,"maze-1"],[f,1,"200","90","79","85","45","30","90","15","95","95","83","55","5","5",r.default,"maze-1"],[f,2,"500","90","79","85","45","40","90","20","95","95","83","55","4","5",a.default,"maze-2"],[f,3,"500","90","79","85","45","40","90","20","95","95","83","55","3","5",a.default,"maze-2"],[f,4,"700","100","87","95","50","40","100","20","105","100","87","60","2","5",a.default,"maze-2"],[f,5,"700","100","87","95","50","50","100","25","105","100","87","60","5","5",u.default,"maze-3"],[f,6,"1000","100","87","95","50","50","100","25","105","100","87","60","2","5",u.default,"maze-3"],[f,7,"1000","100","87","95","50","50","100","25","105","100","87","60","2","5",u.default,"maze-3"],[f,0,"2000","100","87","95","50","60","100","30","105","100","87","60","1","3",u.default,"maze-3"],[f,1,"2000","100","87","95","50","60","100","30","105","100","87","60","5","5",l.default,"maze-4"],[f,2,"2000","100","87","95","50","60","100","30","105","100","87","60","2","5",l.default,"maze-4"],[f,3,"2000","100","87","95","50","80","100","40","105","100","87","60","1","3",l.default,"maze-4"],[f,4,"5000","100","87","95","50","80","100","40","105","100","87","60","1","3",l.default,"maze-4"],[f,5,"5000","100","87","95","50","80","100","40","105","100","87","60","3","5",u.default,"maze-3"],[f,6,"5000","100","87","95","50","100","100","50","105","100","87","60","1","3",u.default,"maze-3"],[f,7,"5000","100","87","95","50","100","100","50","105","100","87","60","1","3",u.default,"maze-3"],[f,7,"5000","100","87","95","50","100","100","50","105","0","0","0","0","0",u.default,"maze-3"],[f,7,"5000","100","87","95","50","100","100","50","105","100","87","60","1","3",l.default,"maze-4"],[f,7,"5000","100","87","95","50","120","100","60","105","0","0","0","0","0",l.default,"maze-4"],[f,7,"5000","100","87","95","50","120","100","60","105","0","0","0","0","0",l.default,"maze-4"],[f,7,"5000","90","79","95","50","120","100","60","105","0","0","0","0","0",l.default,"maze-4"]],d=["game.times","game.bonusIndex","game.bonusScore","pacman.speed","pacman.dotSpeed","ghost.speed","ghost.tunnelSpeed","","","","","pacman.frightenedSpeed","pacman.frightenedDotSpeed","ghost.frightenedSpeed","ghost.frightenedTime","ghost.frightenedFlashes","game.map","game.maze"],p=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,{level:1,score:0,highScore:0,lives:3,extraLives:1,extraLifeScore:1e4,mode:null,...t}));return n.url="jsPacman",n.on("change:score",n.onChangeScore.bind(n)),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"addScore",value:function(t){this.score=this.score+t}},{key:"updateMode",value:function(){this.mode||(this.modeTime=(0,s.default)());for(var t=this.getSettings("game").times,e=(0,s.default)(),n=0,i=0;t[i];){if((n+=t[i].time)+this.modeTime>e||i===t.length-1){this.mode=t[i].mode;break}i++}}},{key:"pause",value:function(){this.pauseTime=(0,s.default)()}},{key:"resume",value:function(){this.modeTime=(0,s.default)()-this.pauseTime}},{key:"getSettings",value:function(t){for(var e={},n=this.level>c.length?c.length:this.level,i=d.length;i--;){var o=d[i].split(".");o[0]===t&&(e[o[1]]=c[n-1][i])}return e}},{key:"onChangeScore",value:function(){this.extraLives&&this.score>=this.extraLifeScore&&(this.extraLives--,this.lives++),this.highScore<this.score&&(this.highScore=this.score)}},{key:"toJSON",value:function(){return{highScore:this.highScore}}}]),e}(o.default);e.default=p},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(t){function e(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"fetch",value:function(){if(this.url&&window.localStorage){var t=window.localStorage.getItem(this.url);t&&this.set(JSON.parse(t))}}},{key:"save",value:function(){this.url&&window.localStorage&&window.localStorage.setItem(this.url,JSON.stringify(this))}}]),e}(n(2).Model);e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=["----------------------------","----------------------------","----------------------------","============================","=......==..........==......=","=*====.==.========.==.====*=","=.====.==.========.==.====.=","=..........................=","===.==.=====.==.=====.==.===","--=.==.=====.==.=====.==.=--","===.==.=====.==.=====.==.===","ttt.==.......==.......==.ttt","===.=====-========-=====.===","--=.=====-========-=====.=--","--=.--------------------.=--","--=.=====-===hh===-=====.=--","--=.=====-===--===-=====.=--","--=.==----=------=----==.=--","--=.==-==-========-==-==.=--","===.==-==-========-==-==.===","ttt.---==----------==---.ttt","===.========-==-========.===","--=.========-==-========.=--","--=.......---==---.......=--","--=.=====.========.=====.=--","===.=====.========.=====.===","=............--............=","=.====.=====.==.=====.====.=","=.====.=====.==.=====.====.=","=.====.==....==....==.====.=","=*====.==.========.==.====*=","=.====.==.========.==.====.=","=..........................=","============================","----------------------------","----------------------------"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=["----------------------------","----------------------------","----------------------------","============================","tttttt-==..........==-tttttt","======.==.========.==.======","======.==.========.==.======","=*...........==...........*=","=.=======.==.==.==.=======.=","=.=======.==.==.==.=======.=","=.==......==.==.==......==.=","=.==.====-==....==-====.==.=","=.==.====-========-====.==.=","=......==-========-==......=","======.==----------==.======","======.==-===hh===-==.======","=......==-===--===-==......=","=.====.==-=------=-==.====.=","=.====.---========---.====.=","=...==.==-========-==.==...=","===.==.==----------==.==.===","--=.==.====-====-====.==.=--","--=.==.====-====-====.==.=--","--=.........====.........=--","--=.=======.====.=======.=--","===.=======.====.=======.===","ttt....==...----...==....ttt","===.==.==.========.==.==.===","===.==.==.========.==.==.===","=*..==.......==.......==..*=","=.====.=====.==.=====.====.=","=.====.=====.==.=====.====.=","=..........................=","============================","----------------------------","----------------------------"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=["----------------------------","----------------------------","----------------------------","============================","=.........==....==.........=","=.=======.==.==.==.=======.=","=*=======.==.==.==.=======*=","=.==.........==.........==.=","=.==.==.====.==.====.==.==.=","=....==.====.==.====.==....=","====.==.====.==.====.==.====","====.==..............==.====","t....====-========-====....t","=.==-====-========-====-==.=","=.==--------------------==.=","=.====-==-===hh===-==-====.=","=.====-==-===--===-==-====.=","=.-----==-=------=-==-----.=","=.==-====-========-====-==.=","=.==-====-========-====-==.=","=.==--------------------==.=","=.====-=====-==-=====-====.=","=.====-=====-==-=====-====.=","=......==....==....==......=","===.==.==.========.==.==.===","===.==.==.========.==.==.===","=*..==.......--.......==..*=","=.====.=====.==.=====.====.=","=.====.=====.==.=====.====.=","=......==....==....==......=","=.====.==.========.==.====.=","=.====.==.========.==.====.=","=......==..........==......=","============================","----------------------------","----------------------------"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=["----------------------------","----------------------------","----------------------------","============================","=..........................=","=.==.====.========.====.==.=","=*==.====.========.====.==*=","=.==.====.==....==.====.==.=","=.==......==.==.==......==.=","=.====.==.==.==.==.==.====.=","=.====.==.==.==.==.==.====.=","=......==....==....==......=","===.========-==-========.===","--=.========-==-========.=--","--=....==----------==....=--","===-==.==-===hh===-==.==-===","ttt-==.==-===--===-==.==-ttt","======.---=------=---.======","======.==-========-==.======","ttt-==.==-========-==.==-ttt","===-==.==----------==.==-===","--=....=====-==-=====....=--","--=.==.=====-==-=====.==.=--","--=.==....---==---....==.=--","--=.=====.==-==-==.=====.=--","===.=====.==-==-==.=====.===","=.........==----==.........=","=.====.==.========.==.====.=","=.====.==.========.==.====.=","=.==...==..........==...==.=","=*==.=======.==.=======.==*=","=.==.=======.==.=======.==.=","=............==............=","============================","----------------------------","----------------------------"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SPRITE_SUE=e.SPRITE_INKY=e.SPRITE_BLINKY=e.SPRITE_PINKY=void 0;var i=a(n(0)),o=n(52),s=a(o),r=a(n(7));function a(t){return t&&t.__esModule?t:{default:t}}var u=e.SPRITE_PINKY="SPRITE_PINKY",l=e.SPRITE_BLINKY="SPRITE_BLINKY",h=e.SPRITE_INKY="SPRITE_INKY",f=e.SPRITE_SUE="SPRITE_SUE";e.default=function(t,e){return"pinky"===t&&(e=Object.assign({type:u,dir:"d",defaultAnimation:"down",getChaseTarget:function(){var t=this.pacmanData.tile,e=this.pacmanData.dir;return t.get(e).get(e).get(e).get(e)},animations:{...o.animations,right:new i.default({...o.animationBase,offsetY:252,offsetX:-2}),down:new i.default({...o.animationBase,offsetY:252,offsetX:126}),up:new i.default({...o.animationBase,offsetY:252,offsetX:254}),left:new i.default({...o.animationBase,offsetY:252,offsetX:382})}},e)),"blinky"===t&&(e=Object.assign({type:l,dir:"l",waitTime:0,scatterTarget:25,defaultAnimation:"left",animations:{...o.animations,right:new i.default({...o.animationBase,offsetY:124,offsetX:-2}),down:new i.default({...o.animationBase,offsetY:124,offsetX:126}),up:new i.default({...o.animationBase,offsetY:124,offsetX:254}),left:new i.default({...o.animationBase,offsetY:124,offsetX:382})}},e)),"inky"===t&&(e=Object.assign({type:h,dir:"u",waitTime:6,scatterTarget:979,defaultAnimation:"up",getChaseTarget:function(){var t=this.pacmanData.tile,e=this.blinky.getTile(),n=this.pacmanData.dir;return t=t.get(n).get(n),this.map.getTile(t.col+t.col-e.col,t.row+t.row-e.row)},animations:{...o.animations,right:new i.default({...o.animationBase,offsetY:316,offsetX:-2}),down:new i.default({...o.animationBase,offsetY:316,offsetX:126}),up:new i.default({...o.animationBase,offsetY:316,offsetX:254}),left:new i.default({...o.animationBase,offsetY:316,offsetX:382})}},e)),"sue"===t&&(e=Object.assign({type:f,dir:"u",waitTime:8,scatterTarget:953,defaultAnimation:"up",getChaseTarget:function(){var t=this.pacmanData.tile;return(0,r.default)(t,this.getTile())>16*t.w?t:this.scatterTarget},animations:{...o.animations,right:new i.default({...o.animationBase,offsetY:188,offsetX:-2}),down:new i.default({...o.animationBase,offsetY:188,offsetX:126}),up:new i.default({...o.animationBase,offsetY:188,offsetX:254}),left:new i.default({...o.animationBase,offsetY:188,offsetX:382})}},e)),new s.default(e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.animations=e.animationBase=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(0),s=c(o),r=c(n(1)),a=c(n(54)),u=c(n(55)),l=c(n(56)),h=c(n(58)),f=c(n(59));function c(t){return t&&t.__esModule?t:{default:t}}var d=e.animationBase={imageURL:"img/characters.png",numberOfFrame:2,delta:64,refreshRate:180,type:o.ANIMATION_HORIZONTAL},p={animations:e.animations={frightened:new s.default({...d,offsetY:376,offsetX:-2}),frightenedBlink:new s.default({...d,offsetY:376,offsetX:-2,numberOfFrame:4}),deadRight:new s.default({...d,offsetY:376,offsetX:254,numberOfFrame:1}),deadDown:new s.default({...d,offsetY:376,offsetX:318,numberOfFrame:1}),deadUp:new s.default({...d,offsetY:376,offsetX:382,numberOfFrame:1}),deadLeft:new s.default({...d,offsetY:376,offsetX:446,numberOfFrame:1}),score200:new s.default({...d,imageURL:"img/misc.png",numberOfFrame:1,offsetX:-2,offsetY:110}),score400:new s.default({...d,imageURL:"img/misc.png",numberOfFrame:1,offsetX:62,offsetY:110}),score800:new s.default({...d,imageURL:"img/misc.png",numberOfFrame:1,offsetX:126,offsetY:110}),score1600:new s.default({...d,imageURL:"img/misc.png",numberOfFrame:1,offsetX:192,offsetY:110})},width:64,speed:75,frightenedTime:5,waitTime:4,scatterTarget:0,mode:"house",score:"200",scores:{200:"400",400:"800",800:"1600"},blinky:null,getChaseTarget:function(){return this.pacmanData.tile},tunnelSpeed:null,frightenedSpeed:null,frightenedFlashes:null},m=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));Object.keys(p).forEach((function(e){e in t&&(n[e]=t[e])}));var i=t.addGameGlobalModeEventListener,o=t.addGameGhostEatenEventListener,s=t.addPacmanEatPillEventListener,r=t.addPacmanPositionEventListener;return n.modes={scatter:new f.default(n),chase:new a.default(n),frightened:new l.default(n),house:new h.default(n),dead:new u.default(n)},n.setMode(n.mode),n.scatterTarget=n.map.tiles[n.scatterTarget],i(n._onGameGlobalMode.bind(n)),n.on("item:tile",(function(t){n.mode===n.modes.frightened?n._speed=n.frightenedSpeed:n.mode===n.modes.dead?n._speed=130:t.isTunnel()?n._speed=n.tunnelSpeed:n._speed=n.speed,n._turnBack?(n.dir=n._getOpDirection(n.dir),n._dir=null,n._nextDir=n.mode.getNextDirection(),n._turnBack=!1):(n._dir=n._nextDir,n._nextDir=n.mode.getNextDirection()),n._eatEvent=!1})),s((function(){n.setMode("frightened"),n.score=200})),o((function(){n.score=n.scores[n.score]})),r((function(t){n.pacmanData=t})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"reset",value:function(){(function t(e,n,i){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,n,i)}if("value"in o)return o.value;var r=o.get;return void 0!==r?r.call(i):void 0})(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"reset",this).call(this),this.setMode(this.mode)}},{key:"pause",value:function(){this.mode.pause()}},{key:"resume",value:function(){this.mode.resume()}},{key:"setMode",value:function(t){if("string"==typeof t&&(t=this.modes[t]),!t){if(this.frightened)return this.mode=this.frightened,void(this.frightened=null);t=this.globalMode}var e=this.modes.house,n=this.modes.dead;t!==this.modes.frightened||this.mode!==e&&this.mode!==n?this.mode=t:this.frightened=t,"function"==typeof t.onEnter&&t.onEnter()}},{key:"isFrightened",value:function(){return this.frightened||this.mode===this.modes.frightened}},{key:"isDead",value:function(){return this.mode===this.modes.dead}},{key:"_onGameGlobalMode",value:function(t){"string"==typeof t&&(t=this.modes[t]),t&&(this.globalMode=t)}},{key:"move",value:function(){if(this.mode.move(),!this._eatEvent){var t=this.pacmanData.tile,e=this.getTile(),n=this._getOpDirection(this.dir);(t===e||this.pacmanData.dir===n&&t===e.get(n))&&(this._eatEvent=!0,this.mode===this.modes.frightened?(this.setMode("dead"),this.emit("item:eaten")):this.mode!==this.modes.dead&&this.emit("item:eat"))}}},{key:"_setNextAnimation",value:function(){this.mode.setAnimation()}},{key:"_canGo",value:function(t){return this.mode.canGo(t)}}]),e}(r.default);Object.assign(m.prototype,p),e.default=m},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(2),s=n(0);var r={width:32,height:32,x:0,y:0,z:0,offsetX:0,offsetY:0,idleCounter:0,currentFrame:0,frameIncrement:1,angle:0,factor:1,playing:!0,factorH:1,factorV:1,animations:{},defaultAnimation:"default",normalizeRefrashRate:null,type:null},a=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return Object.keys(r).forEach((function(e){e in t&&(n[e]=t[e])})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"load",value:function(){var t=this;return Promise.all(Object.keys(this.animations).map((function(e){return t.animations[e].load()})))}},{key:"isReady",value:function(){var t=this;return Object.keys(this.animations).some((function(e){return!!t.animations[e].isReady()}))}},{key:"render",value:function(){Object.assign(this.el.style,{position:"absolute",overflow:"hidden",height:this.height+"px",width:this.width+"px",zIndex:this.z}),this.setAnimation(this.animations[this.defaultAnimation]),this.transform()}},{key:"refresh",value:function(){if(this.animation){if(this.idleCounter===this.normalizeRefrashRate(this.animation.refreshRate)-1&&this.playing&&(this.animation.type&s.ANIMATION_ONCE?this.currentFrame<this.animation.numberOfFrame-1?this.currentFrame+=this.frameIncrement:this.currentFrame==this.animation.numberOfFrame-1&&this.animation.type&s.ANIMATION_CALLBACK&&"function"==typeof this.callback&&(this.callback(this),this.callback=null):(this.animation.type&s.ANIMATION_PINGPONG&&(this.currentFrame===this.animation.numberOfFrame-1&&1===this.frameIncrement?this.frameIncrement=-1:0===this.currentFrame&&-1===this.frameIncrement&&(this.frameIncrement=1)),this.currentFrame=(this.currentFrame+this.frameIncrement)%this.animation.numberOfFrame,0===this.currentFrame&&this.animation.type&s.ANIMATION_CALLBACK&&"function"==typeof this.callback&&this.callback(this)),this.animation.numberOfFrame>1)){var t=0,e=0;this.animation.type&s.ANIMATION_VERTICAL?(t=-this.animation.offsetX,e=-this.animation.offsetY-this.animation.delta*this.currentFrame):this.animation.type&s.ANIMATION_HORIZONTAL&&(t=-this.animation.offsetX-this.animation.delta*this.currentFrame,e=-this.animation.offsetY),this.el.style.backgroundPosition=t+"px "+e+"px"}this.idleCounter=(this.idleCounter+1)%this.normalizeRefrashRate(this.animation.refreshRate)}}},{key:"pauseAnimation",value:function(){this.playing=!1}},{key:"resumeAnimation",value:function(){this.playing=!0}},{key:"setAnimation",value:function(t,e,n){this.animation=t,this.currentFrame=0,this.frameIncrement=1,this.el.style.backgroundImage="url('"+t.imageURL+"')",t.type&s.ANIMATION_VERTICAL?this.el.style.backgroundRepeat="repeat-x":t.type&s.ANIMATION_HORIZONTAL?this.el.style.backgroundRepeat="repeat-y":this.el.style.backgroundRepeat="no-repeat";this.el.style.backgroundPosition=-0-t.offsetX+"px "+(-0-t.offsetY)+"px","function"==typeof n&&(this.callback=n)}},{key:"transform",value:function(){this.el.style.transform="translate("+(this.x*this.factor-this.offsetX)+"px, "+(this.y*this.factor-this.offsetY)+"px) rotate("+this.angle+"deg) scale("+this.factor*this.factorH+", "+this.factor*this.factorV+")"}},{key:"rotate",value:function(t,e){!0===e&&(t+=this.angle,t%=360),this.angle=parseFloat(t),this.transform()}},{key:"scale",value:function(t,e){!0===e&&(t*=this.factor),this.factor=parseFloat(t),this.transform()}},{key:"flipH",value:function(t){if(void 0===t)return void 0!==this.factorH&&-1===this.factorH;this.factorH=t?-1:1,this.transform()}},{key:"flipV",value:function(t){if(void 0===t)return void 0!==this.factorV&&-1===this.factorV;this.factorV=t?-1:1,this.transform()}},{key:"setXYZ",value:function(t,e){var n=this,i=!1;Object.keys(t).forEach((function(o){switch(o){case"x":e&&(t.x+=n.x),n.x=t.x,i=!0;break;case"y":e&&(t.y+=n.y),n.y=t.y,i=!0;break;case"z":e&&(t.z+=n.z),n.z=t.z,n.el.style.zIndex=n.z}})),i&&this.transform()}},{key:"setWH",value:function(t,e){var n=this;Object.keys(t).forEach((function(i){switch(i){case"w":e&&(t.w+=n.width),n.width=t.w,n.el.style.width=n.width+"px";break;case"h":e&&(t.h+=n.height),n.height=t.h,n.el.style.height=n.height+"px"}}))}}]),e}(o.View);Object.assign(a.prototype,r),e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=n(3);function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var u=function(t){function e(){return r(this,e),a(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"_getTarget",value:function(){return this.ghost.getChaseTarget()}}]),e}(((i=s)&&i.__esModule?i:{default:i}).default);e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(1));function s(t){return t&&t.__esModule?t:{default:t}}var r=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n._target=n.ghost.map.house.getR().getU(),n._endX=n.ghost._defaults.x,n._endY=n.ghost.map.houseCenter.y,n._end=n.ghost.map.getTile(n._endX,n._endY,!0),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"onEnter",value:function(){this._prepareEnter=!1,this.ghost._nextAnimation=this.ghost.animations["score"+this.ghost.score],this.ghost.update()}},{key:"move",value:function(){if(this._prepareEnter||this.ghost.getTile()!==this._target||(this._prepareEnter=!0),this.exit())this.onExit();else if(this._prepareEnter){var t=this._endX,e=this._endY;this.ghost.y<e&&(t=this._target.x-this.ghost.map.tw/2),this.ghost.x<t?this.ghost.dir="r":this.ghost.x>t?this.ghost.dir="l":this.ghost.y<e&&(this.ghost.dir="d"),"d"===this.ghost.dir&&(this.ghost.y+=this.ghost.getMin(this.ghost.getStep(),e-this.ghost.y)),"r"===this.ghost.dir&&(this.ghost.x+=this.ghost.getMin(this.ghost.getStep(),t-this.ghost.x)),"l"===this.ghost.dir&&(this.ghost.x-=this.ghost.getMin(this.ghost.getStep(),this.ghost.x-t)),this.setAnimation(),this.ghost.update()}else o.default.prototype.move.call(this.ghost,this.ghost._dir)}},{key:"setAnimation",value:function(){"u"===this.ghost.dir&&(this.ghost._nextAnimation=this.ghost.animations.deadUp),"r"===this.ghost.dir&&(this.ghost._nextAnimation=this.ghost.animations.deadRight),"d"===this.ghost.dir&&(this.ghost._nextAnimation=this.ghost.animations.deadDown),"l"===this.ghost.dir&&(this.ghost._nextAnimation=this.ghost.animations.deadLeft)}},{key:"_getTarget",value:function(){return this._target}},{key:"canGo",value:function(t,e){e||(e=this.ghost.getTile());var n=e.get(t);return!n||!n.isWall()}},{key:"exit",value:function(){return this.ghost.getTile()===this._end}},{key:"onExit",value:function(){this.ghost.reset()}}]),e}(s(n(3)).default);e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(3)),s=a(n(4)),r=a(n(57));function a(t){return t&&t.__esModule?t:{default:t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var h=function(t){function e(){return u(this,e),l(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"onEnter",value:function(){this._startTime=(0,s.default)(),this.ghost.emit("item:modefrightened:enter")}},{key:"resume",value:function(){this._startTime+=(0,s.default)()-this._pauseTime}},{key:"getNextDirection",value:function(){for(var t=this.ghost.getTile().get(this.ghost._dir),e=["u","r","d","l","u","r","d","l"],n=(0,r.default)(4),i=e[n];i&&(i===this.ghost._getOpDirection(this.ghost._dir)||!this.canGo(i,t));)i=e[++n];return i}},{key:"setAnimation",value:function(){this.ghost.frightenedTime-.2*this.ghost.frightenedTime>(0,s.default)()-this._startTime?this.ghost._nextAnimation=this.ghost.animations.frightened:this.ghost._nextAnimation=this.ghost.animations.frightenedBlink}},{key:"exit",value:function(){return!(this.ghost.frightenedTime>(0,s.default)()-this._startTime)}},{key:"onExit",value:function(){this.ghost.frightened||this.ghost.setMode(),this.ghost.emit("item:modefrightened:exit")}}]),e}(o.default);e.default=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return Math.floor(Math.random()*t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(1)),s=a(n(3)),r=a(n(4));function a(t){return t&&t.__esModule?t:{default:t}}var u=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n._houseTop=n.ghost.y-n.ghost.getTile().height/2,n._houseBottom=n.ghost.y+n.ghost.getTile().height/2,n._exitTile=n.ghost.map.house.getR(),n._exitTileX=n._exitTile.x-n.ghost.map.tileWidth/2,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"onEnter",value:function(){this._prepareExit=!1,this.ghost._speed=70}},{key:"resume",value:function(){this._prepareExit||(this._startTime+=(0,r.default)()-this._pauseTime)}},{key:"getNextDirection",value:function(){}},{key:"move",value:function(){this._startTime||(this._startTime=(0,r.default)());var t=this.ghost.getTile();!this._prepareExit&&(0,r.default)()-this._startTime>this.ghost.waitTime&&!t.isWall()&&(this._prepareExit=!0,this.ghost.y=t.y),this.exit()?this.onExit():this._prepareExit?(this.ghost.x<this._exitTileX?this.ghost.dir="r":this.ghost.x>this._exitTileX?this.ghost.dir="l":this.ghost.dir="u","u"===this.ghost.dir&&(this.ghost.y-=this.ghost.getMin(this.ghost.getStep(),this.ghost.y-this._exitTile.getU().y)),"r"===this.ghost.dir&&(this.ghost.x+=this.ghost.getMin(this.ghost.getStep(),this._exitTileX-this.ghost.x)),"l"===this.ghost.dir&&(this.ghost.x-=this.ghost.getMin(this.ghost.getStep(),this.ghost.x-this._exitTileX)),this.setAnimation(),this.ghost.update()):(this.ghost.y<=this._houseTop&&"u"===this.ghost.dir&&(this.ghost.dir="d"),this.ghost.y>=this._houseBottom&&"d"===this.ghost.dir&&(this.ghost.dir="u"),"u"===this.ghost.dir&&(this.ghost.y-=this.ghost.getMin(this.ghost.getStep(),this.ghost.y-this._houseTop)),"d"===this.ghost.dir&&(this.ghost.y+=this.ghost.getMin(this.ghost.getStep(),this._houseBottom-this.ghost.y)),this.setAnimation(),this.ghost.update())}},{key:"setAnimation",value:function(){this.ghost.frightened?this.ghost.frightened.setAnimation():o.default.prototype._setNextAnimation.call(this.ghost)}},{key:"exit",value:function(){return this.ghost.frightened&&this.ghost.frightened.exit()&&(this.ghost.frightened=null),this.ghost.getTile()===this._exitTile.getU()}},{key:"onExit",value:function(){this._startTime=null;var t=this.ghost.getTile();this.ghost._dir="l",this.ghost._nextDir="l",this.ghost._lastTile=t.getD(),this.ghost._speed=this.ghost.speed,this.ghost.setMode()}}]),e}(s.default);e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=n(3);function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var u=function(t){function e(){return r(this,e),a(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"_getTarget",value:function(){return this.ghost.scatterTarget}}]),e}(((i=s)&&i.__esModule?i:{default:i}).default);e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.animationBase=void 0;var i=s(n(0)),o=s(n(6));function s(t){return t&&t.__esModule?t:{default:t}}var r=e.animationBase={imageURL:"img/pills.png",numberOfFrame:1};e.default=function(t){return new o.default({width:8,height:8,defaultAnimation:"white",animations:{white:new i.default({...r,offsetX:24}),yellow:new i.default({...r,offsetX:56}),red:new i.default({...r,offsetX:88})},...t})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),o=r(i),s=r(n(6));function r(t){return t&&t.__esModule?t:{default:t}}var a={imageURL:"img/pills.png",numberOfFrame:2,delta:24,refreshRate:450,type:i.ANIMATION_VERTICAL};e.default=function(t){return new s.default({width:24,height:24,animations:{white:new o.default({...a}),yellow:new o.default({...a,offsetX:32}),red:new o.default({...a,offsetX:64})},...t})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.animations=e.animationBase=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(0)),s=a(n(1)),r=a(n(7));function a(t){return t&&t.__esModule?t:{default:t}}var u=e.animationBase={imageURL:"img/misc.png",offsetY:0,offsetX:0},l={animations:e.animations={default:new o.default({...u}),score100:new o.default({...u,offsetY:60}),score200:new o.default({...u,offsetX:60,offsetY:60}),score500:new o.default({...u,offsetX:120,offsetY:60}),score700:new o.default({...u,offsetX:180,offsetY:60}),score1000:new o.default({...u,offsetX:240,offsetY:60}),score2000:new o.default({...u,offsetX:300,offsetY:60}),score5000:new o.default({...u,offsetX:360,offsetY:60})},speed:40,score:"100"},h=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));Object.keys(l).forEach((function(e){e in t&&(n[e]=t[e])}));var i=t.addPacmanPositionEventListener;return n.on("item:tile",(function(t){n._dir=n._nextDir,n._nextDir=n.getNextDirection(),n._eatEvent=!1,n.getTile()===n._getTarget()&&(n._targetFound?n._targetFound--:n.emit("item:destroy"))})),i((function(t){n.pacmanData=t})),n._targetFound=2,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"move",value:function(){if(s.default.prototype.move.call(this,this._dir),!this._eatEvent){var t=this.pacmanData.tile,e=this.getTile(),n=this._getOpDirection(this._dir);(t===e||this.pacmanData.dir===n&&t===e.get(n))&&(this._eatEvent=!0,this._nextAnimation=this.animations["score"+this.score],this.update(),this.emit("item:eaten",this))}}},{key:"getNextDirection",value:function(){for(var t,e,n=this._getTarget(),i=this._dir||this.dir,o=this.getTile().get(i),s=["u","l","d","r"],a=0;a<4;a++){var u=s[a];if(u!==this._getOpDirection(i)&&this.canGo(u,o)){var l=o.get(u),h=(0,r.default)(l,n);(void 0===e||e>h)&&(t=u,e=h)}}return t}},{key:"canGo",value:function(t,e){e||(e=this.getTile());var n=e.get(t);return!!n&&(!n.isWall()&&!n.isHouse())}},{key:"_getTarget",value:function(){return this.map.tunnels[0]}},{key:"_setNextAnimation",value:function(){}}]),e}(s.default);Object.assign(h.prototype,l),e.default=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=n(12),r=(i=s)&&i.__esModule?i:{default:i};var a=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.pacmans=[],this.model=e.model;for(var n=0;n<5;n++){var i=new r.default({x:e.x+70*n,y:e.y,factor:e.factor,defaultAnimation:"right",addGameGhostEatEventListener:function(){},addGameGhostModeFrightenedEnter:function(){},addGameGhostModeFrightenedExit:function(){},normalizeRefrashRate:function(){return 1}});e.addSprite(i),this.pacmans.push(i),n>this.model.lives-2&&this.pacmans[n].hide()}this.model.on("change:lives",this.render.bind(this))}return o(t,[{key:"render",value:function(){for(var t=0;t<5;t++)t>this.model.lives-2?this.pacmans[t].hide():this.pacmans[t].show()}}]),t}();e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),s=n(11),r=(i=s)&&i.__esModule?i:{default:i};var a=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.bonuses=[],this.x=e.x,this.y=e.y,this.model=e.model;for(var n=0;n<8;n++){var i=(0,r.default)(n,{x:e.x-64*n,y:e.y,factor:e.factor,addPacmanPositionEventListener:function(){},normalizeRefrashRate:function(){return 1}});e.addSprite(i),this.bonuses.push(i),n>=this.model.level&&this.bonuses[n].hide()}this.model.on("change:level",this.render.bind(this))}return o(t,[{key:"render",value:function(){for(var t=0;t<8;t++)t>=this.model.level?this.bonuses[t].hide():this.bonuses[t].show()}}]),t}();e.default=a}]);