diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bf585fde0..f65946cbc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog -## [13.1.0] (melonJS 2) - _2022-xx-xx_ +## [13.1.1] (melonJS 2) - _2022-08-10_ + +### Fixed +- Release date and version/change tracking + +## [13.1.0] (melonJS 2) - _2022-08-10_ ### Added - Color: added a `setHSL(h, s, l)` and `setHSV(h, s, v)` method to the Color class @@ -1277,6 +1282,8 @@ - first public version with alex4 ! - www.melonjs.org is live :) +[13.1.1]: https://github.com/melonjs/melonJS/compare/13.1.1...13.1.0 +[13.1.0]: https://github.com/melonjs/melonJS/compare/13.1.0...13.0.0 [13.0.0]: https://github.com/melonjs/melonJS/compare/13.0.0...12.0.0 [12.0.0]: https://github.com/melonjs/melonJS/compare/12.0.0...11.0.0 [11.0.0]: https://github.com/melonjs/melonJS/compare/10.12.0...11.0.0 diff --git a/dist/melonjs.js b/dist/melonjs.js index c40c125770..3c76962333 100644 --- a/dist/melonjs.js +++ b/dist/melonjs.js @@ -1,5 +1,5 @@ /*! - * melonJS Game Engine - v13.1.0 + * melonJS Game Engine - v13.1.1 * http://www.melonjs.org * melonjs is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -33105,10 +33105,10 @@ * this can be overridden by the plugin * @public * @type {string} - * @default "13.1.0" + * @default "13.1.1" * @name plugin.Base#version */ - this.version = "13.1.0"; + this.version = "13.1.1"; }; /** @@ -37802,7 +37802,7 @@ * @name version * @type {string} */ - var version = "13.1.0"; + var version = "13.1.1"; /** diff --git a/dist/melonjs.min.js b/dist/melonjs.min.js index 53f0cd2268..502b6e114f 100644 --- a/dist/melonjs.min.js +++ b/dist/melonjs.min.js @@ -1,5 +1,5 @@ /*! - * melonJS Game Engine - v13.1.0 + * melonJS Game Engine - v13.1.1 * http://www.melonjs.org * melonjs is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -26,4 +26,4 @@ * * MIT License */ -function(){var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var e=this;if(!e.ctx||!e.ctx.listener)return e;for(var i=e._howls.length-1;i>=0;i--)e._howls[i].stereo(t);return e},HowlerGlobal.prototype.pos=function(t,e,i){var o=this;return o.ctx&&o.ctx.listener?(e="number"!=typeof e?o._pos[1]:e,i="number"!=typeof i?o._pos[2]:i,"number"!=typeof t?o._pos:(o._pos=[t,e,i],void 0!==o.ctx.listener.positionX?(o.ctx.listener.positionX.setTargetAtTime(o._pos[0],Howler.ctx.currentTime,.1),o.ctx.listener.positionY.setTargetAtTime(o._pos[1],Howler.ctx.currentTime,.1),o.ctx.listener.positionZ.setTargetAtTime(o._pos[2],Howler.ctx.currentTime,.1)):o.ctx.listener.setPosition(o._pos[0],o._pos[1],o._pos[2]),o)):o},HowlerGlobal.prototype.orientation=function(t,e,i,o,n,r){var s=this;if(!s.ctx||!s.ctx.listener)return s;var a=s._orientation;return e="number"!=typeof e?a[1]:e,i="number"!=typeof i?a[2]:i,o="number"!=typeof o?a[3]:o,n="number"!=typeof n?a[4]:n,r="number"!=typeof r?a[5]:r,"number"!=typeof t?a:(s._orientation=[t,e,i,o,n,r],void 0!==s.ctx.listener.forwardX?(s.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),s.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),s.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),s.ctx.listener.upX.setTargetAtTime(o,Howler.ctx.currentTime,.1),s.ctx.listener.upY.setTargetAtTime(n,Howler.ctx.currentTime,.1),s.ctx.listener.upZ.setTargetAtTime(r,Howler.ctx.currentTime,.1)):s.ctx.listener.setOrientation(t,e,i,o,n,r),s)},Howl.prototype.init=(t=Howl.prototype.init,function(e){var i=this;return i._orientation=e.orientation||[1,0,0],i._stereo=e.stereo||null,i._pos=e.pos||null,i._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},i._onstereo=e.onstereo?[{fn:e.onstereo}]:[],i._onpos=e.onpos?[{fn:e.onpos}]:[],i._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,i){var o=this;if(!o._webAudio)return o;if("loaded"!==o._state)return o._queue.push({event:"stereo",action:function(){o.stereo(t,i)}}),o;var n=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===i){if("number"!=typeof t)return o._stereo;o._stereo=t,o._pos=[t,0,0]}for(var r=o._getSoundIds(i),s=0;s3)throw new Error("melonJS: failed loading "+t);th[t].load()};function rh(){return!$a.Howler.noAudio}function sh(t,e,i,o){var n=[];if(0===oh.length)throw new Error("target audio extension(s) should be set through me.audio.init() before calling the preloader.");if(!0===vn(t.src))n.push(t.src);else for(var r=0;r0;)e[i]=arguments[i+1];var o=th[t];if(o&&void 0!==o)return o.seek.apply(o,e);throw new Error("audio clip "+t+" does not exist")},rate:function(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];var o=th[t];if(o&&void 0!==o)return o.rate.apply(o,e);throw new Error("audio clip "+t+" does not exist")},stop:function(t,e){if(void 0!==t){var i=th[t];if(!i||void 0===i)throw new Error("audio clip "+t+" does not exist");i.stop(e),i.off("end",void 0,e)}else $a.Howler.stop()},pause:function(t,e){var i=th[t];if(!i||void 0===i)throw new Error("audio clip "+t+" does not exist");i.pause(e)},resume:function(t,e){var i=th[t];if(!i||void 0===i)throw new Error("audio clip "+t+" does not exist");i.play(e)},playTrack:function(t,e){return ah(eh=t,!0,null,e)},stopTrack:function(){null!==eh&&(th[eh].stop(),eh=null)},pauseTrack:hh,resumeTrack:lh,getCurrentTrack:function(){return eh},setVolume:function(t){$a.Howler.volume(t)},getVolume:function(){return $a.Howler.volume()},mute:uh,unmute:function(t,e){uh(t,e,!1)},muteAll:ch,unmuteAll:ph,muted:function(){return $a.Howler._muted},unload:dh,unloadAll:fh}),gh=function(t){function e(e,i,o){if(void 0===e&&(e=0),void 0===i&&(i=0),t.call(this,e,i),void 0===o)throw new Error("undefined `onUpdate` callback");this.setCallback(o.onUpdate,o.scope)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={x:{configurable:!0},y:{configurable:!0}};return e.prototype.onResetEvent=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),this.setMuted(t,e),void 0!==i&&this.setCallback(i.onUpdate,i.scope),this},i.x.get=function(){return this._x},i.x.set=function(t){var e=this.onUpdate.call(this.scope,t,this._y,this._x,this._y);this._x=e&&"x"in e?e.x:t},i.y.get=function(){return this._y},i.y.set=function(t){var e=this.onUpdate.call(this.scope,this._x,t,this._x,this._y);this._y=e&&"y"in e?e.y:t},e.prototype._set=function(t,e){var i=this.onUpdate.call(this.scope,t,e,this._x,this._y);return i&&"x"in i&&"y"in i?(this._x=i.x,this._y=i.y):(this._x=t,this._y=e),this},e.prototype.setMuted=function(t,e){return this._x=t,this._y=e,this},e.prototype.setCallback=function(t,e){if(void 0===e&&(e=null),"function"!=typeof t)throw new Error("invalid `onUpdate` callback");return this.onUpdate=t,this.scope=e,this},e.prototype.add=function(t){return this._set(this._x+t.x,this._y+t.y)},e.prototype.sub=function(t){return this._set(this._x-t.x,this._y-t.y)},e.prototype.scale=function(t,e){return this._set(this._x*t,this._y*(void 0!==e?e:t))},e.prototype.scaleV=function(t){return this._set(this._x*t.x,this._y*t.y)},e.prototype.div=function(t){return this._set(this._x/t,this._y/t)},e.prototype.abs=function(){return this._set(this._x<0?-this._x:this._x,this._y<0?-this._y:this._y)},e.prototype.clamp=function(t,i){return new e(In(this.x,t,i),In(this.y,t,i),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.clampSelf=function(t,e){return this._set(In(this._x,t,e),In(this._y,t,e))},e.prototype.minV=function(t){return this._set(this._xt.x?this._x:t.x,this._y>t.y?this._y:t.y)},e.prototype.floor=function(){return new e(Math.floor(this._x),Math.floor(this._y),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.floorSelf=function(){return this._set(Math.floor(this._x),Math.floor(this._y))},e.prototype.ceil=function(){return new e(Math.ceil(this._x),Math.ceil(this._y),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.ceilSelf=function(){return this._set(Math.ceil(this._x),Math.ceil(this._y))},e.prototype.negate=function(){return new e(-this._x,-this._y,{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.negateSelf=function(){return this._set(-this._x,-this._y)},e.prototype.copy=function(t){return this._set(t.x,t.y)},e.prototype.equals=function(t){return this._x===t.x&&this._y===t.y},e.prototype.perp=function(){return this._set(this._y,-this._x)},e.prototype.rotate=function(t,e){var i=0,o=0;"object"==typeof e&&(i=e.x,o=e.y);var n=this._x-i,r=this._y-o,s=Math.cos(t),a=Math.sin(t);return this._set(n*s-r*a+i,n*a+r*s+o)},e.prototype.dot=function(t){return this._x*t.x+this._y*t.y},e.prototype.cross=function(t){return this._x*t.y-this._y*t.x},e.prototype.lerp=function(t,e){return this._set(this._x+(t.x-this._x)*e,this._y+(t.y-this._y)*e)},e.prototype.moveTowards=function(t,e){var i=Math.atan2(t.y-this._y,t.x-this._x),o=this.distance(t);return 0===o||e>=0&&o<=e*e?t:(this._x+=Math.cos(i)*e,this._y+=Math.sin(i)*e,this)},e.prototype.distance=function(t){return Math.sqrt((this._x-t.x)*(this._x-t.x)+(this._y-t.y)*(this._y-t.y))},e.prototype.clone=function(){return qn.pull("ObservableVector2d",this._x,this._y,{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.toVector2d=function(){return qn.pull("Vector2d",this._x,this._y)},e.prototype.toString=function(){return"x:"+this._x+",y:"+this._y},Object.defineProperties(e.prototype,i),e}(Kn),vh=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.onResetEvent(t,e,i)};vh.prototype.onResetEvent=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i,this},vh.prototype._set=function(t,e,i){return void 0===i&&(i=0),this.x=t,this.y=e,this.z=i,this},vh.prototype.set=function(t,e,i){if(t!==+t||e!==+e||void 0!==i&&i!==+i)throw new Error("invalid x, y, z parameters (not a number)");return this._set(t,e,i)},vh.prototype.setZero=function(){return this.set(0,0,0)},vh.prototype.setV=function(t){return this._set(t.x,t.y,t.z)},vh.prototype.add=function(t){return this._set(this.x+t.x,this.y+t.y,this.z+(t.z||0))},vh.prototype.sub=function(t){return this._set(this.x-t.x,this.y-t.y,this.z-(t.z||0))},vh.prototype.scale=function(t,e,i){return e=void 0!==e?e:t,this._set(this.x*t,this.y*e,this.z*(i||1))},vh.prototype.scaleV=function(t){return this.scale(t.x,t.y,t.z)},vh.prototype.toIso=function(){return this._set(this.x-this.y,.5*(this.x+this.y),this.z)},vh.prototype.to2d=function(){return this._set(this.y+this.x/2,this.y-this.x/2,this.z)},vh.prototype.div=function(t){return this._set(this.x/t,this.y/t,this.z/t)},vh.prototype.abs=function(){return this._set(this.x<0?-this.x:this.x,this.y<0?-this.y:this.y,this.z<0?-this.z:this.z)},vh.prototype.clamp=function(t,e){return new vh(In(this.x,t,e),In(this.y,t,e),In(this.z,t,e))},vh.prototype.clampSelf=function(t,e){return this._set(In(this.x,t,e),In(this.y,t,e),In(this.z,t,e))},vh.prototype.minV=function(t){var e=t.z||0;return this._set(this.xt.x?this.x:t.x,this.y>t.y?this.y:t.y,this.z>e?this.z:e)},vh.prototype.floor=function(){return new vh(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))},vh.prototype.floorSelf=function(){return this._set(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))},vh.prototype.ceil=function(){return new vh(Math.ceil(this.x),Math.ceil(this.y),Math.ceil(this.z))},vh.prototype.ceilSelf=function(){return this._set(Math.ceil(this.x),Math.ceil(this.y),Math.ceil(this.z))},vh.prototype.negate=function(){return new vh(-this.x,-this.y,-this.z)},vh.prototype.negateSelf=function(){return this._set(-this.x,-this.y,-this.z)},vh.prototype.copy=function(t){return this._set(t.x,t.y,t.z||0)},vh.prototype.equals=function(){var t,e,i;return arguments.length>=2?(t=arguments[0],e=arguments[1],i=arguments[2]):(t=arguments[0].x,e=arguments[0].y,i=arguments[0].z),void 0===i&&(i=this.z),this.x===t&&this.y===e&&this.z===i},vh.prototype.normalize=function(){return this.div(this.length()||1)},vh.prototype.perp=function(){return this._set(this.y,-this.x,this.z)},vh.prototype.rotate=function(t,e){var i=0,o=0;"object"==typeof e&&(i=e.x,o=e.y);var n=this.x-i,r=this.y-o,s=Math.cos(t),a=Math.sin(t);return this._set(n*s-r*a+i,n*a+r*s+o,this.z)},vh.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*(void 0!==t.z?t.z:this.z)},vh.prototype.cross=function(t){var e=this.x,i=this.y,o=this.z,n=t.x,r=t.y,s=t.z;return this.x=i*s-o*r,this.y=o*n-e*s,this.z=e*r-i*n,this},vh.prototype.length2=function(){return this.dot(this)},vh.prototype.length=function(){return Math.sqrt(this.length2())},vh.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},vh.prototype.moveTowards=function(t,e){var i=Math.atan2(t.y-this.y,t.x-this.x),o=this.x-t.x,n=this.y-t.y,r=Math.sqrt(o*o+n*n);return 0===r||e>=0&&r<=e*e?t:(this.x+=Math.cos(i)*e,this.y+=Math.sin(i)*e,this)},vh.prototype.distance=function(t){var e=this.x-t.x,i=this.y-t.y,o=this.z-(t.z||0);return Math.sqrt(e*e+i*i+o*o)},vh.prototype.angle=function(t){return Math.acos(In(this.dot(t)/(this.length()*t.length()),-1,1))},vh.prototype.project=function(t){var e=this.dot(t)/t.length2();return this.scale(e,e,e)},vh.prototype.projectN=function(t){var e=this.dot(t)/t.length2();return this.scale(e,e,e)},vh.prototype.clone=function(){return qn.pull("Vector3d",this.x,this.y,this.z)},vh.prototype.toString=function(){return"x:"+this.x+",y:"+this.y+",z:"+this.z};var mh=function(t){function e(e,i,o,n){if(void 0===e&&(e=0),void 0===i&&(i=0),void 0===o&&(o=0),t.call(this,e,i,o),void 0===n)throw new Error("undefined `onUpdate` callback");this.setCallback(n.onUpdate,n.scope)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={x:{configurable:!0},y:{configurable:!0},z:{configurable:!0}};return e.prototype.onResetEvent=function(t,e,i,o){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.setMuted(t,e,i),void 0!==o&&this.setCallback(o.onUpdate,o.scope),this},i.x.get=function(){return this._x},i.x.set=function(t){var e=this.onUpdate.call(this.scope,t,this._y,this._z,this._x,this._y,this._z);this._x=e&&"x"in e?e.x:t},i.y.get=function(){return this._y},i.y.set=function(t){var e=this.onUpdate.call(this.scope,this._x,t,this._z,this._x,this._y,this._z);this._y=e&&"y"in e?e.y:t},i.z.get=function(){return this._z},i.z.set=function(t){var e=this.onUpdate.call(this.scope,this._x,this._y,t,this._x,this._y,this._z);this._z=e&&"z"in e?e.z:t},e.prototype._set=function(t,e,i){var o=this.onUpdate.call(this.scope,t,e,i,this._x,this._y,this._z);return o&&"x"in o&&"y"in o&&"z"in o?(this._x=o.x,this._y=o.y,this._z=o.z):(this._x=t,this._y=e,this._z=i||0),this},e.prototype.setMuted=function(t,e,i){return this._x=t,this._y=e,this._z=i||0,this},e.prototype.setCallback=function(t,e){if(void 0===e&&(e=null),"function"!=typeof t)throw new Error("invalid `onUpdate` callback");return this.onUpdate=t,this.scope=e,this},e.prototype.add=function(t){return this._set(this._x+t.x,this._y+t.y,this._z+(t.z||0))},e.prototype.sub=function(t){return this._set(this._x-t.x,this._y-t.y,this._z-(t.z||0))},e.prototype.scale=function(t,e,i){return e=void 0!==e?e:t,this._set(this._x*t,this._y*e,this._z*(i||1))},e.prototype.scaleV=function(t){return this._set(this._x*t.x,this._y*t.y,this._z*(t.z||1))},e.prototype.div=function(t){return this._set(this._x/t,this._y/t,this._z/t)},e.prototype.abs=function(){return this._set(this._x<0?-this._x:this._x,this._y<0?-this._y:this._y,this._Z<0?-this._z:this._z)},e.prototype.clamp=function(t,i){return new e(In(this._x,t,i),In(this._y,t,i),In(this._z,t,i),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.clampSelf=function(t,e){return this._set(In(this._x,t,e),In(this._y,t,e),In(this._z,t,e))},e.prototype.minV=function(t){var e=t.z||0;return this._set(this._xt.x?this._x:t.x,this._y>t.y?this._y:t.y,this._z>e?this._z:e)},e.prototype.floor=function(){return new e(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.floorSelf=function(){return this._set(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))},e.prototype.ceil=function(){return new e(Math.ceil(this._x),Math.ceil(this._y),Math.ceil(this._z),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.ceilSelf=function(){return this._set(Math.ceil(this._x),Math.ceil(this._y),Math.ceil(this._z))},e.prototype.negate=function(){return new e(-this._x,-this._y,-this._z,{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.negateSelf=function(){return this._set(-this._x,-this._y,-this._z)},e.prototype.copy=function(t){return this._set(t.x,t.y,t.z||0)},e.prototype.equals=function(t){return this._x===t.x&&this._y===t.y&&this._z===(t.z||this._z)},e.prototype.perp=function(){return this._set(this._y,-this._x,this._z)},e.prototype.rotate=function(t,e){var i=0,o=0;"object"==typeof e&&(i=e.x,o=e.y);var n=this.x-i,r=this.y-o,s=Math.cos(t),a=Math.sin(t);return this._set(n*s-r*a+i,n*a+r*s+o,this.z)},e.prototype.dot=function(t){return this._x*t.x+this._y*t.y+this._z*(t.z||1)},e.prototype.cross=function(t){var e=this._x,i=this._y,o=this._z,n=t.x,r=t.y,s=t.z;return this._set(i*s-o*r,o*n-e*s,e*r-i*n)},e.prototype.lerp=function(t,e){return this._set(this._x+(t.x-this._x)*e,this._y+(t.y-this._y)*e,this._z+(t.z-this._z)*e)},e.prototype.moveTowards=function(t,e){var i=Math.atan2(t.y-this._y,t.x-this._x),o=this._x-t.x,n=this._y-t.y,r=Math.sqrt(o*o+n*n);return 0===r||e>=0&&r<=e*e?t:this._set(this._x+Math.cos(i)*e,this._y+Math.sin(i)*e,this._z)},e.prototype.distance=function(t){var e=this._x-t.x,i=this._y-t.y,o=this._z-(t.z||0);return Math.sqrt(e*e+i*i+o*o)},e.prototype.clone=function(){return qn.pull("ObservableVector3d",this._x,this._y,this._z,{onUpdate:this.onUpdate})},e.prototype.toVector3d=function(){return qn.pull("Vector3d",this._x,this._y,this._z)},e.prototype.toString=function(){return"x:"+this._x+",y:"+this._y+",z:"+this._z},Object.defineProperties(e.prototype,i),e}(vh),xh={},_h={},bh={},wh={},Th={},Ah={},Eh=function(t,e,i){e=e||t.keyCode||t.button;var o=Ah[e];if(Wr(Or,o,e,!o||!bh[o]),o){if(!bh[o]){var n=void 0!==i?i:e;wh[o][n]||(xh[o]++,wh[o][n]=!0)}return!Th[e]||"function"!=typeof t.preventDefault||t.preventDefault()}return!0},Sh=function(t,e,i){e=e||t.keyCode||t.button;var o=Ah[e];if(Wr(Ir,o,e),o){var n=void 0!==i?i:e;return wh[o][n]=void 0,xh[o]>0&&xh[o]--,bh[o]=!1,!Th[e]||"function"!=typeof t.preventDefault||t.preventDefault()}return!0},Ch=null;function Mh(){null===Ch&&!1===vs&&"function"==typeof(Ch=globalThis).addEventListener&&(Ch.addEventListener("keydown",Eh,!1),Ch.addEventListener("keyup",Sh,!1))}function Ph(t,e,i){!0===e?Eh({},t,i):Sh({},t,i)}function Oh(t){return Ah[t]}var Ih,kh=new Kn,Rh=function(t){function e(e,i,o,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===o&&(o=1),void 0===n&&(n=1),t.call(this),this.setMinMax(e,i,e+o,i+n),this.LEFT=0,this.MIDDLE=1,this.RIGHT=2,this.event=void 0,this.type=void 0,this.button=0,this.isPrimary=!1,this.pageX=0,this.pageY=0,this.clientX=0,this.clientY=0,this.movementX=0,this.movementY=0,this.deltaMode=0,this.deltaX=0,this.deltaY=0,this.deltaZ=0,this.gameX=0,this.gameY=0,this.gameScreenX=0,this.gameScreenY=0,this.gameWorldX=0,this.gameWorldY=0,this.gameLocalX=0,this.gameLocalY=0,this.pointerId=void 0,this.isNormalized=!1,this.locked=!1,this.bind=[0,0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEvent=function(t,e,i,o,n,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===n&&(n=0),void 0===r&&(r=1),this.event=t,this.pageX=e,this.pageY=i,this.clientX=o,this.clientY=n,ul(this.pageX,this.pageY,kh),this.gameScreenX=this.x=kh.x,this.gameScreenY=this.y=kh.y,this.isNormalized=void 0!==globalThis.PointerEvent&&!(t instanceof globalThis.PointerEvent),this.locked=ll,this.movementX=t.movementX||0,this.movementY=t.movementY||0,"wheel"===t.type?(this.deltaMode=t.deltaMode||0,this.deltaX=t.deltaX||0,this.deltaY=t.deltaY||0,this.deltaZ=t.deltaZ||0):(this.deltaMode=0,this.deltaX=0,this.deltaY=0,this.deltaZ=0),this.pointerId=r,this.isPrimary=void 0===t.isPrimary||t.isPrimary,this.button=t.button||0,this.type=t.type,void 0!==Jl.viewport&&Jl.viewport.localToWorld(this.gameScreenX,this.gameScreenY,kh),this.gameWorldX=kh.x,this.gameWorldY=kh.y,!1===this.isNormalized?(this.width=t.width||1,this.height=t.height||1):"number"==typeof t.radiusX?(this.width=2*t.radiusX||1,this.height=2*t.radiusY||1):this.width=this.height=1},e}(Ka),Bh=[],Dh=new Map,Lh=!1,zh=0,Fh=[],Vh=["wheel"],jh=["pointermove","mousemove","touchmove"],Uh=["pointerdown","mousedown","touchstart"],Nh=["pointerup","mouseup","touchend"],Gh=["pointercancel","mousecancel","touchcancel"],Xh=["pointerenter","mouseenter","touchenter"],Hh=["pointerover","mouseover","touchover"],Yh=["pointerleave","mouseleave","touchleave"],Wh=[Vh[0],jh[0],Uh[0],Nh[0],Gh[0],Xh[0],Hh[0],Yh[0]],qh=[Vh[0],jh[1],Uh[1],Nh[1],Gh[1],Xh[1],Hh[1],Yh[1]],Kh=[jh[2],Uh[2],Nh[2],Gh[2],Xh[2],Hh[2],Yh[2]],Zh={wheel:Vh,pointermove:jh,pointerdown:Uh,pointerup:Nh,pointercancel:Gh,pointerenter:Xh,pointerover:Hh,pointerleave:Yh},Qh=[];function Jh(){if(!Lh){Ih=new Ha(0,0,1,1);for(var t=0;t=0&&(n=t.callbacks[e][r]);r--)if(!1===n(i))return!0}return!1}function il(t){for(var e=!1;t.length>0;){var i=t.pop();if(Bh.push(i),!0===i.isNormalized&&void 0!==i.event.timeStamp){if(i.event.timeStamp0;)n.callbacks[t].pop();0===n.callbacks[t].length&&delete n.callbacks[t]}0===Object.keys(n.callbacks).length&&Dh.delete(e)}}function fl(t){if(Dh.has(t))for(var e=0;e0?i===this.GAMEPAD.BUTTONS.L2?Math.max(0,t-2e4)/111070:(t-1)/131070:(65536+t)/131070+.5}var vl=/^([0-9a-f]{1,4})-([0-9a-f]{1,4})-/i,ml=/^0+/;function xl(t,e){var i=t.replace(vl,(function(t,e,i){return"000".slice(e.length-1)+e+"-"+"000".slice(i.length-1)+i+"-"})),o=t.replace(vl,(function(t,e,i){return e.replace(ml,"")+"-"+i.replace(ml,"")+"-"}));e.analog=e.analog||e.buttons.map((function(){return-1})),e.normalize_fn=e.normalize_fn||function(t){return t},wl.set(i,e),wl.set(o,e)}var _l,bl={},wl=new Map;[["45e-28e-Xbox 360 Wired Controller",{axes:[0,1,3,4],buttons:[11,12,13,14,8,9,-1,-1,5,4,6,7,0,1,2,3,10],analog:[-1,-1,-1,-1,-1,-1,2,5,-1,-1,-1,-1,-1,-1,-1,-1,-1],normalize_fn:function(t,e,i){return i===this.GAMEPAD.BUTTONS.L2||i===this.GAMEPAD.BUTTONS.R2?(t+1)/2:t}}],["54c-268-PLAYSTATION(R)3 Controller",{axes:[0,1,2,3],buttons:[14,13,15,12,10,11,8,9,0,3,1,2,4,6,7,5,16]}],["54c-5c4-Wireless Controller",{axes:[0,1,2,3],buttons:[1,0,2,3,4,5,6,7,8,9,10,11,14,15,16,17,12,13]}],["2836-1-OUYA Game Controller",{axes:[0,3,7,9],buttons:[3,6,4,5,7,8,15,16,-1,-1,9,10,11,12,13,14,-1],analog:[-1,-1,-1,-1,-1,-1,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1],normalize_fn:gl}],["OUYA Game Controller (Vendor: 2836 Product: 0001)",{axes:[0,1,3,4],buttons:[0,3,1,2,4,5,12,13,-1,-1,6,7,8,9,10,11,-1],analog:[-1,-1,-1,-1,-1,-1,2,5,-1,-1,-1,-1,-1,-1,-1,-1,-1],normalize_fn:gl}]].forEach((function(t){xl(t[0],t[1])}));var Tl=function(){var t=navigator.getGamepads();Object.keys(bl).forEach((function(e){var i=t[e];if(i){var o=null;"standard"!==i.mapping&&(o=wl.get(i.id));var n=bl[e];Object.keys(n.buttons).forEach((function(t){var r=n.buttons[t],s=t,a=-1;if(!(o&&(s=o.buttons[t],a=o.analog[t],s<0&&a<0))){var h=i.buttons[s]||{};if(o&&a>=0){var l=o.normalize_fn(i.axes[a],-1,+t);h={value:l,pressed:h.pressed||Math.abs(l)>=yl}}Wr(Br,e,"buttons",+t,h),!r.pressed&&h.pressed?Ph(r.keyCode,!0,s+256):r.pressed&&!h.pressed&&Ph(r.keyCode,!1,s+256),r.value=h.value,r.pressed=h.pressed}})),Object.keys(n.axes).forEach((function(t){var r=n.axes[t],s=t;if(!(o&&(s=o.axes[t])<0)){var a=i.axes[s];if(void 0!==a){o&&(a=o.normalize_fn(a,+t,-1));var h=Math.sign(a)||1;if(0!==r[h].keyCode){var l=Math.abs(a)>=yl+Math.abs(r[h].threshold);Wr(Br,e,"axes",+t,a),!r[h].pressed&&l?(r[-h].pressed&&(Ph(r[-h].keyCode,!1,s+256),r[-h].value=0,r[-h].pressed=!1),Ph(r[h].keyCode,!0,s+256)):!r[h].pressed&&!r[-h].pressed||l||Ph(r[h=r[h].pressed?h:-h].keyCode,!1,s+256),r[h].value=a,r[h].pressed=l}}}}))}}))};globalThis.navigator&&"function"==typeof globalThis.navigator.getGamepads&&(globalThis.addEventListener("gamepadconnected",(function(t){Wr(kr,t.gamepad)}),!1),globalThis.addEventListener("gamepaddisconnected",(function(t){Wr(Rr,t.gamepad)}),!1));for(var Al=xl,El=!0,Sl=Object.freeze({__proto__:null,preventDefault:El,get pointerEventTarget(){return al},pointer:hl,get locked(){return ll},get throttlingInterval(){return sl},globalToLocal:ul,setTouchAction:cl,bindPointer:function(){var t=arguments.length<2?hl.LEFT:arguments[0],e=arguments.length<2?arguments[0]:arguments[1];if(Jh(),!Oh(e))throw new Error("no action defined for keycode "+e);hl.bind[t]=e},unbindPointer:function(t){hl.bind[void 0===t?hl.LEFT:t]=null},registerPointerEvent:pl,releasePointerEvent:dl,releaseAllPointerEvents:fl,requestPointerLock:function(){return!!Is&&(jc().requestPointerLock(),!0)},exitPointerLock:function(){return!!Is&&(document.exitPointerLock(),!0)},get keyBoardEventTarget(){return Ch},KEY:{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:42,INSERT:45,DELETE:46,NUM0:48,NUM1:49,NUM2:50,NUM3:51,NUM4:52,NUM5:53,NUM6:54,NUM7:55,NUM8:56,NUM9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,WINDOW_KEY:91,NUMPAD0:96,NUMPAD1:97,NUMPAD2:98,NUMPAD3:99,NUMPAD4:100,NUMPAD5:101,NUMPAD6:102,NUMPAD7:103,NUMPAD8:104,NUMPAD9:105,MULTIPLY:106,ADD:107,SUBSTRACT:109,DECIMAL:110,DIVIDE:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,TILDE:126,NUM_LOCK:144,SCROLL_LOCK:145,SEMICOLON:186,PLUS:187,COMMA:188,MINUS:189,PERIOD:190,FORWAND_SLASH:191,GRAVE_ACCENT:192,OPEN_BRACKET:219,BACK_SLASH:220,CLOSE_BRACKET:221,SINGLE_QUOTE:222},initKeyboardEvent:Mh,isKeyPressed:function(t){return!(!xh[t]||bh[t])&&(_h[t]&&(bh[t]=!0),!0)},keyStatus:function(t){return xh[t]>0},triggerKeyEvent:Ph,bindKey:function(t,e,i,o){void 0===o&&(o=El),Ah[t]=e,Th[t]=o,xh[e]=0,_h[e]=i||!1,bh[e]=!1,wh[e]={}},getBindingKey:Oh,unlockKey:function(t){bh[t]=!1},unbindKey:function(t){var e=Ah[t];xh[e]=0,_h[e]=!1,wh[e]={},Ah[t]=null,Th[t]=null},GAMEPAD:{AXES:{LX:0,LY:1,RX:2,RY:3,EXTRA_1:4,EXTRA_2:5,EXTRA_3:6,EXTRA_4:7},BUTTONS:{FACE_1:0,FACE_2:1,FACE_3:2,FACE_4:3,L1:4,R1:5,L2:6,R2:7,SELECT:8,BACK:8,START:9,FORWARD:9,L3:10,R3:11,UP:12,DOWN:13,LEFT:14,RIGHT:15,HOME:16,EXTRA_1:17,EXTRA_2:18,EXTRA_3:19,EXTRA_4:20}},bindGamepad:function(t,e,i){if(!Oh(i))throw new Error("no action defined for keycode "+i);void 0===_l&&"function"==typeof navigator.getGamepads&&(_l=qr(wr,Tl)),bl[t]||(bl[t]={axes:{},buttons:{}});var o={keyCode:i,value:0,pressed:!1,threshold:e.threshold},n=bl[t][e.type];if("buttons"===e.type)n[e.code]=o;else if("axes"===e.type){var r=Math.sign(e.threshold)||1;n[e.code]||(n[e.code]={});var s=n[e.code];s[r]=o,s[-r]||(s[-r]={keyCode:0,value:0,pressed:!1,threshold:-r})}},unbindGamepad:function(t,e){if(!bl[t])throw new Error("no bindings for gamepad "+t);bl[t].buttons[e]={}},setGamepadDeadzone:function(t){yl=t},setGamepadMapping:Al}),Cl=function(t){function e(e,i,o,n){t.call(this,e,i,o,n),this.isRenderable=!0,this.isKinematic=!0,this.body=void 0,void 0===this.currentTransform&&(this.currentTransform=qn.pull("Matrix2d")),this.currentTransform.identity(),this.GUID=void 0,this.onVisibilityChange=void 0,this.alwaysUpdate=!1,this.updateWhenPaused=!1,this.isPersistent=!1,this.floating=!1,this.anchorPoint instanceof gh?this.anchorPoint.setMuted(.5,.5).setCallback(this.onAnchorUpdate,this):this.anchorPoint=qn.pull("ObservableVector2d",.5,.5,{onUpdate:this.onAnchorUpdate,scope:this}),this.autoTransform=!0,this.alpha=1,this.ancestor=void 0,this.mask=void 0,this.tint=qn.pull("Color",255,255,255,1),this.blendMode="normal",this.name="",this.pos instanceof mh?this.pos.setMuted(e,i,0).setCallback(this.updateBoundsPos,this):this.pos=qn.pull("ObservableVector3d",e,i,0,{onUpdate:this.updateBoundsPos,scope:this}),this.isDirty=!1,this._flip={x:!1,y:!1},this._inViewport=!1,this.setOpacity(1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isFloating:{configurable:!0},inViewport:{configurable:!0},isFlippedX:{configurable:!0},isFlippedY:{configurable:!0}};return i.isFloating.get=function(){return!0===this.floating||void 0!==this.ancestor&&!0===this.ancestor.floating},i.inViewport.get=function(){return this._inViewport},i.inViewport.set=function(t){this._inViewport!==t&&(this._inViewport=t,"function"==typeof this.onVisibilityChange&&this.onVisibilityChange.call(this,t))},i.isFlippedX.get=function(){return!0===this._flip.x},i.isFlippedY.get=function(){return!0===this._flip.y},e.prototype.getBounds=function(){return void 0===this._bounds&&(t.prototype.getBounds.call(this),this.isFinite()?this._bounds.setMinMax(this.pos.x,this.pos.y,this.pos.x+this.width,this.pos.y+this.height):this._bounds.setMinMax(this.pos.x,this.pos.y,this.width,this.height)),this._bounds},e.prototype.getOpacity=function(){return this.alpha},e.prototype.setOpacity=function(t){"number"==typeof t&&(this.alpha=In(t,0,1),isNaN(this.alpha)&&(this.alpha=1),this.isDirty=!0)},e.prototype.flipX=function(t){return void 0===t&&(t=!0),this._flip.x=!!t,this.isDirty=!0,this},e.prototype.flipY=function(t){return void 0===t&&(t=!0),this._flip.y=!!t,this.isDirty=!0,this},e.prototype.transform=function(t){return this.currentTransform.multiply(t),this.updateBoundsPos(this.pos.x,this.pos.y),this.isDirty=!0,this},e.prototype.angleTo=function(t){var i,o,n=this.getBounds();if(t instanceof e){var r=t.getBounds();i=r.centerX-n.centerX,o=r.centerY-n.centerY}else i=t.x-n.centerX,o=t.y-n.centerY;return Math.atan2(o,i)},e.prototype.distanceTo=function(t){var i,o,n=this.getBounds();if(t instanceof e){var r=t.getBounds();i=n.centerX-r.centerX,o=n.centerY-r.centerY}else i=n.centerX-t.x,o=n.centerY-t.y;return Math.sqrt(i*i+o*o)},e.prototype.lookAt=function(t){var i;i=t instanceof e?t.pos:t;var o=this.angleTo(i);return this.rotate(o),this},e.prototype.rotate=function(t,e){return isNaN(t)||(this.currentTransform.rotate(t,e),this.isDirty=!0),this},e.prototype.scale=function(e,i){return this.currentTransform.scale(e,i),t.prototype.scale.call(this,e,i),this.isDirty=!0,this},e.prototype.scaleV=function(t){return this.scale(t.x,t.y),this},e.prototype.update=function(t){return this.isDirty},e.prototype.updateBounds=function(){return t.prototype.updateBounds.call(this),this.updateBoundsPos(this.pos.x,this.pos.y),this.getBounds()},e.prototype.updateBoundsPos=function(t,e){var i=this.getBounds();i.shift(t,e),void 0!==this.anchorPoint&&i.isFinite()&&i.translate(-this.anchorPoint.x*i.width,-this.anchorPoint.y*i.height),this.ancestor instanceof Hl&&!0!==this.floating&&i.translate(this.ancestor.getAbsolutePosition()),this.isDirty=!0},e.prototype.getAbsolutePosition=function(){return void 0===this._absPos&&(this._absPos=qn.pull("Vector2d")),this._absPos.set(this.pos.x,this.pos.y),this.ancestor instanceof Hl&&!0!==this.floating&&this._absPos.add(this.ancestor.getAbsolutePosition()),this._absPos},e.prototype.onAnchorUpdate=function(t,e){this.anchorPoint.setMuted(t,e),this.updateBoundsPos(this.pos.x,this.pos.y)},e.prototype.preDraw=function(t){var e=this.getBounds(),i=e.width*this.anchorPoint.x,o=e.height*this.anchorPoint.y;if(t.save(),t.setGlobalAlpha(t.globalAlpha()*this.getOpacity()),this._flip.x||this._flip.y){var n=this._flip.x?this.centerX-i:0,r=this._flip.y?this.centerY-o:0;t.translate(n,r),t.scale(this._flip.x?-1:1,this._flip.y?-1:1),t.translate(-n,-r)}void 0!==this.mask&&(t.translate(this.pos.x,this.pos.y),t.setMask(this.mask),t.translate(-this.pos.x,-this.pos.y)),!0!==this.autoTransform||this.currentTransform.isIdentity()||(t.translate(this.pos.x,this.pos.y),t.transform(this.currentTransform),t.translate(-this.pos.x,-this.pos.y)),t.translate(-i,-o),t.setTint(this.tint,this.getOpacity()),this.blendMode!==t.getBlendMode()&&t.setBlendMode(this.blendMode)},e.prototype.draw=function(t,e){},e.prototype.postDraw=function(t){t.clearTint(),void 0!==this.mask&&t.clearMask(),t.restore(),this.isDirty=!1},e.prototype.onCollision=function(t,e){return!1},e.prototype.destroy=function(){qn.push(this.currentTransform),this.currentTransform=void 0,qn.push(this.anchorPoint),this.anchorPoint=void 0,qn.push(this.pos),this.pos=void 0,void 0!==this._absPos&&(qn.push(this._absPos),this._absPos=void 0),qn.push(this._bounds),this._bounds=void 0,this.onVisibilityChange=void 0,void 0!==this.mask&&(qn.push(this.mask),this.mask=void 0),void 0!==this.tint&&(qn.push(this.tint),this.tint=void 0),this.ancestor=void 0,void 0!==this.body&&(this.body.destroy.apply(this.body,arguments),this.body=void 0),fl(this),this.onDestroyEvent.apply(this,arguments)},e.prototype.onDestroyEvent=function(){},Object.defineProperties(e.prototype,i),e}(Ha),Ml=[],Pl=0;Pl<10;Pl++)Ml.push(new Kn);for(var Ol=[],Il=0;Il<5;Il++)Ol.push([]);function kl(t,e,i){for(var o=Number.MAX_VALUE,n=-Number.MAX_VALUE,r=t.length,s=0;sn&&(n=a)}i[0]=o,i[1]=n}function Rl(t,e,i,o,n,r){var s=Ol.pop(),a=Ol.pop(),h=Ml.pop().copy(e).sub(t),l=h.dot(n);if(kl(i,n,s),kl(o,n,a),a[0]+=l,a[1]+=l,s[0]>a[1]||a[0]>s[1])return Ml.push(h),Ol.push(s),Ol.push(a),!0;if(r){var u=0;if(s[0]a[1])u=s[0]-a[1],r.aInB=!1;else{var d=s[1]-a[0],f=a[1]-s[0];u=di?1:0}function Dl(t,e,i,o,n){for(var r=Ml.pop().copy(i.pos).add(i.ancestor.getAbsolutePosition()).add(o.pos).sub(t.pos).add(t.ancestor.getAbsolutePosition()).sub(e.pos),s=o.radius,a=s*s,h=e.points,l=e.edges,u=l.length,c=Ml.pop(),p=Ml.pop(),d=Ml.pop(),f=0,y=0;ya&&(n.aInB=!1);var _=Bl(c,d),b=!0;if(-1===_){var w=null;if(u>1&&(c.copy(l[v]),1!==(_=Bl(c,w=Ml.pop().copy(r).sub(h[v])))&&(b=!1)),b){if((f=d.length())>s)return Ml.push(r),Ml.push(c),Ml.push(p),Ml.push(d),w&&Ml.push(w),!1;n&&(n.bInA=!1,x=d.normalize(),m=s-f)}w&&Ml.push(w)}else if(1===_){if(u>1&&(c.copy(l[g]),d.copy(r).sub(h[g]),-1!==(_=Bl(c,d))&&(b=!1)),b){if((f=d.length())>s)return Ml.push(r),Ml.push(c),Ml.push(p),Ml.push(d),!1;n&&(n.bInA=!1,x=d.normalize(),m=s-f)}}else{p.copy(e.normals[y]),f=d.dot(p);var T=Math.abs(f);if((1===u||f>0)&&T>s)return Ml.push(r),Ml.push(c),Ml.push(p),Ml.push(d),!1;n&&(x=p,m=s-f,(f>=0||m<2*s)&&(n.bInA=!1))}x&&n&&Math.abs(m)l)return Ml.push(r),!1;if(n){var c=Math.sqrt(u);n.a=t,n.b=i,n.overlap=h-c,n.overlapN.copy(r.normalize()),n.overlapV.copy(r).scale(n.overlap),n.aInB=s<=a&&c<=a-s,n.bInA=a<=s&&c<=s-a}return Ml.push(r),!0},testPolygonEllipse:Dl,testEllipsePolygon:function(t,e,i,o,n){var r=Dl(i,o,t,e,n);if(r&&n){var s=n.a,a=n.aInB;n.overlapN.negateSelf(),n.overlapV.negateSelf(),n.a=n.b,n.b=s,n.aInB=n.bInA,n.bInA=a}return r}}),zl=function(){this.a=null,this.b=null,this.overlapN=new Kn,this.overlapV=new Kn,this.aInB=!0,this.bInA=!0,this.indexShapeA=-1,this.indexShapeB=-1,this.overlap=Number.MAX_VALUE};zl.prototype.clear=function(){return this.aInB=!0,this.bInA=!0,this.overlap=Number.MAX_VALUE,this.indexShapeA=-1,this.indexShapeB=-1,this};var Fl={pos:new Kn(0,0),ancestor:{_absPos:new Kn(0,0),getAbsolutePosition:function(){return this._absPos}}},Vl=new zl;function jl(t,e){return!0!==t.isKinematic&&!0!==e.isKinematic&&"object"==typeof t.body&&"object"==typeof e.body&&!(!0===t.body.isStatic&&!0===e.body.isStatic)&&0!=(t.body.collisionMask&e.body.collisionType)&&0!=(t.body.collisionType&e.body.collisionMask)}var Ul={maxChildren:8,maxDepth:4,types:{NO_OBJECT:0,PLAYER_OBJECT:1,NPC_OBJECT:2,ENEMY_OBJECT:4,COLLECTABLE_OBJECT:8,ACTION_OBJECT:16,PROJECTILE_OBJECT:32,WORLD_SHAPE:64,USER:128,ALL_OBJECT:4294967295},rayCast:function(t,e){return function(t,e){void 0===e&&(e=[]);for(var i,o=0,n=Jl.world.broadphase.retrieve(t),r=n.length;i=n[--r];)if(i.body&&t.getBounds().overlaps(i.getBounds())){var s=i.body.shapes.length;if(0===i.body.shapes.length)continue;var a=t,h=0;do{var l=i.body.getShape(h);Ll["test"+a.shapeType+l.shapeType].call(this,Fl,a,i,l)&&(e[o]=i,o++),h++}while(h0&&(this.vel.x*=-this.bounce)),0!==e.y&&(this.vel.y=~~(.5+this.vel.y-e.y)||0,this.bounce>0&&(this.vel.y*=-this.bounce),!this.ignoreGravity)){var i=!0===this.falling?1:!0===this.jumping?-1:0;this.falling=e.y>=i,this.jumping=e.y<=-i}},Nl.prototype.forEach=function(t,e){var i=this,o=0,n=this.shapes,r=n.length;if("function"!=typeof t)throw new Error(t+" is not a function");for(arguments.length>1&&(i=e);o0){var i=this.friction.x*e,o=this.vel.x+i,n=this.vel.x-i;this.vel.x=o<0?o:n>0?n:0}if(this.friction.y>0){var r=this.friction.y*e,s=this.vel.y+r,a=this.vel.y-r;this.vel.y=s<0?s:a>0?a:0}return 0!==this.vel.y&&(this.vel.y=In(this.vel.y,-this.maxVel.y,this.maxVel.y)),0!==this.vel.x&&(this.vel.x=In(this.vel.x,-this.maxVel.x,this.maxVel.x)),this.falling=this.vel.y*Math.sign(this.force.y)>0,this.jumping=!this.falling&&this.jumping,this.ancestor.pos.add(this.vel),0!==this.vel.x||0!==this.vel.y},Nl.prototype.destroy=function(){qn.push(this.bounds),qn.push(this.vel),qn.push(this.force),qn.push(this.friction),qn.push(this.maxVel),this.shapes.forEach((function(t){qn.push(t,!1)})),this.onBodyUpdate=void 0,this.ancestor=void 0,this.bounds=void 0,this.vel=void 0,this.force=void 0,this.friction=void 0,this.maxVel=void 0,this.shapes.length=0,this.setStatic(!1)};var Gl=function(t,e){this.removeChildNow(t,e)},Xl=0,Hl=function(t){function e(e,i,o,n,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===o&&(o=Jl.viewport.width),void 0===n&&(n=Jl.viewport.height),void 0===r&&(r=!1),t.call(this,e,i,o,n),this.pendingSort=null,this.root=r,this.children=void 0,this.sortOn=Jl.sortOn,this.autoSort=!0,this.autoDepth=!0,this.clipping=!1,this.onChildChange=function(t){},this.enableChildBoundsUpdate=!1,this.backgroundColor=qn.pull("Color",0,0,0,0),this.drawCount=0,this.autoTransform=!0,this.isKinematic=!1,this.anchorPoint.set(0,0),!0===this.root&&qr(jr,this.updateBounds.bind(this,!0))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.reset=function(){this.pendingSort&&(clearTimeout(this.pendingSort),this.pendingSort=null);for(var t,e=this.getChildren(),i=e.length;i>=0;t=e[--i])t&&!0!==t.isPersistent&&this.removeChildNow(t);void 0!==this.currentTransform&&this.currentTransform.identity(),this.backgroundColor.setColor(0,0,0,0)},e.prototype.addChild=function(t,i){return t.ancestor instanceof e?t.ancestor.removeChildNow(t):t.isRenderable&&(t.GUID=Hc.createGUID(t.id)),t.ancestor=this,this.getChildren().push(t),void 0!==t.pos&&("number"==typeof i?t.pos.z=i:!0===this.autoDepth&&(t.pos.z=this.getChildren().length)),!0===this.autoSort&&this.sort(),"function"==typeof t.onActivateEvent&&this.isAttachedToRoot()&&t.onActivateEvent(),!0===this.isAttachedToRoot()&&Jl.repaint(),this.enableChildBoundsUpdate&&this.updateBounds(!0),t.body instanceof Nl&&Jl.world.addBody(t.body),this.onChildChange.call(this,this.getChildren().length-1),t},e.prototype.addChildAt=function(t,i){if(i>=0&&i1&&(i=e);o=0&&t=0&&e0?e[0]:null},e.prototype.getChildren=function(){return void 0===this.children&&(this.children=[]),this.children},e.prototype.updateBounds=function(e){void 0===e&&(e=!1),t.prototype.updateBounds.call(this);var i=this.getBounds();return!0!==e&&!0!==this.enableChildBoundsUpdate||this.forEach((function(t){t.isRenderable&&(t.getBounds().isFinite()&&i.addBounds(t.getBounds()))})),i},e.prototype.isAttachedToRoot=function(){if(!0===this.root)return!0;for(var t=this.ancestor;t;){if(!0===t.root)return!0;t=t.ancestor}return!1},e.prototype.updateBoundsPos=function(e,i){var o=this;return t.prototype.updateBoundsPos.call(this,e,i),this.forEach((function(t){t.isRenderable&&t.updateBoundsPos(t.pos.x+e-o.pos.x,t.pos.y+i-o.pos.y)})),this.getBounds()},e.prototype.onActivateEvent=function(){this.forEach((function(t){"function"==typeof t.onActivateEvent&&t.onActivateEvent()}))},e.prototype.removeChild=function(t,e){if(!this.hasChild(t))throw new Error("Child is not mine.");Hc.function.defer(Gl,this,t,e)},e.prototype.removeChildNow=function(t,e){if(this.hasChild(t)&&this.getChildIndex(t)>=0){"function"==typeof t.onDeactivateEvent&&t.onDeactivateEvent(),t.body instanceof Nl&&Jl.world.removeBody(t.body),e||!1===qn.push(t,!1)&&"function"==typeof t.destroy&&t.destroy();var i=this.getChildIndex(t);i>=0&&(this.getChildren().splice(i,1),t.ancestor=void 0),!0===this.isAttachedToRoot()&&Jl.repaint(),this.enableChildBoundsUpdate&&this.updateBounds(!0),this.onChildChange.call(this,i)}},e.prototype.setChildsProperty=function(t,i,o){this.forEach((function(n){!0===o&&n instanceof e&&n.setChildsProperty(t,i,o),n[t]=i}))},e.prototype.moveUp=function(t){var e=this.getChildIndex(t);e-1>=0&&(this.swapChildren(t,this.getChildAt(e-1)),this.isDirty=!0)},e.prototype.moveDown=function(t){var e=this.getChildIndex(t);e>=0&&e+10){var i=this.getChildren();i.splice(0,0,i.splice(e,1)[0]),t.pos.z=i[1].pos.z+1,this.isDirty=!0}},e.prototype.moveToBottom=function(t){var e=this.getChildIndex(t),i=this.getChildren();e>=0&&e0||i.floating)&&Xl++,i.inViewport=!1,_u.current().cameras.forEach((function(t){t.isVisible(i,o)&&(i.inViewport=!0)})),this.isDirty|=(i.inViewport||i.alwaysUpdate)&&i.update(e),Xl>0&&Xl--):this.isDirty|=i.update(e));return t.prototype.update.call(this,e)},e.prototype.draw=function(t,e){var i=!1,o=this.getBounds();this.drawCount=0,!1===this.root&&!0===this.clipping&&!0===o.isFinite()&&t.clipRect(o.left,o.top,o.width,o.height),t.translate(this.pos.x,this.pos.y),this.backgroundColor.alpha>1/255&&t.clearColor(this.backgroundColor);for(var n,r=this.getChildren(),s=r.length;n=r[--s];)n.isRenderable&&(i=!0===n.floating,(n.inViewport||i)&&(i&&(t.save(),t.resetTransform()),n.preDraw(t),n.draw(t,e),n.postDraw(t),i&&t.restore(),this.drawCount++))},e}(Cl),Yl=[];function Wl(t,e,i,o,n){if(void 0===i&&(i=4),void 0===o&&(o=4),void 0===n&&(n=0),Yl.length>0){var r=Yl.pop();return r.world=t,r.bounds=e,r.max_objects=i,r.max_levels=o,r.level=n,r}return new Kl(t,e,i,o,n)}var ql=new Kn,Kl=function(t,e,i,o,n){void 0===i&&(i=4),void 0===o&&(o=4),void 0===n&&(n=0),this.world=t,this.bounds=e,this.max_objects=i,this.max_levels=o,this.level=n,this.bounds=e,this.objects=[],this.nodes=[]};Kl.prototype.split=function(){this.level;var t=this.bounds.width/2,e=this.bounds.height/2,i=this.bounds.left,o=this.bounds.top;this.nodes[0]=Wl(this.world,this.bounds,{left:i+t,top:o,width:t,height:e},this.max_objects,this.max_levels),this.nodes[1]=Wl(this.world,this.bounds,{left:i,top:o,width:t,height:e},this.max_objects,this.max_levels),this.nodes[2]=Wl(this.world,this.bounds,{left:i,top:o+e,width:t,height:e},this.max_objects,this.max_levels),this.nodes[3]=Wl(this.world,this.bounds,{left:i+t,top:o+e,width:t,height:e},this.max_objects,this.max_levels)},Kl.prototype.getIndex=function(t){var e,i=t.getBounds(),o=-1,n=(e=!0===t.isFloating?this.world.app.viewport.localToWorld(i.left,i.top,ql):ql.set(t.left,t.top)).x,r=e.y,s=i.width,a=i.height,h=this.bounds.left+this.bounds.width/2,l=this.bounds.top+this.bounds.height/2,u=rl;return nh&&(u?o=0:c&&(o=3)),o},Kl.prototype.insertContainer=function(t){for(var e,i=t.children.length;i--,e=t.children[i];)!0!==e.isKinematic&&(e instanceof Hl?("rootContainer"!==e.name&&this.insert(e),this.insertContainer(e)):"function"==typeof e.getBounds&&this.insert(e))},Kl.prototype.insert=function(t){var e=-1;if(this.nodes.length>0&&-1!==(e=this.getIndex(t)))this.nodes[e].insert(t);else if(this.objects.push(t),this.objects.length>this.max_objects&&this.level0){var o=this.getIndex(t);if(-1!==o)i=i.concat(this.nodes[o].retrieve(t));else for(var n=0;n0){var i=this.getIndex(t);-1!==i&&(e=zn(this.nodes[i],t))&&this.nodes[i].isPrunable()&&this.nodes.splice(i,1)}return!1===e&&-1!==this.objects.indexOf(t)&&(zn(this.objects,t),e=!0),e},Kl.prototype.isPrunable=function(){return!(this.hasChildren()||this.objects.length>0)},Kl.prototype.hasChildren=function(){for(var t=0;t0||e.objects.length>0)return!0}return!1},Kl.prototype.clear=function(t){this.objects.length=0;for(var e=0;ethis.world.fps},Ql.prototype.getParentContainer=function(t){return t.ancestor},Ql.prototype.repaint=function(){this.isDirty=!0},Ql.prototype.update=function(t,e){if(++this.frameCounter%this.frameRate==0){for(this.frameCounter=0,Wr(wr,t),this.accumulator+=qc.getDelta(),this.accumulator=Math.min(this.accumulator,this.accumulatorMax),this.updateDelta=qc.interpolation?qc.getDelta():this.stepSize,this.accumulatorUpdateDelta=qc.interpolation?this.updateDelta:Math.max(this.updateDelta,this.updateAverageDelta);this.accumulator>=this.accumulatorUpdateDelta||qc.interpolation;)if(this.lastUpdateStart=globalThis.performance.now(),!0!==_u.isPaused()&&Wr(Ar,t),this.isDirty=e.update(this.updateDelta)||this.isDirty,this.lastUpdate=globalThis.performance.now(),this.updateAverageDelta=this.lastUpdate-this.lastUpdateStart,this.accumulator-=this.accumulatorUpdateDelta,qc.interpolation){this.accumulator=0;break}Wr(Tr,this.lastUpdate)}},Ql.prototype.draw=function(t){!0===Fc.isContextValid&&(this.isDirty||this.isAlwaysDirty)&&(Wr(Er,globalThis.performance.now()),Fc.clear(),t.draw(Fc),this.isDirty=!1,Fc.flush(),Wr(Sr,globalThis.performance.now()))};var Jl=new Ql;qr(dr,(function(){Jl.init()}));var $l,tu=Math.min,eu=Math.max,iu=new Kn,ou=function(t){function e(e,i,o,n){t.call(this,e,i,o-e,n-i),this.AXIS={NONE:0,HORIZONTAL:1,VERTICAL:2,BOTH:3},this.bounds=qn.pull("Bounds"),this.smoothFollow=!0,this.damping=1,this.near=-1e3,this.far=1e3,this.projectionMatrix=new sr,this.invCurrentTransform=new hr,this.offset=new Kn,this.target=null,this.follow_axis=this.AXIS.NONE,this._shake={intensity:0,duration:0,axis:this.AXIS.BOTH,onComplete:null},this._fadeOut={color:null,tween:null},this._fadeIn={color:null,tween:null},this.name="default",this.setDeadzone(this.width/6,this.height/6),this.anchorPoint.set(0,0),this.isKinematic=!1,this.bounds.setMinMax(e,i,o,n),this._updateProjectionMatrix(),qr(br,this.reset,this),qr(jr,this.resize,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._updateProjectionMatrix=function(){this.projectionMatrix.ortho(0,this.width,this.height,0,this.near,this.far)},e.prototype._followH=function(t){var e=this.pos.x;return t.x-this.pos.x>this.deadzone.right?e=tu(t.x-this.deadzone.right,this.bounds.width-this.width):t.x-this.pos.xthis.deadzone.bottom?e=tu(t.y-this.deadzone.bottom,this.bounds.height-this.height):t.y-this.pos.y0&&(this._shake.duration-=e,this._shake.duration<=0?(this._shake.duration=0,this.offset.setZero(),"function"==typeof this._shake.onComplete&&this._shake.onComplete()):(this._shake.axis!==this.AXIS.BOTH&&this._shake.axis!==this.AXIS.HORIZONTAL||(this.offset.x=(Math.random()-.5)*this._shake.intensity),this._shake.axis!==this.AXIS.BOTH&&this._shake.axis!==this.AXIS.VERTICAL||(this.offset.y=(Math.random()-.5)*this._shake.intensity)),this.isDirty=!0),!0===this.isDirty&&Wr(Xr,this.pos),null==this._fadeIn.tween&&null==this._fadeOut.tween||(this.isDirty=!0),this.currentTransform.isIdentity()?this.invCurrentTransform.identity():this.invCurrentTransform.copy(this.currentTransform).invert(),t.prototype.update.call(this,e)},e.prototype.shake=function(t,e,i,o,n){0!==this._shake.duration&&!0!==n||(this._shake.intensity=t,this._shake.duration=e,this._shake.axis=i||this.AXIS.BOTH,this._shake.onComplete="function"==typeof o?o:void 0)},e.prototype.fadeOut=function(t,e,i){void 0===e&&(e=1e3),this._fadeOut.color=qn.pull("Color").copy(t),this._fadeOut.tween=qn.pull("Tween",this._fadeOut.color).to({alpha:0},e).onComplete(i||null),this._fadeOut.tween.isPersistent=!0,this._fadeOut.tween.start()},e.prototype.fadeIn=function(t,e,i){void 0===e&&(e=1e3),this._fadeIn.color=qn.pull("Color").copy(t);var o=this._fadeIn.color.alpha;this._fadeIn.color.alpha=0,this._fadeIn.tween=qn.pull("Tween",this._fadeIn.color).to({alpha:o},e).onComplete(i||null),this._fadeIn.tween.isPersistent=!0,this._fadeIn.tween.start()},e.prototype.focusOn=function(t){var e=t.getBounds();this.moveTo(t.pos.x+e.left+e.width/2,t.pos.y+e.top+e.height/2)},e.prototype.isVisible=function(t,e){return void 0===e&&(e=t.floating),!0===e||!0===t.floating?Fc.overlaps(t.getBounds()):t.getBounds().overlaps(this)},e.prototype.localToWorld=function(t,e,i){return(i=i||qn.pull("Vector2d")).set(t,e).add(this.pos).sub(Jl.world.pos),this.currentTransform.isIdentity()||this.invCurrentTransform.apply(i),i},e.prototype.worldToLocal=function(t,e,i){return(i=i||qn.pull("Vector2d")).set(t,e),this.currentTransform.isIdentity()||this.currentTransform.apply(i),i.sub(this.pos).add(Jl.world.pos)},e.prototype.drawFX=function(t){this._fadeIn.tween&&(t.save(),t.resetTransform(),t.setColor(this._fadeIn.color),t.fillRect(0,0,this.width,this.height),t.restore(),1===this._fadeIn.color.alpha&&(this._fadeIn.tween=null,qn.push(this._fadeIn.color),this._fadeIn.color=null)),this._fadeOut.tween&&(t.save(),t.resetTransform(),t.setColor(this._fadeOut.color),t.fillRect(0,0,this.width,this.height),t.restore(),0===this._fadeOut.color.alpha&&(this._fadeOut.tween=null,qn.push(this._fadeOut.color),this._fadeOut.color=null))},e.prototype.draw=function(t,e){var i=this.pos.x+this.offset.x,o=this.pos.y+this.offset.y;e.currentTransform.translate(-i,-o),t.setProjection(this.projectionMatrix),t.clipRect(0,0,this.width,this.height),this.preDraw(t),e.preDraw(t,this),e.draw(t,this),this.drawFX(t),e.postDraw(t,this),this.postDraw(t),e.currentTransform.translate(i,o)},e}(Cl),nu={cameras:[]},ru=function(t){this.cameras=new Map,this.lights=new Map,this.ambientLight=new nr(0,0,0,0),this.settings=Object.assign(nu,t||{})};ru.prototype.reset=function(){var t=this;if(this.settings.cameras.forEach((function(e){t.cameras.set(e.name,e)})),!1===this.cameras.has("default")){if(void 0===$l){var e=Fc.getWidth(),i=Fc.getHeight();$l=new ou(0,0,e,i)}this.cameras.set("default",$l)}Jl.reset(),this.onResetEvent.apply(this,arguments)},ru.prototype.update=function(t){var e=Jl.world.update(t);return this.cameras.forEach((function(i){!0===i.update(t)&&(e=!0)})),this.lights.forEach((function(i){!0===i.update(t)&&(e=!0)})),e},ru.prototype.draw=function(t){var e=this;this.cameras.forEach((function(i){i.draw(t,Jl.world),0!==e.ambientLight.alpha&&(t.save(),e.lights.forEach((function(e){t.setMask(e.getVisibleArea(),!0)})),t.setColor(e.ambientLight),t.fillRect(0,0,i.width,i.height),t.clearMask(),t.restore()),e.lights.forEach((function(e){e.preDraw(t,Jl.world),e.draw(t,Jl.world),e.postDraw(t,Jl.world)}))}))},ru.prototype.destroy=function(){this.cameras.clear(),this.lights.forEach((function(t){t.destroy()})),this.lights.clear(),this.onDestroyEvent.apply(this,arguments)},ru.prototype.onResetEvent=function(){"function"==typeof this.settings.onResetEvent&&this.settings.onResetEvent.apply(this,arguments)},ru.prototype.onDestroyEvent=function(){"function"==typeof this.settings.onDestroyEvent&&this.settings.onDestroyEvent.apply(this,arguments)};var su=function(t){function e(e,i,o,n){t.call(this,e,i,o,n),this.barHeight=n,this.anchorPoint.set(0,0),qr(Pr,this.onProgressUpdate,this),qr(Ur,this.resize,this),this.anchorPoint.set(0,0),this.progress=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onProgressUpdate=function(t){this.progress=~~(t*this.width),this.isDirty=!0},e.prototype.draw=function(t,e){t.setColor("black"),t.fillRect(this.pos.x,e.centerY,t.getWidth(),this.barHeight/2),t.setColor("#55aa00"),t.fillRect(this.pos.x,e.centerY,this.progress,this.barHeight/2)},e.prototype.onDestroyEvent=function(){Zr(Pr,this.onProgressUpdate),Zr(Ur,this.resize)},e}(Cl),au=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onResetEvent=function(){Jl.world.backgroundColor.parseCSS("#202020"),Jl.world.addChild(new su(0,Fc.getHeight()/2,Fc.getWidth(),8),1),uc.load({name:"melonjs_logo",type:"image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAAA8FBMVEUgICBrqDHRZVtqpzEhJCAjKCBurTIfHyDQZFptrDEWAB8OAB7VZ1wtIiIAEhYlISDYaF4SAB4pIiEAFhkcFh8eGyBopDAMAB5noS8kKyAAGhtjmy4bEB9lni8ZBR/HYFdPeim/XFQ9XCUaCh9flS1VhCtSfyorOSEVHh4HHB1EZyatVExhmC5ajCxHbSc0SyMuQCInMiFKcSgxRSI6VSRBYiWdTUZdki09JyZ8PzpYiSs3UCRlNjK1WE9ckC1MdShbjywyJCONRkDKYliUSUNeMzBDKShXMC2kUEl1PDeEQj1OLStnNjNxOjZsODQAAAcMh1CFAAAU4UlEQVR42uyaa3fSMBjHk5EQkgClkBZKoXblNhlswIooc2N6pp7jUb//x/FpRbnt4JWwzv7eraQvfs/zby7tUEpKSkpKSkpKSkpKSkpKSkqKTsg30P8E+FIArJllqQaglMXQt6tPuhogGSlaLWFKKU2hEB33eqPRqDemRAlhRhdbVjwIBj8xogajhpBSkNH1dOJ37mYDt1mr2UCt1mwOZned7qQfjhxPVs0WovTpRIFFNkpIU42CSWfm2phnIzjHP+DLS9hutjuL4IqZUigC9yU/CWDBhBROOJkPbBxL4swKjDf/jEvBbXe4CMeiKixKEx0EAq03JbqeDJs4Ul9a7mE5AqqAazM/pJCb5JaAUmWa42nHBflYDf8y8WC4qznv9yRKZAUIRUKO+/Maz/J1+d8ugu0rK3kVoNSTVhDZr8v/WRGyQw8lC0KJMK989+/sVzXILiRNzmrACGXSC4Z2lsf2f08GN2lyHgJCLUn6bRw1/2dim+A9hIKiJMAQ6NOJu7f5a7r8B+u/7N7BAzMZBaBIkkkz0t83sfMsgDHsgN1BOybaFNvww2qblMgEUGKqi2aU/X3u2HZnHf8iuL4aO0S1PKDVQM54dBn0F50718bfq5CwOYBQIaaDVfd37MG91u5MwhER8WHQU8qC2wCEmFJefEYUrBdedGe15b4xQasAtaqXt/wh/W87W1679YNeCxQbjNCItTchBFheRErAmHEYb575ch/Qeuz9ByXpdHH2QX2wx4NuMBbSbJCfn3IJWZ4dndBvZ6Bytt949A8AbZjT6OHftQeDTHtx2VgebhFj6KfAmGisJaS46k+mj/4sELW/N+QP6UOIXf/Sqwq0p/F7okA8KU312BcAqmTf3k1/1Hx7HlgyskfsL96h7b3XMNCRcYQzz+KH9N3FSC57fxiYUTDOWLmAjgcjpBo2d9oPKxdv95Fs0UPGl5XPinWDVYqGwdBxYFQJH/Mdfc5nQUuyw77KYYXKm/ub09PzV/Xn5SNVAOJ/B/Hf0W8HwiQUHRTwf/2slM/nS6WbN/XjZIDK6534w8zv9r1In6GDUq6/y+VzMaVTdGYg7cDj38/wHX17YknQPzSGUb8p5U5icqX7ovaZkBFk+nw7/hx3epIdvPtAufIpf7Ikl39W0B0BRpToQPy32j8IZUPPW+xC8S0E4Afv6noLwGgL3WZ32u8roetbTqF4v1aA/JdKGWmEUc8ZgP/m0j+4riKKNFEoflwrQO6D1gQwKnrulj/mXUto048XgZV+/vQMaYQ5otfc8s/Wpprav5oFz5cRgHXwo85VgFHw55nN+Ld7UvMnPOP5y2elXMRJ6VzDA7DPH2e7XstBemHl+vubfAk4efGc6SsAo9542x9fVJH+D/lQgfrnF+fn9++KWv0bdHP+z3A7rFKC9MMMo1KsVIr1ssYHgFiqvemfdUemg45EuVAuFMpIH4SI4ZZ/2xEOQ8eCAUgjVHa3/G+txuN/Z/+vYE51suU/9NT/5G8GIL3uPxfsCfwf11fyrW1FgRiGTkna0vZpYHQUXRHdVZBhvCMorP7/V+3oyprgPiy2Dxk2HzA06TknpyHz19CjVfcpf9kj+6SBtqgcMPz/q/vPdPgwLP/DsCM1f2vTf7Ifap5/hYXQ/FGnX7S16LdABADc23oqVP91kYfgrU5b1GxKHSCo7tILzR/z9eJ8nliv0zqAMZ8ATEJfaP6+7jlj3CDlXpHVfsfnH+eyn4kMzMdGQRNO7fNkGEXbGTigBkDq1lZzU07BnaXzIab6LCMAuEEmdWcD8+ax9uNTckxFqyWxwKBgKXZrzerHtAbcPhFQ0R8oAExdChXADIt1Tz0KkGi9TjML1CBLqgA0YZGIFZhZqVNUtf9GCdBbF0IF4Be/vvQYz6pyxhRwH+QC4CpXoAgELvE6iKMtfwJLzv+5YU2iDasOR0MJMBdMgFsMK6ICrppGY+rELGAdhFpAYoXYgRdBRzsLUtB3L/z+7zpITFvHYhQAdorGyQudAdCuNe8qoJjVNgYAF0M+9iFbAe9tK2w4BKIIdVJ0CLASv7jeBFo7cBwCrxcgP1IAjEv5ALipwII1gmGGMR4A2uEB+blJK4x4E1kdZhQA5xYowPe58z3lwKfH199WbQRAc/LpuwPWu17k0qaFCnANAgHSvKJcZdMCxJtgOsQuKsexG2uCwMxa8O8aUa/axHZCe/OUZA42ag0Avqi5ll2nYSAaRQEbZI+NrbKwEFFYJURCiEcpqEE0aZOmBfH/f4PLQ+OEttwxLKg3jq5Or3TG9jyOJ/FjgSIGZvBRLhB1oFvi7/3X5CIDhZHodOLtfyyEXUlh0IGzyDoQM+rbGljFRNaE2ZOXj0MT3pALxGQo8v1z1ILRBb6+hTJoZgLvBoMYRjZAeALuv/v/hZCzeTxWRIu/iwEvbqQMmKcxUekwHqF/KQSo74OCVX8rCyQoC9C/QYBZENZTcYMlRkqjWFlVZfn9OWGXwcoDVFKewD+fo33v9AwQD3HGFqH5XsXHACWVA7BObfp+YyoL4BKpLvb+MuvBlVn1q03iwIONVNFy1jPUBvGyPOaGJT4GGOPAHd9v66bIuy7Pi3p5GKoTrYSdeRXaQrk7LD02P2Gbejv2FqrYdugFxgHM5ChBEFNpIn/czxaObdMJrcXP4Z94sdxZUGZmAZmA+7ws0im4a9oenFQsKg58uE8NhBgE43+LlBysa65FmvJweIppMzobsmJKWve+EFrMsUJ3+wEqGaUKPA9XkSYNhj0xUd8xYkbBsU516lnMhv+LFs1nKCX7BZYVjIUQZ8FC830PRjG6LnSqBzCSPcloP0U9IaLZhknntlynSGhOS+yV/bWuEla1EPwSONXdAc0VKYv4ZcyoWQBGEDp/2zdI/zyrYgfyR6CAL7nm18BC18pJFnlLhuUMsScgvs9CwjrXyOgCq/Q9yIQpBa0Q/DqW6+JoJSNX9AGNT4S2uezhx8B9kBvu2AZGjpQubwLRglHKLnX6Z7DodmgBQjDHkji7O3+MoFFZgITx+pLiMdiChL1G7DUL8DWQLBDPw3dGh5Yjn38YT+TuMrhuvy71HbGiGyzRAg8DVYQQzO49evYg7ArLiP7v82/7n3OcZ8u6F36+IzjfVCqivwkTetqNCHpP2nvdfS74PJTr7zH+NM9pTflPwTMbcN1YkgEwFcL7EXIddf85LQ1SrtZ8FsO6uh13w7Abt02nZ7tjbiuR1+2Xn2COYPxaCCM3+KCqQz86fnpDSgOkPQg+i/dtb8E6P/zUt8Vln+/pF4fVD7D103Gbz8B8cIbULeJlHXqLM2ZQZDHEuGMnpsF+m0Alpfk+pKmAtZdCJNf5wUGJYAervRB8eggotSH2SlAy2myBchi14VbCxKlzka+BScWCqofBUASYCbsVKAQzD65g7CbmEl9OCTQtocEm74ysiPsq6imhilLVxANyUfR2o9i0SN7YstH8DP+9db+DYcD/iFsgqnXWd02SXAc9CrLpx124yFd2w35HlQ4tEPCHxPwO9haY7oG1NbQbMnLPYPbw2YNIMYAlxeTIDlP+WP0axAUhTrGzefUXEeK+kXetvU3DUDQtqdxKSQwJG1romIbQSLWhfuChFRioG92rsP//c3AiwbErxfKxBMoFf/am5cyPc+899/hDkTOJHZ4IKMQQrC6irDZTh+YVa9VHlsbuyK6uEe7tINCdK9hVutGkUgL/S0pox5cEchPX2X9qrXVfuIQIoAcsDN2sj+yb5XuVU8JZlgkpZ+PMzMbhvG0AwKqfteh6O3VZbqL8J4tNhggAluxxBgaNEIK7A/BNWvkWC7DCV/X+3qsMU0+LkqiS75NyMUhD+LqqrjdT51TPlQeAVTZ11nXpW1nm1sDOWhA1blBBcGEincwV1crqwV7Vq6r0U8ZxiCEevONwtzaaKnGS6X3lCGRHSwaAuyzU4Uyr5tjaLv4wL6+cm3BbxwFw9pSujJsfowBY2UfAutHeyRftZGwXb4RxY2+XDQHAgQGAlblMHI382xeRABwnSicBpyDYjS/HADYILhiYFAMA6k8DUDgANCQAfue0bPy3AeC3QD48AGK2gHLOgJFwAKhDENfgvwkArkGGCH0SDcAuEeKp8MhQYcEAtFT4EU2Fn9nB0HvJAExQHEMwRIfDogFgw2GI7eGXIhkANyESlxITvQLc/2UwAO+cLILgW4BMikIg46TF01QwAGxaHOwBuoI9uQBwhRGMPbs09nouFwCo3fAlLG6GCooFAMVRrGVaXTUz5XGxAHjK44xAQioArUBiZgskYiUyUrcAKhygdDEiqT2xPACZDS6qSe2+y04hIROAFM5aSO6F2qe5pmxDAMBJivJCydFhqsiOK9SHhQLQNb/ahTHFycsglh7EFogB4IQUSyORsqT841Aay8aBxR7VqYlQHPfK33SysAUVwY/qzF/ZO5kRfKLljAkidJMfZaEPgJXVD+ubNnUZqL0yS0upwKAOWidW7ZY++UhSIRQxp79KmAvth8sIha5Q8VZJ0B6YdquFaZlBTjyl7UMQEQcXyG8fZ93TN+MHCJv75l4bzWQ3+RhlRI8A2UzGozpEdpvjgSDRYALh7TY6qS+PWpHvBcT9nmdizk+nmQHsNq+xAHoRuLkYt21k32qlQ/01D0es0gVUCIcAZUimdbG+u7z/XOP7PQgsiu395WpbNKUKaEKqNmbyeZFoNiEKOscrDHkf1bxpmz91GdZY2HWHhjWHlt3kRc6bS/I2IoijIkyadZ7nJTNZU5PpByHAAmhXvkgfGqXUACY77fOc5h2SeXRciTNQ2Gkef56oOAsNtF1KQwCRIN/9CxqFZII8E5WXFpdFiZeW2oNHyRrIhSAfGrMHUCUfrKN8yAI+oYyUkFK2HaVFW2khtR/rPzDal+UkZGjwzOMAwRSJkReScwyi5QGdEvxI2wqZSEdNeGryRNYl018dT9X/zlIzndt0eHR4MNSnVXyPgoAGR3tKYidJ8dOa4PRCTTD2eRl7CUyEmAqirIHqbuxveuOcAjIuApwAHjNFKqmC5lsZIdH8zGuuzp8mYJQCTgGo/FARix7KMSQzYzn8vAAU8gFGcPQS+DJ8AH4rndH8PqQ3S35yd2U7isNAMFHasWw/WcopQhRBIBICQsggJCIx/P9XrTMcDWbZY5YQs36Yh4EZXNXl7vJB3Hkjd7fCkCfc3/ZGbgh4zp5xwYbuBdBWGr00pF2OrT0E6p/sIH6V1uRHTANeDv1NE/j4rB1mFYMHgTYJsJtnrGORL1W9w107NA4/u+gqjL+cFXprU2+cbSvA828GxFKImwRmLpDiji6WwCdvsuDjOU1MA7iI+WzXBj4MmfFpQKuAeC7wOdss6n8afe8qjaUaqNdRWoeEPt1g4wPGpFkMUJKuIruDAaA/ahsToVmXr4NnYanq4GI4eq4waLKJZxADYF12MvFIEO3EZKPLTMxxhADo1ztK0zgtxIND3JhieKnTeKEEhacT4F9OHOB+qRkMXHZwcCOzgwxFv76IfKszMxgg4bqNDDa26cSs01hsmKMtDlj9X8La4sfAdHkvHn6vHhngtGcGAJT+EX+3RxnwDDV+GPf7rIYUQGQa/tyj3RFA063GwN4f98cAJT6f3HaIDaukO1FS8GCuMTCveGz10yhJvIWGP+rWolKSFkMtEw7LvuaGMa/yW/y208iO8GMxXEXslnRnE8LrUyEFIpqhht8edb5aRWNeawzYLJMvnxhQsMKZw16KHw2RzoC7iF+dCOJ0PGX2a/Hj0sNFA5gIPl4zDFD+KzX8dfzhoyh0zwCzP/nrREA8MQu0HtjOSHTeAcwDxcDVPt/d1iGQVygQiKx2rq1FIPh4BX7MA/G5AOEwCNZKBN3PjuJEbCLX0cZgVL90kY6SxFcW5E4EZegTq9N+ECssdszWyZ8X/DX4UYc+n+oydFx7SgR0Z4sogEzWgc684x6s9PV1GMS6DbsmguGMc9IRBUC4HM3d+w+d9jIlAxKOIi0R2A5z85HkHWRDCiQV5YIxR8PP7KWAfiblsSxyV++P6tDhQz5dBS38emLfhV9ZkKa/Q8xknKAdu04Fiw/OLfKssFCLAJf1xEH4PZpQ3ZBvMCdddcvejxLhE3hO8KnkzQ7hX8t/LfvdnwAiiz327IoCli9jwUFxQP8l9kBgLKzNvhX/Pc/zpo+JqD4M+NpBEVzlAjeaNqkYA4Hv00s8wetswJDj6/BPfQNOKlCAsN7+rIPtSMjXKy4SIH8rBGoBEPCkqGYHx8XMfx3+wUdombE9RzhfBg8ocIPDUnHAfULgr0JP1R8Vs13kovZvEq2TqfCbsC1xMkXFzsY46RxsPxuQioRWCQC/RA5AFPhUCL9cL6JW+j+Dz1rXTfuXPzaSiNEcY3XHgT3YLRvCheSeBQR5oKpdIQfLS6WQUM4mA8e9Qa/7TWPCf/FpfLwcIgU6B0zBGe6zWVklMlQ8jD2/BX0mg3pjLkUo07jcZIsWPEP0OvwgA9l78r9vBAT5jB5QcESjYDlRvpsuN01dES/lnEupfqQeVKtmtMx2+dBhJ/APmHSdaWGW+rERPyymAVKgtRMq5rYIg2g4z/P9YbFY7PN8PoyC4wuI/QH8yUokxDIu/Ofk7YVFFmllSyfhjJCxFvIXaqa99Ah+MKnF2KzBf0dBElbrAdNk8IAKbL9/txJIlK1EajT8Yzb0hTXb2pjC/7k5X55qvqzCxHT458mL4M10iDL4bsMSEuxGifDeAv5RBcBFPDsEWMq/H3vmOttlIbhFzKt8v5SBL/hquW85QBL+Xvmuk3+W/H2CfyuDccvBIrKxsP859jb0LNqvy1RweK/gYwMCiZDVKMsDdlLCr2m4vEWBD+bTTcFFCu8XfI0Dr53XjbL9yeRh/dNgo0+yo+10s1LcJW+O/ryo05IQ8ricZYt5pGg4Wr6bxo6/taP5YTprKh624AmYavn+urVgfC6F9KpSef7JYTtQ7jcInLYFyhcP8sMkW27KwudCcA/I+4f+Tgnn+a5CKCT3SVWs6ros63q1qgg9/do7vY3+L6H/0a4dqgAAg1AULYPBsjax+P//uA3TwuJAxj3RJiYf7xJ5rBVVLNzHcA8T7fkZl6iePpchSDvs8b9XBwAAAAAAqGQCc31B4/xqSwwAAAAASUVORK5CYII="},(function(){Jl.world.addChild(new cc(Fc.getWidth()/2,Fc.getHeight()/2,{image:"melonjs_logo",framewidth:256,frameheight:256}),2)}))},e.prototype.onDestroyEvent=function(){uc.unload({name:"melonjs_logo",type:"image"})},e}(ru),hu=-1,lu=-1,uu=!1,cu={},pu={color:"",duration:0},du=null,fu=null,yu=0;function gu(){-1===lu&&-1!==hu&&(lu=globalThis.requestAnimationFrame(vu))}function vu(t){var e=cu[hu].stage;Jl.update(t,e),Jl.draw(e),-1!==lu&&(lu=globalThis.requestAnimationFrame(vu))}function mu(){globalThis.cancelAnimationFrame(lu),lu=-1}function xu(t){mu(),cu[hu]&&cu[hu].stage.destroy(),cu[t]&&(cu[hu=t].stage.reset.apply(cu[hu].stage,fu),gu(),Wr(mr),du&&du(),Jl.repaint())}qr(dr,(function(){_u.set(_u.LOADING,new au),_u.set(_u.DEFAULT,new ru),qr(xr,(function(){_u.change(_u.DEFAULT,!0)})),"function"==typeof globalThis.addEventListener&&(globalThis.addEventListener("blur",(function(){_u.pause(!0)}),!1),globalThis.addEventListener("focus",(function(){_u.resume(!0),aa()}),!1)),void 0!==globalThis.document&&"function"==typeof globalThis.document.addEventListener&&globalThis.document.addEventListener("visibilitychange",(function(){"visible"===globalThis.document.visibilityState?_u.resume(!0):_u.pause(!0)}),!1)}));var _u={LOADING:0,MENU:1,READY:2,PLAY:3,GAMEOVER:4,GAME_END:5,SCORE:6,CREDITS:7,SETTINGS:8,DEFAULT:9,USER:100,stop:function(t){void 0===t&&(t=!1),hu!==this.LOADING&&this.isRunning()&&(mu(),!0===t&&t(),yu=globalThis.performance.now(),Wr(gr))},pause:function(t){void 0===t&&(t=!1),hu===this.LOADING||this.isPaused()||(uu=!0,!0===t&&hh(),yu=globalThis.performance.now(),Wr(fr))},restart:function(t){void 0===t&&(t=!1),this.isRunning()||(gu(),!0===t&&lh(),yu=globalThis.performance.now()-yu,Jl.repaint(),Wr(vr,yu))},resume:function(t){void 0===t&&(t=!1),this.isPaused()&&(uu&&-1!==hu&&(uu=!1),!0===t&&lh(),yu=globalThis.performance.now()-yu,Wr(yr,yu))},isRunning:function(){return-1!==lu},isPaused:function(){return uu},set:function(t,e,i){if(void 0===i&&(i=!1),!(e instanceof ru))throw new Error(e+" is not an instance of me.Stage");cu[t]={},cu[t].stage=e,cu[t].transition=!0,!0===i&&this.change(t)},get:function(t){return void 0===t&&(t=hu),void 0!==cu[t]?cu[t].stage:void 0},current:function(){return this.get()},transition:function(t,e,i){"fade"===t&&(pu.color=e,pu.duration=i)},setTransition:function(t,e){cu[t].transition=e},change:function(t,e){if(void 0===cu[t])throw new Error("Undefined Stage for state '"+t+"'");this.isCurrent(t)||(fu=null,arguments.length>1&&(fu=Array.prototype.slice.call(arguments,1)),pu.duration&&cu[t].transition?(du=function(){Jl.viewport.fadeOut(pu.color,pu.duration)},Jl.viewport.fadeIn(pu.color,pu.duration,(function(){Xn(xu,this,t)}))):!0===e?xu(t):Xn(xu,this,t))},isCurrent:function(t){return hu===t}};function bu(t,e,i){var o;if("string"!=typeof i)return i;switch(e){case"int":case"float":i=Number(i);break;case"bool":i="true"===i;break;default:if(!i||yn(i))i=!i||"true"===i;else if(fn(i))i=Number(i);else if(0===i.search(/^json:/i)){o=i.split(/^json:/i)[1];try{i=JSON.parse(o)}catch(t){throw new Error("Unable to parse JSON: "+o)}}else if(0===i.search(/^eval:/i)){o=i.split(/^eval:/i)[1];try{i=Function("'use strict';return ("+o+")")()}catch(t){throw new Error("Unable to evaluate: "+o)}}else((o=i.match(/^#([\da-fA-F])([\da-fA-F]{3})$/))||(o=i.match(/^#([\da-fA-F]{2})([\da-fA-F]{6})$/)))&&(i="#"+o[2]+o[1]);0===t.search(/^(ratio|anchorPoint)$/)&&"number"==typeof i&&(i={x:i,y:i})}return i}function wu(t,e,i){switch(i=i||"none",e=e||"none"){case"csv":return function(t){for(var e=t.replace("\n","").trim().split(","),i=[],o=0;o=0;--o)s[i]+=r.charCodeAt(i*e+o)<<(o<<3);return s}(t,4);return"none"===i?o:function(){throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!")}();case"none":return t;case"xml":throw new Error("XML encoding is deprecated, use base64 instead");default:throw new Error("Unknown layer encoding: "+e)}}function Tu(t,e){var i=e.nodeName;switch(i){case"data":var o=Au(e);o.text=o.text||o.chunk.text,o.encoding=o.encoding||"xml",t.data=wu(o.text,o.encoding,o.compression),t.encoding="none";break;case"imagelayer":case"layer":case"objectgroup":case"group":var n=Au(e);n.type="layer"===i?"tilelayer":i,n.image&&(n.image=n.image.source),t.layers=t.layers||[],t.layers.push(n);break;case"animation":t.animation=Au(e).frames;break;case"frame":case"object":var r=i+"s";t[r]=t[r]||[],t[r].push(Au(e));break;case"tile":var s=Au(e);s.image&&(s.imagewidth=s.image.width,s.imageheight=s.image.height,s.image=s.image.source),t.tiles=t.tiles||{},t.tiles[s.id]=s;break;case"tileset":var a=Au(e);a.image&&(a.imagewidth=a.image.width,a.imageheight=a.image.height,a.image=a.image.source),t.tilesets=t.tilesets||[],t.tilesets.push(a);break;case"polygon":case"polyline":t[i]=[];for(var h,l=Au(e).points.split(" "),u=0;u0)for(var i=0;i0&&(this.maskLevel=0,this.getContext().restore())},e}(Ja);function Pu(t,e){var i=0;!function(t){t.layerData=new Array(t.cols);for(var e=0;e0,this.isAnimated&&(this.preRender=!1),this.getBounds().addBounds(this.getRenderer().getBounds(),!0),this.getBounds().shift(this.pos),!0!==this.preRender||this.canvasRenderer||(this.canvasRenderer=new Mu({canvas:Vc(this.width,this.height),widht:this.width,heigth:this.height,transparent:!0}),function(t,e){for(var i=0;i=0&&o=0&&nthis.cols?this.cols:s.x,s.y=s.y>this.rows?this.rows:s.y,e.renderorder){case"right-up":s.y=r.y+(r.y=s.y)-s.y,n=-1;break;case"left-down":s.x=r.x+(r.x=s.x)-s.x,o=-1;break;case"left-up":s.x=r.x+(r.x=s.x)-s.x,s.y=r.y+(r.y=s.y)-s.y,o=-1,n=-1}for(var a=r.y;a!==s.y;a+=n)for(var h=r.x;h!==s.x;h+=o){var l=e.cellAt(h,a,!1);l&&this.drawTile(t,h,a,l)}qn.push(r),qn.push(s)},e}(Iu),Ru=function(t){function e(e){t.call(this,e.cols,e.rows,e.tilewidth,e.tileheight),this.hTilewidth=this.tilewidth/2,this.hTileheight=this.tileheight/2,this.originX=this.rows*this.hTilewidth}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.canRender=function(e){return"isometric"===e.orientation&&t.prototype.canRender.call(this,e)},e.prototype.getBounds=function(t){var e=t instanceof Ou?qn.pull("Bounds"):this.bounds;return e.setMinMax(0,0,(this.cols+this.rows)*(this.tilewidth/2),(this.cols+this.rows)*(this.tileheight/2)),e},e.prototype.pixelToTileCoords=function(t,e,i){return(i||new Kn).set(e/this.tileheight+(t-this.originX)/this.tilewidth,e/this.tileheight-(t-this.originX)/this.tilewidth)},e.prototype.tileToPixelCoords=function(t,e,i){return(i||new Kn).set((t-e)*this.hTilewidth+this.originX,(t+e)*this.hTileheight)},e.prototype.adjustPosition=function(t){var e=t.x/this.hTilewidth,i=t.y/this.tileheight,o=qn.pull("Vector2d");this.tileToPixelCoords(e,i,o),t.x=o.x,t.y=o.y,qn.push(o)},e.prototype.drawTile=function(t,e,i,o){var n=o.tileset;n.drawTile(t,(this.cols-1)*n.tilewidth+(e-i)*n.tilewidth>>1,-n.tilewidth+(e+i)*n.tileheight>>2,o)},e.prototype.drawTileLayer=function(t,e,i){var o=e.tileset,n=this.pixelToTileCoords(i.pos.x-o.tilewidth,i.pos.y-o.tileheight,qn.pull("Vector2d")).floorSelf(),r=this.pixelToTileCoords(i.pos.x+i.width+o.tilewidth,i.pos.y+i.height+o.tileheight,qn.pull("Vector2d")).ceilSelf(),s=this.tileToPixelCoords(r.x,r.y,qn.pull("Vector2d")),a=this.tileToPixelCoords(n.x,n.y,qn.pull("Vector2d"));a.x-=this.hTilewidth,a.y+=this.tileheight;var h=a.y-i.pos.y>this.hTileheight,l=i.pos.x-a.x1&&(e.height+=this.rowheight)):(e.setMinMax(0,0,this.cols*(this.tilewidth+this.sidelengthx),this.rows*this.rowheight+this.sideoffsety),e.height>1&&(e.width+=this.columnwidth)),e},e.prototype.doStaggerX=function(t){return this.staggerX&&1&t^this.staggerEven},e.prototype.doStaggerY=function(t){return!this.staggerX&&1&t^this.staggerEven},e.prototype.topLeft=function(t,e,i){var o=i||new Kn;return this.staggerX?1&t^this.staggerEven?o.set(t-1,e):o.set(t-1,e-1):1&e^this.staggerEven?o.set(t,e-1):o.set(t-1,e-1),o},e.prototype.topRight=function(t,e,i){var o=i||new Kn;return this.staggerX?1&t^this.staggerEven?o.set(t+1,e):o.set(t+1,e-1):1&e^this.staggerEven?o.set(t+1,e-1):o.set(t,e-1),o},e.prototype.bottomLeft=function(t,e,i){var o=i||new Kn;return this.staggerX?1&t^this.staggerEven?o.set(t-1,e+1):o.set(t-1,e):1&e^this.staggerEven?o.set(t,e+1):o.set(t-1,e+1),o},e.prototype.bottomRight=function(t,e,i){var o=i||new Kn;return this.staggerX?1&t^this.staggerEven?o.set(t+1,e+1):o.set(t+1,e):1&e^this.staggerEven?o.set(t+1,e+1):o.set(t,e+1),o},e.prototype.pixelToTileCoords=function(t,e,i){var o=i||new Kn;this.staggerX?t-=this.staggerEven?this.tilewidth:this.sideoffsetx:e-=this.staggerEven?this.tileheight:this.sideoffsety;var n,r,s,a,h=qn.pull("Vector2d",Math.floor(t/(2*this.columnwidth)),Math.floor(e/(2*this.rowheight))),l=qn.pull("Vector2d",t-h.x*(2*this.columnwidth),e-h.y*(2*this.rowheight));this.staggerX?(h.x=2*h.x,this.staggerEven&&++h.x):(h.y=2*h.y,this.staggerEven&&++h.y),this.staggerX?(s=(n=this.sidelengthx/2)+this.columnwidth,a=this.tileheight/2,this.centers[0].set(n,a),this.centers[1].set(s,a-this.rowheight),this.centers[2].set(s,a+this.rowheight),this.centers[3].set(s+this.columnwidth,a)):(r=this.sidelengthy/2,s=this.tilewidth/2,a=r+this.rowheight,this.centers[0].set(s,r),this.centers[1].set(s-this.columnwidth,a),this.centers[2].set(s+this.columnwidth,a),this.centers[3].set(s,a+this.rowheight));for(var u=0,c=Number.MAX_VALUE,p=0;p<4;++p){var d=this.centers[p].sub(l).length2();da.y&&(s=this.topLeft(s.x,s.y,s)),-this.sideoffsety+h>a.y&&(s=this.topRight(s.x,s.y,s)),this.sideoffsety+h0;var h=t.tileoffset;h&&(this.tileoffset.x=+h.x,this.tileoffset.y=+h.y);var l=t.tileproperties;if(l)for(e in l)l.hasOwnProperty(e)&&this.setTileProperty(+e+this.firstgid,l[e]);if(!1===this.isCollection){if(this.image=uc.getImage(t.image),!this.image)throw new Error("melonJS: '"+t.image+"' file for tileset '"+this.name+"' not found!");this.texture=Fc.cache.get(this.image,{framewidth:this.tilewidth,frameheight:this.tileheight,margin:this.margin,spacing:this.spacing}),this.atlas=this.texture.getAtlas();var u=+t.columns||Math.round(this.image.width/(this.tilewidth+this.spacing)),c=Math.round(this.image.height/(this.tileheight+this.spacing));t.tilecount%u>0&&++c,this.lastgid=this.firstgid+(u*c-1||0),t.tilecount&&this.lastgid-this.firstgid+1!=+t.tilecount&&console.warn("Computed tilecount ("+(this.lastgid-this.firstgid+1)+") does not match expected tilecount ("+t.tilecount+")")}};Fu.prototype.getTileImage=function(t){return this.imageCollection[t]},Fu.prototype.setTileProperty=function(t,e){this.TileProperties[t]=e},Fu.prototype.contains=function(t){return t>=this.firstgid&&t<=this.lastgid},Fu.prototype.getViewTileId=function(t){var e=t-this.firstgid;return this.animations.has(e)?this.animations.get(e).cur.tileid:e},Fu.prototype.getTileProperties=function(t){return this.TileProperties[t]},Fu.prototype.update=function(t){var e=0,i=qc.getTime(),o=!1;return this._lastUpdate!==i&&(this._lastUpdate=i,this.animations.forEach((function(i){for(i.dt+=t,e=i.cur.duration;i.dt>=e;)i.dt-=e,i.idx=(i.idx+1)%i.frames.length,i.cur=i.frames[i.idx],e=i.cur.duration,o=!0}))),o},Fu.prototype.drawTile=function(t,e,i,o){if(o.flipped&&(t.save(),t.translate(e,i),t.transform(o.currentTransform),e=i=0),!0===this.isCollection)t.drawImage(this.imageCollection[o.tileId],0,0,o.width,o.height,e,i,o.width,o.height);else{var n=this.atlas[this.getViewTileId(o.tileId)].offset;t.drawImage(this.image,n.x,n.y,this.tilewidth,this.tileheight,e,i,this.tilewidth+t.uvOffset,this.tileheight+t.uvOffset)}o.flipped&&t.restore()};var Vu=function(){this.tilesets=[],this.length=0};Vu.prototype.add=function(t){this.tilesets.push(t),this.length++},Vu.prototype.getTilesetByIndex=function(t){return this.tilesets[t]},Vu.prototype.getTilesetByGid=function(t){var e=-1;t&=536870911;for(var i=0,o=this.tilesets.length;i=this.tilesets[i].firstgid&&(e=i)}if(-1!==e)return this.tilesets[e];throw new Error("no matching tileset found for gid "+t)};var ju=function(t,e,i){this.points=void 0,this.name=e.name,this.x=+e.x,this.y=+e.y,this.z=+i,this.width=+e.width||0,this.height=+e.height||0,this.gid=+e.gid||null,this.tintcolor=e.tintcolor,this.type=e.type,this.class=void 0!==e.class?e.class:e.type,this.text=void 0,this.rotation=On(+e.rotation||0),this.id=+e.id||void 0,this.orientation=t.orientation,this.shapes=void 0,this.isEllipse=!1,this.isPolygon=!1,this.isPolyLine=!1,"number"==typeof this.gid?this.setTile(t.tilesets):void 0!==e.ellipse?this.isEllipse=!0:void 0!==e.polygon?(this.points=e.polygon,this.isPolygon=!0):void 0!==e.polyline&&(this.points=e.polyline,this.isPolyLine=!0),void 0!==e.text?(this.text=e.text,this.text.font=e.text.fontfamily||"sans-serif",this.text.size=e.text.pixelsize||16,this.text.fillStyle=e.text.color||"#000000",this.text.textAlign=e.text.halign||"left",this.text.textBaseline=e.text.valign||"top",this.text.width=this.width,this.text.height=this.height,Eu(this.text,e)):(Eu(this,e),this.shapes||(this.shapes=this.parseTMXShapes())),t.isEditor||t.getRenderer().adjustPosition(this)};ju.prototype.setTile=function(t){var e=t.getTilesetByGid(this.gid);!1===e.isCollection&&(this.width=this.framewidth=e.tilewidth,this.height=this.frameheight=e.tileheight),this.tile=new Cu(this.x,this.y,this.gid,e)},ju.prototype.parseTMXShapes=function(){var t=0,e=[];if(!0===this.isEllipse)e.push(qn.pull("Ellipse",this.width/2,this.height/2,this.width,this.height).rotate(this.rotation));else if(!0===this.isPolygon){var i=qn.pull("Polygon",0,0,this.points);if(!1===i.isConvex())throw new Error("collision polygones in Tiled should be defined as Convex");e.push(i.rotate(this.rotation))}else if(!0===this.isPolyLine){var o,n,r=this.points,s=r.length-1;for(t=0;t0&&(e.autoSort=!0,e.autoDepth=!0,i.push(e))}return i},Gu.prototype.getLayers=function(){return this.readMapObjects(this.data),this.layers},Gu.prototype.destroy=function(){this.tilesets=void 0,this.layers.length=0,this.objectGroups.length=0,this.initialized=!1};var Xu={},Hu=[],Yu=0;function Wu(t,e,i){e.container.reset(),Jl.reset(),Xu[qu.getCurrentLevelId()]&&Xu[qu.getCurrentLevelId()].destroy(),Yu=Hu.indexOf(t),function(t,e,i,o){var n=Xu[t];Hc.resetGUID(t,n.nextobjectid),e.anchorPoint.set(0,0),n.addTo(e,i,o)}(t,e.container,e.flatten,e.setViewportBounds),Wr(Cr,t),e.onLoaded(t),i&&_u.restart()}var qu={add:function(t,e,i){if("tmx"===t)return null==Xu[e]&&(Xu[e]=new Gu(e,uc.getTMX(e)),Hu.push(e),i&&i(),!0);throw new Error("no level loader defined for format "+t)},load:function(t,e){if(e=Object.assign({container:Jl.world,onLoaded:Jl.onLevelLoaded,flatten:Jl.mergeGroup,setViewportBounds:!0},e||{}),void 0===Xu[t])throw new Error("level "+t+" not found");if(!(Xu[t]instanceof Gu))throw new Error("no level loader defined");return _u.isRunning()?(_u.stop(),Hc.function.defer(Wu,this,t,e,!0)):Wu(t,e),!0},getCurrentLevelId:function(){return Hu[Yu]},getCurrentLevel:function(){return Xu[this.getCurrentLevelId()]},reload:function(t){return this.load(this.getCurrentLevelId(),t)},next:function(t){return Yu+1=0&&this.load(Hu[Yu-1],t)},levelCount:function(){return Hu.length}},Ku={},Zu={},Qu={},Ju={},$u={},tc=0,ec=0,ic=0;function oc(t){if(ec===tc){if("function"!=typeof t&&!uc.onload)throw new Error("no load callback defined");clearTimeout(ic);var e=t||uc.onload;setTimeout((function(){e(),Wr(Mr)}),300)}else ic=setTimeout((function(){oc(t)}),100)}function nc(t,e,i){Ku[t.name]=new Image,"function"==typeof e&&(Ku[t.name].onload=e),"function"==typeof i&&(Ku[t.name].onerror=i),"string"==typeof uc.crossOrigin&&(Ku[t.name].crossOrigin=uc.crossOrigin),Ku[t.name].src=t.src+uc.nocache}function rc(t,e,i){!0===vn(t.src)&&(t.src.startsWith("url(")||(t.src="url("+t.src+")"));var o=new FontFace(t.name,t.src);o.load().then((function(){document.fonts.add(o),document.body.style.fontFamily=t.name,"function"==typeof e&&e()}),(function(){"function"==typeof i&&i(t.name)}))}function sc(t,e,i){function o(e){Zu[t.name]=e,"tmx"===t.type&&qu.add(t.type,t.name)}if(t.data)return o(t.data),void("function"==typeof e&&e());var n=new XMLHttpRequest,r=Nn(t.src);n.overrideMimeType&&("json"===r?n.overrideMimeType("application/json"):n.overrideMimeType("text/xml")),n.open("GET",t.src+uc.nocache,!0),n.withCredentials=uc.withCredentials,n.ontimeout=i,n.onreadystatechange=function(){if(4===n.readyState)if(200===n.status||0===n.status&&n.responseText){var s=null;switch(r){case"xml":case"tmx":case"tsx":if(rs.match(/msie/i)||!n.responseXML){if(!globalThis.DOMParser)throw new Error("XML file format loading not supported, use the JSON file format instead");s=(new DOMParser).parseFromString(n.responseText,"text/xml")}else s=n.responseXML;var a=Au(s);switch(r){case"tmx":s=a.map;break;case"tsx":s=a.tilesets[0]}break;case"json":s=JSON.parse(n.responseText);break;default:throw new Error("TMX file format "+r+"not supported !")}o(s),"function"==typeof e&&e()}else"function"==typeof i&&i(t.name)},n.send()}function ac(t,e,i){var o=new XMLHttpRequest;o.overrideMimeType&&o.overrideMimeType("application/json"),o.open("GET",t.src+uc.nocache,!0),o.withCredentials=uc.withCredentials,o.ontimeout=i,o.onreadystatechange=function(){4===o.readyState&&(200===o.status||0===o.status&&o.responseText?(Ju[t.name]=JSON.parse(o.responseText),"function"==typeof e&&e()):"function"==typeof i&&i(t.name))},o.send()}function hc(t,e,i){var o=new XMLHttpRequest;o.open("GET",t.src+uc.nocache,!0),o.withCredentials=uc.withCredentials,o.responseType="arraybuffer",o.onerror=i,o.onload=function(){var i=o.response;if(i){for(var n=new Uint8Array(i),r=[],s=0;s0){var i=this.getAnimationFrameObjectByIndex(this.current.idx).delay;for(this.dt+=e;this.dt>=i;){this.isDirty=!0,this.dt-=i;var o=this.current.length>1?this.current.idx+1:this.current.idx;if(this.setAnimationFrame(o),0===this.current.idx&&"function"==typeof this.resetAnim&&!1===this.resetAnim()){this.setAnimationFrame(this.current.length-1),this.dt%=i;break}i=this.getAnimationFrameObjectByIndex(this.current.idx).delay}}return this._flicker.isFlickering&&(this._flicker.duration-=e,this._flicker.duration<0&&("function"==typeof this._flicker.callback&&this._flicker.callback(),this.flicker(-1)),this.isDirty=!0),t.prototype.update.call(this,e)},e.prototype.destroy=function(){qn.push(this.offset),this.offset=void 0,t.prototype.destroy.call(this)},e.prototype.draw=function(t,e){if(!this._flicker.isFlickering||(this._flicker.state=!this._flicker.state,this._flicker.state)){var i=this.current,o=this.pos.x,n=this.pos.y,r=i.width,s=i.height,a=i.offset,h=this.offset;0!==i.angle&&(t.translate(-o,-n),t.rotate(i.angle),o-=s,r=i.height,s=i.width),t.drawImage(this.image,h.x+a.x,h.y+a.y,r,s,o,n,r,s)}},e}(Cl);function pc(t,e,i,o){return void 0===i&&(i="default"),void 0===o&&(o="no-repeat"),{meta:{app:"melonJS",size:{w:t,h:e},repeat:o,image:"default"},frames:[{filename:i,frame:{x:0,y:0,w:t,h:e}}]}}var dc=function(t,e,i){var o=this;if(this.format=null,this.sources=new Map,this.atlases=new Map,void 0!==t)for(var n in t=Array.isArray(t)?t:[t]){var r=t[n];if(void 0!==r.meta){if(r.meta.app.includes("texturepacker")||r.meta.app.includes("free-tex-packer")){if(this.format="texturepacker",void 0===e){var s=uc.getImage(r.meta.image);if(!s)throw new Error("Atlas texture '"+s+"' not found");this.sources.set(r.meta.image,s)}else this.sources.set(r.meta.image||"default","string"==typeof e?uc.getImage(e):e);this.repeat="no-repeat"}else if(r.meta.app.includes("ShoeBox")){if(!r.meta.exporter||!r.meta.exporter.includes("melonJS"))throw new Error("ShoeBox requires the JSON exporter : https://github.com/melonjs/melonJS/tree/master/media/shoebox_JSON_export.sbx");this.format="ShoeBox",this.repeat="no-repeat",this.sources.set("default","string"==typeof e?uc.getImage(e):e)}else r.meta.app.includes("melonJS")&&(this.format="melonJS",this.repeat=r.meta.repeat||"no-repeat",this.sources.set("default","string"==typeof e?uc.getImage(e):e));this.atlases.set(r.meta.image||"default",this.parse(r))}else void 0!==r.framewidth&&void 0!==r.frameheight&&(this.format="Spritesheet (fixed cell size)",this.repeat="no-repeat",void 0!==e&&(r.image="string"==typeof e?uc.getImage(e):e),this.atlases.set("default",this.parseFromSpriteSheet(r)),this.sources.set("default",r.image))}if(0===this.atlases.length)throw new Error("texture atlas format not supported");!1!==i&&this.sources.forEach((function(t){i instanceof Pc?i.set(t,o):Fc.cache.set(t,o)}))};dc.prototype.parse=function(t){var e=this,i={};return t.frames.forEach((function(o){if(o.hasOwnProperty("filename")){var n,r,s=o.frame,a=o.spriteSourceSize&&o.sourceSize&&o.pivot;a&&(n=o.sourceSize.w*o.pivot.x-(o.trimmed?o.spriteSourceSize.x:0),r=o.sourceSize.h*o.pivot.y-(o.trimmed?o.spriteSourceSize.y:0)),i[o.filename]={name:o.filename,texture:t.meta.image||"default",offset:new Kn(s.x,s.y),anchorPoint:a?new Kn(n/s.w,r/s.h):null,trimmed:!!o.trimmed,width:s.w,height:s.h,angle:!0===o.rotated?-Sn:0},e.addUVs(i,o.filename,t.meta.size.w,t.meta.size.h)}})),i},dc.prototype.parseFromSpriteSheet=function(t){var e={},i=t.image,o=t.spacing||0,n=t.margin||0,r=i.width,s=i.height,a=qn.pull("Vector2d",~~((r-n+o)/(t.framewidth+o)),~~((s-n+o)/(t.frameheight+o)));if(r%(t.framewidth+o)!=0||s%(t.frameheight+o)!=0){var h=a.x*(t.framewidth+o),l=a.y*(t.frameheight+o);h-r!==o&&l-s!==o&&(r=h,s=l,console.warn("Spritesheet Texture for image: "+i.src+" is not divisible by "+(t.framewidth+o)+"x"+(t.frameheight+o)+", truncating effective size to "+r+"x"+s))}for(var u=0,c=a.x*a.y;u0&&n[n.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!n||r[1]>n[0]&&r[1]=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},xc=e&&e.__read||function(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var o,n,r=i.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)s.push(o.value)}catch(t){n={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return s};Object.defineProperty(gc,"__esModule",{value:!0}),gc.Multimap=void 0;var _c=function(){function t(t,e){var i,o;if(this.size_=0,this.map=new Map,this.operator=t,e)try{for(var n=mc(e),r=n.next();!r.done;r=n.next()){var s=xc(r.value,2),a=s[0],h=s[1];this.put(a,h)}}catch(t){i={error:t}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(i)throw i.error}}return this}return Object.defineProperty(t.prototype,"size",{get:function(){return this.size_},enumerable:!1,configurable:!0}),t.prototype.get=function(t){var e=this.map.get(t);return e?this.operator.clone(e):this.operator.create()},t.prototype.put=function(t,e){var i=this.map.get(t);return i||(i=this.operator.create()),!!this.operator.add(e,i)&&(this.map.set(t,i),this.size_++,!0)},t.prototype.putAll=function(e,i){var o,n,r,s,a=0;if(i){var h=e,l=i;try{for(var u=mc(l),c=u.next();!c.done;c=u.next()){var p=c.value;this.put(h,p),a++}}catch(t){o={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}}else{if(!(e instanceof t))throw new TypeError("unexpected arguments");try{for(var d=mc(e.entries()),f=d.next();!f.done;f=d.next()){var y=xc(f.value,2);h=y[0],p=y[1];this.put(h,p),a++}}catch(t){r={error:t}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}return a>0},t.prototype.has=function(t){return this.map.has(t)},t.prototype.hasEntry=function(t,e){return this.operator.has(e,this.get(t))},t.prototype.delete=function(t){return this.size_-=this.operator.size(this.get(t)),this.map.delete(t)},t.prototype.deleteEntry=function(t,e){var i=this.get(t);return!!this.operator.delete(e,i)&&(this.map.set(t,i),this.size_--,!0)},t.prototype.clear=function(){this.map.clear(),this.size_=0},t.prototype.keys=function(){return this.map.keys()},t.prototype.entries=function(){var t=this;return function(){var e,i,o,n,r,s,a,h,l,u,c,p,d,f;return vc(this,(function(y){switch(y.label){case 0:y.trys.push([0,11,12,13]),e=mc(t.map.entries()),i=e.next(),y.label=1;case 1:if(i.done)return[3,10];o=xc(i.value,2),n=o[0],r=o[1],y.label=2;case 2:y.trys.push([2,7,8,9]),d=void 0,s=mc(r),a=s.next(),y.label=3;case 3:return a.done?[3,6]:(h=a.value,[4,[n,h]]);case 4:y.sent(),y.label=5;case 5:return a=s.next(),[3,3];case 6:return[3,9];case 7:return l=y.sent(),d={error:l},[3,9];case 8:try{a&&!a.done&&(f=s.return)&&f.call(s)}finally{if(d)throw d.error}return[7];case 9:return i=e.next(),[3,1];case 10:return[3,13];case 11:return u=y.sent(),c={error:u},[3,13];case 12:try{i&&!i.done&&(p=e.return)&&p.call(e)}finally{if(c)throw c.error}return[7];case 13:return[2]}}))}()},t.prototype.values=function(){var t=this;return function(){var e,i,o,n,r,s;return vc(this,(function(a){switch(a.label){case 0:a.trys.push([0,5,6,7]),e=mc(t.entries()),i=e.next(),a.label=1;case 1:return i.done?[3,4]:(o=xc(i.value,2),[4,o[1]]);case 2:a.sent(),a.label=3;case 3:return i=e.next(),[3,1];case 4:return[3,7];case 5:return n=a.sent(),r={error:n},[3,7];case 6:try{i&&!i.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}return[7];case 7:return[2]}}))}()},t.prototype.forEach=function(t,e){var i,o;try{for(var n=mc(this.entries()),r=n.next();!r.done;r=n.next()){var s=xc(r.value,2),a=s[0],h=s[1];t.call(void 0===e?this:e,h,a,this)}}catch(t){i={error:t}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(i)throw i.error}}},t.prototype[Symbol.iterator]=function(){return this.entries()},t.prototype.asMap=function(){var t,e,i=new Map;try{for(var o=mc(this.keys()),n=o.next();!n.done;n=o.next()){var r=n.value;i.set(r,this.operator.clone(this.get(r)))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return i},t}();gc.Multimap=_c;var bc,wc=e&&e.__extends||(bc=function(t,e){return bc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},bc(t,e)},function(t,e){function i(){this.constructor=t}bc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(yc,"__esModule",{value:!0}),yc.ArrayMultimap=void 0;var Tc=function(t){function e(e){return t.call(this,new Ac,e)||this}return wc(e,t),Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ArrayMultimap"},enumerable:!1,configurable:!0}),e}(gc.Multimap);yc.ArrayMultimap=Tc;var Ac=function(){function t(){}return t.prototype.create=function(){return[]},t.prototype.clone=function(t){return t.slice()},t.prototype.add=function(t,e){return e.push(t),!0},t.prototype.size=function(t){return t.length},t.prototype.delete=function(t,e){var i=e.indexOf(t);return i>-1&&(e.splice(i,1),!0)},t.prototype.has=function(t,e){return e.includes(t)},t}(),Ec={},Sc=e&&e.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}();Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.SetMultimap=void 0;var Cc=function(t){function e(e){return t.call(this,new Mc,e)||this}return Sc(e,t),Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"SetMultimap"},enumerable:!1,configurable:!0}),e}(gc.Multimap);Ec.SetMultimap=Cc;var Mc=function(){function t(){}return t.prototype.create=function(){return new Set},t.prototype.clone=function(t){return new Set(t)},t.prototype.add=function(t,e){var i=e.size;return e.add(t),i!==e.size},t.prototype.size=function(t){return t.size},t.prototype.delete=function(t,e){return e.delete(t)},t.prototype.has=function(t,e){return e.has(t)},t}();!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SetMultimap=t.ArrayMultimap=void 0;var e=yc;Object.defineProperty(t,"ArrayMultimap",{enumerable:!0,get:function(){return e.ArrayMultimap}});var i=Ec;Object.defineProperty(t,"SetMultimap",{enumerable:!0,get:function(){return i.SetMultimap}})}(fc);var Pc=function(t){this.cache=new fc.ArrayMultimap,this.tinted=new Map,this.units=new Map,this.max_size=t||1/0,this.clear()};Pc.prototype.clear=function(){this.cache.clear(),this.tinted.clear(),this.units.clear(),this.length=0},Pc.prototype.validate=function(){if(this.length>=this.max_size)throw new Error("Texture cache overflow: "+this.max_size+" texture units available for this GPU.")},Pc.prototype.get=function(t,e){var i;return void 0===e?i=this.cache.get(t)[0]:this.cache.forEach((function(o,n){var r=o.getAtlas();n===t&&r[0].width===e.framewidth&&r[0].height===e.frameheight&&(i=o)})),void 0===i&&(e||(e=pc(t.width,t.height,t.src?Un(t.src):void 0)),i=new dc(e,t,!1),this.set(t,i)),i},Pc.prototype.delete=function(t){this.cache.has(t)||this.cache.delete(t)},Pc.prototype.tint=function(t,e){var i=this.tinted.get(t);return void 0===i&&(i=this.tinted.set(t,new Map)),i.has(e)||i.set(e,Fc.tint(t,e,"multiply")),i.get(e)},Pc.prototype.set=function(t,e){var i=t.width,o=t.height;if(!(1!==Fc.WebGLVersion||Mn(i)&&Mn(o))){var n=void 0!==t.src?t.src:t;console.warn("[Texture] "+n+" is not a POT texture ("+i+"x"+o+")")}return this.cache.put(t,e)},Pc.prototype.getUnit=function(t){return this.units.has(t)||(this.validate(),this.units.set(t,this.length++)),this.units.get(t)};var Oc=function(t){function e(e){var i=this;t.call(this,e),this.WebGLVersion=1,this.GPUVendor=null,this.GPURenderer=null,this.context=this.gl=this.getContextGL(this.getCanvas(),e.transparent),this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this._colorStack=[],this._matrixStack=[],this._scissorStack=[],this._blendStack=[],this.currentTransform=new hr,this.currentCompositor=null,this.compositors=new Map;var o=new(this.settings.compositor||ga)(this);this.compositors.set("default",o),this.setCompositor(o),this.gl.disable(this.gl.DEPTH_TEST),this.gl.disable(this.gl.SCISSOR_TEST),this.gl.enable(this.gl.BLEND),this.setBlendMode(this.settings.blendMode);var n=this.gl.getExtension("WEBGL_debug_renderer_info");null!==n&&(this.GPUVendor=this.gl.getParameter(n.UNMASKED_VENDOR_WEBGL),this.GPURenderer=this.gl.getParameter(n.UNMASKED_RENDERER_WEBGL)),this.cache=new Pc(this.maxTextures),this.getCanvas().addEventListener("webglcontextlost",(function(t){t.preventDefault(),i.isContextValid=!1,Wr(Hr,i)}),!1),this.getCanvas().addEventListener("webglcontextrestored",(function(){i.reset(),i.isContextValid=!0,Wr(Yr,i)}),!1)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.reset=function(){var e=this;t.prototype.reset.call(this),this.compositors.forEach((function(t){!1===e.isContextValid?t.init(e):t.reset()})),this.gl.disable(this.gl.SCISSOR_TEST),void 0!==this.fontContext2D&&this.createFontTexture(this.cache)},e.prototype.setCompositor=function(t){if(void 0===t&&(t="default"),"string"==typeof t&&(t=this.compositors.get(t)),void 0===t)throw new Error("Invalid WebGL Compositor");this.currentCompositor!==t&&(null!==this.currentCompositor&&this.currentCompositor.flush(),this.currentCompositor=t)},e.prototype.resetTransform=function(){this.currentTransform.identity()},e.prototype.createFontTexture=function(t){if(void 0===this.fontTexture){var e=this.getCanvas(),i=e.width,o=e.height;1===this.WebGLVersion&&(Mn(i)||(i=Pn(e.width)),Mn(o)||(o=Pn(e.height)));var n=Vc(i,o,!0);this.fontContext2D=this.getContext2d(n),this.fontTexture=new dc(pc(e.width,e.height,"fontTexture"),n,t),this.currentCompositor.uploadTexture(this.fontTexture,0,0,0)}else t.set(this.fontContext2D.canvas,this.fontTexture)},e.prototype.createPattern=function(t,e){if(!(1!==Fc.WebGLVersion||Mn(t.width)&&Mn(t.height))){var i=void 0!==t.src?t.src:t;throw new Error("[WebGL Renderer] "+i+" is not a POT texture ("+t.width+"x"+t.height+")")}var o=new dc(pc(t.width,t.height,"pattern",e),t);return this.currentCompositor.uploadTexture(o),o},e.prototype.flush=function(){this.currentCompositor.flush()},e.prototype.setProjection=function(e){t.prototype.setProjection.call(this,e),this.currentCompositor.setProjection(e)},e.prototype.clearColor=function(t,e){var i;if(void 0===t&&(t="#000000"),void 0===e&&(e=!1),t instanceof nr)i=t.toArray();else{var o=qn.pull("me.Color");i=o.parseCSS(t).toArray(),qn.push(o)}this.currentCompositor.clearColor(i[0],i[1],i[2],!0===e?1:i[3]),this.currentCompositor.clear(),this.currentCompositor.clearColor(0,0,0,0)},e.prototype.clearRect=function(t,e,i,o){this.save(),this.clipRect(t,e,i,o),this.clearColor(),this.restore()},e.prototype.drawFont=function(t){var e=this.getFontContext();this.currentCompositor.uploadTexture(this.fontTexture,0,0,0,!0);var i=this.fontTexture.getUVs(t.left+","+t.top+","+t.width+","+t.height);this.currentCompositor.addQuad(this.fontTexture,t.left,t.top,t.width,t.height,i[0],i[1],i[2],i[3],this.currentTint.toUint32()),e.clearRect(t.left,t.top,t.width,t.height)},e.prototype.drawImage=function(t,e,i,o,n,r,s,a,h){void 0===o?(o=a=t.width,n=h=t.height,r=e,s=i,e=0,i=0):void 0===r&&(r=e,s=i,a=o,h=n,o=t.width,n=t.height,e=0,i=0),!1===this.settings.subPixel&&(r|=0,s|=0);var l=this.cache.get(t),u=l.getUVs(e+","+i+","+o+","+n);this.currentCompositor.addQuad(l,r,s,a,h,u[0],u[1],u[2],u[3],this.currentTint.toUint32())},e.prototype.drawPattern=function(t,e,i,o,n){var r=t.getUVs("0,0,"+o+","+n);this.currentCompositor.addQuad(t,e,i,o,n,r[0],r[1],r[2],r[3],this.currentTint.toUint32())},e.prototype.getContextGL=function(t,e){if(null==t)throw new Error("You must pass a canvas element in order to create a GL context");"boolean"!=typeof e&&(e=!0);var i,o={alpha:e,antialias:this.settings.antiAlias,depth:!1,stencil:!0,preserveDrawingBuffer:!1,premultipliedAlpha:e,powerPreference:this.settings.powerPreference,failIfMajorPerformanceCaveat:this.settings.failIfMajorPerformanceCaveat};if(!1===this.settings.preferWebGL1&&(i=t.getContext("webgl2",o))&&(this.WebGLVersion=2),i||(this.WebGLVersion=1,i=t.getContext("webgl",o)||t.getContext("experimental-webgl",o)),!i)throw new Error("A WebGL context could not be created.");return i},e.prototype.getContext=function(){return this.gl},e.prototype.setBlendMode=function(t,e){if(void 0===t&&(t="normal"),void 0===e&&(e=this.gl),this.currentBlendMode!==t)switch(this.flush(),e.enable(e.BLEND),this.currentBlendMode=t,t){case"screen":e.blendFunc(e.ONE,e.ONE_MINUS_SRC_COLOR);break;case"lighter":case"additive":e.blendFunc(e.ONE,e.ONE);break;case"multiply":e.blendFunc(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA);break;default:e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),this.currentBlendMode="normal"}},e.prototype.getFontContext=function(){return void 0===this.fontContext2D&&(console.warn("[WebGL Renderer] WARNING : Using Standard me.Text with WebGL will severly impact performances !"),this.createFontTexture(this.cache)),this.fontContext2D},e.prototype.restore=function(){if(0!==this._matrixStack.length){var t=this._colorStack.pop(),e=this._matrixStack.pop();this.currentColor.copy(t),this.currentTransform.copy(e),this.setBlendMode(this._blendStack.pop()),qn.push(t),qn.push(e)}0!==this._scissorStack.length?this.currentScissor.set(this._scissorStack.pop()):(this.gl.disable(this.gl.SCISSOR_TEST),this.currentScissor[0]=0,this.currentScissor[1]=0,this.currentScissor[2]=this.getCanvas().width,this.currentScissor[3]=this.getCanvas().height)},e.prototype.save=function(){this._colorStack.push(this.currentColor.clone()),this._matrixStack.push(this.currentTransform.clone()),this.gl.isEnabled(this.gl.SCISSOR_TEST)&&this._scissorStack.push(this.currentScissor.slice()),this._blendStack.push(this.getBlendMode())},e.prototype.rotate=function(t){this.currentTransform.rotate(t)},e.prototype.scale=function(t,e){this.currentTransform.scale(t,e)},e.prototype.setAntiAlias=function(e,i){t.prototype.setAntiAlias.call(this,e,i)},e.prototype.setGlobalAlpha=function(t){this.currentColor.alpha=t},e.prototype.getGlobalAlpha=function(){return this.currentColor.alpha},e.prototype.setColor=function(t){var e=this.currentColor.alpha;this.currentColor.copy(t),this.currentColor.alpha*=e},e.prototype.setLineWidth=function(t){this.getContext().lineWidth(t)},e.prototype.strokeArc=function(t,e,i,o,n,r,s){void 0===r&&(r=!1),void 0===s&&(s=!1),this.getGlobalAlpha()<1/255||(this.path2D.beginPath(),this.path2D.arc(t,e,i,o,n,r),!1===s?this.currentCompositor.drawVertices(this.gl.LINE_STRIP,this.path2D.points):(this.path2D.closePath(),this.currentCompositor.drawVertices(this.gl.TRIANGLES,this.path2D.triangulatePath())))},e.prototype.fillArc=function(t,e,i,o,n,r){void 0===r&&(r=!1),this.strokeArc(t,e,i,o,n,r,!0)},e.prototype.strokeEllipse=function(t,e,i,o,n){void 0===n&&(n=!1),this.getGlobalAlpha()<1/255||(this.path2D.beginPath(),this.path2D.ellipse(t,e,i,o,0,0,360),this.path2D.closePath(),!1===n?this.currentCompositor.drawVertices(this.gl.LINE_LOOP,this.path2D.points):this.currentCompositor.drawVertices(this.gl.TRIANGLES,this.path2D.triangulatePath()))},e.prototype.fillEllipse=function(t,e,i,o){this.strokeEllipse(t,e,i,o,!1)},e.prototype.strokeLine=function(t,e,i,o){this.getGlobalAlpha()<1/255||(this.path2D.beginPath(),this.path2D.moveTo(t,e),this.path2D.lineTo(i,o),this.currentCompositor.drawVertices(this.gl.LINE_STRIP,this.path2D.points))},e.prototype.fillLine=function(t,e,i,o){this.strokeLine(t,e,i,o)},e.prototype.strokePolygon=function(t,e){if(void 0===e&&(e=!1),!(this.getGlobalAlpha()<1/255)){var i;this.translate(t.pos.x,t.pos.y),this.path2D.beginPath(),this.path2D.moveTo(t.points[0].x,t.points[0].y);for(var o=1;o0&&(this.flush(),this.maskLevel=0,this.gl.disable(this.gl.STENCIL_TEST))},e}(Ja),Ic=1,kc=0,Rc=0,Bc={parent:void 0,renderer:2,autoScale:!1,scale:1,scaleMethod:"manual",transparent:!1,blendMode:"normal",antiAlias:!1,failIfMajorPerformanceCaveat:!0,subPixel:!1,preferWebGL1:!1,powerPreference:"default",verbose:!1,consoleHeader:!0};function Dc(){var t=Fc.settings,e=1,i=1;if(t.autoScale){var o=1/0,n=1/0;if(globalThis.getComputedStyle){var r=globalThis.getComputedStyle(Fc.getCanvas(),null);o=parseInt(r.maxWidth,10)||1/0,n=parseInt(r.maxHeight,10)||1/0}var s=na(jc()),a=Math.min(o,s.width),h=Math.min(n,s.height),l=a/h;if("fill-min"===t.scaleMethod&&l>Ic||"fill-max"===t.scaleMethod&&lIc||"flex-height"===t.scaleMethod){var c=Math.min(n,kc*(h/a));e=i=h/c,Fc.resize(kc,Math.floor(c))}else"flex"===t.scaleMethod?Fc.resize(Math.floor(a),Math.floor(h)):"stretch"===t.scaleMethod?(e=a/kc,i=h/Rc):e=i=l0;)o[n]=arguments[n+3];return this.timers.push({fn:t,delay:e,elapsed:0,repeat:!1,timerId:++this.timerId,pauseable:!0===i||!0,args:o}),this.timerId},Yc.prototype.setInterval=function(t,e,i){for(var o=[],n=arguments.length-3;n-- >0;)o[n]=arguments[n+3];return this.timers.push({fn:t,delay:e,elapsed:0,repeat:!0,timerId:++this.timerId,pauseable:!0===i||!0,args:o}),this.timerId},Yc.prototype.clearTimeout=function(t){Hc.function.defer(this.clearTimer.bind(this),this,t)},Yc.prototype.clearInterval=function(t){Hc.function.defer(this.clearTimer.bind(this),this,t)},Yc.prototype.getTime=function(){return this.now},Yc.prototype.getDelta=function(){return this.delta},Yc.prototype.countFPS=function(){this.framecount++,this.framedelta+=this.delta,this.framecount%10==0&&(this.fps=In(Math.round(1e3*this.framecount/this.framedelta),0,this.maxfps),this.framedelta=0,this.framecount=0)},Yc.prototype.update=function(t){this.last=this.now,this.now=t,this.delta=this.now-this.last,this.delta<0&&(this.delta=0),this.tick=this.delta>this.minstep&&this.interpolation?this.delta/this.step:1,this.updateTimers()},Yc.prototype.clearTimer=function(t){for(var e=0,i=this.timers.length;e=i.delay&&(i.fn.apply(null,i.args),!0===i.repeat?i.elapsed-=i.delay:this.clearTimeout(i.timerId))}};var Wc,qc=new Yc,Kc=0,Zc=["ms","moz","webkit","o"],Qc=globalThis.requestAnimationFrame,Jc=globalThis.cancelAnimationFrame;for(Wc=0;Wc2&&(i=Array.prototype.slice.call(arguments,1)),i[0]=t;var o=new(t.bind.apply(t,i));if(void 0===o||!(o instanceof tp.Base))throw new Error("Plugin should extend the me.plugin.Base Class !");if(Hc.checkVersion(o.version)>0)throw new Error("Plugin version mismatch, expected: "+o.version+", got: "+Lp);$c[e]=o}},ep={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-ep.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*ep.Bounce.In(2*t):.5*ep.Bounce.Out(2*t-1)+.5}}},ip={Linear:function(t,e){var i=t.length-1,o=i*e,n=Math.floor(o),r=ip.Utils.Linear;return e<0?r(t[0],t[1],o):e>1?r(t[i],t[i-1],i-o):r(t[n],t[n+1>i?i:n+1],o-n)},Bezier:function(t,e){var i,o=0,n=t.length-1,r=Math.pow,s=ip.Utils.Bernstein;for(i=0;i<=n;i++)o+=r(1-e,n-i)*r(e,i)*t[i]*s(n,i);return o},CatmullRom:function(t,e){var i=t.length-1,o=i*e,n=Math.floor(o),r=ip.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(n=Math.floor(o=i*(1+e))),r(t[(n-1+i)%i],t[n],t[(n+1)%i],t[(n+2)%i],o-n)):e<0?t[0]-(r(t[0],t[0],t[1],t[1],-o)-t[0]):e>1?t[i]-(r(t[i],t[i],t[i-1],t[i-1],o-i)-t[i]):r(t[n?n-1:0],t[n],t[i1;i--)o*=i;return t[e]=o,o}}(),CatmullRom:function(t,e,i,o,n){var r=.5*(i-t),s=.5*(o-e),a=n*n;return(2*e-2*i+r+s)*(n*a)+(-3*e+3*i-2*r-s)*a+r*n+e}}},op=function(t){this.setProperties(t)},np={Easing:{configurable:!0},Interpolation:{configurable:!0}};op.prototype.onResetEvent=function(t){this.setProperties(t)},op.prototype.setProperties=function(t){for(var e in this._object=t,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._yoyo=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=ep.Linear.None,this._interpolationFunction=ip.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onCompleteCallback=null,this._tweenTimeTracker=Jl.lastUpdate,this.isPersistent=!1,this.updateWhenPaused=!1,this.isRenderable=!1,t)"object"!=typeof t&&(this._valuesStart[e]=parseFloat(t[e]))},op.prototype._resumeCallback=function(t){this._startTime&&(this._startTime+=t)},op.prototype.onActivateEvent=function(){qr(yr,this._resumeCallback,this)},op.prototype.onDeactivateEvent=function(){Zr(yr,this._resumeCallback)},op.prototype.to=function(t,e){return this._valuesEnd=t,void 0!==e&&("number"==typeof e?this._duration=e:"object"==typeof e&&(e.duration&&(this._duration=e.duration),e.yoyo&&this.yoyo(e.yoyo),e.easing&&this.easing(e.easing),e.repeat&&this.repeat(e.repeat),e.delay&&this.delay(e.delay),e.interpolation&&this.interpolation(e.interpolation),e.autoStart&&this.start())),this},op.prototype.start=function(t){for(var e in void 0===t&&(t=qc.getTime()),this._onStartCallbackFired=!1,Jl.world.addChild(this),this._startTime=t+this._delayTime,this._valuesEnd){if(this._valuesEnd[e]instanceof Array){if(0===this._valuesEnd[e].length)continue;this._valuesEnd[e]=[this._object[e]].concat(this._valuesEnd[e])}this._valuesStart[e]=this._object[e],this._valuesStart[e]instanceof Array==!1&&(this._valuesStart[e]*=1),this._valuesStartRepeat[e]=this._valuesStart[e]||0}return this},op.prototype.stop=function(){return Jl.world.removeChildNow(this),this},op.prototype.delay=function(t){return this._delayTime=t,this},op.prototype.repeat=function(t){return this._repeat=t,this},op.prototype.yoyo=function(t){return this._yoyo=t,this},op.prototype.easing=function(t){if("function"!=typeof t)throw new Error("invalid easing function for me.Tween.easing()");return this._easingFunction=t,this},op.prototype.interpolation=function(t){return this._interpolationFunction=t,this},op.prototype.chain=function(){return this._chainedTweens=arguments,this},op.prototype.onStart=function(t){return this._onStartCallback=t,this},op.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},op.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},op.prototype.update=function(t){this._tweenTimeTracker=Jl.lastUpdate>this._tweenTimeTracker?Jl.lastUpdate:this._tweenTimeTracker+t;var e,i=this._tweenTimeTracker;if(i1?1:o;var n=this._easingFunction(o);for(e in this._valuesEnd){var r=this._valuesStart[e]||0,s=this._valuesEnd[e];s instanceof Array?this._object[e]=this._interpolationFunction(s,n):("string"==typeof s&&(s=r+parseFloat(s)),"number"==typeof s&&(this._object[e]=r+(s-r)*n))}if(null!==this._onUpdateCallback&&this._onUpdateCallback.call(this._object,n),1===o){if(this._repeat>0){for(e in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat){if("string"==typeof this._valuesEnd[e]&&(this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(this._valuesEnd[e])),this._yoyo){var a=this._valuesStartRepeat[e];this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=a}this._valuesStart[e]=this._valuesStartRepeat[e]}return this._yoyo&&(this._reversed=!this._reversed),this._startTime=i+this._delayTime,!0}Jl.world.removeChildNow(this),null!==this._onCompleteCallback&&this._onCompleteCallback.call(this._object);for(var h=0,l=this._chainedTweens.length;h0&&this.wordWrapWidth>0&&(this._text=this.metrics.wordWrap(this._text,this.wordWrapWidth,pp(Fc,this))),e.addBounds(this.metrics.measureText(this._text,pp(Fc,this)),!0),!0===this.offScreenCanvas){var i=Math.ceil(this.metrics.width),o=Math.ceil(this.metrics.height);Fc instanceof Oc&&(this.glTextureUnit=Fc.cache.getUnit(Fc.cache.get(this.canvasTexture.canvas)),Fc.currentCompositor.unbindTexture2D(null,this.glTextureUnit),1===Fc.WebGLVersion&&(i=Pn(this.metrics.width),o=Pn(this.metrics.height))),(this.canvasTexture.width0&&this.wordWrapWidth>0&&(this._text=this.metrics.wordWrap(this._text,this.wordWrapWidth)),this.getBounds().addBounds(this.metrics.measureText(this._text),!0),this},i.fillStyle.get=function(){return this.tint},i.fillStyle.set=function(t){this.tint=t},e.prototype.resize=function(t){return this.fontScale.set(t,t),this.getBounds().addBounds(this.metrics.measureText(this._text),!0),this.isDirty=!0,this},e.prototype.measureText=function(t){return void 0===t&&(t=this._text),this.metrics.measureText(t)},e.prototype.draw=function(t,e,i,o){var n=t.globalAlpha();void 0===this.ancestor?(this.setText(e),t.setGlobalAlpha(n*this.getOpacity())):(i=this.pos.x,o=this.pos.y);for(var r=i,s=this.metrics.lineHeight(),a=0,h=0;h>>9];if(e)return e[511&t]||0}return 0},yp.prototype.setKerning=function(t,e){this.kerning||(this.kerning={});var i=this.kerning[t>>>9];void 0===i&&(this.kerning[t>>>9]={},i=this.kerning[t>>>9]),i[511&t]=e};var gp=["M","N","B","D","C","E","F","K","A","G","H","I","J","L","O","P","Q","R","S","T","U","V","W","X","Y","Z"];function vp(t,e){var i=t.match(e);if(!i)throw new Error("Could not find pattern "+e+" in string: "+t);return i[0].split("=")[1]}function mp(t){var e=" ".charCodeAt(0),i=t[e];i||((i=new yp).id=e,i.xadvance=function(t){for(var e=Object.keys(t),i=0;i32)return t[e[i]];return null}(t).xadvance,t[e]=i)}var xp=function(t){this.onResetEvent(t)};xp.prototype.onResetEvent=function(t){this.padTop=0,this.padRight=0,this.padBottom=0,this.padLeft=0,this.lineHeight=0,this.capHeight=1,this.descent=0,this.glyphs={},this.parse(t)},xp.prototype.parse=function(t){if(!t)throw new Error("File containing font data was empty, cannot load the bitmap font.");var e=t.split(/\r\n|\n/),i=t.match(/padding\=\d+,\d+,\d+,\d+/g);if(!i)throw new Error("Padding not found in first line");var o=i[0].split("=")[1].split(",");this.padTop=parseFloat(o[0]),this.padLeft=parseFloat(o[1]),this.padBottom=parseFloat(o[2]),this.padRight=parseFloat(o[3]),this.lineHeight=parseFloat(vp(e[1],/lineHeight\=\d+/g));var n,r=parseFloat(vp(e[1],/base\=\d+/g)),s=this.padTop+this.padBottom,a=null;for(n=4;n0&&a.height>0&&(this.descent=Math.min(r+a.yoffset,this.descent)),this.glyphs[d]=a}}this.descent+=this.padBottom,mp(this.glyphs);var f=null;for(n=0;n=u?(e=1,o=1,i=u/l,n=l/u,r=s.createRadialGradient(a,h*n,0,a,u*n,l)):(i=1,n=1,e=l/u,o=u/l,r=s.createRadialGradient(a*o,h,0,a*o,h,u)),r.addColorStop(0,t.color.toRGBA(t.intensity)),r.addColorStop(1,t.color.toRGBA(0)),s.fillStyle=r,s.setTransform(e,0,0,i,0,0),s.fillRect(0,0,t.texture.width*o,t.texture.height*n)}(this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getVisibleArea=function(){return this.visibleArea.setShape(this.getBounds().centerX,this.getBounds().centerY,this.width,this.height)},e.prototype.draw=function(t,e){t.drawImage(this.texture.canvas,this.getBounds().x,this.getBounds().y)},e.prototype.destroy=function(){qn.push(this.color),this.color=void 0,qn.push(this.texture),this.texture=void 0,qn.push(this.visibleArea),this.visibleArea=void 0,t.prototype.destroy.call(this)},e}(Cl),Cp=function(t){function e(e,i,o,n){t.call(this,e,i,o,n),this.isKinematic=!1,this.dragging=!1,this.dragId=null,this.grabOffset=new Kn(0,0),this.initEvents()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.initEvents=function(){var t=this;pl("pointerdown",this,(function(e){Wr(zr,e,t)})),pl("pointerup",this,(function(e){Wr(Fr,e,t)})),pl("pointercancel",this,(function(e){Wr(Fr,e,t)})),qr(Dr,this.dragMove.bind(this)),qr(zr,(function(e,i){i===t&&t.dragStart(e)})),qr(Fr,(function(e,i){i===t&&t.dragEnd(e)}))},e.prototype.dragStart=function(t){if(!1===this.dragging)return this.dragging=!0,this.grabOffset.set(t.gameX,t.gameY),this.grabOffset.sub(this.pos),!1},e.prototype.dragMove=function(t){!0===this.dragging&&(this.pos.set(t.gameX,t.gameY,this.pos.z),this.pos.sub(this.grabOffset))},e.prototype.dragEnd=function(){if(!0===this.dragging)return this.dragging=!1,!1},e.prototype.destroy=function(){Zr(Dr,this.dragMove),Zr(zr,this.dragStart),Zr(Fr,this.dragEnd),dl("pointerdown",this),dl("pointerup",this),dl("pointercancel",this),t.prototype.destroy.call(this)},e}(Cl),Mp=function(t){function e(e,i,o,n){t.call(this,e,i,o,n),this.isKinematic=!1,this.CHECKMETHOD_OVERLAP="overlaps",this.CHECKMETHOD_CONTAINS="contains",this.checkMethod=this.CHECKMETHOD_OVERLAP,qr(Fr,this.checkOnMe,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setCheckMethod=function(t){"function"==typeof this.getBounds()[this.checkMethod]&&(this.checkMethod=t)},e.prototype.checkOnMe=function(t,e){e&&this.getBounds()[this.checkMethod](e.getBounds())&&this.drop(e)},e.prototype.drop=function(t){},e.prototype.destroy=function(){Zr(Fr,this.checkOnMe),t.prototype.destroy.call(this)},e}(Cl),Pp={width:1,height:1,image:void 0,textureSize:8,tint:"#fff",totalParticles:50,angle:Math.PI/2,angleVariation:0,minLife:1e3,maxLife:3e3,speed:2,speedVariation:1,minRotation:0,maxRotation:0,minStartScale:1,maxStartScale:1,minEndScale:0,maxEndScale:0,gravity:0,wind:0,followTrajectory:!1,textureAdditive:!1,blendMode:"normal",onlyInViewport:!0,floating:!1,maxParticles:10,frequency:100,duration:1/0,framesToSkip:0};var Op=function(t){function e(e,i,o){void 0===o&&(o={}),t.call(this,e,i,1|o.width,1|o.height),this.settings={},this.centerOn(e,i),this._stream=!1,this._frequencyTimer=0,this._durationTimer=0,this._enabled=!1,this.alwaysUpdate=!0,this.autoSort=!1,this._updateCount=0,this._dt=0,this.reset(o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.reset=function(t){void 0===t&&(t={}),Object.assign(this.settings,Pp,t),void 0===this.settings.image&&(this._defaultParticle=function(t,e){void 0===t&&(t=8),void 0===e&&(e=8);var i=qn.pull("CanvasTexture",t,e,{offscreenCanvas:!0});return i.context.fillStyle="#fff",i.context.fillRect(0,0,t,e),i}(t.textureSize,t.textureSize),this.settings.image=this._defaultParticle.canvas),this.floating=this.settings.floating,this.isDirty=!0},e.prototype.getRandomPointX=function(){return Rn(0,this.getBounds().width)},e.prototype.getRandomPointY=function(){return Rn(0,this.getBounds().height)},e.prototype.addParticles=function(t){for(var e=0;ethis.settings.framesToSkip&&(this._updateCount=0),this._updateCount>0)return this._dt+=e,this.isDirty;if(e+=this._dt,this._dt=0,this.isDirty|=t.prototype.update.call(this,e),this._enabled&&this._stream){if(this._durationTimer!==1/0&&(this._durationTimer-=e,this._durationTimer<=0))return this.stopStream(),this.isDirty;this._frequencyTimer+=e;var i=this.children.length;i=this.settings.frequency&&(i+this.settings.maxParticles<=this.settings.totalParticles?this.addParticles(this.settings.maxParticles):this.addParticles(this.settings.totalParticles-i),this._frequencyTimer=0,this.isDirty=!0)}return this.isDirty},e.prototype.destroy=function(){t.prototype.destroy.call(this,arguments),void 0!==this._defaultParticle&&(qn.push(this._defaultParticle),this._defaultParticle=void 0),this.settings.image=void 0,this.settings=void 0},e}(Hl),Ip=function(t){function e(e){t.call(this,e.getRandomPointX(),e.getRandomPointY(),e.settings.image.width,e.settings.image.height),this.onResetEvent(e,!0)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onResetEvent=function(t,e){void 0===e&&(e=!1),!1===e?(this.pos.set(t.getRandomPointX(),t.getRandomPointY()),this.resize(t.settings.image.width,t.settings.image.height),this.currentTransform.identity()):this.vel=qn.pull("Vector2d"),this.image=t.settings.image,this.alwaysUpdate=!0,"string"==typeof t.settings.tint&&this.tint.parseCSS(t.settings.tint),!0===t.settings.textureAdditive&&(this.blendMode="additive"),"normal"!==t.settings.blendMode&&(this.blendMode=t.settings.blendMode);var i=t.settings.angle+(t.settings.angleVariation>0?(Rn(0,2)-1)*t.settings.angleVariation:0),o=t.settings.speed+(t.settings.speedVariation>0?(Rn(0,2)-1)*t.settings.speedVariation:0);this.vel.set(o*Math.cos(i),-o*Math.sin(i)),this.life=Rn(t.settings.minLife,t.settings.maxLife),this.startLife=this.life,this.startScale=In(Rn(t.settings.minStartScale,t.settings.maxStartScale),t.settings.minStartScale,t.settings.maxStartScale),this.endScale=In(Rn(t.settings.minEndScale,t.settings.maxEndScale),t.settings.minEndScale,t.settings.maxEndScale),this.gravity=t.settings.gravity,this.wind=t.settings.wind,this.followTrajectory=t.settings.followTrajectory,this.onlyInViewport=t.settings.onlyInViewport,this._deltaInv=qc.maxfps/1e3,t.settings.followTrajectory||(this.angle=Rn(t.settings.minRotation,t.settings.maxRotation))},e.prototype.update=function(e){var i=e*this._deltaInv;if(this.life=this.life>e?this.life-e:0,this.life<=0)return this.ancestor.removeChild(this),!1;var o=this.life/this.startLife,n=this.startScale;this.startScale>this.endScale?n=(n*=o)this.endScale?this.endScale:n),this.alpha=o,this.vel.x+=this.wind*i,this.vel.y+=this.gravity*i;var r=this.followTrajectory?Math.atan2(this.vel.y,this.vel.x):this.angle;return this.pos.x+=this.vel.x*i,this.pos.y+=this.vel.y*i,this.currentTransform.setTransform(n,0,0,0,n,0,this.pos.x,this.pos.y,1).rotate(r),this.isDirty=this.inViewport||!this.onlyInViewport,t.prototype.update.call(this,e)},e.prototype.draw=function(t){var e=this.width,i=this.height;t.drawImage(this.image,0,0,e,i,-e/2,-i/2,e,i)},e}(Cl),kp=function(t){function e(e,i,o){if("number"!=typeof o.width||"number"!=typeof o.height)throw new Error("height and width properties are mandatory when passing settings parameters to an object entity");t.call(this,e,i,o.width,o.height),this.children=[],o.image&&(o.framewidth=o.framewidth||o.width,o.frameheight=o.frameheight||o.height,this.renderable=new cc(0,0,o)),o.anchorPoint?this.anchorPoint.set(o.anchorPoint.x,o.anchorPoint.y):this.anchorPoint.set(0,0),"string"==typeof o.name&&(this.name=o.name),this.type=o.type||"",this.id=o.id||"",this.alive=!0,void 0===o.shapes&&(o.shapes=qn.pull("Polygon",0,0,[qn.pull("Vector2d",0,0),qn.pull("Vector2d",this.width,0),qn.pull("Vector2d",this.width,this.height),qn.pull("Vector2d",0,this.height)])),this.body=new Nl(this,o.shapes,this.onBodyUpdate.bind(this)),0===this.width&&0===this.height&&this.resize(this.body.getBounds().width,this.body.getBounds().height),this.body.setCollisionMask(o.collisionMask),this.body.setCollisionType(o.collisionType),this.autoTransform=!1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={renderable:{configurable:!0}};return i.renderable.get=function(){return this.children[0]},i.renderable.set=function(e){if(!(e instanceof t))throw new Error(e+"should extend me.Renderable");this.children[0]=e,this.children[0].ancestor=this},e.prototype.update=function(e){return this.renderable&&(this.isDirty|=this.renderable.update(e)),t.prototype.update.call(this,e)},e.prototype.onBodyUpdate=function(t){this.getBounds().addBounds(t.getBounds(),!0),this.updateBoundsPos(this.pos.x,this.pos.y)},e.prototype.preDraw=function(e){e.save(),e.translate(this.pos.x+this.body.getBounds().x,this.pos.y+this.body.getBounds().y),this.renderable instanceof t&&e.translate(this.anchorPoint.x*this.body.getBounds().width,this.anchorPoint.y*this.body.getBounds().height)},e.prototype.draw=function(e,i){var o=this.renderable;o instanceof t&&(o.preDraw(e),o.draw(e,i),o.postDraw(e))},e.prototype.destroy=function(){this.renderable&&(this.renderable.destroy.apply(this.renderable,arguments),this.children.splice(0,1)),t.prototype.destroy.call(this,arguments)},e.prototype.onDeactivateEvent=function(){this.renderable&&this.renderable.onDeactivateEvent&&this.renderable.onDeactivateEvent()},Object.defineProperties(e.prototype,i),e}(Cl);function Rp(t,e,i){var o="melonJS: %s is deprecated since version %s, please use %s",n=(new Error).stack;console.groupCollapsed?console.groupCollapsed("%c"+o,"font-weight:normal;color:yellow;",t,i,e):console.warn(o,t,i,e),void 0!==n&&console.warn(n),console.groupCollapsed&&console.groupEnd()}Object.defineProperty(Ja.prototype,"Texture",{get:function(){return Rp("me.video.renderer.Texture","me.TextureAtlas","10.4.0"),dc}});var Bp=function(t){function e(e,i,o){Rp("DraggableEntity","Draggable","10.5.0"),t.call(this,e,i,o.width,o.height)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Cp),Dp=function(t){function e(e,i,o){Rp("DroptargetEntity","DropTarget","10.5.0"),t.call(this,e,i,o.width,o.height)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Mp);Ja.prototype.getScreenCanvas=function(){return Rp("getScreenCanvas","getCanvas","13.1.0"),this.getCanvas()},Ja.prototype.getScreenContext=function(){return Rp("getScreenContext","getContext","13.1.0"),this.getContext()};var Lp="13.1.0";t.initialized=!1;function zp(){!0!==t.initialized&&(qn.register("me.Entity",kp),qn.register("me.Collectable",Ap),qn.register("me.Trigger",Ep),qn.register("me.Light2d",Sp),qn.register("me.Tween",op,!0),qn.register("me.Color",nr,!0),qn.register("me.Particle",Ip,!0),qn.register("me.Sprite",cc),qn.register("me.NineSliceSprite",wp),qn.register("me.Renderable",Cl),qn.register("me.Text",dp,!0),qn.register("me.BitmapText",fp),qn.register("me.BitmapTextData",xp,!0),qn.register("me.ImageLayer",bp),qn.register("me.ColorLayer",_p,!0),qn.register("me.Vector2d",Kn,!0),qn.register("me.Vector3d",vh,!0),qn.register("me.ObservableVector2d",gh,!0),qn.register("me.ObservableVector3d",mh,!0),qn.register("me.Matrix2d",hr,!0),qn.register("me.Matrix3d",sr,!0),qn.register("me.Rect",Ha,!0),qn.register("me.RoundRect",Ya,!0),qn.register("me.Polygon",Xa,!0),qn.register("me.Line",qa,!0),qn.register("me.Ellipse",Wa,!0),qn.register("me.Bounds",Ka,!0),qn.register("Entity",kp),qn.register("Collectable",Ap),qn.register("Trigger",Ep),qn.register("Light2d",Sp),qn.register("Tween",op,!0),qn.register("Color",nr,!0),qn.register("Particle",Ip,!0),qn.register("Sprite",cc),qn.register("NineSliceSprite",wp),qn.register("Renderable",Cl),qn.register("Text",dp,!0),qn.register("BitmapText",fp),qn.register("BitmapTextData",xp,!0),qn.register("ImageLayer",bp),qn.register("ColorLayer",_p,!0),qn.register("Vector2d",Kn,!0),qn.register("Vector3d",vh,!0),qn.register("ObservableVector2d",gh,!0),qn.register("ObservableVector3d",mh,!0),qn.register("Matrix2d",hr,!0),qn.register("Matrix3d",sr,!0),qn.register("Rect",Ha,!0),qn.register("RoundRect",Ya,!0),qn.register("Polygon",Xa,!0),qn.register("Line",qa,!0),qn.register("Ellipse",Wa,!0),qn.register("Bounds",Ka,!0),qn.register("CanvasTexture",sp,!0),Wr(dr),uc.setNocache(Hc.getUriFragment().nocache||!1),Mh(),t.initialized=!0)}Qs((function(){zp()})),t.BitmapText=fp,t.BitmapTextData=xp,t.Body=Nl,t.Bounds=Ka,t.Camera2d=ou,t.CanvasRenderer=Mu,t.Collectable=Ap,t.Color=nr,t.ColorLayer=_p,t.Container=Hl,t.Draggable=Cp,t.DraggableEntity=Bp,t.DropTarget=Mp,t.DroptargetEntity=Dp,t.Ellipse=Wa,t.Entity=kp,t.GLShader=da,t.GUI_Object=Tp,t.ImageLayer=bp,t.Light2d=Sp,t.Line=qa,t.Math=Ln,t.Matrix2d=hr,t.Matrix3d=sr,t.NineSliceSprite=wp,t.ObservableVector2d=gh,t.ObservableVector3d=mh,t.Particle=Ip,t.ParticleEmitter=Op,t.ParticleEmitterSettings=Pp,t.Pointer=Rh,t.Polygon=Xa,t.QuadTree=Kl,t.Rect=Ha,t.Renderable=Cl,t.Renderer=Ja,t.RoundRect=Ya,t.Sprite=cc,t.Stage=ru,t.TMXHexagonalRenderer=Lu,t.TMXIsometricRenderer=Ru,t.TMXLayer=Ou,t.TMXOrthogonalRenderer=ku,t.TMXRenderer=Iu,t.TMXStaggeredRenderer=zu,t.TMXTileMap=Gu,t.TMXTileset=Fu,t.TMXTilesetGroup=Vu,t.Text=dp,t.TextureAtlas=dc,t.Tile=Cu,t.Trigger=Ep,t.Tween=op,t.Vector2d=Kn,t.Vector3d=vh,t.WebGLCompositor=ga,t.WebGLRenderer=Oc,t.World=Zl,t.audio=yh,t.boot=zp,t.collision=Ul,t.device=ha,t.event=Qr,t.game=Jl,t.input=Sl,t.level=qu,t.loader=uc,t.plugin=tp,t.plugins=$c,t.pool=qn,t.save=es,t.skipAutoInit=!1,t.state=_u,t.timer=qc,t.utils=Hc,t.version=Lp,t.video=Nc,t.warning=Rp,Object.defineProperty(t,"__esModule",{value:!0})})); \ No newline at end of file +function(){var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var e=this;if(!e.ctx||!e.ctx.listener)return e;for(var i=e._howls.length-1;i>=0;i--)e._howls[i].stereo(t);return e},HowlerGlobal.prototype.pos=function(t,e,i){var o=this;return o.ctx&&o.ctx.listener?(e="number"!=typeof e?o._pos[1]:e,i="number"!=typeof i?o._pos[2]:i,"number"!=typeof t?o._pos:(o._pos=[t,e,i],void 0!==o.ctx.listener.positionX?(o.ctx.listener.positionX.setTargetAtTime(o._pos[0],Howler.ctx.currentTime,.1),o.ctx.listener.positionY.setTargetAtTime(o._pos[1],Howler.ctx.currentTime,.1),o.ctx.listener.positionZ.setTargetAtTime(o._pos[2],Howler.ctx.currentTime,.1)):o.ctx.listener.setPosition(o._pos[0],o._pos[1],o._pos[2]),o)):o},HowlerGlobal.prototype.orientation=function(t,e,i,o,n,r){var s=this;if(!s.ctx||!s.ctx.listener)return s;var a=s._orientation;return e="number"!=typeof e?a[1]:e,i="number"!=typeof i?a[2]:i,o="number"!=typeof o?a[3]:o,n="number"!=typeof n?a[4]:n,r="number"!=typeof r?a[5]:r,"number"!=typeof t?a:(s._orientation=[t,e,i,o,n,r],void 0!==s.ctx.listener.forwardX?(s.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),s.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),s.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),s.ctx.listener.upX.setTargetAtTime(o,Howler.ctx.currentTime,.1),s.ctx.listener.upY.setTargetAtTime(n,Howler.ctx.currentTime,.1),s.ctx.listener.upZ.setTargetAtTime(r,Howler.ctx.currentTime,.1)):s.ctx.listener.setOrientation(t,e,i,o,n,r),s)},Howl.prototype.init=(t=Howl.prototype.init,function(e){var i=this;return i._orientation=e.orientation||[1,0,0],i._stereo=e.stereo||null,i._pos=e.pos||null,i._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},i._onstereo=e.onstereo?[{fn:e.onstereo}]:[],i._onpos=e.onpos?[{fn:e.onpos}]:[],i._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,i){var o=this;if(!o._webAudio)return o;if("loaded"!==o._state)return o._queue.push({event:"stereo",action:function(){o.stereo(t,i)}}),o;var n=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===i){if("number"!=typeof t)return o._stereo;o._stereo=t,o._pos=[t,0,0]}for(var r=o._getSoundIds(i),s=0;s3)throw new Error("melonJS: failed loading "+t);th[t].load()};function rh(){return!$a.Howler.noAudio}function sh(t,e,i,o){var n=[];if(0===oh.length)throw new Error("target audio extension(s) should be set through me.audio.init() before calling the preloader.");if(!0===vn(t.src))n.push(t.src);else for(var r=0;r0;)e[i]=arguments[i+1];var o=th[t];if(o&&void 0!==o)return o.seek.apply(o,e);throw new Error("audio clip "+t+" does not exist")},rate:function(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];var o=th[t];if(o&&void 0!==o)return o.rate.apply(o,e);throw new Error("audio clip "+t+" does not exist")},stop:function(t,e){if(void 0!==t){var i=th[t];if(!i||void 0===i)throw new Error("audio clip "+t+" does not exist");i.stop(e),i.off("end",void 0,e)}else $a.Howler.stop()},pause:function(t,e){var i=th[t];if(!i||void 0===i)throw new Error("audio clip "+t+" does not exist");i.pause(e)},resume:function(t,e){var i=th[t];if(!i||void 0===i)throw new Error("audio clip "+t+" does not exist");i.play(e)},playTrack:function(t,e){return ah(eh=t,!0,null,e)},stopTrack:function(){null!==eh&&(th[eh].stop(),eh=null)},pauseTrack:hh,resumeTrack:lh,getCurrentTrack:function(){return eh},setVolume:function(t){$a.Howler.volume(t)},getVolume:function(){return $a.Howler.volume()},mute:uh,unmute:function(t,e){uh(t,e,!1)},muteAll:ch,unmuteAll:ph,muted:function(){return $a.Howler._muted},unload:dh,unloadAll:fh}),gh=function(t){function e(e,i,o){if(void 0===e&&(e=0),void 0===i&&(i=0),t.call(this,e,i),void 0===o)throw new Error("undefined `onUpdate` callback");this.setCallback(o.onUpdate,o.scope)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={x:{configurable:!0},y:{configurable:!0}};return e.prototype.onResetEvent=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),this.setMuted(t,e),void 0!==i&&this.setCallback(i.onUpdate,i.scope),this},i.x.get=function(){return this._x},i.x.set=function(t){var e=this.onUpdate.call(this.scope,t,this._y,this._x,this._y);this._x=e&&"x"in e?e.x:t},i.y.get=function(){return this._y},i.y.set=function(t){var e=this.onUpdate.call(this.scope,this._x,t,this._x,this._y);this._y=e&&"y"in e?e.y:t},e.prototype._set=function(t,e){var i=this.onUpdate.call(this.scope,t,e,this._x,this._y);return i&&"x"in i&&"y"in i?(this._x=i.x,this._y=i.y):(this._x=t,this._y=e),this},e.prototype.setMuted=function(t,e){return this._x=t,this._y=e,this},e.prototype.setCallback=function(t,e){if(void 0===e&&(e=null),"function"!=typeof t)throw new Error("invalid `onUpdate` callback");return this.onUpdate=t,this.scope=e,this},e.prototype.add=function(t){return this._set(this._x+t.x,this._y+t.y)},e.prototype.sub=function(t){return this._set(this._x-t.x,this._y-t.y)},e.prototype.scale=function(t,e){return this._set(this._x*t,this._y*(void 0!==e?e:t))},e.prototype.scaleV=function(t){return this._set(this._x*t.x,this._y*t.y)},e.prototype.div=function(t){return this._set(this._x/t,this._y/t)},e.prototype.abs=function(){return this._set(this._x<0?-this._x:this._x,this._y<0?-this._y:this._y)},e.prototype.clamp=function(t,i){return new e(In(this.x,t,i),In(this.y,t,i),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.clampSelf=function(t,e){return this._set(In(this._x,t,e),In(this._y,t,e))},e.prototype.minV=function(t){return this._set(this._xt.x?this._x:t.x,this._y>t.y?this._y:t.y)},e.prototype.floor=function(){return new e(Math.floor(this._x),Math.floor(this._y),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.floorSelf=function(){return this._set(Math.floor(this._x),Math.floor(this._y))},e.prototype.ceil=function(){return new e(Math.ceil(this._x),Math.ceil(this._y),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.ceilSelf=function(){return this._set(Math.ceil(this._x),Math.ceil(this._y))},e.prototype.negate=function(){return new e(-this._x,-this._y,{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.negateSelf=function(){return this._set(-this._x,-this._y)},e.prototype.copy=function(t){return this._set(t.x,t.y)},e.prototype.equals=function(t){return this._x===t.x&&this._y===t.y},e.prototype.perp=function(){return this._set(this._y,-this._x)},e.prototype.rotate=function(t,e){var i=0,o=0;"object"==typeof e&&(i=e.x,o=e.y);var n=this._x-i,r=this._y-o,s=Math.cos(t),a=Math.sin(t);return this._set(n*s-r*a+i,n*a+r*s+o)},e.prototype.dot=function(t){return this._x*t.x+this._y*t.y},e.prototype.cross=function(t){return this._x*t.y-this._y*t.x},e.prototype.lerp=function(t,e){return this._set(this._x+(t.x-this._x)*e,this._y+(t.y-this._y)*e)},e.prototype.moveTowards=function(t,e){var i=Math.atan2(t.y-this._y,t.x-this._x),o=this.distance(t);return 0===o||e>=0&&o<=e*e?t:(this._x+=Math.cos(i)*e,this._y+=Math.sin(i)*e,this)},e.prototype.distance=function(t){return Math.sqrt((this._x-t.x)*(this._x-t.x)+(this._y-t.y)*(this._y-t.y))},e.prototype.clone=function(){return qn.pull("ObservableVector2d",this._x,this._y,{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.toVector2d=function(){return qn.pull("Vector2d",this._x,this._y)},e.prototype.toString=function(){return"x:"+this._x+",y:"+this._y},Object.defineProperties(e.prototype,i),e}(Kn),vh=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.onResetEvent(t,e,i)};vh.prototype.onResetEvent=function(t,e,i){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i,this},vh.prototype._set=function(t,e,i){return void 0===i&&(i=0),this.x=t,this.y=e,this.z=i,this},vh.prototype.set=function(t,e,i){if(t!==+t||e!==+e||void 0!==i&&i!==+i)throw new Error("invalid x, y, z parameters (not a number)");return this._set(t,e,i)},vh.prototype.setZero=function(){return this.set(0,0,0)},vh.prototype.setV=function(t){return this._set(t.x,t.y,t.z)},vh.prototype.add=function(t){return this._set(this.x+t.x,this.y+t.y,this.z+(t.z||0))},vh.prototype.sub=function(t){return this._set(this.x-t.x,this.y-t.y,this.z-(t.z||0))},vh.prototype.scale=function(t,e,i){return e=void 0!==e?e:t,this._set(this.x*t,this.y*e,this.z*(i||1))},vh.prototype.scaleV=function(t){return this.scale(t.x,t.y,t.z)},vh.prototype.toIso=function(){return this._set(this.x-this.y,.5*(this.x+this.y),this.z)},vh.prototype.to2d=function(){return this._set(this.y+this.x/2,this.y-this.x/2,this.z)},vh.prototype.div=function(t){return this._set(this.x/t,this.y/t,this.z/t)},vh.prototype.abs=function(){return this._set(this.x<0?-this.x:this.x,this.y<0?-this.y:this.y,this.z<0?-this.z:this.z)},vh.prototype.clamp=function(t,e){return new vh(In(this.x,t,e),In(this.y,t,e),In(this.z,t,e))},vh.prototype.clampSelf=function(t,e){return this._set(In(this.x,t,e),In(this.y,t,e),In(this.z,t,e))},vh.prototype.minV=function(t){var e=t.z||0;return this._set(this.xt.x?this.x:t.x,this.y>t.y?this.y:t.y,this.z>e?this.z:e)},vh.prototype.floor=function(){return new vh(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))},vh.prototype.floorSelf=function(){return this._set(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))},vh.prototype.ceil=function(){return new vh(Math.ceil(this.x),Math.ceil(this.y),Math.ceil(this.z))},vh.prototype.ceilSelf=function(){return this._set(Math.ceil(this.x),Math.ceil(this.y),Math.ceil(this.z))},vh.prototype.negate=function(){return new vh(-this.x,-this.y,-this.z)},vh.prototype.negateSelf=function(){return this._set(-this.x,-this.y,-this.z)},vh.prototype.copy=function(t){return this._set(t.x,t.y,t.z||0)},vh.prototype.equals=function(){var t,e,i;return arguments.length>=2?(t=arguments[0],e=arguments[1],i=arguments[2]):(t=arguments[0].x,e=arguments[0].y,i=arguments[0].z),void 0===i&&(i=this.z),this.x===t&&this.y===e&&this.z===i},vh.prototype.normalize=function(){return this.div(this.length()||1)},vh.prototype.perp=function(){return this._set(this.y,-this.x,this.z)},vh.prototype.rotate=function(t,e){var i=0,o=0;"object"==typeof e&&(i=e.x,o=e.y);var n=this.x-i,r=this.y-o,s=Math.cos(t),a=Math.sin(t);return this._set(n*s-r*a+i,n*a+r*s+o,this.z)},vh.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*(void 0!==t.z?t.z:this.z)},vh.prototype.cross=function(t){var e=this.x,i=this.y,o=this.z,n=t.x,r=t.y,s=t.z;return this.x=i*s-o*r,this.y=o*n-e*s,this.z=e*r-i*n,this},vh.prototype.length2=function(){return this.dot(this)},vh.prototype.length=function(){return Math.sqrt(this.length2())},vh.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},vh.prototype.moveTowards=function(t,e){var i=Math.atan2(t.y-this.y,t.x-this.x),o=this.x-t.x,n=this.y-t.y,r=Math.sqrt(o*o+n*n);return 0===r||e>=0&&r<=e*e?t:(this.x+=Math.cos(i)*e,this.y+=Math.sin(i)*e,this)},vh.prototype.distance=function(t){var e=this.x-t.x,i=this.y-t.y,o=this.z-(t.z||0);return Math.sqrt(e*e+i*i+o*o)},vh.prototype.angle=function(t){return Math.acos(In(this.dot(t)/(this.length()*t.length()),-1,1))},vh.prototype.project=function(t){var e=this.dot(t)/t.length2();return this.scale(e,e,e)},vh.prototype.projectN=function(t){var e=this.dot(t)/t.length2();return this.scale(e,e,e)},vh.prototype.clone=function(){return qn.pull("Vector3d",this.x,this.y,this.z)},vh.prototype.toString=function(){return"x:"+this.x+",y:"+this.y+",z:"+this.z};var mh=function(t){function e(e,i,o,n){if(void 0===e&&(e=0),void 0===i&&(i=0),void 0===o&&(o=0),t.call(this,e,i,o),void 0===n)throw new Error("undefined `onUpdate` callback");this.setCallback(n.onUpdate,n.scope)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={x:{configurable:!0},y:{configurable:!0},z:{configurable:!0}};return e.prototype.onResetEvent=function(t,e,i,o){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.setMuted(t,e,i),void 0!==o&&this.setCallback(o.onUpdate,o.scope),this},i.x.get=function(){return this._x},i.x.set=function(t){var e=this.onUpdate.call(this.scope,t,this._y,this._z,this._x,this._y,this._z);this._x=e&&"x"in e?e.x:t},i.y.get=function(){return this._y},i.y.set=function(t){var e=this.onUpdate.call(this.scope,this._x,t,this._z,this._x,this._y,this._z);this._y=e&&"y"in e?e.y:t},i.z.get=function(){return this._z},i.z.set=function(t){var e=this.onUpdate.call(this.scope,this._x,this._y,t,this._x,this._y,this._z);this._z=e&&"z"in e?e.z:t},e.prototype._set=function(t,e,i){var o=this.onUpdate.call(this.scope,t,e,i,this._x,this._y,this._z);return o&&"x"in o&&"y"in o&&"z"in o?(this._x=o.x,this._y=o.y,this._z=o.z):(this._x=t,this._y=e,this._z=i||0),this},e.prototype.setMuted=function(t,e,i){return this._x=t,this._y=e,this._z=i||0,this},e.prototype.setCallback=function(t,e){if(void 0===e&&(e=null),"function"!=typeof t)throw new Error("invalid `onUpdate` callback");return this.onUpdate=t,this.scope=e,this},e.prototype.add=function(t){return this._set(this._x+t.x,this._y+t.y,this._z+(t.z||0))},e.prototype.sub=function(t){return this._set(this._x-t.x,this._y-t.y,this._z-(t.z||0))},e.prototype.scale=function(t,e,i){return e=void 0!==e?e:t,this._set(this._x*t,this._y*e,this._z*(i||1))},e.prototype.scaleV=function(t){return this._set(this._x*t.x,this._y*t.y,this._z*(t.z||1))},e.prototype.div=function(t){return this._set(this._x/t,this._y/t,this._z/t)},e.prototype.abs=function(){return this._set(this._x<0?-this._x:this._x,this._y<0?-this._y:this._y,this._Z<0?-this._z:this._z)},e.prototype.clamp=function(t,i){return new e(In(this._x,t,i),In(this._y,t,i),In(this._z,t,i),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.clampSelf=function(t,e){return this._set(In(this._x,t,e),In(this._y,t,e),In(this._z,t,e))},e.prototype.minV=function(t){var e=t.z||0;return this._set(this._xt.x?this._x:t.x,this._y>t.y?this._y:t.y,this._z>e?this._z:e)},e.prototype.floor=function(){return new e(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.floorSelf=function(){return this._set(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))},e.prototype.ceil=function(){return new e(Math.ceil(this._x),Math.ceil(this._y),Math.ceil(this._z),{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.ceilSelf=function(){return this._set(Math.ceil(this._x),Math.ceil(this._y),Math.ceil(this._z))},e.prototype.negate=function(){return new e(-this._x,-this._y,-this._z,{onUpdate:this.onUpdate,scope:this.scope})},e.prototype.negateSelf=function(){return this._set(-this._x,-this._y,-this._z)},e.prototype.copy=function(t){return this._set(t.x,t.y,t.z||0)},e.prototype.equals=function(t){return this._x===t.x&&this._y===t.y&&this._z===(t.z||this._z)},e.prototype.perp=function(){return this._set(this._y,-this._x,this._z)},e.prototype.rotate=function(t,e){var i=0,o=0;"object"==typeof e&&(i=e.x,o=e.y);var n=this.x-i,r=this.y-o,s=Math.cos(t),a=Math.sin(t);return this._set(n*s-r*a+i,n*a+r*s+o,this.z)},e.prototype.dot=function(t){return this._x*t.x+this._y*t.y+this._z*(t.z||1)},e.prototype.cross=function(t){var e=this._x,i=this._y,o=this._z,n=t.x,r=t.y,s=t.z;return this._set(i*s-o*r,o*n-e*s,e*r-i*n)},e.prototype.lerp=function(t,e){return this._set(this._x+(t.x-this._x)*e,this._y+(t.y-this._y)*e,this._z+(t.z-this._z)*e)},e.prototype.moveTowards=function(t,e){var i=Math.atan2(t.y-this._y,t.x-this._x),o=this._x-t.x,n=this._y-t.y,r=Math.sqrt(o*o+n*n);return 0===r||e>=0&&r<=e*e?t:this._set(this._x+Math.cos(i)*e,this._y+Math.sin(i)*e,this._z)},e.prototype.distance=function(t){var e=this._x-t.x,i=this._y-t.y,o=this._z-(t.z||0);return Math.sqrt(e*e+i*i+o*o)},e.prototype.clone=function(){return qn.pull("ObservableVector3d",this._x,this._y,this._z,{onUpdate:this.onUpdate})},e.prototype.toVector3d=function(){return qn.pull("Vector3d",this._x,this._y,this._z)},e.prototype.toString=function(){return"x:"+this._x+",y:"+this._y+",z:"+this._z},Object.defineProperties(e.prototype,i),e}(vh),xh={},_h={},bh={},wh={},Th={},Ah={},Eh=function(t,e,i){e=e||t.keyCode||t.button;var o=Ah[e];if(Wr(Or,o,e,!o||!bh[o]),o){if(!bh[o]){var n=void 0!==i?i:e;wh[o][n]||(xh[o]++,wh[o][n]=!0)}return!Th[e]||"function"!=typeof t.preventDefault||t.preventDefault()}return!0},Sh=function(t,e,i){e=e||t.keyCode||t.button;var o=Ah[e];if(Wr(Ir,o,e),o){var n=void 0!==i?i:e;return wh[o][n]=void 0,xh[o]>0&&xh[o]--,bh[o]=!1,!Th[e]||"function"!=typeof t.preventDefault||t.preventDefault()}return!0},Ch=null;function Mh(){null===Ch&&!1===vs&&"function"==typeof(Ch=globalThis).addEventListener&&(Ch.addEventListener("keydown",Eh,!1),Ch.addEventListener("keyup",Sh,!1))}function Ph(t,e,i){!0===e?Eh({},t,i):Sh({},t,i)}function Oh(t){return Ah[t]}var Ih,kh=new Kn,Rh=function(t){function e(e,i,o,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===o&&(o=1),void 0===n&&(n=1),t.call(this),this.setMinMax(e,i,e+o,i+n),this.LEFT=0,this.MIDDLE=1,this.RIGHT=2,this.event=void 0,this.type=void 0,this.button=0,this.isPrimary=!1,this.pageX=0,this.pageY=0,this.clientX=0,this.clientY=0,this.movementX=0,this.movementY=0,this.deltaMode=0,this.deltaX=0,this.deltaY=0,this.deltaZ=0,this.gameX=0,this.gameY=0,this.gameScreenX=0,this.gameScreenY=0,this.gameWorldX=0,this.gameWorldY=0,this.gameLocalX=0,this.gameLocalY=0,this.pointerId=void 0,this.isNormalized=!1,this.locked=!1,this.bind=[0,0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEvent=function(t,e,i,o,n,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===n&&(n=0),void 0===r&&(r=1),this.event=t,this.pageX=e,this.pageY=i,this.clientX=o,this.clientY=n,ul(this.pageX,this.pageY,kh),this.gameScreenX=this.x=kh.x,this.gameScreenY=this.y=kh.y,this.isNormalized=void 0!==globalThis.PointerEvent&&!(t instanceof globalThis.PointerEvent),this.locked=ll,this.movementX=t.movementX||0,this.movementY=t.movementY||0,"wheel"===t.type?(this.deltaMode=t.deltaMode||0,this.deltaX=t.deltaX||0,this.deltaY=t.deltaY||0,this.deltaZ=t.deltaZ||0):(this.deltaMode=0,this.deltaX=0,this.deltaY=0,this.deltaZ=0),this.pointerId=r,this.isPrimary=void 0===t.isPrimary||t.isPrimary,this.button=t.button||0,this.type=t.type,void 0!==Jl.viewport&&Jl.viewport.localToWorld(this.gameScreenX,this.gameScreenY,kh),this.gameWorldX=kh.x,this.gameWorldY=kh.y,!1===this.isNormalized?(this.width=t.width||1,this.height=t.height||1):"number"==typeof t.radiusX?(this.width=2*t.radiusX||1,this.height=2*t.radiusY||1):this.width=this.height=1},e}(Ka),Bh=[],Dh=new Map,Lh=!1,zh=0,Fh=[],Vh=["wheel"],jh=["pointermove","mousemove","touchmove"],Uh=["pointerdown","mousedown","touchstart"],Nh=["pointerup","mouseup","touchend"],Gh=["pointercancel","mousecancel","touchcancel"],Xh=["pointerenter","mouseenter","touchenter"],Hh=["pointerover","mouseover","touchover"],Yh=["pointerleave","mouseleave","touchleave"],Wh=[Vh[0],jh[0],Uh[0],Nh[0],Gh[0],Xh[0],Hh[0],Yh[0]],qh=[Vh[0],jh[1],Uh[1],Nh[1],Gh[1],Xh[1],Hh[1],Yh[1]],Kh=[jh[2],Uh[2],Nh[2],Gh[2],Xh[2],Hh[2],Yh[2]],Zh={wheel:Vh,pointermove:jh,pointerdown:Uh,pointerup:Nh,pointercancel:Gh,pointerenter:Xh,pointerover:Hh,pointerleave:Yh},Qh=[];function Jh(){if(!Lh){Ih=new Ha(0,0,1,1);for(var t=0;t=0&&(n=t.callbacks[e][r]);r--)if(!1===n(i))return!0}return!1}function il(t){for(var e=!1;t.length>0;){var i=t.pop();if(Bh.push(i),!0===i.isNormalized&&void 0!==i.event.timeStamp){if(i.event.timeStamp0;)n.callbacks[t].pop();0===n.callbacks[t].length&&delete n.callbacks[t]}0===Object.keys(n.callbacks).length&&Dh.delete(e)}}function fl(t){if(Dh.has(t))for(var e=0;e0?i===this.GAMEPAD.BUTTONS.L2?Math.max(0,t-2e4)/111070:(t-1)/131070:(65536+t)/131070+.5}var vl=/^([0-9a-f]{1,4})-([0-9a-f]{1,4})-/i,ml=/^0+/;function xl(t,e){var i=t.replace(vl,(function(t,e,i){return"000".slice(e.length-1)+e+"-"+"000".slice(i.length-1)+i+"-"})),o=t.replace(vl,(function(t,e,i){return e.replace(ml,"")+"-"+i.replace(ml,"")+"-"}));e.analog=e.analog||e.buttons.map((function(){return-1})),e.normalize_fn=e.normalize_fn||function(t){return t},wl.set(i,e),wl.set(o,e)}var _l,bl={},wl=new Map;[["45e-28e-Xbox 360 Wired Controller",{axes:[0,1,3,4],buttons:[11,12,13,14,8,9,-1,-1,5,4,6,7,0,1,2,3,10],analog:[-1,-1,-1,-1,-1,-1,2,5,-1,-1,-1,-1,-1,-1,-1,-1,-1],normalize_fn:function(t,e,i){return i===this.GAMEPAD.BUTTONS.L2||i===this.GAMEPAD.BUTTONS.R2?(t+1)/2:t}}],["54c-268-PLAYSTATION(R)3 Controller",{axes:[0,1,2,3],buttons:[14,13,15,12,10,11,8,9,0,3,1,2,4,6,7,5,16]}],["54c-5c4-Wireless Controller",{axes:[0,1,2,3],buttons:[1,0,2,3,4,5,6,7,8,9,10,11,14,15,16,17,12,13]}],["2836-1-OUYA Game Controller",{axes:[0,3,7,9],buttons:[3,6,4,5,7,8,15,16,-1,-1,9,10,11,12,13,14,-1],analog:[-1,-1,-1,-1,-1,-1,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1],normalize_fn:gl}],["OUYA Game Controller (Vendor: 2836 Product: 0001)",{axes:[0,1,3,4],buttons:[0,3,1,2,4,5,12,13,-1,-1,6,7,8,9,10,11,-1],analog:[-1,-1,-1,-1,-1,-1,2,5,-1,-1,-1,-1,-1,-1,-1,-1,-1],normalize_fn:gl}]].forEach((function(t){xl(t[0],t[1])}));var Tl=function(){var t=navigator.getGamepads();Object.keys(bl).forEach((function(e){var i=t[e];if(i){var o=null;"standard"!==i.mapping&&(o=wl.get(i.id));var n=bl[e];Object.keys(n.buttons).forEach((function(t){var r=n.buttons[t],s=t,a=-1;if(!(o&&(s=o.buttons[t],a=o.analog[t],s<0&&a<0))){var h=i.buttons[s]||{};if(o&&a>=0){var l=o.normalize_fn(i.axes[a],-1,+t);h={value:l,pressed:h.pressed||Math.abs(l)>=yl}}Wr(Br,e,"buttons",+t,h),!r.pressed&&h.pressed?Ph(r.keyCode,!0,s+256):r.pressed&&!h.pressed&&Ph(r.keyCode,!1,s+256),r.value=h.value,r.pressed=h.pressed}})),Object.keys(n.axes).forEach((function(t){var r=n.axes[t],s=t;if(!(o&&(s=o.axes[t])<0)){var a=i.axes[s];if(void 0!==a){o&&(a=o.normalize_fn(a,+t,-1));var h=Math.sign(a)||1;if(0!==r[h].keyCode){var l=Math.abs(a)>=yl+Math.abs(r[h].threshold);Wr(Br,e,"axes",+t,a),!r[h].pressed&&l?(r[-h].pressed&&(Ph(r[-h].keyCode,!1,s+256),r[-h].value=0,r[-h].pressed=!1),Ph(r[h].keyCode,!0,s+256)):!r[h].pressed&&!r[-h].pressed||l||Ph(r[h=r[h].pressed?h:-h].keyCode,!1,s+256),r[h].value=a,r[h].pressed=l}}}}))}}))};globalThis.navigator&&"function"==typeof globalThis.navigator.getGamepads&&(globalThis.addEventListener("gamepadconnected",(function(t){Wr(kr,t.gamepad)}),!1),globalThis.addEventListener("gamepaddisconnected",(function(t){Wr(Rr,t.gamepad)}),!1));for(var Al=xl,El=!0,Sl=Object.freeze({__proto__:null,preventDefault:El,get pointerEventTarget(){return al},pointer:hl,get locked(){return ll},get throttlingInterval(){return sl},globalToLocal:ul,setTouchAction:cl,bindPointer:function(){var t=arguments.length<2?hl.LEFT:arguments[0],e=arguments.length<2?arguments[0]:arguments[1];if(Jh(),!Oh(e))throw new Error("no action defined for keycode "+e);hl.bind[t]=e},unbindPointer:function(t){hl.bind[void 0===t?hl.LEFT:t]=null},registerPointerEvent:pl,releasePointerEvent:dl,releaseAllPointerEvents:fl,requestPointerLock:function(){return!!Is&&(jc().requestPointerLock(),!0)},exitPointerLock:function(){return!!Is&&(document.exitPointerLock(),!0)},get keyBoardEventTarget(){return Ch},KEY:{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:42,INSERT:45,DELETE:46,NUM0:48,NUM1:49,NUM2:50,NUM3:51,NUM4:52,NUM5:53,NUM6:54,NUM7:55,NUM8:56,NUM9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,WINDOW_KEY:91,NUMPAD0:96,NUMPAD1:97,NUMPAD2:98,NUMPAD3:99,NUMPAD4:100,NUMPAD5:101,NUMPAD6:102,NUMPAD7:103,NUMPAD8:104,NUMPAD9:105,MULTIPLY:106,ADD:107,SUBSTRACT:109,DECIMAL:110,DIVIDE:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,TILDE:126,NUM_LOCK:144,SCROLL_LOCK:145,SEMICOLON:186,PLUS:187,COMMA:188,MINUS:189,PERIOD:190,FORWAND_SLASH:191,GRAVE_ACCENT:192,OPEN_BRACKET:219,BACK_SLASH:220,CLOSE_BRACKET:221,SINGLE_QUOTE:222},initKeyboardEvent:Mh,isKeyPressed:function(t){return!(!xh[t]||bh[t])&&(_h[t]&&(bh[t]=!0),!0)},keyStatus:function(t){return xh[t]>0},triggerKeyEvent:Ph,bindKey:function(t,e,i,o){void 0===o&&(o=El),Ah[t]=e,Th[t]=o,xh[e]=0,_h[e]=i||!1,bh[e]=!1,wh[e]={}},getBindingKey:Oh,unlockKey:function(t){bh[t]=!1},unbindKey:function(t){var e=Ah[t];xh[e]=0,_h[e]=!1,wh[e]={},Ah[t]=null,Th[t]=null},GAMEPAD:{AXES:{LX:0,LY:1,RX:2,RY:3,EXTRA_1:4,EXTRA_2:5,EXTRA_3:6,EXTRA_4:7},BUTTONS:{FACE_1:0,FACE_2:1,FACE_3:2,FACE_4:3,L1:4,R1:5,L2:6,R2:7,SELECT:8,BACK:8,START:9,FORWARD:9,L3:10,R3:11,UP:12,DOWN:13,LEFT:14,RIGHT:15,HOME:16,EXTRA_1:17,EXTRA_2:18,EXTRA_3:19,EXTRA_4:20}},bindGamepad:function(t,e,i){if(!Oh(i))throw new Error("no action defined for keycode "+i);void 0===_l&&"function"==typeof navigator.getGamepads&&(_l=qr(wr,Tl)),bl[t]||(bl[t]={axes:{},buttons:{}});var o={keyCode:i,value:0,pressed:!1,threshold:e.threshold},n=bl[t][e.type];if("buttons"===e.type)n[e.code]=o;else if("axes"===e.type){var r=Math.sign(e.threshold)||1;n[e.code]||(n[e.code]={});var s=n[e.code];s[r]=o,s[-r]||(s[-r]={keyCode:0,value:0,pressed:!1,threshold:-r})}},unbindGamepad:function(t,e){if(!bl[t])throw new Error("no bindings for gamepad "+t);bl[t].buttons[e]={}},setGamepadDeadzone:function(t){yl=t},setGamepadMapping:Al}),Cl=function(t){function e(e,i,o,n){t.call(this,e,i,o,n),this.isRenderable=!0,this.isKinematic=!0,this.body=void 0,void 0===this.currentTransform&&(this.currentTransform=qn.pull("Matrix2d")),this.currentTransform.identity(),this.GUID=void 0,this.onVisibilityChange=void 0,this.alwaysUpdate=!1,this.updateWhenPaused=!1,this.isPersistent=!1,this.floating=!1,this.anchorPoint instanceof gh?this.anchorPoint.setMuted(.5,.5).setCallback(this.onAnchorUpdate,this):this.anchorPoint=qn.pull("ObservableVector2d",.5,.5,{onUpdate:this.onAnchorUpdate,scope:this}),this.autoTransform=!0,this.alpha=1,this.ancestor=void 0,this.mask=void 0,this.tint=qn.pull("Color",255,255,255,1),this.blendMode="normal",this.name="",this.pos instanceof mh?this.pos.setMuted(e,i,0).setCallback(this.updateBoundsPos,this):this.pos=qn.pull("ObservableVector3d",e,i,0,{onUpdate:this.updateBoundsPos,scope:this}),this.isDirty=!1,this._flip={x:!1,y:!1},this._inViewport=!1,this.setOpacity(1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isFloating:{configurable:!0},inViewport:{configurable:!0},isFlippedX:{configurable:!0},isFlippedY:{configurable:!0}};return i.isFloating.get=function(){return!0===this.floating||void 0!==this.ancestor&&!0===this.ancestor.floating},i.inViewport.get=function(){return this._inViewport},i.inViewport.set=function(t){this._inViewport!==t&&(this._inViewport=t,"function"==typeof this.onVisibilityChange&&this.onVisibilityChange.call(this,t))},i.isFlippedX.get=function(){return!0===this._flip.x},i.isFlippedY.get=function(){return!0===this._flip.y},e.prototype.getBounds=function(){return void 0===this._bounds&&(t.prototype.getBounds.call(this),this.isFinite()?this._bounds.setMinMax(this.pos.x,this.pos.y,this.pos.x+this.width,this.pos.y+this.height):this._bounds.setMinMax(this.pos.x,this.pos.y,this.width,this.height)),this._bounds},e.prototype.getOpacity=function(){return this.alpha},e.prototype.setOpacity=function(t){"number"==typeof t&&(this.alpha=In(t,0,1),isNaN(this.alpha)&&(this.alpha=1),this.isDirty=!0)},e.prototype.flipX=function(t){return void 0===t&&(t=!0),this._flip.x=!!t,this.isDirty=!0,this},e.prototype.flipY=function(t){return void 0===t&&(t=!0),this._flip.y=!!t,this.isDirty=!0,this},e.prototype.transform=function(t){return this.currentTransform.multiply(t),this.updateBoundsPos(this.pos.x,this.pos.y),this.isDirty=!0,this},e.prototype.angleTo=function(t){var i,o,n=this.getBounds();if(t instanceof e){var r=t.getBounds();i=r.centerX-n.centerX,o=r.centerY-n.centerY}else i=t.x-n.centerX,o=t.y-n.centerY;return Math.atan2(o,i)},e.prototype.distanceTo=function(t){var i,o,n=this.getBounds();if(t instanceof e){var r=t.getBounds();i=n.centerX-r.centerX,o=n.centerY-r.centerY}else i=n.centerX-t.x,o=n.centerY-t.y;return Math.sqrt(i*i+o*o)},e.prototype.lookAt=function(t){var i;i=t instanceof e?t.pos:t;var o=this.angleTo(i);return this.rotate(o),this},e.prototype.rotate=function(t,e){return isNaN(t)||(this.currentTransform.rotate(t,e),this.isDirty=!0),this},e.prototype.scale=function(e,i){return this.currentTransform.scale(e,i),t.prototype.scale.call(this,e,i),this.isDirty=!0,this},e.prototype.scaleV=function(t){return this.scale(t.x,t.y),this},e.prototype.update=function(t){return this.isDirty},e.prototype.updateBounds=function(){return t.prototype.updateBounds.call(this),this.updateBoundsPos(this.pos.x,this.pos.y),this.getBounds()},e.prototype.updateBoundsPos=function(t,e){var i=this.getBounds();i.shift(t,e),void 0!==this.anchorPoint&&i.isFinite()&&i.translate(-this.anchorPoint.x*i.width,-this.anchorPoint.y*i.height),this.ancestor instanceof Hl&&!0!==this.floating&&i.translate(this.ancestor.getAbsolutePosition()),this.isDirty=!0},e.prototype.getAbsolutePosition=function(){return void 0===this._absPos&&(this._absPos=qn.pull("Vector2d")),this._absPos.set(this.pos.x,this.pos.y),this.ancestor instanceof Hl&&!0!==this.floating&&this._absPos.add(this.ancestor.getAbsolutePosition()),this._absPos},e.prototype.onAnchorUpdate=function(t,e){this.anchorPoint.setMuted(t,e),this.updateBoundsPos(this.pos.x,this.pos.y)},e.prototype.preDraw=function(t){var e=this.getBounds(),i=e.width*this.anchorPoint.x,o=e.height*this.anchorPoint.y;if(t.save(),t.setGlobalAlpha(t.globalAlpha()*this.getOpacity()),this._flip.x||this._flip.y){var n=this._flip.x?this.centerX-i:0,r=this._flip.y?this.centerY-o:0;t.translate(n,r),t.scale(this._flip.x?-1:1,this._flip.y?-1:1),t.translate(-n,-r)}void 0!==this.mask&&(t.translate(this.pos.x,this.pos.y),t.setMask(this.mask),t.translate(-this.pos.x,-this.pos.y)),!0!==this.autoTransform||this.currentTransform.isIdentity()||(t.translate(this.pos.x,this.pos.y),t.transform(this.currentTransform),t.translate(-this.pos.x,-this.pos.y)),t.translate(-i,-o),t.setTint(this.tint,this.getOpacity()),this.blendMode!==t.getBlendMode()&&t.setBlendMode(this.blendMode)},e.prototype.draw=function(t,e){},e.prototype.postDraw=function(t){t.clearTint(),void 0!==this.mask&&t.clearMask(),t.restore(),this.isDirty=!1},e.prototype.onCollision=function(t,e){return!1},e.prototype.destroy=function(){qn.push(this.currentTransform),this.currentTransform=void 0,qn.push(this.anchorPoint),this.anchorPoint=void 0,qn.push(this.pos),this.pos=void 0,void 0!==this._absPos&&(qn.push(this._absPos),this._absPos=void 0),qn.push(this._bounds),this._bounds=void 0,this.onVisibilityChange=void 0,void 0!==this.mask&&(qn.push(this.mask),this.mask=void 0),void 0!==this.tint&&(qn.push(this.tint),this.tint=void 0),this.ancestor=void 0,void 0!==this.body&&(this.body.destroy.apply(this.body,arguments),this.body=void 0),fl(this),this.onDestroyEvent.apply(this,arguments)},e.prototype.onDestroyEvent=function(){},Object.defineProperties(e.prototype,i),e}(Ha),Ml=[],Pl=0;Pl<10;Pl++)Ml.push(new Kn);for(var Ol=[],Il=0;Il<5;Il++)Ol.push([]);function kl(t,e,i){for(var o=Number.MAX_VALUE,n=-Number.MAX_VALUE,r=t.length,s=0;sn&&(n=a)}i[0]=o,i[1]=n}function Rl(t,e,i,o,n,r){var s=Ol.pop(),a=Ol.pop(),h=Ml.pop().copy(e).sub(t),l=h.dot(n);if(kl(i,n,s),kl(o,n,a),a[0]+=l,a[1]+=l,s[0]>a[1]||a[0]>s[1])return Ml.push(h),Ol.push(s),Ol.push(a),!0;if(r){var u=0;if(s[0]a[1])u=s[0]-a[1],r.aInB=!1;else{var d=s[1]-a[0],f=a[1]-s[0];u=di?1:0}function Dl(t,e,i,o,n){for(var r=Ml.pop().copy(i.pos).add(i.ancestor.getAbsolutePosition()).add(o.pos).sub(t.pos).add(t.ancestor.getAbsolutePosition()).sub(e.pos),s=o.radius,a=s*s,h=e.points,l=e.edges,u=l.length,c=Ml.pop(),p=Ml.pop(),d=Ml.pop(),f=0,y=0;ya&&(n.aInB=!1);var _=Bl(c,d),b=!0;if(-1===_){var w=null;if(u>1&&(c.copy(l[v]),1!==(_=Bl(c,w=Ml.pop().copy(r).sub(h[v])))&&(b=!1)),b){if((f=d.length())>s)return Ml.push(r),Ml.push(c),Ml.push(p),Ml.push(d),w&&Ml.push(w),!1;n&&(n.bInA=!1,x=d.normalize(),m=s-f)}w&&Ml.push(w)}else if(1===_){if(u>1&&(c.copy(l[g]),d.copy(r).sub(h[g]),-1!==(_=Bl(c,d))&&(b=!1)),b){if((f=d.length())>s)return Ml.push(r),Ml.push(c),Ml.push(p),Ml.push(d),!1;n&&(n.bInA=!1,x=d.normalize(),m=s-f)}}else{p.copy(e.normals[y]),f=d.dot(p);var T=Math.abs(f);if((1===u||f>0)&&T>s)return Ml.push(r),Ml.push(c),Ml.push(p),Ml.push(d),!1;n&&(x=p,m=s-f,(f>=0||m<2*s)&&(n.bInA=!1))}x&&n&&Math.abs(m)l)return Ml.push(r),!1;if(n){var c=Math.sqrt(u);n.a=t,n.b=i,n.overlap=h-c,n.overlapN.copy(r.normalize()),n.overlapV.copy(r).scale(n.overlap),n.aInB=s<=a&&c<=a-s,n.bInA=a<=s&&c<=s-a}return Ml.push(r),!0},testPolygonEllipse:Dl,testEllipsePolygon:function(t,e,i,o,n){var r=Dl(i,o,t,e,n);if(r&&n){var s=n.a,a=n.aInB;n.overlapN.negateSelf(),n.overlapV.negateSelf(),n.a=n.b,n.b=s,n.aInB=n.bInA,n.bInA=a}return r}}),zl=function(){this.a=null,this.b=null,this.overlapN=new Kn,this.overlapV=new Kn,this.aInB=!0,this.bInA=!0,this.indexShapeA=-1,this.indexShapeB=-1,this.overlap=Number.MAX_VALUE};zl.prototype.clear=function(){return this.aInB=!0,this.bInA=!0,this.overlap=Number.MAX_VALUE,this.indexShapeA=-1,this.indexShapeB=-1,this};var Fl={pos:new Kn(0,0),ancestor:{_absPos:new Kn(0,0),getAbsolutePosition:function(){return this._absPos}}},Vl=new zl;function jl(t,e){return!0!==t.isKinematic&&!0!==e.isKinematic&&"object"==typeof t.body&&"object"==typeof e.body&&!(!0===t.body.isStatic&&!0===e.body.isStatic)&&0!=(t.body.collisionMask&e.body.collisionType)&&0!=(t.body.collisionType&e.body.collisionMask)}var Ul={maxChildren:8,maxDepth:4,types:{NO_OBJECT:0,PLAYER_OBJECT:1,NPC_OBJECT:2,ENEMY_OBJECT:4,COLLECTABLE_OBJECT:8,ACTION_OBJECT:16,PROJECTILE_OBJECT:32,WORLD_SHAPE:64,USER:128,ALL_OBJECT:4294967295},rayCast:function(t,e){return function(t,e){void 0===e&&(e=[]);for(var i,o=0,n=Jl.world.broadphase.retrieve(t),r=n.length;i=n[--r];)if(i.body&&t.getBounds().overlaps(i.getBounds())){var s=i.body.shapes.length;if(0===i.body.shapes.length)continue;var a=t,h=0;do{var l=i.body.getShape(h);Ll["test"+a.shapeType+l.shapeType].call(this,Fl,a,i,l)&&(e[o]=i,o++),h++}while(h0&&(this.vel.x*=-this.bounce)),0!==e.y&&(this.vel.y=~~(.5+this.vel.y-e.y)||0,this.bounce>0&&(this.vel.y*=-this.bounce),!this.ignoreGravity)){var i=!0===this.falling?1:!0===this.jumping?-1:0;this.falling=e.y>=i,this.jumping=e.y<=-i}},Nl.prototype.forEach=function(t,e){var i=this,o=0,n=this.shapes,r=n.length;if("function"!=typeof t)throw new Error(t+" is not a function");for(arguments.length>1&&(i=e);o0){var i=this.friction.x*e,o=this.vel.x+i,n=this.vel.x-i;this.vel.x=o<0?o:n>0?n:0}if(this.friction.y>0){var r=this.friction.y*e,s=this.vel.y+r,a=this.vel.y-r;this.vel.y=s<0?s:a>0?a:0}return 0!==this.vel.y&&(this.vel.y=In(this.vel.y,-this.maxVel.y,this.maxVel.y)),0!==this.vel.x&&(this.vel.x=In(this.vel.x,-this.maxVel.x,this.maxVel.x)),this.falling=this.vel.y*Math.sign(this.force.y)>0,this.jumping=!this.falling&&this.jumping,this.ancestor.pos.add(this.vel),0!==this.vel.x||0!==this.vel.y},Nl.prototype.destroy=function(){qn.push(this.bounds),qn.push(this.vel),qn.push(this.force),qn.push(this.friction),qn.push(this.maxVel),this.shapes.forEach((function(t){qn.push(t,!1)})),this.onBodyUpdate=void 0,this.ancestor=void 0,this.bounds=void 0,this.vel=void 0,this.force=void 0,this.friction=void 0,this.maxVel=void 0,this.shapes.length=0,this.setStatic(!1)};var Gl=function(t,e){this.removeChildNow(t,e)},Xl=0,Hl=function(t){function e(e,i,o,n,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===o&&(o=Jl.viewport.width),void 0===n&&(n=Jl.viewport.height),void 0===r&&(r=!1),t.call(this,e,i,o,n),this.pendingSort=null,this.root=r,this.children=void 0,this.sortOn=Jl.sortOn,this.autoSort=!0,this.autoDepth=!0,this.clipping=!1,this.onChildChange=function(t){},this.enableChildBoundsUpdate=!1,this.backgroundColor=qn.pull("Color",0,0,0,0),this.drawCount=0,this.autoTransform=!0,this.isKinematic=!1,this.anchorPoint.set(0,0),!0===this.root&&qr(jr,this.updateBounds.bind(this,!0))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.reset=function(){this.pendingSort&&(clearTimeout(this.pendingSort),this.pendingSort=null);for(var t,e=this.getChildren(),i=e.length;i>=0;t=e[--i])t&&!0!==t.isPersistent&&this.removeChildNow(t);void 0!==this.currentTransform&&this.currentTransform.identity(),this.backgroundColor.setColor(0,0,0,0)},e.prototype.addChild=function(t,i){return t.ancestor instanceof e?t.ancestor.removeChildNow(t):t.isRenderable&&(t.GUID=Hc.createGUID(t.id)),t.ancestor=this,this.getChildren().push(t),void 0!==t.pos&&("number"==typeof i?t.pos.z=i:!0===this.autoDepth&&(t.pos.z=this.getChildren().length)),!0===this.autoSort&&this.sort(),"function"==typeof t.onActivateEvent&&this.isAttachedToRoot()&&t.onActivateEvent(),!0===this.isAttachedToRoot()&&Jl.repaint(),this.enableChildBoundsUpdate&&this.updateBounds(!0),t.body instanceof Nl&&Jl.world.addBody(t.body),this.onChildChange.call(this,this.getChildren().length-1),t},e.prototype.addChildAt=function(t,i){if(i>=0&&i1&&(i=e);o=0&&t=0&&e0?e[0]:null},e.prototype.getChildren=function(){return void 0===this.children&&(this.children=[]),this.children},e.prototype.updateBounds=function(e){void 0===e&&(e=!1),t.prototype.updateBounds.call(this);var i=this.getBounds();return!0!==e&&!0!==this.enableChildBoundsUpdate||this.forEach((function(t){t.isRenderable&&(t.getBounds().isFinite()&&i.addBounds(t.getBounds()))})),i},e.prototype.isAttachedToRoot=function(){if(!0===this.root)return!0;for(var t=this.ancestor;t;){if(!0===t.root)return!0;t=t.ancestor}return!1},e.prototype.updateBoundsPos=function(e,i){var o=this;return t.prototype.updateBoundsPos.call(this,e,i),this.forEach((function(t){t.isRenderable&&t.updateBoundsPos(t.pos.x+e-o.pos.x,t.pos.y+i-o.pos.y)})),this.getBounds()},e.prototype.onActivateEvent=function(){this.forEach((function(t){"function"==typeof t.onActivateEvent&&t.onActivateEvent()}))},e.prototype.removeChild=function(t,e){if(!this.hasChild(t))throw new Error("Child is not mine.");Hc.function.defer(Gl,this,t,e)},e.prototype.removeChildNow=function(t,e){if(this.hasChild(t)&&this.getChildIndex(t)>=0){"function"==typeof t.onDeactivateEvent&&t.onDeactivateEvent(),t.body instanceof Nl&&Jl.world.removeBody(t.body),e||!1===qn.push(t,!1)&&"function"==typeof t.destroy&&t.destroy();var i=this.getChildIndex(t);i>=0&&(this.getChildren().splice(i,1),t.ancestor=void 0),!0===this.isAttachedToRoot()&&Jl.repaint(),this.enableChildBoundsUpdate&&this.updateBounds(!0),this.onChildChange.call(this,i)}},e.prototype.setChildsProperty=function(t,i,o){this.forEach((function(n){!0===o&&n instanceof e&&n.setChildsProperty(t,i,o),n[t]=i}))},e.prototype.moveUp=function(t){var e=this.getChildIndex(t);e-1>=0&&(this.swapChildren(t,this.getChildAt(e-1)),this.isDirty=!0)},e.prototype.moveDown=function(t){var e=this.getChildIndex(t);e>=0&&e+10){var i=this.getChildren();i.splice(0,0,i.splice(e,1)[0]),t.pos.z=i[1].pos.z+1,this.isDirty=!0}},e.prototype.moveToBottom=function(t){var e=this.getChildIndex(t),i=this.getChildren();e>=0&&e0||i.floating)&&Xl++,i.inViewport=!1,_u.current().cameras.forEach((function(t){t.isVisible(i,o)&&(i.inViewport=!0)})),this.isDirty|=(i.inViewport||i.alwaysUpdate)&&i.update(e),Xl>0&&Xl--):this.isDirty|=i.update(e));return t.prototype.update.call(this,e)},e.prototype.draw=function(t,e){var i=!1,o=this.getBounds();this.drawCount=0,!1===this.root&&!0===this.clipping&&!0===o.isFinite()&&t.clipRect(o.left,o.top,o.width,o.height),t.translate(this.pos.x,this.pos.y),this.backgroundColor.alpha>1/255&&t.clearColor(this.backgroundColor);for(var n,r=this.getChildren(),s=r.length;n=r[--s];)n.isRenderable&&(i=!0===n.floating,(n.inViewport||i)&&(i&&(t.save(),t.resetTransform()),n.preDraw(t),n.draw(t,e),n.postDraw(t),i&&t.restore(),this.drawCount++))},e}(Cl),Yl=[];function Wl(t,e,i,o,n){if(void 0===i&&(i=4),void 0===o&&(o=4),void 0===n&&(n=0),Yl.length>0){var r=Yl.pop();return r.world=t,r.bounds=e,r.max_objects=i,r.max_levels=o,r.level=n,r}return new Kl(t,e,i,o,n)}var ql=new Kn,Kl=function(t,e,i,o,n){void 0===i&&(i=4),void 0===o&&(o=4),void 0===n&&(n=0),this.world=t,this.bounds=e,this.max_objects=i,this.max_levels=o,this.level=n,this.bounds=e,this.objects=[],this.nodes=[]};Kl.prototype.split=function(){this.level;var t=this.bounds.width/2,e=this.bounds.height/2,i=this.bounds.left,o=this.bounds.top;this.nodes[0]=Wl(this.world,this.bounds,{left:i+t,top:o,width:t,height:e},this.max_objects,this.max_levels),this.nodes[1]=Wl(this.world,this.bounds,{left:i,top:o,width:t,height:e},this.max_objects,this.max_levels),this.nodes[2]=Wl(this.world,this.bounds,{left:i,top:o+e,width:t,height:e},this.max_objects,this.max_levels),this.nodes[3]=Wl(this.world,this.bounds,{left:i+t,top:o+e,width:t,height:e},this.max_objects,this.max_levels)},Kl.prototype.getIndex=function(t){var e,i=t.getBounds(),o=-1,n=(e=!0===t.isFloating?this.world.app.viewport.localToWorld(i.left,i.top,ql):ql.set(t.left,t.top)).x,r=e.y,s=i.width,a=i.height,h=this.bounds.left+this.bounds.width/2,l=this.bounds.top+this.bounds.height/2,u=rl;return nh&&(u?o=0:c&&(o=3)),o},Kl.prototype.insertContainer=function(t){for(var e,i=t.children.length;i--,e=t.children[i];)!0!==e.isKinematic&&(e instanceof Hl?("rootContainer"!==e.name&&this.insert(e),this.insertContainer(e)):"function"==typeof e.getBounds&&this.insert(e))},Kl.prototype.insert=function(t){var e=-1;if(this.nodes.length>0&&-1!==(e=this.getIndex(t)))this.nodes[e].insert(t);else if(this.objects.push(t),this.objects.length>this.max_objects&&this.level0){var o=this.getIndex(t);if(-1!==o)i=i.concat(this.nodes[o].retrieve(t));else for(var n=0;n0){var i=this.getIndex(t);-1!==i&&(e=zn(this.nodes[i],t))&&this.nodes[i].isPrunable()&&this.nodes.splice(i,1)}return!1===e&&-1!==this.objects.indexOf(t)&&(zn(this.objects,t),e=!0),e},Kl.prototype.isPrunable=function(){return!(this.hasChildren()||this.objects.length>0)},Kl.prototype.hasChildren=function(){for(var t=0;t0||e.objects.length>0)return!0}return!1},Kl.prototype.clear=function(t){this.objects.length=0;for(var e=0;ethis.world.fps},Ql.prototype.getParentContainer=function(t){return t.ancestor},Ql.prototype.repaint=function(){this.isDirty=!0},Ql.prototype.update=function(t,e){if(++this.frameCounter%this.frameRate==0){for(this.frameCounter=0,Wr(wr,t),this.accumulator+=qc.getDelta(),this.accumulator=Math.min(this.accumulator,this.accumulatorMax),this.updateDelta=qc.interpolation?qc.getDelta():this.stepSize,this.accumulatorUpdateDelta=qc.interpolation?this.updateDelta:Math.max(this.updateDelta,this.updateAverageDelta);this.accumulator>=this.accumulatorUpdateDelta||qc.interpolation;)if(this.lastUpdateStart=globalThis.performance.now(),!0!==_u.isPaused()&&Wr(Ar,t),this.isDirty=e.update(this.updateDelta)||this.isDirty,this.lastUpdate=globalThis.performance.now(),this.updateAverageDelta=this.lastUpdate-this.lastUpdateStart,this.accumulator-=this.accumulatorUpdateDelta,qc.interpolation){this.accumulator=0;break}Wr(Tr,this.lastUpdate)}},Ql.prototype.draw=function(t){!0===Fc.isContextValid&&(this.isDirty||this.isAlwaysDirty)&&(Wr(Er,globalThis.performance.now()),Fc.clear(),t.draw(Fc),this.isDirty=!1,Fc.flush(),Wr(Sr,globalThis.performance.now()))};var Jl=new Ql;qr(dr,(function(){Jl.init()}));var $l,tu=Math.min,eu=Math.max,iu=new Kn,ou=function(t){function e(e,i,o,n){t.call(this,e,i,o-e,n-i),this.AXIS={NONE:0,HORIZONTAL:1,VERTICAL:2,BOTH:3},this.bounds=qn.pull("Bounds"),this.smoothFollow=!0,this.damping=1,this.near=-1e3,this.far=1e3,this.projectionMatrix=new sr,this.invCurrentTransform=new hr,this.offset=new Kn,this.target=null,this.follow_axis=this.AXIS.NONE,this._shake={intensity:0,duration:0,axis:this.AXIS.BOTH,onComplete:null},this._fadeOut={color:null,tween:null},this._fadeIn={color:null,tween:null},this.name="default",this.setDeadzone(this.width/6,this.height/6),this.anchorPoint.set(0,0),this.isKinematic=!1,this.bounds.setMinMax(e,i,o,n),this._updateProjectionMatrix(),qr(br,this.reset,this),qr(jr,this.resize,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._updateProjectionMatrix=function(){this.projectionMatrix.ortho(0,this.width,this.height,0,this.near,this.far)},e.prototype._followH=function(t){var e=this.pos.x;return t.x-this.pos.x>this.deadzone.right?e=tu(t.x-this.deadzone.right,this.bounds.width-this.width):t.x-this.pos.xthis.deadzone.bottom?e=tu(t.y-this.deadzone.bottom,this.bounds.height-this.height):t.y-this.pos.y0&&(this._shake.duration-=e,this._shake.duration<=0?(this._shake.duration=0,this.offset.setZero(),"function"==typeof this._shake.onComplete&&this._shake.onComplete()):(this._shake.axis!==this.AXIS.BOTH&&this._shake.axis!==this.AXIS.HORIZONTAL||(this.offset.x=(Math.random()-.5)*this._shake.intensity),this._shake.axis!==this.AXIS.BOTH&&this._shake.axis!==this.AXIS.VERTICAL||(this.offset.y=(Math.random()-.5)*this._shake.intensity)),this.isDirty=!0),!0===this.isDirty&&Wr(Xr,this.pos),null==this._fadeIn.tween&&null==this._fadeOut.tween||(this.isDirty=!0),this.currentTransform.isIdentity()?this.invCurrentTransform.identity():this.invCurrentTransform.copy(this.currentTransform).invert(),t.prototype.update.call(this,e)},e.prototype.shake=function(t,e,i,o,n){0!==this._shake.duration&&!0!==n||(this._shake.intensity=t,this._shake.duration=e,this._shake.axis=i||this.AXIS.BOTH,this._shake.onComplete="function"==typeof o?o:void 0)},e.prototype.fadeOut=function(t,e,i){void 0===e&&(e=1e3),this._fadeOut.color=qn.pull("Color").copy(t),this._fadeOut.tween=qn.pull("Tween",this._fadeOut.color).to({alpha:0},e).onComplete(i||null),this._fadeOut.tween.isPersistent=!0,this._fadeOut.tween.start()},e.prototype.fadeIn=function(t,e,i){void 0===e&&(e=1e3),this._fadeIn.color=qn.pull("Color").copy(t);var o=this._fadeIn.color.alpha;this._fadeIn.color.alpha=0,this._fadeIn.tween=qn.pull("Tween",this._fadeIn.color).to({alpha:o},e).onComplete(i||null),this._fadeIn.tween.isPersistent=!0,this._fadeIn.tween.start()},e.prototype.focusOn=function(t){var e=t.getBounds();this.moveTo(t.pos.x+e.left+e.width/2,t.pos.y+e.top+e.height/2)},e.prototype.isVisible=function(t,e){return void 0===e&&(e=t.floating),!0===e||!0===t.floating?Fc.overlaps(t.getBounds()):t.getBounds().overlaps(this)},e.prototype.localToWorld=function(t,e,i){return(i=i||qn.pull("Vector2d")).set(t,e).add(this.pos).sub(Jl.world.pos),this.currentTransform.isIdentity()||this.invCurrentTransform.apply(i),i},e.prototype.worldToLocal=function(t,e,i){return(i=i||qn.pull("Vector2d")).set(t,e),this.currentTransform.isIdentity()||this.currentTransform.apply(i),i.sub(this.pos).add(Jl.world.pos)},e.prototype.drawFX=function(t){this._fadeIn.tween&&(t.save(),t.resetTransform(),t.setColor(this._fadeIn.color),t.fillRect(0,0,this.width,this.height),t.restore(),1===this._fadeIn.color.alpha&&(this._fadeIn.tween=null,qn.push(this._fadeIn.color),this._fadeIn.color=null)),this._fadeOut.tween&&(t.save(),t.resetTransform(),t.setColor(this._fadeOut.color),t.fillRect(0,0,this.width,this.height),t.restore(),0===this._fadeOut.color.alpha&&(this._fadeOut.tween=null,qn.push(this._fadeOut.color),this._fadeOut.color=null))},e.prototype.draw=function(t,e){var i=this.pos.x+this.offset.x,o=this.pos.y+this.offset.y;e.currentTransform.translate(-i,-o),t.setProjection(this.projectionMatrix),t.clipRect(0,0,this.width,this.height),this.preDraw(t),e.preDraw(t,this),e.draw(t,this),this.drawFX(t),e.postDraw(t,this),this.postDraw(t),e.currentTransform.translate(i,o)},e}(Cl),nu={cameras:[]},ru=function(t){this.cameras=new Map,this.lights=new Map,this.ambientLight=new nr(0,0,0,0),this.settings=Object.assign(nu,t||{})};ru.prototype.reset=function(){var t=this;if(this.settings.cameras.forEach((function(e){t.cameras.set(e.name,e)})),!1===this.cameras.has("default")){if(void 0===$l){var e=Fc.getWidth(),i=Fc.getHeight();$l=new ou(0,0,e,i)}this.cameras.set("default",$l)}Jl.reset(),this.onResetEvent.apply(this,arguments)},ru.prototype.update=function(t){var e=Jl.world.update(t);return this.cameras.forEach((function(i){!0===i.update(t)&&(e=!0)})),this.lights.forEach((function(i){!0===i.update(t)&&(e=!0)})),e},ru.prototype.draw=function(t){var e=this;this.cameras.forEach((function(i){i.draw(t,Jl.world),0!==e.ambientLight.alpha&&(t.save(),e.lights.forEach((function(e){t.setMask(e.getVisibleArea(),!0)})),t.setColor(e.ambientLight),t.fillRect(0,0,i.width,i.height),t.clearMask(),t.restore()),e.lights.forEach((function(e){e.preDraw(t,Jl.world),e.draw(t,Jl.world),e.postDraw(t,Jl.world)}))}))},ru.prototype.destroy=function(){this.cameras.clear(),this.lights.forEach((function(t){t.destroy()})),this.lights.clear(),this.onDestroyEvent.apply(this,arguments)},ru.prototype.onResetEvent=function(){"function"==typeof this.settings.onResetEvent&&this.settings.onResetEvent.apply(this,arguments)},ru.prototype.onDestroyEvent=function(){"function"==typeof this.settings.onDestroyEvent&&this.settings.onDestroyEvent.apply(this,arguments)};var su=function(t){function e(e,i,o,n){t.call(this,e,i,o,n),this.barHeight=n,this.anchorPoint.set(0,0),qr(Pr,this.onProgressUpdate,this),qr(Ur,this.resize,this),this.anchorPoint.set(0,0),this.progress=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onProgressUpdate=function(t){this.progress=~~(t*this.width),this.isDirty=!0},e.prototype.draw=function(t,e){t.setColor("black"),t.fillRect(this.pos.x,e.centerY,t.getWidth(),this.barHeight/2),t.setColor("#55aa00"),t.fillRect(this.pos.x,e.centerY,this.progress,this.barHeight/2)},e.prototype.onDestroyEvent=function(){Zr(Pr,this.onProgressUpdate),Zr(Ur,this.resize)},e}(Cl),au=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onResetEvent=function(){Jl.world.backgroundColor.parseCSS("#202020"),Jl.world.addChild(new su(0,Fc.getHeight()/2,Fc.getWidth(),8),1),uc.load({name:"melonjs_logo",type:"image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAAA8FBMVEUgICBrqDHRZVtqpzEhJCAjKCBurTIfHyDQZFptrDEWAB8OAB7VZ1wtIiIAEhYlISDYaF4SAB4pIiEAFhkcFh8eGyBopDAMAB5noS8kKyAAGhtjmy4bEB9lni8ZBR/HYFdPeim/XFQ9XCUaCh9flS1VhCtSfyorOSEVHh4HHB1EZyatVExhmC5ajCxHbSc0SyMuQCInMiFKcSgxRSI6VSRBYiWdTUZdki09JyZ8PzpYiSs3UCRlNjK1WE9ckC1MdShbjywyJCONRkDKYliUSUNeMzBDKShXMC2kUEl1PDeEQj1OLStnNjNxOjZsODQAAAcMh1CFAAAU4UlEQVR42uyaa3fSMBjHk5EQkgClkBZKoXblNhlswIooc2N6pp7jUb//x/FpRbnt4JWwzv7eraQvfs/zby7tUEpKSkpKSkpKSkpKSkpKSkqKTsg30P8E+FIArJllqQaglMXQt6tPuhogGSlaLWFKKU2hEB33eqPRqDemRAlhRhdbVjwIBj8xogajhpBSkNH1dOJ37mYDt1mr2UCt1mwOZned7qQfjhxPVs0WovTpRIFFNkpIU42CSWfm2phnIzjHP+DLS9hutjuL4IqZUigC9yU/CWDBhBROOJkPbBxL4swKjDf/jEvBbXe4CMeiKixKEx0EAq03JbqeDJs4Ul9a7mE5AqqAazM/pJCb5JaAUmWa42nHBflYDf8y8WC4qznv9yRKZAUIRUKO+/Maz/J1+d8ugu0rK3kVoNSTVhDZr8v/WRGyQw8lC0KJMK989+/sVzXILiRNzmrACGXSC4Z2lsf2f08GN2lyHgJCLUn6bRw1/2dim+A9hIKiJMAQ6NOJu7f5a7r8B+u/7N7BAzMZBaBIkkkz0t83sfMsgDHsgN1BOybaFNvww2qblMgEUGKqi2aU/X3u2HZnHf8iuL4aO0S1PKDVQM54dBn0F50718bfq5CwOYBQIaaDVfd37MG91u5MwhER8WHQU8qC2wCEmFJefEYUrBdedGe15b4xQasAtaqXt/wh/W87W1679YNeCxQbjNCItTchBFheRErAmHEYb575ch/Qeuz9ByXpdHH2QX2wx4NuMBbSbJCfn3IJWZ4dndBvZ6Bytt949A8AbZjT6OHftQeDTHtx2VgebhFj6KfAmGisJaS46k+mj/4sELW/N+QP6UOIXf/Sqwq0p/F7okA8KU312BcAqmTf3k1/1Hx7HlgyskfsL96h7b3XMNCRcYQzz+KH9N3FSC57fxiYUTDOWLmAjgcjpBo2d9oPKxdv95Fs0UPGl5XPinWDVYqGwdBxYFQJH/Mdfc5nQUuyw77KYYXKm/ub09PzV/Xn5SNVAOJ/B/Hf0W8HwiQUHRTwf/2slM/nS6WbN/XjZIDK6534w8zv9r1In6GDUq6/y+VzMaVTdGYg7cDj38/wHX17YknQPzSGUb8p5U5icqX7ovaZkBFk+nw7/hx3epIdvPtAufIpf7Ikl39W0B0BRpToQPy32j8IZUPPW+xC8S0E4Afv6noLwGgL3WZ32u8roetbTqF4v1aA/JdKGWmEUc8ZgP/m0j+4riKKNFEoflwrQO6D1gQwKnrulj/mXUto048XgZV+/vQMaYQ5otfc8s/Wpprav5oFz5cRgHXwo85VgFHw55nN+Ld7UvMnPOP5y2elXMRJ6VzDA7DPH2e7XstBemHl+vubfAk4efGc6SsAo9542x9fVJH+D/lQgfrnF+fn9++KWv0bdHP+z3A7rFKC9MMMo1KsVIr1ssYHgFiqvemfdUemg45EuVAuFMpIH4SI4ZZ/2xEOQ8eCAUgjVHa3/G+txuN/Z/+vYE51suU/9NT/5G8GIL3uPxfsCfwf11fyrW1FgRiGTkna0vZpYHQUXRHdVZBhvCMorP7/V+3oyprgPiy2Dxk2HzA06TknpyHz19CjVfcpf9kj+6SBtqgcMPz/q/vPdPgwLP/DsCM1f2vTf7Ifap5/hYXQ/FGnX7S16LdABADc23oqVP91kYfgrU5b1GxKHSCo7tILzR/z9eJ8nliv0zqAMZ8ATEJfaP6+7jlj3CDlXpHVfsfnH+eyn4kMzMdGQRNO7fNkGEXbGTigBkDq1lZzU07BnaXzIab6LCMAuEEmdWcD8+ax9uNTckxFqyWxwKBgKXZrzerHtAbcPhFQ0R8oAExdChXADIt1Tz0KkGi9TjML1CBLqgA0YZGIFZhZqVNUtf9GCdBbF0IF4Be/vvQYz6pyxhRwH+QC4CpXoAgELvE6iKMtfwJLzv+5YU2iDasOR0MJMBdMgFsMK6ICrppGY+rELGAdhFpAYoXYgRdBRzsLUtB3L/z+7zpITFvHYhQAdorGyQudAdCuNe8qoJjVNgYAF0M+9iFbAe9tK2w4BKIIdVJ0CLASv7jeBFo7cBwCrxcgP1IAjEv5ALipwII1gmGGMR4A2uEB+blJK4x4E1kdZhQA5xYowPe58z3lwKfH199WbQRAc/LpuwPWu17k0qaFCnANAgHSvKJcZdMCxJtgOsQuKsexG2uCwMxa8O8aUa/axHZCe/OUZA42ag0Avqi5ll2nYSAaRQEbZI+NrbKwEFFYJURCiEcpqEE0aZOmBfH/f4PLQ+OEttwxLKg3jq5Or3TG9jyOJ/FjgSIGZvBRLhB1oFvi7/3X5CIDhZHodOLtfyyEXUlh0IGzyDoQM+rbGljFRNaE2ZOXj0MT3pALxGQo8v1z1ILRBb6+hTJoZgLvBoMYRjZAeALuv/v/hZCzeTxWRIu/iwEvbqQMmKcxUekwHqF/KQSo74OCVX8rCyQoC9C/QYBZENZTcYMlRkqjWFlVZfn9OWGXwcoDVFKewD+fo33v9AwQD3HGFqH5XsXHACWVA7BObfp+YyoL4BKpLvb+MuvBlVn1q03iwIONVNFy1jPUBvGyPOaGJT4GGOPAHd9v66bIuy7Pi3p5GKoTrYSdeRXaQrk7LD02P2Gbejv2FqrYdugFxgHM5ChBEFNpIn/czxaObdMJrcXP4Z94sdxZUGZmAZmA+7ws0im4a9oenFQsKg58uE8NhBgE43+LlBysa65FmvJweIppMzobsmJKWve+EFrMsUJ3+wEqGaUKPA9XkSYNhj0xUd8xYkbBsU516lnMhv+LFs1nKCX7BZYVjIUQZ8FC830PRjG6LnSqBzCSPcloP0U9IaLZhknntlynSGhOS+yV/bWuEla1EPwSONXdAc0VKYv4ZcyoWQBGEDp/2zdI/zyrYgfyR6CAL7nm18BC18pJFnlLhuUMsScgvs9CwjrXyOgCq/Q9yIQpBa0Q/DqW6+JoJSNX9AGNT4S2uezhx8B9kBvu2AZGjpQubwLRglHKLnX6Z7DodmgBQjDHkji7O3+MoFFZgITx+pLiMdiChL1G7DUL8DWQLBDPw3dGh5Yjn38YT+TuMrhuvy71HbGiGyzRAg8DVYQQzO49evYg7ArLiP7v82/7n3OcZ8u6F36+IzjfVCqivwkTetqNCHpP2nvdfS74PJTr7zH+NM9pTflPwTMbcN1YkgEwFcL7EXIddf85LQ1SrtZ8FsO6uh13w7Abt02nZ7tjbiuR1+2Xn2COYPxaCCM3+KCqQz86fnpDSgOkPQg+i/dtb8E6P/zUt8Vln+/pF4fVD7D103Gbz8B8cIbULeJlHXqLM2ZQZDHEuGMnpsF+m0Alpfk+pKmAtZdCJNf5wUGJYAervRB8eggotSH2SlAy2myBchi14VbCxKlzka+BScWCqofBUASYCbsVKAQzD65g7CbmEl9OCTQtocEm74ysiPsq6imhilLVxANyUfR2o9i0SN7YstH8DP+9db+DYcD/iFsgqnXWd02SXAc9CrLpx124yFd2w35HlQ4tEPCHxPwO9haY7oG1NbQbMnLPYPbw2YNIMYAlxeTIDlP+WP0axAUhTrGzefUXEeK+kXetvU3DUDQtqdxKSQwJG1romIbQSLWhfuChFRioG92rsP//c3AiwbErxfKxBMoFf/am5cyPc+899/hDkTOJHZ4IKMQQrC6irDZTh+YVa9VHlsbuyK6uEe7tINCdK9hVutGkUgL/S0pox5cEchPX2X9qrXVfuIQIoAcsDN2sj+yb5XuVU8JZlgkpZ+PMzMbhvG0AwKqfteh6O3VZbqL8J4tNhggAluxxBgaNEIK7A/BNWvkWC7DCV/X+3qsMU0+LkqiS75NyMUhD+LqqrjdT51TPlQeAVTZ11nXpW1nm1sDOWhA1blBBcGEincwV1crqwV7Vq6r0U8ZxiCEevONwtzaaKnGS6X3lCGRHSwaAuyzU4Uyr5tjaLv4wL6+cm3BbxwFw9pSujJsfowBY2UfAutHeyRftZGwXb4RxY2+XDQHAgQGAlblMHI382xeRABwnSicBpyDYjS/HADYILhiYFAMA6k8DUDgANCQAfue0bPy3AeC3QD48AGK2gHLOgJFwAKhDENfgvwkArkGGCH0SDcAuEeKp8MhQYcEAtFT4EU2Fn9nB0HvJAExQHEMwRIfDogFgw2GI7eGXIhkANyESlxITvQLc/2UwAO+cLILgW4BMikIg46TF01QwAGxaHOwBuoI9uQBwhRGMPbs09nouFwCo3fAlLG6GCooFAMVRrGVaXTUz5XGxAHjK44xAQioArUBiZgskYiUyUrcAKhygdDEiqT2xPACZDS6qSe2+y04hIROAFM5aSO6F2qe5pmxDAMBJivJCydFhqsiOK9SHhQLQNb/ahTHFycsglh7EFogB4IQUSyORsqT841Aay8aBxR7VqYlQHPfK33SysAUVwY/qzF/ZO5kRfKLljAkidJMfZaEPgJXVD+ubNnUZqL0yS0upwKAOWidW7ZY++UhSIRQxp79KmAvth8sIha5Q8VZJ0B6YdquFaZlBTjyl7UMQEQcXyG8fZ93TN+MHCJv75l4bzWQ3+RhlRI8A2UzGozpEdpvjgSDRYALh7TY6qS+PWpHvBcT9nmdizk+nmQHsNq+xAHoRuLkYt21k32qlQ/01D0es0gVUCIcAZUimdbG+u7z/XOP7PQgsiu395WpbNKUKaEKqNmbyeZFoNiEKOscrDHkf1bxpmz91GdZY2HWHhjWHlt3kRc6bS/I2IoijIkyadZ7nJTNZU5PpByHAAmhXvkgfGqXUACY77fOc5h2SeXRciTNQ2Gkef56oOAsNtF1KQwCRIN/9CxqFZII8E5WXFpdFiZeW2oNHyRrIhSAfGrMHUCUfrKN8yAI+oYyUkFK2HaVFW2khtR/rPzDal+UkZGjwzOMAwRSJkReScwyi5QGdEvxI2wqZSEdNeGryRNYl018dT9X/zlIzndt0eHR4MNSnVXyPgoAGR3tKYidJ8dOa4PRCTTD2eRl7CUyEmAqirIHqbuxveuOcAjIuApwAHjNFKqmC5lsZIdH8zGuuzp8mYJQCTgGo/FARix7KMSQzYzn8vAAU8gFGcPQS+DJ8AH4rndH8PqQ3S35yd2U7isNAMFHasWw/WcopQhRBIBICQsggJCIx/P9XrTMcDWbZY5YQs36Yh4EZXNXl7vJB3Hkjd7fCkCfc3/ZGbgh4zp5xwYbuBdBWGr00pF2OrT0E6p/sIH6V1uRHTANeDv1NE/j4rB1mFYMHgTYJsJtnrGORL1W9w107NA4/u+gqjL+cFXprU2+cbSvA828GxFKImwRmLpDiji6WwCdvsuDjOU1MA7iI+WzXBj4MmfFpQKuAeC7wOdss6n8afe8qjaUaqNdRWoeEPt1g4wPGpFkMUJKuIruDAaA/ahsToVmXr4NnYanq4GI4eq4waLKJZxADYF12MvFIEO3EZKPLTMxxhADo1ztK0zgtxIND3JhieKnTeKEEhacT4F9OHOB+qRkMXHZwcCOzgwxFv76IfKszMxgg4bqNDDa26cSs01hsmKMtDlj9X8La4sfAdHkvHn6vHhngtGcGAJT+EX+3RxnwDDV+GPf7rIYUQGQa/tyj3RFA063GwN4f98cAJT6f3HaIDaukO1FS8GCuMTCveGz10yhJvIWGP+rWolKSFkMtEw7LvuaGMa/yW/y208iO8GMxXEXslnRnE8LrUyEFIpqhht8edb5aRWNeawzYLJMvnxhQsMKZw16KHw2RzoC7iF+dCOJ0PGX2a/Hj0sNFA5gIPl4zDFD+KzX8dfzhoyh0zwCzP/nrREA8MQu0HtjOSHTeAcwDxcDVPt/d1iGQVygQiKx2rq1FIPh4BX7MA/G5AOEwCNZKBN3PjuJEbCLX0cZgVL90kY6SxFcW5E4EZegTq9N+ECssdszWyZ8X/DX4UYc+n+oydFx7SgR0Z4sogEzWgc684x6s9PV1GMS6DbsmguGMc9IRBUC4HM3d+w+d9jIlAxKOIi0R2A5z85HkHWRDCiQV5YIxR8PP7KWAfiblsSxyV++P6tDhQz5dBS38emLfhV9ZkKa/Q8xknKAdu04Fiw/OLfKssFCLAJf1xEH4PZpQ3ZBvMCdddcvejxLhE3hO8KnkzQ7hX8t/LfvdnwAiiz327IoCli9jwUFxQP8l9kBgLKzNvhX/Pc/zpo+JqD4M+NpBEVzlAjeaNqkYA4Hv00s8wetswJDj6/BPfQNOKlCAsN7+rIPtSMjXKy4SIH8rBGoBEPCkqGYHx8XMfx3+wUdombE9RzhfBg8ocIPDUnHAfULgr0JP1R8Vs13kovZvEq2TqfCbsC1xMkXFzsY46RxsPxuQioRWCQC/RA5AFPhUCL9cL6JW+j+Dz1rXTfuXPzaSiNEcY3XHgT3YLRvCheSeBQR5oKpdIQfLS6WQUM4mA8e9Qa/7TWPCf/FpfLwcIgU6B0zBGe6zWVklMlQ8jD2/BX0mg3pjLkUo07jcZIsWPEP0OvwgA9l78r9vBAT5jB5QcESjYDlRvpsuN01dES/lnEupfqQeVKtmtMx2+dBhJ/APmHSdaWGW+rERPyymAVKgtRMq5rYIg2g4z/P9YbFY7PN8PoyC4wuI/QH8yUokxDIu/Ofk7YVFFmllSyfhjJCxFvIXaqa99Ah+MKnF2KzBf0dBElbrAdNk8IAKbL9/txJIlK1EajT8Yzb0hTXb2pjC/7k5X55qvqzCxHT458mL4M10iDL4bsMSEuxGifDeAv5RBcBFPDsEWMq/H3vmOttlIbhFzKt8v5SBL/hquW85QBL+Xvmuk3+W/H2CfyuDccvBIrKxsP859jb0LNqvy1RweK/gYwMCiZDVKMsDdlLCr2m4vEWBD+bTTcFFCu8XfI0Dr53XjbL9yeRh/dNgo0+yo+10s1LcJW+O/ryo05IQ8ricZYt5pGg4Wr6bxo6/taP5YTprKh624AmYavn+urVgfC6F9KpSef7JYTtQ7jcInLYFyhcP8sMkW27KwudCcA/I+4f+Tgnn+a5CKCT3SVWs6ros63q1qgg9/do7vY3+L6H/0a4dqgAAg1AULYPBsjax+P//uA3TwuJAxj3RJiYf7xJ5rBVVLNzHcA8T7fkZl6iePpchSDvs8b9XBwAAAAAAqGQCc31B4/xqSwwAAAAASUVORK5CYII="},(function(){Jl.world.addChild(new cc(Fc.getWidth()/2,Fc.getHeight()/2,{image:"melonjs_logo",framewidth:256,frameheight:256}),2)}))},e.prototype.onDestroyEvent=function(){uc.unload({name:"melonjs_logo",type:"image"})},e}(ru),hu=-1,lu=-1,uu=!1,cu={},pu={color:"",duration:0},du=null,fu=null,yu=0;function gu(){-1===lu&&-1!==hu&&(lu=globalThis.requestAnimationFrame(vu))}function vu(t){var e=cu[hu].stage;Jl.update(t,e),Jl.draw(e),-1!==lu&&(lu=globalThis.requestAnimationFrame(vu))}function mu(){globalThis.cancelAnimationFrame(lu),lu=-1}function xu(t){mu(),cu[hu]&&cu[hu].stage.destroy(),cu[t]&&(cu[hu=t].stage.reset.apply(cu[hu].stage,fu),gu(),Wr(mr),du&&du(),Jl.repaint())}qr(dr,(function(){_u.set(_u.LOADING,new au),_u.set(_u.DEFAULT,new ru),qr(xr,(function(){_u.change(_u.DEFAULT,!0)})),"function"==typeof globalThis.addEventListener&&(globalThis.addEventListener("blur",(function(){_u.pause(!0)}),!1),globalThis.addEventListener("focus",(function(){_u.resume(!0),aa()}),!1)),void 0!==globalThis.document&&"function"==typeof globalThis.document.addEventListener&&globalThis.document.addEventListener("visibilitychange",(function(){"visible"===globalThis.document.visibilityState?_u.resume(!0):_u.pause(!0)}),!1)}));var _u={LOADING:0,MENU:1,READY:2,PLAY:3,GAMEOVER:4,GAME_END:5,SCORE:6,CREDITS:7,SETTINGS:8,DEFAULT:9,USER:100,stop:function(t){void 0===t&&(t=!1),hu!==this.LOADING&&this.isRunning()&&(mu(),!0===t&&t(),yu=globalThis.performance.now(),Wr(gr))},pause:function(t){void 0===t&&(t=!1),hu===this.LOADING||this.isPaused()||(uu=!0,!0===t&&hh(),yu=globalThis.performance.now(),Wr(fr))},restart:function(t){void 0===t&&(t=!1),this.isRunning()||(gu(),!0===t&&lh(),yu=globalThis.performance.now()-yu,Jl.repaint(),Wr(vr,yu))},resume:function(t){void 0===t&&(t=!1),this.isPaused()&&(uu&&-1!==hu&&(uu=!1),!0===t&&lh(),yu=globalThis.performance.now()-yu,Wr(yr,yu))},isRunning:function(){return-1!==lu},isPaused:function(){return uu},set:function(t,e,i){if(void 0===i&&(i=!1),!(e instanceof ru))throw new Error(e+" is not an instance of me.Stage");cu[t]={},cu[t].stage=e,cu[t].transition=!0,!0===i&&this.change(t)},get:function(t){return void 0===t&&(t=hu),void 0!==cu[t]?cu[t].stage:void 0},current:function(){return this.get()},transition:function(t,e,i){"fade"===t&&(pu.color=e,pu.duration=i)},setTransition:function(t,e){cu[t].transition=e},change:function(t,e){if(void 0===cu[t])throw new Error("Undefined Stage for state '"+t+"'");this.isCurrent(t)||(fu=null,arguments.length>1&&(fu=Array.prototype.slice.call(arguments,1)),pu.duration&&cu[t].transition?(du=function(){Jl.viewport.fadeOut(pu.color,pu.duration)},Jl.viewport.fadeIn(pu.color,pu.duration,(function(){Xn(xu,this,t)}))):!0===e?xu(t):Xn(xu,this,t))},isCurrent:function(t){return hu===t}};function bu(t,e,i){var o;if("string"!=typeof i)return i;switch(e){case"int":case"float":i=Number(i);break;case"bool":i="true"===i;break;default:if(!i||yn(i))i=!i||"true"===i;else if(fn(i))i=Number(i);else if(0===i.search(/^json:/i)){o=i.split(/^json:/i)[1];try{i=JSON.parse(o)}catch(t){throw new Error("Unable to parse JSON: "+o)}}else if(0===i.search(/^eval:/i)){o=i.split(/^eval:/i)[1];try{i=Function("'use strict';return ("+o+")")()}catch(t){throw new Error("Unable to evaluate: "+o)}}else((o=i.match(/^#([\da-fA-F])([\da-fA-F]{3})$/))||(o=i.match(/^#([\da-fA-F]{2})([\da-fA-F]{6})$/)))&&(i="#"+o[2]+o[1]);0===t.search(/^(ratio|anchorPoint)$/)&&"number"==typeof i&&(i={x:i,y:i})}return i}function wu(t,e,i){switch(i=i||"none",e=e||"none"){case"csv":return function(t){for(var e=t.replace("\n","").trim().split(","),i=[],o=0;o=0;--o)s[i]+=r.charCodeAt(i*e+o)<<(o<<3);return s}(t,4);return"none"===i?o:function(){throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!")}();case"none":return t;case"xml":throw new Error("XML encoding is deprecated, use base64 instead");default:throw new Error("Unknown layer encoding: "+e)}}function Tu(t,e){var i=e.nodeName;switch(i){case"data":var o=Au(e);o.text=o.text||o.chunk.text,o.encoding=o.encoding||"xml",t.data=wu(o.text,o.encoding,o.compression),t.encoding="none";break;case"imagelayer":case"layer":case"objectgroup":case"group":var n=Au(e);n.type="layer"===i?"tilelayer":i,n.image&&(n.image=n.image.source),t.layers=t.layers||[],t.layers.push(n);break;case"animation":t.animation=Au(e).frames;break;case"frame":case"object":var r=i+"s";t[r]=t[r]||[],t[r].push(Au(e));break;case"tile":var s=Au(e);s.image&&(s.imagewidth=s.image.width,s.imageheight=s.image.height,s.image=s.image.source),t.tiles=t.tiles||{},t.tiles[s.id]=s;break;case"tileset":var a=Au(e);a.image&&(a.imagewidth=a.image.width,a.imageheight=a.image.height,a.image=a.image.source),t.tilesets=t.tilesets||[],t.tilesets.push(a);break;case"polygon":case"polyline":t[i]=[];for(var h,l=Au(e).points.split(" "),u=0;u0)for(var i=0;i0&&(this.maskLevel=0,this.getContext().restore())},e}(Ja);function Pu(t,e){var i=0;!function(t){t.layerData=new Array(t.cols);for(var e=0;e0,this.isAnimated&&(this.preRender=!1),this.getBounds().addBounds(this.getRenderer().getBounds(),!0),this.getBounds().shift(this.pos),!0!==this.preRender||this.canvasRenderer||(this.canvasRenderer=new Mu({canvas:Vc(this.width,this.height),widht:this.width,heigth:this.height,transparent:!0}),function(t,e){for(var i=0;i=0&&o=0&&nthis.cols?this.cols:s.x,s.y=s.y>this.rows?this.rows:s.y,e.renderorder){case"right-up":s.y=r.y+(r.y=s.y)-s.y,n=-1;break;case"left-down":s.x=r.x+(r.x=s.x)-s.x,o=-1;break;case"left-up":s.x=r.x+(r.x=s.x)-s.x,s.y=r.y+(r.y=s.y)-s.y,o=-1,n=-1}for(var a=r.y;a!==s.y;a+=n)for(var h=r.x;h!==s.x;h+=o){var l=e.cellAt(h,a,!1);l&&this.drawTile(t,h,a,l)}qn.push(r),qn.push(s)},e}(Iu),Ru=function(t){function e(e){t.call(this,e.cols,e.rows,e.tilewidth,e.tileheight),this.hTilewidth=this.tilewidth/2,this.hTileheight=this.tileheight/2,this.originX=this.rows*this.hTilewidth}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.canRender=function(e){return"isometric"===e.orientation&&t.prototype.canRender.call(this,e)},e.prototype.getBounds=function(t){var e=t instanceof Ou?qn.pull("Bounds"):this.bounds;return e.setMinMax(0,0,(this.cols+this.rows)*(this.tilewidth/2),(this.cols+this.rows)*(this.tileheight/2)),e},e.prototype.pixelToTileCoords=function(t,e,i){return(i||new Kn).set(e/this.tileheight+(t-this.originX)/this.tilewidth,e/this.tileheight-(t-this.originX)/this.tilewidth)},e.prototype.tileToPixelCoords=function(t,e,i){return(i||new Kn).set((t-e)*this.hTilewidth+this.originX,(t+e)*this.hTileheight)},e.prototype.adjustPosition=function(t){var e=t.x/this.hTilewidth,i=t.y/this.tileheight,o=qn.pull("Vector2d");this.tileToPixelCoords(e,i,o),t.x=o.x,t.y=o.y,qn.push(o)},e.prototype.drawTile=function(t,e,i,o){var n=o.tileset;n.drawTile(t,(this.cols-1)*n.tilewidth+(e-i)*n.tilewidth>>1,-n.tilewidth+(e+i)*n.tileheight>>2,o)},e.prototype.drawTileLayer=function(t,e,i){var o=e.tileset,n=this.pixelToTileCoords(i.pos.x-o.tilewidth,i.pos.y-o.tileheight,qn.pull("Vector2d")).floorSelf(),r=this.pixelToTileCoords(i.pos.x+i.width+o.tilewidth,i.pos.y+i.height+o.tileheight,qn.pull("Vector2d")).ceilSelf(),s=this.tileToPixelCoords(r.x,r.y,qn.pull("Vector2d")),a=this.tileToPixelCoords(n.x,n.y,qn.pull("Vector2d"));a.x-=this.hTilewidth,a.y+=this.tileheight;var h=a.y-i.pos.y>this.hTileheight,l=i.pos.x-a.x1&&(e.height+=this.rowheight)):(e.setMinMax(0,0,this.cols*(this.tilewidth+this.sidelengthx),this.rows*this.rowheight+this.sideoffsety),e.height>1&&(e.width+=this.columnwidth)),e},e.prototype.doStaggerX=function(t){return this.staggerX&&1&t^this.staggerEven},e.prototype.doStaggerY=function(t){return!this.staggerX&&1&t^this.staggerEven},e.prototype.topLeft=function(t,e,i){var o=i||new Kn;return this.staggerX?1&t^this.staggerEven?o.set(t-1,e):o.set(t-1,e-1):1&e^this.staggerEven?o.set(t,e-1):o.set(t-1,e-1),o},e.prototype.topRight=function(t,e,i){var o=i||new Kn;return this.staggerX?1&t^this.staggerEven?o.set(t+1,e):o.set(t+1,e-1):1&e^this.staggerEven?o.set(t+1,e-1):o.set(t,e-1),o},e.prototype.bottomLeft=function(t,e,i){var o=i||new Kn;return this.staggerX?1&t^this.staggerEven?o.set(t-1,e+1):o.set(t-1,e):1&e^this.staggerEven?o.set(t,e+1):o.set(t-1,e+1),o},e.prototype.bottomRight=function(t,e,i){var o=i||new Kn;return this.staggerX?1&t^this.staggerEven?o.set(t+1,e+1):o.set(t+1,e):1&e^this.staggerEven?o.set(t+1,e+1):o.set(t,e+1),o},e.prototype.pixelToTileCoords=function(t,e,i){var o=i||new Kn;this.staggerX?t-=this.staggerEven?this.tilewidth:this.sideoffsetx:e-=this.staggerEven?this.tileheight:this.sideoffsety;var n,r,s,a,h=qn.pull("Vector2d",Math.floor(t/(2*this.columnwidth)),Math.floor(e/(2*this.rowheight))),l=qn.pull("Vector2d",t-h.x*(2*this.columnwidth),e-h.y*(2*this.rowheight));this.staggerX?(h.x=2*h.x,this.staggerEven&&++h.x):(h.y=2*h.y,this.staggerEven&&++h.y),this.staggerX?(s=(n=this.sidelengthx/2)+this.columnwidth,a=this.tileheight/2,this.centers[0].set(n,a),this.centers[1].set(s,a-this.rowheight),this.centers[2].set(s,a+this.rowheight),this.centers[3].set(s+this.columnwidth,a)):(r=this.sidelengthy/2,s=this.tilewidth/2,a=r+this.rowheight,this.centers[0].set(s,r),this.centers[1].set(s-this.columnwidth,a),this.centers[2].set(s+this.columnwidth,a),this.centers[3].set(s,a+this.rowheight));for(var u=0,c=Number.MAX_VALUE,p=0;p<4;++p){var d=this.centers[p].sub(l).length2();da.y&&(s=this.topLeft(s.x,s.y,s)),-this.sideoffsety+h>a.y&&(s=this.topRight(s.x,s.y,s)),this.sideoffsety+h0;var h=t.tileoffset;h&&(this.tileoffset.x=+h.x,this.tileoffset.y=+h.y);var l=t.tileproperties;if(l)for(e in l)l.hasOwnProperty(e)&&this.setTileProperty(+e+this.firstgid,l[e]);if(!1===this.isCollection){if(this.image=uc.getImage(t.image),!this.image)throw new Error("melonJS: '"+t.image+"' file for tileset '"+this.name+"' not found!");this.texture=Fc.cache.get(this.image,{framewidth:this.tilewidth,frameheight:this.tileheight,margin:this.margin,spacing:this.spacing}),this.atlas=this.texture.getAtlas();var u=+t.columns||Math.round(this.image.width/(this.tilewidth+this.spacing)),c=Math.round(this.image.height/(this.tileheight+this.spacing));t.tilecount%u>0&&++c,this.lastgid=this.firstgid+(u*c-1||0),t.tilecount&&this.lastgid-this.firstgid+1!=+t.tilecount&&console.warn("Computed tilecount ("+(this.lastgid-this.firstgid+1)+") does not match expected tilecount ("+t.tilecount+")")}};Fu.prototype.getTileImage=function(t){return this.imageCollection[t]},Fu.prototype.setTileProperty=function(t,e){this.TileProperties[t]=e},Fu.prototype.contains=function(t){return t>=this.firstgid&&t<=this.lastgid},Fu.prototype.getViewTileId=function(t){var e=t-this.firstgid;return this.animations.has(e)?this.animations.get(e).cur.tileid:e},Fu.prototype.getTileProperties=function(t){return this.TileProperties[t]},Fu.prototype.update=function(t){var e=0,i=qc.getTime(),o=!1;return this._lastUpdate!==i&&(this._lastUpdate=i,this.animations.forEach((function(i){for(i.dt+=t,e=i.cur.duration;i.dt>=e;)i.dt-=e,i.idx=(i.idx+1)%i.frames.length,i.cur=i.frames[i.idx],e=i.cur.duration,o=!0}))),o},Fu.prototype.drawTile=function(t,e,i,o){if(o.flipped&&(t.save(),t.translate(e,i),t.transform(o.currentTransform),e=i=0),!0===this.isCollection)t.drawImage(this.imageCollection[o.tileId],0,0,o.width,o.height,e,i,o.width,o.height);else{var n=this.atlas[this.getViewTileId(o.tileId)].offset;t.drawImage(this.image,n.x,n.y,this.tilewidth,this.tileheight,e,i,this.tilewidth+t.uvOffset,this.tileheight+t.uvOffset)}o.flipped&&t.restore()};var Vu=function(){this.tilesets=[],this.length=0};Vu.prototype.add=function(t){this.tilesets.push(t),this.length++},Vu.prototype.getTilesetByIndex=function(t){return this.tilesets[t]},Vu.prototype.getTilesetByGid=function(t){var e=-1;t&=536870911;for(var i=0,o=this.tilesets.length;i=this.tilesets[i].firstgid&&(e=i)}if(-1!==e)return this.tilesets[e];throw new Error("no matching tileset found for gid "+t)};var ju=function(t,e,i){this.points=void 0,this.name=e.name,this.x=+e.x,this.y=+e.y,this.z=+i,this.width=+e.width||0,this.height=+e.height||0,this.gid=+e.gid||null,this.tintcolor=e.tintcolor,this.type=e.type,this.class=void 0!==e.class?e.class:e.type,this.text=void 0,this.rotation=On(+e.rotation||0),this.id=+e.id||void 0,this.orientation=t.orientation,this.shapes=void 0,this.isEllipse=!1,this.isPolygon=!1,this.isPolyLine=!1,"number"==typeof this.gid?this.setTile(t.tilesets):void 0!==e.ellipse?this.isEllipse=!0:void 0!==e.polygon?(this.points=e.polygon,this.isPolygon=!0):void 0!==e.polyline&&(this.points=e.polyline,this.isPolyLine=!0),void 0!==e.text?(this.text=e.text,this.text.font=e.text.fontfamily||"sans-serif",this.text.size=e.text.pixelsize||16,this.text.fillStyle=e.text.color||"#000000",this.text.textAlign=e.text.halign||"left",this.text.textBaseline=e.text.valign||"top",this.text.width=this.width,this.text.height=this.height,Eu(this.text,e)):(Eu(this,e),this.shapes||(this.shapes=this.parseTMXShapes())),t.isEditor||t.getRenderer().adjustPosition(this)};ju.prototype.setTile=function(t){var e=t.getTilesetByGid(this.gid);!1===e.isCollection&&(this.width=this.framewidth=e.tilewidth,this.height=this.frameheight=e.tileheight),this.tile=new Cu(this.x,this.y,this.gid,e)},ju.prototype.parseTMXShapes=function(){var t=0,e=[];if(!0===this.isEllipse)e.push(qn.pull("Ellipse",this.width/2,this.height/2,this.width,this.height).rotate(this.rotation));else if(!0===this.isPolygon){var i=qn.pull("Polygon",0,0,this.points);if(!1===i.isConvex())throw new Error("collision polygones in Tiled should be defined as Convex");e.push(i.rotate(this.rotation))}else if(!0===this.isPolyLine){var o,n,r=this.points,s=r.length-1;for(t=0;t0&&(e.autoSort=!0,e.autoDepth=!0,i.push(e))}return i},Gu.prototype.getLayers=function(){return this.readMapObjects(this.data),this.layers},Gu.prototype.destroy=function(){this.tilesets=void 0,this.layers.length=0,this.objectGroups.length=0,this.initialized=!1};var Xu={},Hu=[],Yu=0;function Wu(t,e,i){e.container.reset(),Jl.reset(),Xu[qu.getCurrentLevelId()]&&Xu[qu.getCurrentLevelId()].destroy(),Yu=Hu.indexOf(t),function(t,e,i,o){var n=Xu[t];Hc.resetGUID(t,n.nextobjectid),e.anchorPoint.set(0,0),n.addTo(e,i,o)}(t,e.container,e.flatten,e.setViewportBounds),Wr(Cr,t),e.onLoaded(t),i&&_u.restart()}var qu={add:function(t,e,i){if("tmx"===t)return null==Xu[e]&&(Xu[e]=new Gu(e,uc.getTMX(e)),Hu.push(e),i&&i(),!0);throw new Error("no level loader defined for format "+t)},load:function(t,e){if(e=Object.assign({container:Jl.world,onLoaded:Jl.onLevelLoaded,flatten:Jl.mergeGroup,setViewportBounds:!0},e||{}),void 0===Xu[t])throw new Error("level "+t+" not found");if(!(Xu[t]instanceof Gu))throw new Error("no level loader defined");return _u.isRunning()?(_u.stop(),Hc.function.defer(Wu,this,t,e,!0)):Wu(t,e),!0},getCurrentLevelId:function(){return Hu[Yu]},getCurrentLevel:function(){return Xu[this.getCurrentLevelId()]},reload:function(t){return this.load(this.getCurrentLevelId(),t)},next:function(t){return Yu+1=0&&this.load(Hu[Yu-1],t)},levelCount:function(){return Hu.length}},Ku={},Zu={},Qu={},Ju={},$u={},tc=0,ec=0,ic=0;function oc(t){if(ec===tc){if("function"!=typeof t&&!uc.onload)throw new Error("no load callback defined");clearTimeout(ic);var e=t||uc.onload;setTimeout((function(){e(),Wr(Mr)}),300)}else ic=setTimeout((function(){oc(t)}),100)}function nc(t,e,i){Ku[t.name]=new Image,"function"==typeof e&&(Ku[t.name].onload=e),"function"==typeof i&&(Ku[t.name].onerror=i),"string"==typeof uc.crossOrigin&&(Ku[t.name].crossOrigin=uc.crossOrigin),Ku[t.name].src=t.src+uc.nocache}function rc(t,e,i){!0===vn(t.src)&&(t.src.startsWith("url(")||(t.src="url("+t.src+")"));var o=new FontFace(t.name,t.src);o.load().then((function(){document.fonts.add(o),document.body.style.fontFamily=t.name,"function"==typeof e&&e()}),(function(){"function"==typeof i&&i(t.name)}))}function sc(t,e,i){function o(e){Zu[t.name]=e,"tmx"===t.type&&qu.add(t.type,t.name)}if(t.data)return o(t.data),void("function"==typeof e&&e());var n=new XMLHttpRequest,r=Nn(t.src);n.overrideMimeType&&("json"===r?n.overrideMimeType("application/json"):n.overrideMimeType("text/xml")),n.open("GET",t.src+uc.nocache,!0),n.withCredentials=uc.withCredentials,n.ontimeout=i,n.onreadystatechange=function(){if(4===n.readyState)if(200===n.status||0===n.status&&n.responseText){var s=null;switch(r){case"xml":case"tmx":case"tsx":if(rs.match(/msie/i)||!n.responseXML){if(!globalThis.DOMParser)throw new Error("XML file format loading not supported, use the JSON file format instead");s=(new DOMParser).parseFromString(n.responseText,"text/xml")}else s=n.responseXML;var a=Au(s);switch(r){case"tmx":s=a.map;break;case"tsx":s=a.tilesets[0]}break;case"json":s=JSON.parse(n.responseText);break;default:throw new Error("TMX file format "+r+"not supported !")}o(s),"function"==typeof e&&e()}else"function"==typeof i&&i(t.name)},n.send()}function ac(t,e,i){var o=new XMLHttpRequest;o.overrideMimeType&&o.overrideMimeType("application/json"),o.open("GET",t.src+uc.nocache,!0),o.withCredentials=uc.withCredentials,o.ontimeout=i,o.onreadystatechange=function(){4===o.readyState&&(200===o.status||0===o.status&&o.responseText?(Ju[t.name]=JSON.parse(o.responseText),"function"==typeof e&&e()):"function"==typeof i&&i(t.name))},o.send()}function hc(t,e,i){var o=new XMLHttpRequest;o.open("GET",t.src+uc.nocache,!0),o.withCredentials=uc.withCredentials,o.responseType="arraybuffer",o.onerror=i,o.onload=function(){var i=o.response;if(i){for(var n=new Uint8Array(i),r=[],s=0;s0){var i=this.getAnimationFrameObjectByIndex(this.current.idx).delay;for(this.dt+=e;this.dt>=i;){this.isDirty=!0,this.dt-=i;var o=this.current.length>1?this.current.idx+1:this.current.idx;if(this.setAnimationFrame(o),0===this.current.idx&&"function"==typeof this.resetAnim&&!1===this.resetAnim()){this.setAnimationFrame(this.current.length-1),this.dt%=i;break}i=this.getAnimationFrameObjectByIndex(this.current.idx).delay}}return this._flicker.isFlickering&&(this._flicker.duration-=e,this._flicker.duration<0&&("function"==typeof this._flicker.callback&&this._flicker.callback(),this.flicker(-1)),this.isDirty=!0),t.prototype.update.call(this,e)},e.prototype.destroy=function(){qn.push(this.offset),this.offset=void 0,t.prototype.destroy.call(this)},e.prototype.draw=function(t,e){if(!this._flicker.isFlickering||(this._flicker.state=!this._flicker.state,this._flicker.state)){var i=this.current,o=this.pos.x,n=this.pos.y,r=i.width,s=i.height,a=i.offset,h=this.offset;0!==i.angle&&(t.translate(-o,-n),t.rotate(i.angle),o-=s,r=i.height,s=i.width),t.drawImage(this.image,h.x+a.x,h.y+a.y,r,s,o,n,r,s)}},e}(Cl);function pc(t,e,i,o){return void 0===i&&(i="default"),void 0===o&&(o="no-repeat"),{meta:{app:"melonJS",size:{w:t,h:e},repeat:o,image:"default"},frames:[{filename:i,frame:{x:0,y:0,w:t,h:e}}]}}var dc=function(t,e,i){var o=this;if(this.format=null,this.sources=new Map,this.atlases=new Map,void 0!==t)for(var n in t=Array.isArray(t)?t:[t]){var r=t[n];if(void 0!==r.meta){if(r.meta.app.includes("texturepacker")||r.meta.app.includes("free-tex-packer")){if(this.format="texturepacker",void 0===e){var s=uc.getImage(r.meta.image);if(!s)throw new Error("Atlas texture '"+s+"' not found");this.sources.set(r.meta.image,s)}else this.sources.set(r.meta.image||"default","string"==typeof e?uc.getImage(e):e);this.repeat="no-repeat"}else if(r.meta.app.includes("ShoeBox")){if(!r.meta.exporter||!r.meta.exporter.includes("melonJS"))throw new Error("ShoeBox requires the JSON exporter : https://github.com/melonjs/melonJS/tree/master/media/shoebox_JSON_export.sbx");this.format="ShoeBox",this.repeat="no-repeat",this.sources.set("default","string"==typeof e?uc.getImage(e):e)}else r.meta.app.includes("melonJS")&&(this.format="melonJS",this.repeat=r.meta.repeat||"no-repeat",this.sources.set("default","string"==typeof e?uc.getImage(e):e));this.atlases.set(r.meta.image||"default",this.parse(r))}else void 0!==r.framewidth&&void 0!==r.frameheight&&(this.format="Spritesheet (fixed cell size)",this.repeat="no-repeat",void 0!==e&&(r.image="string"==typeof e?uc.getImage(e):e),this.atlases.set("default",this.parseFromSpriteSheet(r)),this.sources.set("default",r.image))}if(0===this.atlases.length)throw new Error("texture atlas format not supported");!1!==i&&this.sources.forEach((function(t){i instanceof Pc?i.set(t,o):Fc.cache.set(t,o)}))};dc.prototype.parse=function(t){var e=this,i={};return t.frames.forEach((function(o){if(o.hasOwnProperty("filename")){var n,r,s=o.frame,a=o.spriteSourceSize&&o.sourceSize&&o.pivot;a&&(n=o.sourceSize.w*o.pivot.x-(o.trimmed?o.spriteSourceSize.x:0),r=o.sourceSize.h*o.pivot.y-(o.trimmed?o.spriteSourceSize.y:0)),i[o.filename]={name:o.filename,texture:t.meta.image||"default",offset:new Kn(s.x,s.y),anchorPoint:a?new Kn(n/s.w,r/s.h):null,trimmed:!!o.trimmed,width:s.w,height:s.h,angle:!0===o.rotated?-Sn:0},e.addUVs(i,o.filename,t.meta.size.w,t.meta.size.h)}})),i},dc.prototype.parseFromSpriteSheet=function(t){var e={},i=t.image,o=t.spacing||0,n=t.margin||0,r=i.width,s=i.height,a=qn.pull("Vector2d",~~((r-n+o)/(t.framewidth+o)),~~((s-n+o)/(t.frameheight+o)));if(r%(t.framewidth+o)!=0||s%(t.frameheight+o)!=0){var h=a.x*(t.framewidth+o),l=a.y*(t.frameheight+o);h-r!==o&&l-s!==o&&(r=h,s=l,console.warn("Spritesheet Texture for image: "+i.src+" is not divisible by "+(t.framewidth+o)+"x"+(t.frameheight+o)+", truncating effective size to "+r+"x"+s))}for(var u=0,c=a.x*a.y;u0&&n[n.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!n||r[1]>n[0]&&r[1]=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},xc=e&&e.__read||function(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var o,n,r=i.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)s.push(o.value)}catch(t){n={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return s};Object.defineProperty(gc,"__esModule",{value:!0}),gc.Multimap=void 0;var _c=function(){function t(t,e){var i,o;if(this.size_=0,this.map=new Map,this.operator=t,e)try{for(var n=mc(e),r=n.next();!r.done;r=n.next()){var s=xc(r.value,2),a=s[0],h=s[1];this.put(a,h)}}catch(t){i={error:t}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(i)throw i.error}}return this}return Object.defineProperty(t.prototype,"size",{get:function(){return this.size_},enumerable:!1,configurable:!0}),t.prototype.get=function(t){var e=this.map.get(t);return e?this.operator.clone(e):this.operator.create()},t.prototype.put=function(t,e){var i=this.map.get(t);return i||(i=this.operator.create()),!!this.operator.add(e,i)&&(this.map.set(t,i),this.size_++,!0)},t.prototype.putAll=function(e,i){var o,n,r,s,a=0;if(i){var h=e,l=i;try{for(var u=mc(l),c=u.next();!c.done;c=u.next()){var p=c.value;this.put(h,p),a++}}catch(t){o={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}}else{if(!(e instanceof t))throw new TypeError("unexpected arguments");try{for(var d=mc(e.entries()),f=d.next();!f.done;f=d.next()){var y=xc(f.value,2);h=y[0],p=y[1];this.put(h,p),a++}}catch(t){r={error:t}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}return a>0},t.prototype.has=function(t){return this.map.has(t)},t.prototype.hasEntry=function(t,e){return this.operator.has(e,this.get(t))},t.prototype.delete=function(t){return this.size_-=this.operator.size(this.get(t)),this.map.delete(t)},t.prototype.deleteEntry=function(t,e){var i=this.get(t);return!!this.operator.delete(e,i)&&(this.map.set(t,i),this.size_--,!0)},t.prototype.clear=function(){this.map.clear(),this.size_=0},t.prototype.keys=function(){return this.map.keys()},t.prototype.entries=function(){var t=this;return function(){var e,i,o,n,r,s,a,h,l,u,c,p,d,f;return vc(this,(function(y){switch(y.label){case 0:y.trys.push([0,11,12,13]),e=mc(t.map.entries()),i=e.next(),y.label=1;case 1:if(i.done)return[3,10];o=xc(i.value,2),n=o[0],r=o[1],y.label=2;case 2:y.trys.push([2,7,8,9]),d=void 0,s=mc(r),a=s.next(),y.label=3;case 3:return a.done?[3,6]:(h=a.value,[4,[n,h]]);case 4:y.sent(),y.label=5;case 5:return a=s.next(),[3,3];case 6:return[3,9];case 7:return l=y.sent(),d={error:l},[3,9];case 8:try{a&&!a.done&&(f=s.return)&&f.call(s)}finally{if(d)throw d.error}return[7];case 9:return i=e.next(),[3,1];case 10:return[3,13];case 11:return u=y.sent(),c={error:u},[3,13];case 12:try{i&&!i.done&&(p=e.return)&&p.call(e)}finally{if(c)throw c.error}return[7];case 13:return[2]}}))}()},t.prototype.values=function(){var t=this;return function(){var e,i,o,n,r,s;return vc(this,(function(a){switch(a.label){case 0:a.trys.push([0,5,6,7]),e=mc(t.entries()),i=e.next(),a.label=1;case 1:return i.done?[3,4]:(o=xc(i.value,2),[4,o[1]]);case 2:a.sent(),a.label=3;case 3:return i=e.next(),[3,1];case 4:return[3,7];case 5:return n=a.sent(),r={error:n},[3,7];case 6:try{i&&!i.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}return[7];case 7:return[2]}}))}()},t.prototype.forEach=function(t,e){var i,o;try{for(var n=mc(this.entries()),r=n.next();!r.done;r=n.next()){var s=xc(r.value,2),a=s[0],h=s[1];t.call(void 0===e?this:e,h,a,this)}}catch(t){i={error:t}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(i)throw i.error}}},t.prototype[Symbol.iterator]=function(){return this.entries()},t.prototype.asMap=function(){var t,e,i=new Map;try{for(var o=mc(this.keys()),n=o.next();!n.done;n=o.next()){var r=n.value;i.set(r,this.operator.clone(this.get(r)))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return i},t}();gc.Multimap=_c;var bc,wc=e&&e.__extends||(bc=function(t,e){return bc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},bc(t,e)},function(t,e){function i(){this.constructor=t}bc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(yc,"__esModule",{value:!0}),yc.ArrayMultimap=void 0;var Tc=function(t){function e(e){return t.call(this,new Ac,e)||this}return wc(e,t),Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"ArrayMultimap"},enumerable:!1,configurable:!0}),e}(gc.Multimap);yc.ArrayMultimap=Tc;var Ac=function(){function t(){}return t.prototype.create=function(){return[]},t.prototype.clone=function(t){return t.slice()},t.prototype.add=function(t,e){return e.push(t),!0},t.prototype.size=function(t){return t.length},t.prototype.delete=function(t,e){var i=e.indexOf(t);return i>-1&&(e.splice(i,1),!0)},t.prototype.has=function(t,e){return e.includes(t)},t}(),Ec={},Sc=e&&e.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}();Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.SetMultimap=void 0;var Cc=function(t){function e(e){return t.call(this,new Mc,e)||this}return Sc(e,t),Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"SetMultimap"},enumerable:!1,configurable:!0}),e}(gc.Multimap);Ec.SetMultimap=Cc;var Mc=function(){function t(){}return t.prototype.create=function(){return new Set},t.prototype.clone=function(t){return new Set(t)},t.prototype.add=function(t,e){var i=e.size;return e.add(t),i!==e.size},t.prototype.size=function(t){return t.size},t.prototype.delete=function(t,e){return e.delete(t)},t.prototype.has=function(t,e){return e.has(t)},t}();!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SetMultimap=t.ArrayMultimap=void 0;var e=yc;Object.defineProperty(t,"ArrayMultimap",{enumerable:!0,get:function(){return e.ArrayMultimap}});var i=Ec;Object.defineProperty(t,"SetMultimap",{enumerable:!0,get:function(){return i.SetMultimap}})}(fc);var Pc=function(t){this.cache=new fc.ArrayMultimap,this.tinted=new Map,this.units=new Map,this.max_size=t||1/0,this.clear()};Pc.prototype.clear=function(){this.cache.clear(),this.tinted.clear(),this.units.clear(),this.length=0},Pc.prototype.validate=function(){if(this.length>=this.max_size)throw new Error("Texture cache overflow: "+this.max_size+" texture units available for this GPU.")},Pc.prototype.get=function(t,e){var i;return void 0===e?i=this.cache.get(t)[0]:this.cache.forEach((function(o,n){var r=o.getAtlas();n===t&&r[0].width===e.framewidth&&r[0].height===e.frameheight&&(i=o)})),void 0===i&&(e||(e=pc(t.width,t.height,t.src?Un(t.src):void 0)),i=new dc(e,t,!1),this.set(t,i)),i},Pc.prototype.delete=function(t){this.cache.has(t)||this.cache.delete(t)},Pc.prototype.tint=function(t,e){var i=this.tinted.get(t);return void 0===i&&(i=this.tinted.set(t,new Map)),i.has(e)||i.set(e,Fc.tint(t,e,"multiply")),i.get(e)},Pc.prototype.set=function(t,e){var i=t.width,o=t.height;if(!(1!==Fc.WebGLVersion||Mn(i)&&Mn(o))){var n=void 0!==t.src?t.src:t;console.warn("[Texture] "+n+" is not a POT texture ("+i+"x"+o+")")}return this.cache.put(t,e)},Pc.prototype.getUnit=function(t){return this.units.has(t)||(this.validate(),this.units.set(t,this.length++)),this.units.get(t)};var Oc=function(t){function e(e){var i=this;t.call(this,e),this.WebGLVersion=1,this.GPUVendor=null,this.GPURenderer=null,this.context=this.gl=this.getContextGL(this.getCanvas(),e.transparent),this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this._colorStack=[],this._matrixStack=[],this._scissorStack=[],this._blendStack=[],this.currentTransform=new hr,this.currentCompositor=null,this.compositors=new Map;var o=new(this.settings.compositor||ga)(this);this.compositors.set("default",o),this.setCompositor(o),this.gl.disable(this.gl.DEPTH_TEST),this.gl.disable(this.gl.SCISSOR_TEST),this.gl.enable(this.gl.BLEND),this.setBlendMode(this.settings.blendMode);var n=this.gl.getExtension("WEBGL_debug_renderer_info");null!==n&&(this.GPUVendor=this.gl.getParameter(n.UNMASKED_VENDOR_WEBGL),this.GPURenderer=this.gl.getParameter(n.UNMASKED_RENDERER_WEBGL)),this.cache=new Pc(this.maxTextures),this.getCanvas().addEventListener("webglcontextlost",(function(t){t.preventDefault(),i.isContextValid=!1,Wr(Hr,i)}),!1),this.getCanvas().addEventListener("webglcontextrestored",(function(){i.reset(),i.isContextValid=!0,Wr(Yr,i)}),!1)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.reset=function(){var e=this;t.prototype.reset.call(this),this.compositors.forEach((function(t){!1===e.isContextValid?t.init(e):t.reset()})),this.gl.disable(this.gl.SCISSOR_TEST),void 0!==this.fontContext2D&&this.createFontTexture(this.cache)},e.prototype.setCompositor=function(t){if(void 0===t&&(t="default"),"string"==typeof t&&(t=this.compositors.get(t)),void 0===t)throw new Error("Invalid WebGL Compositor");this.currentCompositor!==t&&(null!==this.currentCompositor&&this.currentCompositor.flush(),this.currentCompositor=t)},e.prototype.resetTransform=function(){this.currentTransform.identity()},e.prototype.createFontTexture=function(t){if(void 0===this.fontTexture){var e=this.getCanvas(),i=e.width,o=e.height;1===this.WebGLVersion&&(Mn(i)||(i=Pn(e.width)),Mn(o)||(o=Pn(e.height)));var n=Vc(i,o,!0);this.fontContext2D=this.getContext2d(n),this.fontTexture=new dc(pc(e.width,e.height,"fontTexture"),n,t),this.currentCompositor.uploadTexture(this.fontTexture,0,0,0)}else t.set(this.fontContext2D.canvas,this.fontTexture)},e.prototype.createPattern=function(t,e){if(!(1!==Fc.WebGLVersion||Mn(t.width)&&Mn(t.height))){var i=void 0!==t.src?t.src:t;throw new Error("[WebGL Renderer] "+i+" is not a POT texture ("+t.width+"x"+t.height+")")}var o=new dc(pc(t.width,t.height,"pattern",e),t);return this.currentCompositor.uploadTexture(o),o},e.prototype.flush=function(){this.currentCompositor.flush()},e.prototype.setProjection=function(e){t.prototype.setProjection.call(this,e),this.currentCompositor.setProjection(e)},e.prototype.clearColor=function(t,e){var i;if(void 0===t&&(t="#000000"),void 0===e&&(e=!1),t instanceof nr)i=t.toArray();else{var o=qn.pull("me.Color");i=o.parseCSS(t).toArray(),qn.push(o)}this.currentCompositor.clearColor(i[0],i[1],i[2],!0===e?1:i[3]),this.currentCompositor.clear(),this.currentCompositor.clearColor(0,0,0,0)},e.prototype.clearRect=function(t,e,i,o){this.save(),this.clipRect(t,e,i,o),this.clearColor(),this.restore()},e.prototype.drawFont=function(t){var e=this.getFontContext();this.currentCompositor.uploadTexture(this.fontTexture,0,0,0,!0);var i=this.fontTexture.getUVs(t.left+","+t.top+","+t.width+","+t.height);this.currentCompositor.addQuad(this.fontTexture,t.left,t.top,t.width,t.height,i[0],i[1],i[2],i[3],this.currentTint.toUint32()),e.clearRect(t.left,t.top,t.width,t.height)},e.prototype.drawImage=function(t,e,i,o,n,r,s,a,h){void 0===o?(o=a=t.width,n=h=t.height,r=e,s=i,e=0,i=0):void 0===r&&(r=e,s=i,a=o,h=n,o=t.width,n=t.height,e=0,i=0),!1===this.settings.subPixel&&(r|=0,s|=0);var l=this.cache.get(t),u=l.getUVs(e+","+i+","+o+","+n);this.currentCompositor.addQuad(l,r,s,a,h,u[0],u[1],u[2],u[3],this.currentTint.toUint32())},e.prototype.drawPattern=function(t,e,i,o,n){var r=t.getUVs("0,0,"+o+","+n);this.currentCompositor.addQuad(t,e,i,o,n,r[0],r[1],r[2],r[3],this.currentTint.toUint32())},e.prototype.getContextGL=function(t,e){if(null==t)throw new Error("You must pass a canvas element in order to create a GL context");"boolean"!=typeof e&&(e=!0);var i,o={alpha:e,antialias:this.settings.antiAlias,depth:!1,stencil:!0,preserveDrawingBuffer:!1,premultipliedAlpha:e,powerPreference:this.settings.powerPreference,failIfMajorPerformanceCaveat:this.settings.failIfMajorPerformanceCaveat};if(!1===this.settings.preferWebGL1&&(i=t.getContext("webgl2",o))&&(this.WebGLVersion=2),i||(this.WebGLVersion=1,i=t.getContext("webgl",o)||t.getContext("experimental-webgl",o)),!i)throw new Error("A WebGL context could not be created.");return i},e.prototype.getContext=function(){return this.gl},e.prototype.setBlendMode=function(t,e){if(void 0===t&&(t="normal"),void 0===e&&(e=this.gl),this.currentBlendMode!==t)switch(this.flush(),e.enable(e.BLEND),this.currentBlendMode=t,t){case"screen":e.blendFunc(e.ONE,e.ONE_MINUS_SRC_COLOR);break;case"lighter":case"additive":e.blendFunc(e.ONE,e.ONE);break;case"multiply":e.blendFunc(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA);break;default:e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),this.currentBlendMode="normal"}},e.prototype.getFontContext=function(){return void 0===this.fontContext2D&&(console.warn("[WebGL Renderer] WARNING : Using Standard me.Text with WebGL will severly impact performances !"),this.createFontTexture(this.cache)),this.fontContext2D},e.prototype.restore=function(){if(0!==this._matrixStack.length){var t=this._colorStack.pop(),e=this._matrixStack.pop();this.currentColor.copy(t),this.currentTransform.copy(e),this.setBlendMode(this._blendStack.pop()),qn.push(t),qn.push(e)}0!==this._scissorStack.length?this.currentScissor.set(this._scissorStack.pop()):(this.gl.disable(this.gl.SCISSOR_TEST),this.currentScissor[0]=0,this.currentScissor[1]=0,this.currentScissor[2]=this.getCanvas().width,this.currentScissor[3]=this.getCanvas().height)},e.prototype.save=function(){this._colorStack.push(this.currentColor.clone()),this._matrixStack.push(this.currentTransform.clone()),this.gl.isEnabled(this.gl.SCISSOR_TEST)&&this._scissorStack.push(this.currentScissor.slice()),this._blendStack.push(this.getBlendMode())},e.prototype.rotate=function(t){this.currentTransform.rotate(t)},e.prototype.scale=function(t,e){this.currentTransform.scale(t,e)},e.prototype.setAntiAlias=function(e,i){t.prototype.setAntiAlias.call(this,e,i)},e.prototype.setGlobalAlpha=function(t){this.currentColor.alpha=t},e.prototype.getGlobalAlpha=function(){return this.currentColor.alpha},e.prototype.setColor=function(t){var e=this.currentColor.alpha;this.currentColor.copy(t),this.currentColor.alpha*=e},e.prototype.setLineWidth=function(t){this.getContext().lineWidth(t)},e.prototype.strokeArc=function(t,e,i,o,n,r,s){void 0===r&&(r=!1),void 0===s&&(s=!1),this.getGlobalAlpha()<1/255||(this.path2D.beginPath(),this.path2D.arc(t,e,i,o,n,r),!1===s?this.currentCompositor.drawVertices(this.gl.LINE_STRIP,this.path2D.points):(this.path2D.closePath(),this.currentCompositor.drawVertices(this.gl.TRIANGLES,this.path2D.triangulatePath())))},e.prototype.fillArc=function(t,e,i,o,n,r){void 0===r&&(r=!1),this.strokeArc(t,e,i,o,n,r,!0)},e.prototype.strokeEllipse=function(t,e,i,o,n){void 0===n&&(n=!1),this.getGlobalAlpha()<1/255||(this.path2D.beginPath(),this.path2D.ellipse(t,e,i,o,0,0,360),this.path2D.closePath(),!1===n?this.currentCompositor.drawVertices(this.gl.LINE_LOOP,this.path2D.points):this.currentCompositor.drawVertices(this.gl.TRIANGLES,this.path2D.triangulatePath()))},e.prototype.fillEllipse=function(t,e,i,o){this.strokeEllipse(t,e,i,o,!1)},e.prototype.strokeLine=function(t,e,i,o){this.getGlobalAlpha()<1/255||(this.path2D.beginPath(),this.path2D.moveTo(t,e),this.path2D.lineTo(i,o),this.currentCompositor.drawVertices(this.gl.LINE_STRIP,this.path2D.points))},e.prototype.fillLine=function(t,e,i,o){this.strokeLine(t,e,i,o)},e.prototype.strokePolygon=function(t,e){if(void 0===e&&(e=!1),!(this.getGlobalAlpha()<1/255)){var i;this.translate(t.pos.x,t.pos.y),this.path2D.beginPath(),this.path2D.moveTo(t.points[0].x,t.points[0].y);for(var o=1;o0&&(this.flush(),this.maskLevel=0,this.gl.disable(this.gl.STENCIL_TEST))},e}(Ja),Ic=1,kc=0,Rc=0,Bc={parent:void 0,renderer:2,autoScale:!1,scale:1,scaleMethod:"manual",transparent:!1,blendMode:"normal",antiAlias:!1,failIfMajorPerformanceCaveat:!0,subPixel:!1,preferWebGL1:!1,powerPreference:"default",verbose:!1,consoleHeader:!0};function Dc(){var t=Fc.settings,e=1,i=1;if(t.autoScale){var o=1/0,n=1/0;if(globalThis.getComputedStyle){var r=globalThis.getComputedStyle(Fc.getCanvas(),null);o=parseInt(r.maxWidth,10)||1/0,n=parseInt(r.maxHeight,10)||1/0}var s=na(jc()),a=Math.min(o,s.width),h=Math.min(n,s.height),l=a/h;if("fill-min"===t.scaleMethod&&l>Ic||"fill-max"===t.scaleMethod&&lIc||"flex-height"===t.scaleMethod){var c=Math.min(n,kc*(h/a));e=i=h/c,Fc.resize(kc,Math.floor(c))}else"flex"===t.scaleMethod?Fc.resize(Math.floor(a),Math.floor(h)):"stretch"===t.scaleMethod?(e=a/kc,i=h/Rc):e=i=l0;)o[n]=arguments[n+3];return this.timers.push({fn:t,delay:e,elapsed:0,repeat:!1,timerId:++this.timerId,pauseable:!0===i||!0,args:o}),this.timerId},Yc.prototype.setInterval=function(t,e,i){for(var o=[],n=arguments.length-3;n-- >0;)o[n]=arguments[n+3];return this.timers.push({fn:t,delay:e,elapsed:0,repeat:!0,timerId:++this.timerId,pauseable:!0===i||!0,args:o}),this.timerId},Yc.prototype.clearTimeout=function(t){Hc.function.defer(this.clearTimer.bind(this),this,t)},Yc.prototype.clearInterval=function(t){Hc.function.defer(this.clearTimer.bind(this),this,t)},Yc.prototype.getTime=function(){return this.now},Yc.prototype.getDelta=function(){return this.delta},Yc.prototype.countFPS=function(){this.framecount++,this.framedelta+=this.delta,this.framecount%10==0&&(this.fps=In(Math.round(1e3*this.framecount/this.framedelta),0,this.maxfps),this.framedelta=0,this.framecount=0)},Yc.prototype.update=function(t){this.last=this.now,this.now=t,this.delta=this.now-this.last,this.delta<0&&(this.delta=0),this.tick=this.delta>this.minstep&&this.interpolation?this.delta/this.step:1,this.updateTimers()},Yc.prototype.clearTimer=function(t){for(var e=0,i=this.timers.length;e=i.delay&&(i.fn.apply(null,i.args),!0===i.repeat?i.elapsed-=i.delay:this.clearTimeout(i.timerId))}};var Wc,qc=new Yc,Kc=0,Zc=["ms","moz","webkit","o"],Qc=globalThis.requestAnimationFrame,Jc=globalThis.cancelAnimationFrame;for(Wc=0;Wc2&&(i=Array.prototype.slice.call(arguments,1)),i[0]=t;var o=new(t.bind.apply(t,i));if(void 0===o||!(o instanceof tp.Base))throw new Error("Plugin should extend the me.plugin.Base Class !");if(Hc.checkVersion(o.version)>0)throw new Error("Plugin version mismatch, expected: "+o.version+", got: "+Lp);$c[e]=o}},ep={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-ep.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*ep.Bounce.In(2*t):.5*ep.Bounce.Out(2*t-1)+.5}}},ip={Linear:function(t,e){var i=t.length-1,o=i*e,n=Math.floor(o),r=ip.Utils.Linear;return e<0?r(t[0],t[1],o):e>1?r(t[i],t[i-1],i-o):r(t[n],t[n+1>i?i:n+1],o-n)},Bezier:function(t,e){var i,o=0,n=t.length-1,r=Math.pow,s=ip.Utils.Bernstein;for(i=0;i<=n;i++)o+=r(1-e,n-i)*r(e,i)*t[i]*s(n,i);return o},CatmullRom:function(t,e){var i=t.length-1,o=i*e,n=Math.floor(o),r=ip.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(n=Math.floor(o=i*(1+e))),r(t[(n-1+i)%i],t[n],t[(n+1)%i],t[(n+2)%i],o-n)):e<0?t[0]-(r(t[0],t[0],t[1],t[1],-o)-t[0]):e>1?t[i]-(r(t[i],t[i],t[i-1],t[i-1],o-i)-t[i]):r(t[n?n-1:0],t[n],t[i1;i--)o*=i;return t[e]=o,o}}(),CatmullRom:function(t,e,i,o,n){var r=.5*(i-t),s=.5*(o-e),a=n*n;return(2*e-2*i+r+s)*(n*a)+(-3*e+3*i-2*r-s)*a+r*n+e}}},op=function(t){this.setProperties(t)},np={Easing:{configurable:!0},Interpolation:{configurable:!0}};op.prototype.onResetEvent=function(t){this.setProperties(t)},op.prototype.setProperties=function(t){for(var e in this._object=t,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._yoyo=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=ep.Linear.None,this._interpolationFunction=ip.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onCompleteCallback=null,this._tweenTimeTracker=Jl.lastUpdate,this.isPersistent=!1,this.updateWhenPaused=!1,this.isRenderable=!1,t)"object"!=typeof t&&(this._valuesStart[e]=parseFloat(t[e]))},op.prototype._resumeCallback=function(t){this._startTime&&(this._startTime+=t)},op.prototype.onActivateEvent=function(){qr(yr,this._resumeCallback,this)},op.prototype.onDeactivateEvent=function(){Zr(yr,this._resumeCallback)},op.prototype.to=function(t,e){return this._valuesEnd=t,void 0!==e&&("number"==typeof e?this._duration=e:"object"==typeof e&&(e.duration&&(this._duration=e.duration),e.yoyo&&this.yoyo(e.yoyo),e.easing&&this.easing(e.easing),e.repeat&&this.repeat(e.repeat),e.delay&&this.delay(e.delay),e.interpolation&&this.interpolation(e.interpolation),e.autoStart&&this.start())),this},op.prototype.start=function(t){for(var e in void 0===t&&(t=qc.getTime()),this._onStartCallbackFired=!1,Jl.world.addChild(this),this._startTime=t+this._delayTime,this._valuesEnd){if(this._valuesEnd[e]instanceof Array){if(0===this._valuesEnd[e].length)continue;this._valuesEnd[e]=[this._object[e]].concat(this._valuesEnd[e])}this._valuesStart[e]=this._object[e],this._valuesStart[e]instanceof Array==!1&&(this._valuesStart[e]*=1),this._valuesStartRepeat[e]=this._valuesStart[e]||0}return this},op.prototype.stop=function(){return Jl.world.removeChildNow(this),this},op.prototype.delay=function(t){return this._delayTime=t,this},op.prototype.repeat=function(t){return this._repeat=t,this},op.prototype.yoyo=function(t){return this._yoyo=t,this},op.prototype.easing=function(t){if("function"!=typeof t)throw new Error("invalid easing function for me.Tween.easing()");return this._easingFunction=t,this},op.prototype.interpolation=function(t){return this._interpolationFunction=t,this},op.prototype.chain=function(){return this._chainedTweens=arguments,this},op.prototype.onStart=function(t){return this._onStartCallback=t,this},op.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},op.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},op.prototype.update=function(t){this._tweenTimeTracker=Jl.lastUpdate>this._tweenTimeTracker?Jl.lastUpdate:this._tweenTimeTracker+t;var e,i=this._tweenTimeTracker;if(i1?1:o;var n=this._easingFunction(o);for(e in this._valuesEnd){var r=this._valuesStart[e]||0,s=this._valuesEnd[e];s instanceof Array?this._object[e]=this._interpolationFunction(s,n):("string"==typeof s&&(s=r+parseFloat(s)),"number"==typeof s&&(this._object[e]=r+(s-r)*n))}if(null!==this._onUpdateCallback&&this._onUpdateCallback.call(this._object,n),1===o){if(this._repeat>0){for(e in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat){if("string"==typeof this._valuesEnd[e]&&(this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(this._valuesEnd[e])),this._yoyo){var a=this._valuesStartRepeat[e];this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=a}this._valuesStart[e]=this._valuesStartRepeat[e]}return this._yoyo&&(this._reversed=!this._reversed),this._startTime=i+this._delayTime,!0}Jl.world.removeChildNow(this),null!==this._onCompleteCallback&&this._onCompleteCallback.call(this._object);for(var h=0,l=this._chainedTweens.length;h0&&this.wordWrapWidth>0&&(this._text=this.metrics.wordWrap(this._text,this.wordWrapWidth,pp(Fc,this))),e.addBounds(this.metrics.measureText(this._text,pp(Fc,this)),!0),!0===this.offScreenCanvas){var i=Math.ceil(this.metrics.width),o=Math.ceil(this.metrics.height);Fc instanceof Oc&&(this.glTextureUnit=Fc.cache.getUnit(Fc.cache.get(this.canvasTexture.canvas)),Fc.currentCompositor.unbindTexture2D(null,this.glTextureUnit),1===Fc.WebGLVersion&&(i=Pn(this.metrics.width),o=Pn(this.metrics.height))),(this.canvasTexture.width0&&this.wordWrapWidth>0&&(this._text=this.metrics.wordWrap(this._text,this.wordWrapWidth)),this.getBounds().addBounds(this.metrics.measureText(this._text),!0),this},i.fillStyle.get=function(){return this.tint},i.fillStyle.set=function(t){this.tint=t},e.prototype.resize=function(t){return this.fontScale.set(t,t),this.getBounds().addBounds(this.metrics.measureText(this._text),!0),this.isDirty=!0,this},e.prototype.measureText=function(t){return void 0===t&&(t=this._text),this.metrics.measureText(t)},e.prototype.draw=function(t,e,i,o){var n=t.globalAlpha();void 0===this.ancestor?(this.setText(e),t.setGlobalAlpha(n*this.getOpacity())):(i=this.pos.x,o=this.pos.y);for(var r=i,s=this.metrics.lineHeight(),a=0,h=0;h>>9];if(e)return e[511&t]||0}return 0},yp.prototype.setKerning=function(t,e){this.kerning||(this.kerning={});var i=this.kerning[t>>>9];void 0===i&&(this.kerning[t>>>9]={},i=this.kerning[t>>>9]),i[511&t]=e};var gp=["M","N","B","D","C","E","F","K","A","G","H","I","J","L","O","P","Q","R","S","T","U","V","W","X","Y","Z"];function vp(t,e){var i=t.match(e);if(!i)throw new Error("Could not find pattern "+e+" in string: "+t);return i[0].split("=")[1]}function mp(t){var e=" ".charCodeAt(0),i=t[e];i||((i=new yp).id=e,i.xadvance=function(t){for(var e=Object.keys(t),i=0;i32)return t[e[i]];return null}(t).xadvance,t[e]=i)}var xp=function(t){this.onResetEvent(t)};xp.prototype.onResetEvent=function(t){this.padTop=0,this.padRight=0,this.padBottom=0,this.padLeft=0,this.lineHeight=0,this.capHeight=1,this.descent=0,this.glyphs={},this.parse(t)},xp.prototype.parse=function(t){if(!t)throw new Error("File containing font data was empty, cannot load the bitmap font.");var e=t.split(/\r\n|\n/),i=t.match(/padding\=\d+,\d+,\d+,\d+/g);if(!i)throw new Error("Padding not found in first line");var o=i[0].split("=")[1].split(",");this.padTop=parseFloat(o[0]),this.padLeft=parseFloat(o[1]),this.padBottom=parseFloat(o[2]),this.padRight=parseFloat(o[3]),this.lineHeight=parseFloat(vp(e[1],/lineHeight\=\d+/g));var n,r=parseFloat(vp(e[1],/base\=\d+/g)),s=this.padTop+this.padBottom,a=null;for(n=4;n0&&a.height>0&&(this.descent=Math.min(r+a.yoffset,this.descent)),this.glyphs[d]=a}}this.descent+=this.padBottom,mp(this.glyphs);var f=null;for(n=0;n=u?(e=1,o=1,i=u/l,n=l/u,r=s.createRadialGradient(a,h*n,0,a,u*n,l)):(i=1,n=1,e=l/u,o=u/l,r=s.createRadialGradient(a*o,h,0,a*o,h,u)),r.addColorStop(0,t.color.toRGBA(t.intensity)),r.addColorStop(1,t.color.toRGBA(0)),s.fillStyle=r,s.setTransform(e,0,0,i,0,0),s.fillRect(0,0,t.texture.width*o,t.texture.height*n)}(this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getVisibleArea=function(){return this.visibleArea.setShape(this.getBounds().centerX,this.getBounds().centerY,this.width,this.height)},e.prototype.draw=function(t,e){t.drawImage(this.texture.canvas,this.getBounds().x,this.getBounds().y)},e.prototype.destroy=function(){qn.push(this.color),this.color=void 0,qn.push(this.texture),this.texture=void 0,qn.push(this.visibleArea),this.visibleArea=void 0,t.prototype.destroy.call(this)},e}(Cl),Cp=function(t){function e(e,i,o,n){t.call(this,e,i,o,n),this.isKinematic=!1,this.dragging=!1,this.dragId=null,this.grabOffset=new Kn(0,0),this.initEvents()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.initEvents=function(){var t=this;pl("pointerdown",this,(function(e){Wr(zr,e,t)})),pl("pointerup",this,(function(e){Wr(Fr,e,t)})),pl("pointercancel",this,(function(e){Wr(Fr,e,t)})),qr(Dr,this.dragMove.bind(this)),qr(zr,(function(e,i){i===t&&t.dragStart(e)})),qr(Fr,(function(e,i){i===t&&t.dragEnd(e)}))},e.prototype.dragStart=function(t){if(!1===this.dragging)return this.dragging=!0,this.grabOffset.set(t.gameX,t.gameY),this.grabOffset.sub(this.pos),!1},e.prototype.dragMove=function(t){!0===this.dragging&&(this.pos.set(t.gameX,t.gameY,this.pos.z),this.pos.sub(this.grabOffset))},e.prototype.dragEnd=function(){if(!0===this.dragging)return this.dragging=!1,!1},e.prototype.destroy=function(){Zr(Dr,this.dragMove),Zr(zr,this.dragStart),Zr(Fr,this.dragEnd),dl("pointerdown",this),dl("pointerup",this),dl("pointercancel",this),t.prototype.destroy.call(this)},e}(Cl),Mp=function(t){function e(e,i,o,n){t.call(this,e,i,o,n),this.isKinematic=!1,this.CHECKMETHOD_OVERLAP="overlaps",this.CHECKMETHOD_CONTAINS="contains",this.checkMethod=this.CHECKMETHOD_OVERLAP,qr(Fr,this.checkOnMe,this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setCheckMethod=function(t){"function"==typeof this.getBounds()[this.checkMethod]&&(this.checkMethod=t)},e.prototype.checkOnMe=function(t,e){e&&this.getBounds()[this.checkMethod](e.getBounds())&&this.drop(e)},e.prototype.drop=function(t){},e.prototype.destroy=function(){Zr(Fr,this.checkOnMe),t.prototype.destroy.call(this)},e}(Cl),Pp={width:1,height:1,image:void 0,textureSize:8,tint:"#fff",totalParticles:50,angle:Math.PI/2,angleVariation:0,minLife:1e3,maxLife:3e3,speed:2,speedVariation:1,minRotation:0,maxRotation:0,minStartScale:1,maxStartScale:1,minEndScale:0,maxEndScale:0,gravity:0,wind:0,followTrajectory:!1,textureAdditive:!1,blendMode:"normal",onlyInViewport:!0,floating:!1,maxParticles:10,frequency:100,duration:1/0,framesToSkip:0};var Op=function(t){function e(e,i,o){void 0===o&&(o={}),t.call(this,e,i,1|o.width,1|o.height),this.settings={},this.centerOn(e,i),this._stream=!1,this._frequencyTimer=0,this._durationTimer=0,this._enabled=!1,this.alwaysUpdate=!0,this.autoSort=!1,this._updateCount=0,this._dt=0,this.reset(o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.reset=function(t){void 0===t&&(t={}),Object.assign(this.settings,Pp,t),void 0===this.settings.image&&(this._defaultParticle=function(t,e){void 0===t&&(t=8),void 0===e&&(e=8);var i=qn.pull("CanvasTexture",t,e,{offscreenCanvas:!0});return i.context.fillStyle="#fff",i.context.fillRect(0,0,t,e),i}(t.textureSize,t.textureSize),this.settings.image=this._defaultParticle.canvas),this.floating=this.settings.floating,this.isDirty=!0},e.prototype.getRandomPointX=function(){return Rn(0,this.getBounds().width)},e.prototype.getRandomPointY=function(){return Rn(0,this.getBounds().height)},e.prototype.addParticles=function(t){for(var e=0;ethis.settings.framesToSkip&&(this._updateCount=0),this._updateCount>0)return this._dt+=e,this.isDirty;if(e+=this._dt,this._dt=0,this.isDirty|=t.prototype.update.call(this,e),this._enabled&&this._stream){if(this._durationTimer!==1/0&&(this._durationTimer-=e,this._durationTimer<=0))return this.stopStream(),this.isDirty;this._frequencyTimer+=e;var i=this.children.length;i=this.settings.frequency&&(i+this.settings.maxParticles<=this.settings.totalParticles?this.addParticles(this.settings.maxParticles):this.addParticles(this.settings.totalParticles-i),this._frequencyTimer=0,this.isDirty=!0)}return this.isDirty},e.prototype.destroy=function(){t.prototype.destroy.call(this,arguments),void 0!==this._defaultParticle&&(qn.push(this._defaultParticle),this._defaultParticle=void 0),this.settings.image=void 0,this.settings=void 0},e}(Hl),Ip=function(t){function e(e){t.call(this,e.getRandomPointX(),e.getRandomPointY(),e.settings.image.width,e.settings.image.height),this.onResetEvent(e,!0)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onResetEvent=function(t,e){void 0===e&&(e=!1),!1===e?(this.pos.set(t.getRandomPointX(),t.getRandomPointY()),this.resize(t.settings.image.width,t.settings.image.height),this.currentTransform.identity()):this.vel=qn.pull("Vector2d"),this.image=t.settings.image,this.alwaysUpdate=!0,"string"==typeof t.settings.tint&&this.tint.parseCSS(t.settings.tint),!0===t.settings.textureAdditive&&(this.blendMode="additive"),"normal"!==t.settings.blendMode&&(this.blendMode=t.settings.blendMode);var i=t.settings.angle+(t.settings.angleVariation>0?(Rn(0,2)-1)*t.settings.angleVariation:0),o=t.settings.speed+(t.settings.speedVariation>0?(Rn(0,2)-1)*t.settings.speedVariation:0);this.vel.set(o*Math.cos(i),-o*Math.sin(i)),this.life=Rn(t.settings.minLife,t.settings.maxLife),this.startLife=this.life,this.startScale=In(Rn(t.settings.minStartScale,t.settings.maxStartScale),t.settings.minStartScale,t.settings.maxStartScale),this.endScale=In(Rn(t.settings.minEndScale,t.settings.maxEndScale),t.settings.minEndScale,t.settings.maxEndScale),this.gravity=t.settings.gravity,this.wind=t.settings.wind,this.followTrajectory=t.settings.followTrajectory,this.onlyInViewport=t.settings.onlyInViewport,this._deltaInv=qc.maxfps/1e3,t.settings.followTrajectory||(this.angle=Rn(t.settings.minRotation,t.settings.maxRotation))},e.prototype.update=function(e){var i=e*this._deltaInv;if(this.life=this.life>e?this.life-e:0,this.life<=0)return this.ancestor.removeChild(this),!1;var o=this.life/this.startLife,n=this.startScale;this.startScale>this.endScale?n=(n*=o)this.endScale?this.endScale:n),this.alpha=o,this.vel.x+=this.wind*i,this.vel.y+=this.gravity*i;var r=this.followTrajectory?Math.atan2(this.vel.y,this.vel.x):this.angle;return this.pos.x+=this.vel.x*i,this.pos.y+=this.vel.y*i,this.currentTransform.setTransform(n,0,0,0,n,0,this.pos.x,this.pos.y,1).rotate(r),this.isDirty=this.inViewport||!this.onlyInViewport,t.prototype.update.call(this,e)},e.prototype.draw=function(t){var e=this.width,i=this.height;t.drawImage(this.image,0,0,e,i,-e/2,-i/2,e,i)},e}(Cl),kp=function(t){function e(e,i,o){if("number"!=typeof o.width||"number"!=typeof o.height)throw new Error("height and width properties are mandatory when passing settings parameters to an object entity");t.call(this,e,i,o.width,o.height),this.children=[],o.image&&(o.framewidth=o.framewidth||o.width,o.frameheight=o.frameheight||o.height,this.renderable=new cc(0,0,o)),o.anchorPoint?this.anchorPoint.set(o.anchorPoint.x,o.anchorPoint.y):this.anchorPoint.set(0,0),"string"==typeof o.name&&(this.name=o.name),this.type=o.type||"",this.id=o.id||"",this.alive=!0,void 0===o.shapes&&(o.shapes=qn.pull("Polygon",0,0,[qn.pull("Vector2d",0,0),qn.pull("Vector2d",this.width,0),qn.pull("Vector2d",this.width,this.height),qn.pull("Vector2d",0,this.height)])),this.body=new Nl(this,o.shapes,this.onBodyUpdate.bind(this)),0===this.width&&0===this.height&&this.resize(this.body.getBounds().width,this.body.getBounds().height),this.body.setCollisionMask(o.collisionMask),this.body.setCollisionType(o.collisionType),this.autoTransform=!1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={renderable:{configurable:!0}};return i.renderable.get=function(){return this.children[0]},i.renderable.set=function(e){if(!(e instanceof t))throw new Error(e+"should extend me.Renderable");this.children[0]=e,this.children[0].ancestor=this},e.prototype.update=function(e){return this.renderable&&(this.isDirty|=this.renderable.update(e)),t.prototype.update.call(this,e)},e.prototype.onBodyUpdate=function(t){this.getBounds().addBounds(t.getBounds(),!0),this.updateBoundsPos(this.pos.x,this.pos.y)},e.prototype.preDraw=function(e){e.save(),e.translate(this.pos.x+this.body.getBounds().x,this.pos.y+this.body.getBounds().y),this.renderable instanceof t&&e.translate(this.anchorPoint.x*this.body.getBounds().width,this.anchorPoint.y*this.body.getBounds().height)},e.prototype.draw=function(e,i){var o=this.renderable;o instanceof t&&(o.preDraw(e),o.draw(e,i),o.postDraw(e))},e.prototype.destroy=function(){this.renderable&&(this.renderable.destroy.apply(this.renderable,arguments),this.children.splice(0,1)),t.prototype.destroy.call(this,arguments)},e.prototype.onDeactivateEvent=function(){this.renderable&&this.renderable.onDeactivateEvent&&this.renderable.onDeactivateEvent()},Object.defineProperties(e.prototype,i),e}(Cl);function Rp(t,e,i){var o="melonJS: %s is deprecated since version %s, please use %s",n=(new Error).stack;console.groupCollapsed?console.groupCollapsed("%c"+o,"font-weight:normal;color:yellow;",t,i,e):console.warn(o,t,i,e),void 0!==n&&console.warn(n),console.groupCollapsed&&console.groupEnd()}Object.defineProperty(Ja.prototype,"Texture",{get:function(){return Rp("me.video.renderer.Texture","me.TextureAtlas","10.4.0"),dc}});var Bp=function(t){function e(e,i,o){Rp("DraggableEntity","Draggable","10.5.0"),t.call(this,e,i,o.width,o.height)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Cp),Dp=function(t){function e(e,i,o){Rp("DroptargetEntity","DropTarget","10.5.0"),t.call(this,e,i,o.width,o.height)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Mp);Ja.prototype.getScreenCanvas=function(){return Rp("getScreenCanvas","getCanvas","13.1.0"),this.getCanvas()},Ja.prototype.getScreenContext=function(){return Rp("getScreenContext","getContext","13.1.0"),this.getContext()};var Lp="13.1.1";t.initialized=!1;function zp(){!0!==t.initialized&&(qn.register("me.Entity",kp),qn.register("me.Collectable",Ap),qn.register("me.Trigger",Ep),qn.register("me.Light2d",Sp),qn.register("me.Tween",op,!0),qn.register("me.Color",nr,!0),qn.register("me.Particle",Ip,!0),qn.register("me.Sprite",cc),qn.register("me.NineSliceSprite",wp),qn.register("me.Renderable",Cl),qn.register("me.Text",dp,!0),qn.register("me.BitmapText",fp),qn.register("me.BitmapTextData",xp,!0),qn.register("me.ImageLayer",bp),qn.register("me.ColorLayer",_p,!0),qn.register("me.Vector2d",Kn,!0),qn.register("me.Vector3d",vh,!0),qn.register("me.ObservableVector2d",gh,!0),qn.register("me.ObservableVector3d",mh,!0),qn.register("me.Matrix2d",hr,!0),qn.register("me.Matrix3d",sr,!0),qn.register("me.Rect",Ha,!0),qn.register("me.RoundRect",Ya,!0),qn.register("me.Polygon",Xa,!0),qn.register("me.Line",qa,!0),qn.register("me.Ellipse",Wa,!0),qn.register("me.Bounds",Ka,!0),qn.register("Entity",kp),qn.register("Collectable",Ap),qn.register("Trigger",Ep),qn.register("Light2d",Sp),qn.register("Tween",op,!0),qn.register("Color",nr,!0),qn.register("Particle",Ip,!0),qn.register("Sprite",cc),qn.register("NineSliceSprite",wp),qn.register("Renderable",Cl),qn.register("Text",dp,!0),qn.register("BitmapText",fp),qn.register("BitmapTextData",xp,!0),qn.register("ImageLayer",bp),qn.register("ColorLayer",_p,!0),qn.register("Vector2d",Kn,!0),qn.register("Vector3d",vh,!0),qn.register("ObservableVector2d",gh,!0),qn.register("ObservableVector3d",mh,!0),qn.register("Matrix2d",hr,!0),qn.register("Matrix3d",sr,!0),qn.register("Rect",Ha,!0),qn.register("RoundRect",Ya,!0),qn.register("Polygon",Xa,!0),qn.register("Line",qa,!0),qn.register("Ellipse",Wa,!0),qn.register("Bounds",Ka,!0),qn.register("CanvasTexture",sp,!0),Wr(dr),uc.setNocache(Hc.getUriFragment().nocache||!1),Mh(),t.initialized=!0)}Qs((function(){zp()})),t.BitmapText=fp,t.BitmapTextData=xp,t.Body=Nl,t.Bounds=Ka,t.Camera2d=ou,t.CanvasRenderer=Mu,t.Collectable=Ap,t.Color=nr,t.ColorLayer=_p,t.Container=Hl,t.Draggable=Cp,t.DraggableEntity=Bp,t.DropTarget=Mp,t.DroptargetEntity=Dp,t.Ellipse=Wa,t.Entity=kp,t.GLShader=da,t.GUI_Object=Tp,t.ImageLayer=bp,t.Light2d=Sp,t.Line=qa,t.Math=Ln,t.Matrix2d=hr,t.Matrix3d=sr,t.NineSliceSprite=wp,t.ObservableVector2d=gh,t.ObservableVector3d=mh,t.Particle=Ip,t.ParticleEmitter=Op,t.ParticleEmitterSettings=Pp,t.Pointer=Rh,t.Polygon=Xa,t.QuadTree=Kl,t.Rect=Ha,t.Renderable=Cl,t.Renderer=Ja,t.RoundRect=Ya,t.Sprite=cc,t.Stage=ru,t.TMXHexagonalRenderer=Lu,t.TMXIsometricRenderer=Ru,t.TMXLayer=Ou,t.TMXOrthogonalRenderer=ku,t.TMXRenderer=Iu,t.TMXStaggeredRenderer=zu,t.TMXTileMap=Gu,t.TMXTileset=Fu,t.TMXTilesetGroup=Vu,t.Text=dp,t.TextureAtlas=dc,t.Tile=Cu,t.Trigger=Ep,t.Tween=op,t.Vector2d=Kn,t.Vector3d=vh,t.WebGLCompositor=ga,t.WebGLRenderer=Oc,t.World=Zl,t.audio=yh,t.boot=zp,t.collision=Ul,t.device=ha,t.event=Qr,t.game=Jl,t.input=Sl,t.level=qu,t.loader=uc,t.plugin=tp,t.plugins=$c,t.pool=qn,t.save=es,t.skipAutoInit=!1,t.state=_u,t.timer=qc,t.utils=Hc,t.version=Lp,t.video=Nc,t.warning=Rp,Object.defineProperty(t,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/dist/melonjs.module.js b/dist/melonjs.module.js index 61cc2071e4..96af889f23 100644 --- a/dist/melonjs.module.js +++ b/dist/melonjs.module.js @@ -1,5 +1,5 @@ /*! - * melonJS Game Engine - v13.1.0 + * melonJS Game Engine - v13.1.1 * http://www.melonjs.org * melonjs is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -33010,10 +33010,10 @@ class BasePlugin { * this can be overridden by the plugin * @public * @type {string} - * @default "13.1.0" + * @default "13.1.1" * @name plugin.Base#version */ - this.version = "13.1.0"; + this.version = "13.1.1"; } } @@ -37822,7 +37822,7 @@ Renderer.prototype.getScreenContext = function() { * @name version * @type {string} */ -const version = "13.1.0"; +const version = "13.1.1"; /** diff --git a/package.json b/package.json index ab3ccc91c5..22ecad32fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "melonjs", - "version": "13.1.0", + "version": "13.1.1", "description": "melonJS Game Engine", "homepage": "http://www.melonjs.org/", "keywords": [